diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-25 02:59:47 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-25 02:59:47 +0000 |
commit | 03a1bd448be99d872d663a57a1cf4492882e090d (patch) | |
tree | c3d23691aa4dfdba89856bde05707a9a8e16abab /coverage-report | |
parent | Adding upstream version 0.1.28. (diff) | |
download | debputy-03a1bd448be99d872d663a57a1cf4492882e090d.tar.xz debputy-03a1bd448be99d872d663a57a1cf4492882e090d.zip |
Adding upstream version 0.1.29.upstream/0.1.29
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'coverage-report')
120 files changed, 0 insertions, 61968 deletions
diff --git a/coverage-report/coverage_html.js b/coverage-report/coverage_html.js deleted file mode 100644 index 4c32118..0000000 --- a/coverage-report/coverage_html.js +++ /dev/null @@ -1,624 +0,0 @@ -// Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 -// For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt - -// Coverage.py HTML report browser code. -/*jslint browser: true, sloppy: true, vars: true, plusplus: true, maxerr: 50, indent: 4 */ -/*global coverage: true, document, window, $ */ - -coverage = {}; - -// General helpers -function debounce(callback, wait) { - let timeoutId = null; - return function(...args) { - clearTimeout(timeoutId); - timeoutId = setTimeout(() => { - callback.apply(this, args); - }, wait); - }; -}; - -function checkVisible(element) { - const rect = element.getBoundingClientRect(); - const viewBottom = Math.max(document.documentElement.clientHeight, window.innerHeight); - const viewTop = 30; - return !(rect.bottom < viewTop || rect.top >= viewBottom); -} - -function on_click(sel, fn) { - const elt = document.querySelector(sel); - if (elt) { - elt.addEventListener("click", fn); - } -} - -// Helpers for table sorting -function getCellValue(row, column = 0) { - const cell = row.cells[column] - if (cell.childElementCount == 1) { - const child = cell.firstElementChild - if (child instanceof HTMLTimeElement && child.dateTime) { - return child.dateTime - } else if (child instanceof HTMLDataElement && child.value) { - return child.value - } - } - return cell.innerText || cell.textContent; -} - -function rowComparator(rowA, rowB, column = 0) { - let valueA = getCellValue(rowA, column); - let valueB = getCellValue(rowB, column); - if (!isNaN(valueA) && !isNaN(valueB)) { - return valueA - valueB - } - return valueA.localeCompare(valueB, undefined, {numeric: true}); -} - -function sortColumn(th) { - // Get the current sorting direction of the selected header, - // clear state on other headers and then set the new sorting direction - const currentSortOrder = th.getAttribute("aria-sort"); - [...th.parentElement.cells].forEach(header => header.setAttribute("aria-sort", "none")); - if (currentSortOrder === "none") { - th.setAttribute("aria-sort", th.dataset.defaultSortOrder || "ascending"); - } else { - th.setAttribute("aria-sort", currentSortOrder === "ascending" ? "descending" : "ascending"); - } - - const column = [...th.parentElement.cells].indexOf(th) - - // Sort all rows and afterwards append them in order to move them in the DOM - Array.from(th.closest("table").querySelectorAll("tbody tr")) - .sort((rowA, rowB) => rowComparator(rowA, rowB, column) * (th.getAttribute("aria-sort") === "ascending" ? 1 : -1)) - .forEach(tr => tr.parentElement.appendChild(tr) ); -} - -// Find all the elements with data-shortcut attribute, and use them to assign a shortcut key. -coverage.assign_shortkeys = function () { - document.querySelectorAll("[data-shortcut]").forEach(element => { - document.addEventListener("keypress", event => { - if (event.target.tagName.toLowerCase() === "input") { - return; // ignore keypress from search filter - } - if (event.key === element.dataset.shortcut) { - element.click(); - } - }); - }); -}; - -// Create the events for the filter box. -coverage.wire_up_filter = function () { - // Cache elements. - const table = document.querySelector("table.index"); - const table_body_rows = table.querySelectorAll("tbody tr"); - const no_rows = document.getElementById("no_rows"); - - // Observe filter keyevents. - document.getElementById("filter").addEventListener("input", debounce(event => { - // Keep running total of each metric, first index contains number of shown rows - const totals = new Array(table.rows[0].cells.length).fill(0); - // Accumulate the percentage as fraction - totals[totals.length - 1] = { "numer": 0, "denom": 0 }; - - // Hide / show elements. - table_body_rows.forEach(row => { - if (!row.cells[0].textContent.includes(event.target.value)) { - // hide - row.classList.add("hidden"); - return; - } - - // show - row.classList.remove("hidden"); - totals[0]++; - - for (let column = 1; column < totals.length; column++) { - // Accumulate dynamic totals - cell = row.cells[column] - if (column === totals.length - 1) { - // Last column contains percentage - const [numer, denom] = cell.dataset.ratio.split(" "); - totals[column]["numer"] += parseInt(numer, 10); - totals[column]["denom"] += parseInt(denom, 10); - } else { - totals[column] += parseInt(cell.textContent, 10); - } - } - }); - - // Show placeholder if no rows will be displayed. - if (!totals[0]) { - // Show placeholder, hide table. - no_rows.style.display = "block"; - table.style.display = "none"; - return; - } - - // Hide placeholder, show table. - no_rows.style.display = null; - table.style.display = null; - - const footer = table.tFoot.rows[0]; - // Calculate new dynamic sum values based on visible rows. - for (let column = 1; column < totals.length; column++) { - // Get footer cell element. - const cell = footer.cells[column]; - - // Set value into dynamic footer cell element. - if (column === totals.length - 1) { - // Percentage column uses the numerator and denominator, - // and adapts to the number of decimal places. - const match = /\.([0-9]+)/.exec(cell.textContent); - const places = match ? match[1].length : 0; - const { numer, denom } = totals[column]; - cell.dataset.ratio = `${numer} ${denom}`; - // Check denom to prevent NaN if filtered files contain no statements - cell.textContent = denom - ? `${(numer * 100 / denom).toFixed(places)}%` - : `${(100).toFixed(places)}%`; - } else { - cell.textContent = totals[column]; - } - } - })); - - // Trigger change event on setup, to force filter on page refresh - // (filter value may still be present). - document.getElementById("filter").dispatchEvent(new Event("input")); -}; - -coverage.INDEX_SORT_STORAGE = "COVERAGE_INDEX_SORT_2"; - -// Loaded on index.html -coverage.index_ready = function () { - coverage.assign_shortkeys(); - coverage.wire_up_filter(); - document.querySelectorAll("[data-sortable] th[aria-sort]").forEach( - th => th.addEventListener("click", e => sortColumn(e.target)) - ); - - // Look for a localStorage item containing previous sort settings: - const stored_list = localStorage.getItem(coverage.INDEX_SORT_STORAGE); - - if (stored_list) { - const {column, direction} = JSON.parse(stored_list); - const th = document.querySelector("[data-sortable]").tHead.rows[0].cells[column]; - th.setAttribute("aria-sort", direction === "ascending" ? "descending" : "ascending"); - th.click() - } - - // Watch for page unload events so we can save the final sort settings: - window.addEventListener("unload", function () { - const th = document.querySelector('[data-sortable] th[aria-sort="ascending"], [data-sortable] [aria-sort="descending"]'); - if (!th) { - return; - } - localStorage.setItem(coverage.INDEX_SORT_STORAGE, JSON.stringify({ - column: [...th.parentElement.cells].indexOf(th), - direction: th.getAttribute("aria-sort"), - })); - }); - - on_click(".button_prev_file", coverage.to_prev_file); - on_click(".button_next_file", coverage.to_next_file); - - on_click(".button_show_hide_help", coverage.show_hide_help); -}; - -// -- pyfile stuff -- - -coverage.LINE_FILTERS_STORAGE = "COVERAGE_LINE_FILTERS"; - -coverage.pyfile_ready = function () { - // If we're directed to a particular line number, highlight the line. - var frag = location.hash; - if (frag.length > 2 && frag[1] === "t") { - document.querySelector(frag).closest(".n").classList.add("highlight"); - coverage.set_sel(parseInt(frag.substr(2), 10)); - } else { - coverage.set_sel(0); - } - - on_click(".button_toggle_run", coverage.toggle_lines); - on_click(".button_toggle_mis", coverage.toggle_lines); - on_click(".button_toggle_exc", coverage.toggle_lines); - on_click(".button_toggle_par", coverage.toggle_lines); - - on_click(".button_next_chunk", coverage.to_next_chunk_nicely); - on_click(".button_prev_chunk", coverage.to_prev_chunk_nicely); - on_click(".button_top_of_page", coverage.to_top); - on_click(".button_first_chunk", coverage.to_first_chunk); - - on_click(".button_prev_file", coverage.to_prev_file); - on_click(".button_next_file", coverage.to_next_file); - on_click(".button_to_index", coverage.to_index); - - on_click(".button_show_hide_help", coverage.show_hide_help); - - coverage.filters = undefined; - try { - coverage.filters = localStorage.getItem(coverage.LINE_FILTERS_STORAGE); - } catch(err) {} - - if (coverage.filters) { - coverage.filters = JSON.parse(coverage.filters); - } - else { - coverage.filters = {run: false, exc: true, mis: true, par: true}; - } - - for (cls in coverage.filters) { - coverage.set_line_visibilty(cls, coverage.filters[cls]); - } - - coverage.assign_shortkeys(); - coverage.init_scroll_markers(); - coverage.wire_up_sticky_header(); - - document.querySelectorAll("[id^=ctxs]").forEach( - cbox => cbox.addEventListener("click", coverage.expand_contexts) - ); - - // Rebuild scroll markers when the window height changes. - window.addEventListener("resize", coverage.build_scroll_markers); -}; - -coverage.toggle_lines = function (event) { - const btn = event.target.closest("button"); - const category = btn.value - const show = !btn.classList.contains("show_" + category); - coverage.set_line_visibilty(category, show); - coverage.build_scroll_markers(); - coverage.filters[category] = show; - try { - localStorage.setItem(coverage.LINE_FILTERS_STORAGE, JSON.stringify(coverage.filters)); - } catch(err) {} -}; - -coverage.set_line_visibilty = function (category, should_show) { - const cls = "show_" + category; - const btn = document.querySelector(".button_toggle_" + category); - if (btn) { - if (should_show) { - document.querySelectorAll("#source ." + category).forEach(e => e.classList.add(cls)); - btn.classList.add(cls); - } - else { - document.querySelectorAll("#source ." + category).forEach(e => e.classList.remove(cls)); - btn.classList.remove(cls); - } - } -}; - -// Return the nth line div. -coverage.line_elt = function (n) { - return document.getElementById("t" + n)?.closest("p"); -}; - -// Set the selection. b and e are line numbers. -coverage.set_sel = function (b, e) { - // The first line selected. - coverage.sel_begin = b; - // The next line not selected. - coverage.sel_end = (e === undefined) ? b+1 : e; -}; - -coverage.to_top = function () { - coverage.set_sel(0, 1); - coverage.scroll_window(0); -}; - -coverage.to_first_chunk = function () { - coverage.set_sel(0, 1); - coverage.to_next_chunk(); -}; - -coverage.to_prev_file = function () { - window.location = document.getElementById("prevFileLink").href; -} - -coverage.to_next_file = function () { - window.location = document.getElementById("nextFileLink").href; -} - -coverage.to_index = function () { - location.href = document.getElementById("indexLink").href; -} - -coverage.show_hide_help = function () { - const helpCheck = document.getElementById("help_panel_state") - helpCheck.checked = !helpCheck.checked; -} - -// Return a string indicating what kind of chunk this line belongs to, -// or null if not a chunk. -coverage.chunk_indicator = function (line_elt) { - const classes = line_elt?.className; - if (!classes) { - return null; - } - const match = classes.match(/\bshow_\w+\b/); - if (!match) { - return null; - } - return match[0]; -}; - -coverage.to_next_chunk = function () { - const c = coverage; - - // Find the start of the next colored chunk. - var probe = c.sel_end; - var chunk_indicator, probe_line; - while (true) { - probe_line = c.line_elt(probe); - if (!probe_line) { - return; - } - chunk_indicator = c.chunk_indicator(probe_line); - if (chunk_indicator) { - break; - } - probe++; - } - - // There's a next chunk, `probe` points to it. - var begin = probe; - - // Find the end of this chunk. - var next_indicator = chunk_indicator; - while (next_indicator === chunk_indicator) { - probe++; - probe_line = c.line_elt(probe); - next_indicator = c.chunk_indicator(probe_line); - } - c.set_sel(begin, probe); - c.show_selection(); -}; - -coverage.to_prev_chunk = function () { - const c = coverage; - - // Find the end of the prev colored chunk. - var probe = c.sel_begin-1; - var probe_line = c.line_elt(probe); - if (!probe_line) { - return; - } - var chunk_indicator = c.chunk_indicator(probe_line); - while (probe > 1 && !chunk_indicator) { - probe--; - probe_line = c.line_elt(probe); - if (!probe_line) { - return; - } - chunk_indicator = c.chunk_indicator(probe_line); - } - - // There's a prev chunk, `probe` points to its last line. - var end = probe+1; - - // Find the beginning of this chunk. - var prev_indicator = chunk_indicator; - while (prev_indicator === chunk_indicator) { - probe--; - if (probe <= 0) { - return; - } - probe_line = c.line_elt(probe); - prev_indicator = c.chunk_indicator(probe_line); - } - c.set_sel(probe+1, end); - c.show_selection(); -}; - -// Returns 0, 1, or 2: how many of the two ends of the selection are on -// the screen right now? -coverage.selection_ends_on_screen = function () { - if (coverage.sel_begin === 0) { - return 0; - } - - const begin = coverage.line_elt(coverage.sel_begin); - const end = coverage.line_elt(coverage.sel_end-1); - - return ( - (checkVisible(begin) ? 1 : 0) - + (checkVisible(end) ? 1 : 0) - ); -}; - -coverage.to_next_chunk_nicely = function () { - if (coverage.selection_ends_on_screen() === 0) { - // The selection is entirely off the screen: - // Set the top line on the screen as selection. - - // This will select the top-left of the viewport - // As this is most likely the span with the line number we take the parent - const line = document.elementFromPoint(0, 0).parentElement; - if (line.parentElement !== document.getElementById("source")) { - // The element is not a source line but the header or similar - coverage.select_line_or_chunk(1); - } else { - // We extract the line number from the id - coverage.select_line_or_chunk(parseInt(line.id.substring(1), 10)); - } - } - coverage.to_next_chunk(); -}; - -coverage.to_prev_chunk_nicely = function () { - if (coverage.selection_ends_on_screen() === 0) { - // The selection is entirely off the screen: - // Set the lowest line on the screen as selection. - - // This will select the bottom-left of the viewport - // As this is most likely the span with the line number we take the parent - const line = document.elementFromPoint(document.documentElement.clientHeight-1, 0).parentElement; - if (line.parentElement !== document.getElementById("source")) { - // The element is not a source line but the header or similar - coverage.select_line_or_chunk(coverage.lines_len); - } else { - // We extract the line number from the id - coverage.select_line_or_chunk(parseInt(line.id.substring(1), 10)); - } - } - coverage.to_prev_chunk(); -}; - -// Select line number lineno, or if it is in a colored chunk, select the -// entire chunk -coverage.select_line_or_chunk = function (lineno) { - var c = coverage; - var probe_line = c.line_elt(lineno); - if (!probe_line) { - return; - } - var the_indicator = c.chunk_indicator(probe_line); - if (the_indicator) { - // The line is in a highlighted chunk. - // Search backward for the first line. - var probe = lineno; - var indicator = the_indicator; - while (probe > 0 && indicator === the_indicator) { - probe--; - probe_line = c.line_elt(probe); - if (!probe_line) { - break; - } - indicator = c.chunk_indicator(probe_line); - } - var begin = probe + 1; - - // Search forward for the last line. - probe = lineno; - indicator = the_indicator; - while (indicator === the_indicator) { - probe++; - probe_line = c.line_elt(probe); - indicator = c.chunk_indicator(probe_line); - } - - coverage.set_sel(begin, probe); - } - else { - coverage.set_sel(lineno); - } -}; - -coverage.show_selection = function () { - // Highlight the lines in the chunk - document.querySelectorAll("#source .highlight").forEach(e => e.classList.remove("highlight")); - for (let probe = coverage.sel_begin; probe < coverage.sel_end; probe++) { - coverage.line_elt(probe).querySelector(".n").classList.add("highlight"); - } - - coverage.scroll_to_selection(); -}; - -coverage.scroll_to_selection = function () { - // Scroll the page if the chunk isn't fully visible. - if (coverage.selection_ends_on_screen() < 2) { - const element = coverage.line_elt(coverage.sel_begin); - coverage.scroll_window(element.offsetTop - 60); - } -}; - -coverage.scroll_window = function (to_pos) { - window.scroll({top: to_pos, behavior: "smooth"}); -}; - -coverage.init_scroll_markers = function () { - // Init some variables - coverage.lines_len = document.querySelectorAll("#source > p").length; - - // Build html - coverage.build_scroll_markers(); -}; - -coverage.build_scroll_markers = function () { - const temp_scroll_marker = document.getElementById("scroll_marker") - if (temp_scroll_marker) temp_scroll_marker.remove(); - // Don't build markers if the window has no scroll bar. - if (document.body.scrollHeight <= window.innerHeight) { - return; - } - - const marker_scale = window.innerHeight / document.body.scrollHeight; - const line_height = Math.min(Math.max(3, window.innerHeight / coverage.lines_len), 10); - - let previous_line = -99, last_mark, last_top; - - const scroll_marker = document.createElement("div"); - scroll_marker.id = "scroll_marker"; - document.getElementById("source").querySelectorAll( - "p.show_run, p.show_mis, p.show_exc, p.show_exc, p.show_par" - ).forEach(element => { - const line_top = Math.floor(element.offsetTop * marker_scale); - const line_number = parseInt(element.querySelector(".n a").id.substr(1)); - - if (line_number === previous_line + 1) { - // If this solid missed block just make previous mark higher. - last_mark.style.height = `${line_top + line_height - last_top}px`; - } else { - // Add colored line in scroll_marker block. - last_mark = document.createElement("div"); - last_mark.id = `m${line_number}`; - last_mark.classList.add("marker"); - last_mark.style.height = `${line_height}px`; - last_mark.style.top = `${line_top}px`; - scroll_marker.append(last_mark); - last_top = line_top; - } - - previous_line = line_number; - }); - - // Append last to prevent layout calculation - document.body.append(scroll_marker); -}; - -coverage.wire_up_sticky_header = function () { - const header = document.querySelector("header"); - const header_bottom = ( - header.querySelector(".content h2").getBoundingClientRect().top - - header.getBoundingClientRect().top - ); - - function updateHeader() { - if (window.scrollY > header_bottom) { - header.classList.add("sticky"); - } else { - header.classList.remove("sticky"); - } - } - - window.addEventListener("scroll", updateHeader); - updateHeader(); -}; - -coverage.expand_contexts = function (e) { - var ctxs = e.target.parentNode.querySelector(".ctxs"); - - if (!ctxs.classList.contains("expanded")) { - var ctxs_text = ctxs.textContent; - var width = Number(ctxs_text[0]); - ctxs.textContent = ""; - for (var i = 1; i < ctxs_text.length; i += width) { - key = ctxs_text.substring(i, i + width).trim(); - ctxs.appendChild(document.createTextNode(contexts[key])); - ctxs.appendChild(document.createElement("br")); - } - ctxs.classList.add("expanded"); - } -}; - -document.addEventListener("DOMContentLoaded", () => { - if (document.body.classList.contains("indexfile")) { - coverage.index_ready(); - } else { - coverage.pyfile_ready(); - } -}); diff --git a/coverage-report/d_08cd1ad648464ded_debputy_self_hosting_py.html b/coverage-report/d_08cd1ad648464ded_debputy_self_hosting_py.html deleted file mode 100644 index 44fa87f..0000000 --- a/coverage-report/d_08cd1ad648464ded_debputy_self_hosting_py.html +++ /dev/null @@ -1,160 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for self-hosting-plugins/debputy_self_hosting.py: 73%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>self-hosting-plugins/debputy_self_hosting.py</b>: - <span class="pc_cov">73%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">13 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">10<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">3<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">1<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_9ae9c81fc31f2694_perl_openssl_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_08cd1ad648464ded_debputy_self_hosting_test_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">textwrap</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> <span class="nam">DebputyPluginInitializer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="nam">BinaryCtrlAccessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">POSTINST_DEFAULT_CONDITION</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="key">def</span> <span class="nam">_maintscript_generator</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">_path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">:</span> <span class="nam">BinaryCtrlAccessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">context</span><span class="op">:</span> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">maintscript</span> <span class="op">=</span> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="com"># When `debputy` becomes a stand-alone package, it should have these maintscripts instead of dh-debputy</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="com"># Admittedly, I hope to get rid of this plugin before then, but ...</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="key">assert</span> <span class="nam">context</span><span class="op">.</span><span class="nam">binary_package</span><span class="op">.</span><span class="nam">name</span> <span class="op">!=</span> <span class="str">"debputy"</span><span class="op">,</span> <span class="str">"Update the self-hosting plugin"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">dirname</span> <span class="op">=</span> <span class="str">"/usr/share/debputy"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="key">if</span> <span class="nam">context</span><span class="op">.</span><span class="nam">binary_package</span><span class="op">.</span><span class="nam">name</span> <span class="op">==</span> <span class="str">"dh-debputy"</span><span class="op">:</span> </span><span class="r"><span class="annotate short">24 ↛ 25</span><span class="annotate long">line 24 didn't jump to line 25, because the condition on line 24 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">dpkg_trigger</span><span class="op">(</span><span class="str">"interest-noawait"</span><span class="op">,</span> <span class="nam">dirname</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="nam">maintscript</span><span class="op">.</span><span class="nam">unconditionally_in_script</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="str">"postinst"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="str">f"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"><span class="str"> if {POSTINST_DEFAULT_CONDITION} || [ "$1" = "triggered" ] ; then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"><span class="str"> # Ensure all plugins are byte-compiled (plus uninstalled plugins are cleaned up)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"><span class="str"> py3clean {dirname}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"><span class="str"> if command -v py3compile >/dev/null 2>&1; then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"><span class="str"> py3compile {dirname}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"><span class="str"> fi</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"><span class="str"> if command -v pypy3compile >/dev/null 2>&1; then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="str"> pypy3compile {dirname} || true</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"><span class="str"> fi</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"><span class="str"> fi</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">maintscript</span><span class="op">.</span><span class="nam">unconditionally_in_script</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="str">"prerm"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="str">f"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"><span class="str"> if command -v py3clean >/dev/null 2>&1; then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"><span class="str"> py3clean {dirname}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"><span class="str"> else</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"><span class="str"> find {dirname}/ -type d -name __pycache__ -empty -print0 | xargs --null --no-run-if-empty rmdir</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"><span class="str"> fi</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"><span class="key">def</span> <span class="nam">initializer</span><span class="op">(</span><span class="nam">api</span><span class="op">:</span> <span class="nam">DebputyPluginInitializer</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">metadata_or_maintscript_detector</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="str">"debputy-self-hosting"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="nam">_maintscript_generator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_9ae9c81fc31f2694_perl_openssl_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_08cd1ad648464ded_debputy_self_hosting_test_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_08cd1ad648464ded_debputy_self_hosting_test_py.html b/coverage-report/d_08cd1ad648464ded_debputy_self_hosting_test_py.html deleted file mode 100644 index d1ca33e..0000000 --- a/coverage-report/d_08cd1ad648464ded_debputy_self_hosting_test_py.html +++ /dev/null @@ -1,109 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for self-hosting-plugins/debputy_self_hosting_test.py: 100%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>self-hosting-plugins/debputy_self_hosting_test.py</b>: - <span class="pc_cov">100%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">5 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">5<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">0<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_08cd1ad648464ded_debputy_self_hosting_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878___init___py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">test_api</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"> <span class="nam">initialize_plugin_under_test</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"> <span class="nam">build_virtual_file_system</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">def</span> <span class="nam">test_plugin</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">plugin</span> <span class="op">=</span> <span class="nam">initialize_plugin_under_test</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">fs</span> <span class="op">=</span> <span class="nam">build_virtual_file_system</span><span class="op">(</span><span class="op">[</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">plugin</span><span class="op">.</span><span class="nam">run_metadata_detector</span><span class="op">(</span><span class="str">"debputy-self-hosting"</span><span class="op">,</span> <span class="nam">fs</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_08cd1ad648464ded_debputy_self_hosting_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878___init___py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_128305113a77411b___init___py.html b/coverage-report/d_128305113a77411b___init___py.html deleted file mode 100644 index a110cd4..0000000 --- a/coverage-report/d_128305113a77411b___init___py.html +++ /dev/null @@ -1,99 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/package_build/__init__.py: 100%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/package_build/__init__.py</b>: - <span class="pc_cov">100%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">0 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">0<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">0<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_4f754ff76d8638bb_util_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_128305113a77411b_assemble_deb_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_4f754ff76d8638bb_util_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_128305113a77411b_assemble_deb_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_128305113a77411b_assemble_deb_py.html b/coverage-report/d_128305113a77411b_assemble_deb_py.html deleted file mode 100644 index 9e6b9ef..0000000 --- a/coverage-report/d_128305113a77411b_assemble_deb_py.html +++ /dev/null @@ -1,354 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/package_build/assemble_deb.py: 14%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/package_build/assemble_deb.py</b>: - <span class="pc_cov">14%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">98 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">19<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">79<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_128305113a77411b___init___py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_packager_provided_files_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">json</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">subprocess</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Optional</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">,</span> <span class="nam">List</span><span class="op">,</span> <span class="nam">Tuple</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span> <span class="key">import</span> <span class="nam">DEBPUTY_ROOT_DIR</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">commands</span><span class="op">.</span><span class="nam">debputy_cmd</span><span class="op">.</span><span class="nam">context</span> <span class="key">import</span> <span class="nam">CommandContext</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">deb_packaging_support</span> <span class="key">import</span> <span class="nam">setup_control_files</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">debhelper_emulation</span> <span class="key">import</span> <span class="nam">dhe_dbgsym_root_dir</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">filesystem_scan</span> <span class="key">import</span> <span class="nam">FSRootDir</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">highlevel_manifest</span> <span class="key">import</span> <span class="nam">HighLevelManifest</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">intermediate_manifest</span> <span class="key">import</span> <span class="nam">IntermediateManifest</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">impl_types</span> <span class="key">import</span> <span class="nam">PackageDataTable</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">escape_shell</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">_error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">compute_output_filename</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">scratch_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">ensure_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">_warn</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">assume_not_none</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"><span class="nam">_RRR_DEB_ASSEMBLY_KEYWORD</span> <span class="op">=</span> <span class="str">"debputy/deb-assembly"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"><span class="nam">_WARNED_ABOUT_FALLBACK_ASSEMBLY</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"><span class="key">def</span> <span class="nam">_serialize_intermediate_manifest</span><span class="op">(</span><span class="nam">members</span><span class="op">:</span> <span class="nam">IntermediateManifest</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="nam">serial_format</span> <span class="op">=</span> <span class="op">[</span><span class="nam">m</span><span class="op">.</span><span class="nam">to_manifest</span><span class="op">(</span><span class="op">)</span> <span class="key">for</span> <span class="nam">m</span> <span class="key">in</span> <span class="nam">members</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="key">return</span> <span class="nam">json</span><span class="op">.</span><span class="nam">dumps</span><span class="op">(</span><span class="nam">serial_format</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"><span class="key">def</span> <span class="nam">determine_assembly_method</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="nam">package</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="nam">intermediate_manifest</span><span class="op">:</span> <span class="nam">IntermediateManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">bool</span><span class="op">,</span> <span class="nam">bool</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="nam">paths_needing_root</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">tm</span> <span class="key">for</span> <span class="nam">tm</span> <span class="key">in</span> <span class="nam">intermediate_manifest</span> <span class="key">if</span> <span class="nam">tm</span><span class="op">.</span><span class="nam">owner</span> <span class="op">!=</span> <span class="str">"root"</span> <span class="key">or</span> <span class="nam">tm</span><span class="op">.</span><span class="nam">group</span> <span class="op">!=</span> <span class="str">"root"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="nam">matched_path</span> <span class="op">=</span> <span class="nam">next</span><span class="op">(</span><span class="nam">paths_needing_root</span><span class="op">,</span> <span class="key">None</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="key">if</span> <span class="nam">matched_path</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span><span class="op">,</span> <span class="key">False</span><span class="op">,</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="nam">rrr</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">environ</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"DEB_RULES_REQUIRES_ROOT"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="key">if</span> <span class="nam">rrr</span> <span class="key">and</span> <span class="nam">_RRR_DEB_ASSEMBLY_KEYWORD</span> <span class="key">in</span> <span class="nam">rrr</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="nam">gain_root_cmd</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">environ</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"DEB_GAIN_ROOT_CMD"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">gain_root_cmd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="str">"DEB_RULES_REQUIRES_ROOT contains a debputy keyword but DEB_GAIN_ROOT_CMD does not contain a "</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="str">'"gain root" command'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span><span class="op">,</span> <span class="key">False</span><span class="op">,</span> <span class="nam">gain_root_cmd</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="key">if</span> <span class="nam">rrr</span> <span class="op">==</span> <span class="str">"no"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="key">global</span> <span class="nam">_WARNED_ABOUT_FALLBACK_ASSEMBLY</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">_WARNED_ABOUT_FALLBACK_ASSEMBLY</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="str">'Using internal assembly method due to "Rules-Requires-Root" being "no" and dpkg-deb assembly would'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="str">" require (fake)root for binary packages that needs it."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="nam">_WARNED_ABOUT_FALLBACK_ASSEMBLY</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span><span class="op">,</span> <span class="key">True</span><span class="op">,</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="str">f'Due to the path "{matched_path.member_path}" in {package}, the package assembly will require (fake)root.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="str">" However, this command is not run as root nor was debputy requested to use a root command via"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="str">f' "Rules-Requires-Root". Please consider adding "{_RRR_DEB_ASSEMBLY_KEYWORD}" to "Rules-Requires-Root"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="str">" in debian/control. Though, due to #1036865, you may have to revert to"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="str">' "Rules-Requires-Root: binary-targets" depending on which version of dpkg you need to support.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="str">' Alternatively, you can set "Rules-Requires-Root: no" in debian/control and debputy will assemble'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="str">" the package anyway. In this case, dpkg-deb will not be used, but the output should be bit-for-bit"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="str">" compatible with what debputy would have produced with dpkg-deb (and root/fakeroot)."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"><span class="key">def</span> <span class="nam">assemble_debs</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="nam">context</span><span class="op">:</span> <span class="nam">CommandContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="nam">manifest</span><span class="op">:</span> <span class="nam">HighLevelManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="nam">package_data_table</span><span class="op">:</span> <span class="nam">PackageDataTable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="nam">is_dh_rrr_only_mode</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="nam">parsed_args</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">parsed_args</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="nam">output_path</span> <span class="op">=</span> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">output</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="nam">upstream_args</span> <span class="op">=</span> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">upstream_args</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="nam">deb_materialize</span> <span class="op">=</span> <span class="nam">str</span><span class="op">(</span><span class="nam">DEBPUTY_ROOT_DIR</span> <span class="op">/</span> <span class="str">"deb_materialization.py"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="nam">mtime</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">mtime</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="key">for</span> <span class="nam">dctrl_bin</span> <span class="key">in</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">active_packages</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="nam">package</span> <span class="op">=</span> <span class="nam">dctrl_bin</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="nam">dbgsym_package_name</span> <span class="op">=</span> <span class="str">f"{package}-dbgsym"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="nam">dctrl_data</span> <span class="op">=</span> <span class="nam">package_data_table</span><span class="op">[</span><span class="nam">package</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="nam">fs_root</span> <span class="op">=</span> <span class="nam">dctrl_data</span><span class="op">.</span><span class="nam">fs_root</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="nam">control_output_dir</span> <span class="op">=</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">dctrl_data</span><span class="op">.</span><span class="nam">control_output_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="nam">package_metadata_context</span> <span class="op">=</span> <span class="nam">dctrl_data</span><span class="op">.</span><span class="nam">package_metadata_context</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="nam">dbgsym_package_name</span> <span class="key">in</span> <span class="nam">package_data_table</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="key">or</span> <span class="str">"noautodbgsym"</span> <span class="key">in</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">build_env</span><span class="op">.</span><span class="nam">deb_build_options</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="key">or</span> <span class="str">"noddebs"</span> <span class="key">in</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">build_env</span><span class="op">.</span><span class="nam">deb_build_options</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="com"># Discard the dbgsym part if it conflicts with a real package, or</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="com"># we were asked not to build it.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="nam">dctrl_data</span><span class="op">.</span><span class="nam">dbgsym_info</span><span class="op">.</span><span class="nam">dbgsym_fs_root</span> <span class="op">=</span> <span class="nam">FSRootDir</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="nam">dctrl_data</span><span class="op">.</span><span class="nam">dbgsym_info</span><span class="op">.</span><span class="nam">dbgsym_ids</span><span class="op">.</span><span class="nam">clear</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="nam">dbgsym_fs_root</span> <span class="op">=</span> <span class="nam">dctrl_data</span><span class="op">.</span><span class="nam">dbgsym_info</span><span class="op">.</span><span class="nam">dbgsym_fs_root</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="nam">dbgsym_ids</span> <span class="op">=</span> <span class="nam">dctrl_data</span><span class="op">.</span><span class="nam">dbgsym_info</span><span class="op">.</span><span class="nam">dbgsym_ids</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="nam">intermediate_manifest</span> <span class="op">=</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">finalize_data_tar_contents</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="nam">package</span><span class="op">,</span> <span class="nam">fs_root</span><span class="op">,</span> <span class="nam">mtime</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="nam">setup_control_files</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="nam">dctrl_data</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="nam">manifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="nam">dbgsym_fs_root</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="nam">dbgsym_ids</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="nam">package_metadata_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="nam">allow_ctrl_file_management</span><span class="op">=</span><span class="key">not</span> <span class="nam">is_dh_rrr_only_mode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="nam">needs_root</span><span class="op">,</span> <span class="nam">use_fallback_assembly</span><span class="op">,</span> <span class="nam">gain_root_cmd</span> <span class="op">=</span> <span class="nam">determine_assembly_method</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="nam">package</span><span class="op">,</span> <span class="nam">intermediate_manifest</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">dctrl_bin</span><span class="op">.</span><span class="nam">is_udeb</span> <span class="key">and</span> <span class="nam">any</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="nam">f</span> <span class="key">for</span> <span class="nam">f</span> <span class="key">in</span> <span class="nam">dbgsym_fs_root</span><span class="op">.</span><span class="nam">all_paths</span><span class="op">(</span><span class="op">)</span> <span class="key">if</span> <span class="nam">f</span><span class="op">.</span><span class="nam">is_file</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="com"># We never built udebs due to #797391. We currently do not generate a control</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="com"># file for it either for the same reason.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="nam">dbgsym_root</span> <span class="op">=</span> <span class="nam">dhe_dbgsym_root_dir</span><span class="op">(</span><span class="nam">dctrl_bin</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">isdir</span><span class="op">(</span><span class="nam">output_path</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="str">"Cannot produce a dbgsym package when output path is not a directory."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="nam">dbgsym_intermediate_manifest</span> <span class="op">=</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">finalize_data_tar_contents</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="nam">dbgsym_package_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="nam">dbgsym_fs_root</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="nam">mtime</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="nam">_assemble_deb</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="nam">dbgsym_package_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="nam">deb_materialize</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="nam">dbgsym_intermediate_manifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="nam">mtime</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">dbgsym_root</span><span class="op">,</span> <span class="str">"DEBIAN"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="nam">output_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="nam">upstream_args</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="nam">is_udeb</span><span class="op">=</span><span class="nam">dctrl_bin</span><span class="op">.</span><span class="nam">is_udeb</span><span class="op">,</span> <span class="com"># Review this if we ever do dbgsyms for udebs</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="nam">use_fallback_assembly</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="nam">needs_root</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="nam">_assemble_deb</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="nam">package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="nam">deb_materialize</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="nam">intermediate_manifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="nam">mtime</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="nam">control_output_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="nam">output_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="nam">upstream_args</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="nam">is_udeb</span><span class="op">=</span><span class="nam">dctrl_bin</span><span class="op">.</span><span class="nam">is_udeb</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="nam">use_fallback_assembly</span><span class="op">=</span><span class="nam">use_fallback_assembly</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="nam">needs_root</span><span class="op">=</span><span class="nam">needs_root</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="nam">gain_root_cmd</span><span class="op">=</span><span class="nam">gain_root_cmd</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"><span class="key">def</span> <span class="nam">_assemble_deb</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="nam">package</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="nam">deb_materialize_cmd</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="nam">intermediate_manifest</span><span class="op">:</span> <span class="nam">IntermediateManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="nam">mtime</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="nam">control_output_dir</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="nam">output_path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="nam">upstream_args</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">is_udeb</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="nam">use_fallback_assembly</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="nam">needs_root</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="nam">gain_root_cmd</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="nam">scratch_root_dir</span> <span class="op">=</span> <span class="nam">scratch_dir</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="nam">materialization_dir</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="nam">scratch_root_dir</span><span class="op">,</span> <span class="str">"materialization-dirs"</span><span class="op">,</span> <span class="nam">package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="nam">ensure_dir</span><span class="op">(</span><span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">dirname</span><span class="op">(</span><span class="nam">materialization_dir</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="nam">materialize_cmd</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="key">assert</span> <span class="key">not</span> <span class="nam">use_fallback_assembly</span> <span class="key">or</span> <span class="key">not</span> <span class="nam">gain_root_cmd</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="key">if</span> <span class="nam">needs_root</span> <span class="key">and</span> <span class="nam">gain_root_cmd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="com"># Only use the gain_root_cmd if we absolutely need it.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="com"># Note that gain_root_cmd will be empty unless R³ is set to the relevant keyword</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="com"># that would make us use targeted promotion. Therefore, we do not need to check other</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="com"># conditions than the package needing root. (R³: binary-targets implies `needs_root=True`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="com"># without a gain_root_cmd)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="nam">materialize_cmd</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">gain_root_cmd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="nam">materialize_cmd</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="nam">deb_materialize_cmd</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="str">"materialize-deb"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="str">"--intermediate-package-manifest"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="str">"-"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="str">"--may-move-control-files"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="str">"--may-move-data-files"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="str">"--source-date-epoch"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="nam">str</span><span class="op">(</span><span class="nam">mtime</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="str">"--discard-existing-output"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="nam">control_output_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="nam">materialization_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="nam">output</span> <span class="op">=</span> <span class="nam">output_path</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_udeb</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="nam">materialize_cmd</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">"--udeb"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="nam">output</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="nam">output_path</span><span class="op">,</span> <span class="nam">compute_output_filename</span><span class="op">(</span><span class="nam">control_output_dir</span><span class="op">,</span> <span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="nam">assembly_method</span> <span class="op">=</span> <span class="str">"debputy"</span> <span class="key">if</span> <span class="nam">needs_root</span> <span class="key">and</span> <span class="nam">use_fallback_assembly</span> <span class="key">else</span> <span class="str">"dpkg-deb"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="nam">combined_materialization_and_assembly</span> <span class="op">=</span> <span class="key">not</span> <span class="nam">needs_root</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="key">if</span> <span class="nam">combined_materialization_and_assembly</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="nam">materialize_cmd</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="op">[</span><span class="str">"--build-method"</span><span class="op">,</span> <span class="nam">assembly_method</span><span class="op">,</span> <span class="str">"--assembled-deb-output"</span><span class="op">,</span> <span class="nam">output</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="key">if</span> <span class="nam">upstream_args</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="nam">materialize_cmd</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">"--"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="nam">materialize_cmd</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">upstream_args</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="key">if</span> <span class="nam">combined_materialization_and_assembly</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="str">f"Materializing and assembling {package} via: {escape_shell(*materialize_cmd)}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">f"Materializing {package} via: {escape_shell(*materialize_cmd)}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="nam">proc</span> <span class="op">=</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">Popen</span><span class="op">(</span><span class="nam">materialize_cmd</span><span class="op">,</span> <span class="nam">stdin</span><span class="op">=</span><span class="nam">subprocess</span><span class="op">.</span><span class="nam">PIPE</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="nam">proc</span><span class="op">.</span><span class="nam">communicate</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="nam">_serialize_intermediate_manifest</span><span class="op">(</span><span class="nam">intermediate_manifest</span><span class="op">)</span><span class="op">.</span><span class="nam">encode</span><span class="op">(</span><span class="str">"utf-8"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="key">if</span> <span class="nam">proc</span><span class="op">.</span><span class="nam">returncode</span> <span class="op">!=</span> <span class="num">0</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span><span class="str">f"{escape_shell(deb_materialize_cmd)} exited with a non-zero exit code!"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">combined_materialization_and_assembly</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="nam">build_materialization</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="nam">deb_materialize_cmd</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="str">"build-materialized-deb"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="nam">materialization_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="nam">assembly_method</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="str">"--output"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="nam">output</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">f"Assembling {package} via: {escape_shell(*build_materialization)}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_call</span><span class="op">(</span><span class="nam">build_materialization</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="key">except</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">CalledProcessError</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="nam">exit_code</span> <span class="op">=</span> <span class="str">f" with exit code {e.returncode}"</span> <span class="key">if</span> <span class="nam">e</span><span class="op">.</span><span class="nam">returncode</span> <span class="key">else</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="str">f"Assembly command for {package} failed{exit_code}. Please review the output of the command"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="str">f" for more details on the problem."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_128305113a77411b___init___py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_packager_provided_files_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_23db3c975895bd86___init___py.html b/coverage-report/d_23db3c975895bd86___init___py.html deleted file mode 100644 index 38e3e3e..0000000 --- a/coverage-report/d_23db3c975895bd86___init___py.html +++ /dev/null @@ -1,99 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/dh_migration/__init__.py: 100%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/dh_migration/__init__.py</b>: - <span class="pc_cov">100%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">0 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">0<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">0<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_debhelper_emulation_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_23db3c975895bd86_migration_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_debhelper_emulation_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_23db3c975895bd86_migration_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_23db3c975895bd86_migration_py.html b/coverage-report/d_23db3c975895bd86_migration_py.html deleted file mode 100644 index 05f9cac..0000000 --- a/coverage-report/d_23db3c975895bd86_migration_py.html +++ /dev/null @@ -1,445 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/dh_migration/migration.py: 7%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/dh_migration/migration.py</b>: - <span class="pc_cov">7%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">192 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">20<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">172<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">1<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_23db3c975895bd86___init___py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_23db3c975895bd86_migrators_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">json</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">re</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">import</span> <span class="nam">subprocess</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">from</span> <span class="nam">itertools</span> <span class="key">import</span> <span class="nam">chain</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Optional</span><span class="op">,</span> <span class="nam">List</span><span class="op">,</span> <span class="nam">Callable</span><span class="op">,</span> <span class="nam">Set</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="key">from</span> <span class="nam">debian</span><span class="op">.</span><span class="nam">deb822</span> <span class="key">import</span> <span class="nam">Deb822</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">debhelper_emulation</span> <span class="key">import</span> <span class="nam">CannotEmulateExecutableDHConfigFile</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">dh_migration</span><span class="op">.</span><span class="nam">migrators</span> <span class="key">import</span> <span class="nam">MIGRATORS</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">dh_migration</span><span class="op">.</span><span class="nam">migrators_impl</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">read_dh_addon_sequences</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">MIGRATION_TARGET_DH_DEBPUTY</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">MIGRATION_TARGET_DH_DEBPUTY_RRR</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">dh_migration</span><span class="op">.</span><span class="nam">models</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">FeatureMigration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">AcceptableMigrationIssues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">UnsupportedFeature</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">ConflictingChange</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">highlevel_manifest</span> <span class="key">import</span> <span class="nam">HighLevelManifest</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">exceptions</span> <span class="key">import</span> <span class="nam">ManifestParseException</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="nam">VirtualPath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">_error</span><span class="op">,</span> <span class="nam">_warn</span><span class="op">,</span> <span class="nam">_info</span><span class="op">,</span> <span class="nam">escape_shell</span><span class="op">,</span> <span class="nam">assume_not_none</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"><span class="key">def</span> <span class="nam">_print_migration_summary</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="nam">migrations</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">FeatureMigration</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="nam">compat</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="nam">min_compat_level</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="nam">required_plugins</span><span class="op">:</span> <span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="nam">requested_plugins</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="nam">warning_count</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="key">for</span> <span class="nam">migration</span> <span class="key">in</span> <span class="nam">migrations</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">migration</span><span class="op">.</span><span class="nam">anything_to_do</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="nam">underline</span> <span class="op">=</span> <span class="str">"-"</span> <span class="op">*</span> <span class="nam">len</span><span class="op">(</span><span class="nam">migration</span><span class="op">.</span><span class="nam">tagline</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="key">if</span> <span class="nam">migration</span><span class="op">.</span><span class="nam">warnings</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span><span class="str">f"Summary for migration: {migration.tagline}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span><span class="str">f"-----------------------{underline}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span><span class="str">" /!\\ ATTENTION /!\\"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="nam">warning_count</span> <span class="op">+=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">migration</span><span class="op">.</span><span class="nam">warnings</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="key">for</span> <span class="nam">warning</span> <span class="key">in</span> <span class="nam">migration</span><span class="op">.</span><span class="nam">warnings</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span><span class="str">f" * {warning}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="key">if</span> <span class="nam">compat</span> <span class="op"><</span> <span class="nam">min_compat_level</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="key">if</span> <span class="nam">warning_count</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span><span class="str">""</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span><span class="str">"Supported debhelper compat check"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span><span class="str">"--------------------------------"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="nam">warning_count</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="str">f"The migration tool assumes debhelper compat {min_compat_level}+ semantics, but this package"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="str">f" is using compat {compat}. Consider upgrading the package to compat {min_compat_level}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="str">" first."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="key">if</span> <span class="nam">required_plugins</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="key">if</span> <span class="nam">requested_plugins</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="nam">warning_count</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="nam">needed_plugins</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="str">f"debputy-plugin-{n}"</span> <span class="key">for</span> <span class="nam">n</span> <span class="key">in</span> <span class="nam">required_plugins</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="key">if</span> <span class="nam">warning_count</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span><span class="str">""</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span><span class="str">"Missing debputy plugin check"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span><span class="str">"----------------------------"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="str">f"The migration tool could not read d/control and therefore cannot tell if all the required"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="str">f" plugins have been requested. Please ensure that the package Build-Depends on: {needed_plugins}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="nam">missing_plugins</span> <span class="op">=</span> <span class="nam">required_plugins</span> <span class="op">-</span> <span class="nam">requested_plugins</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="key">if</span> <span class="nam">missing_plugins</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="nam">warning_count</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="nam">needed_plugins</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="str">f"debputy-plugin-{n}"</span> <span class="key">for</span> <span class="nam">n</span> <span class="key">in</span> <span class="nam">missing_plugins</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="key">if</span> <span class="nam">warning_count</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span><span class="str">""</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span><span class="str">"Missing debputy plugin check"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span><span class="str">"----------------------------"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="str">f"The migration tool asserted that the following `debputy` plugins would be required, which"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="str">f" are not explicitly requested. Please add the following to Build-Depends: {needed_plugins}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="key">if</span> <span class="nam">warning_count</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span><span class="str">""</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="str">f"/!\\ Total number of warnings or manual migrations required: {warning_count}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"><span class="key">def</span> <span class="nam">_dh_compat_level</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="nam">res</span> <span class="op">=</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_output</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="op">[</span><span class="str">"dh_assistant"</span><span class="op">,</span> <span class="str">"active-compat-level"</span><span class="op">]</span><span class="op">,</span> <span class="nam">stderr</span><span class="op">=</span><span class="nam">subprocess</span><span class="op">.</span><span class="nam">DEVNULL</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="key">except</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">CalledProcessError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="nam">compat</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="nam">compat</span> <span class="op">=</span> <span class="nam">json</span><span class="op">.</span><span class="nam">loads</span><span class="op">(</span><span class="nam">res</span><span class="op">)</span><span class="op">[</span><span class="str">"declared-compat-level"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="key">except</span> <span class="nam">RuntimeError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="nam">compat</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">compat</span><span class="op">,</span> <span class="nam">int</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="nam">compat</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="key">return</span> <span class="nam">compat</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"><span class="key">def</span> <span class="nam">_requested_debputy_plugins</span><span class="op">(</span><span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="nam">ctrl_file</span> <span class="op">=</span> <span class="nam">debian_dir</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"control"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">ctrl_file</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="nam">dep_regex</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">"^([a-z0-9][-+.a-z0-9]+)"</span><span class="op">,</span> <span class="nam">re</span><span class="op">.</span><span class="nam">ASCII</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="nam">plugins</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="key">with</span> <span class="nam">ctrl_file</span><span class="op">.</span><span class="nam">open</span><span class="op">(</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="nam">ctrl</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">Deb822</span><span class="op">.</span><span class="nam">iter_paragraphs</span><span class="op">(</span><span class="nam">fd</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="nam">source_paragraph</span> <span class="op">=</span> <span class="nam">ctrl</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="key">if</span> <span class="nam">ctrl</span> <span class="key">else</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="key">for</span> <span class="nam">f</span> <span class="key">in</span> <span class="op">(</span><span class="str">"Build-Depends"</span><span class="op">,</span> <span class="str">"Build-Depends-Indep"</span><span class="op">,</span> <span class="str">"Build-Depends-Arch"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="nam">field</span> <span class="op">=</span> <span class="nam">source_paragraph</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">f</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">field</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="key">for</span> <span class="nam">dep_clause</span> <span class="key">in</span> <span class="op">(</span><span class="nam">d</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span> <span class="key">for</span> <span class="nam">d</span> <span class="key">in</span> <span class="nam">field</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="str">","</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="nam">match</span> <span class="op">=</span> <span class="nam">dep_regex</span><span class="op">.</span><span class="nam">match</span><span class="op">(</span><span class="nam">dep_clause</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">match</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="nam">dep</span> <span class="op">=</span> <span class="nam">match</span><span class="op">.</span><span class="nam">group</span><span class="op">(</span><span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">dep</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"debputy-plugin-"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="nam">plugins</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">dep</span><span class="op">[</span><span class="num">15</span><span class="op">:</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="key">return</span> <span class="nam">plugins</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"><span class="key">def</span> <span class="nam">_check_migration_target</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="nam">migration_target</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="nam">r</span> <span class="op">=</span> <span class="nam">read_dh_addon_sequences</span><span class="op">(</span><span class="nam">debian_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="key">if</span> <span class="nam">r</span> <span class="key">is</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">migration_target</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span><span class="str">"debian/control is missing and no migration target was provided"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="nam">bd_sequences</span><span class="op">,</span> <span class="nam">dr_sequences</span> <span class="op">=</span> <span class="nam">r</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="nam">all_sequences</span> <span class="op">=</span> <span class="nam">bd_sequences</span> <span class="op">|</span> <span class="nam">dr_sequences</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="nam">has_zz_debputy</span> <span class="op">=</span> <span class="str">"zz-debputy"</span> <span class="key">in</span> <span class="nam">all_sequences</span> <span class="key">or</span> <span class="str">"debputy"</span> <span class="key">in</span> <span class="nam">all_sequences</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="nam">has_zz_debputy_rrr</span> <span class="op">=</span> <span class="str">"zz-debputy-rrr"</span> <span class="key">in</span> <span class="nam">all_sequences</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="nam">has_any_existing</span> <span class="op">=</span> <span class="nam">has_zz_debputy</span> <span class="key">or</span> <span class="nam">has_zz_debputy_rrr</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="key">if</span> <span class="nam">migration_target</span> <span class="op">==</span> <span class="str">"dh-sequence-zz-debputy-rrr"</span> <span class="key">and</span> <span class="nam">has_zz_debputy</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span><span class="str">"Cannot migrate from (zz-)debputy to zz-debputy-rrr"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="key">if</span> <span class="nam">has_zz_debputy_rrr</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">has_zz_debputy</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="nam">resolved_migration_target</span> <span class="op">=</span> <span class="nam">MIGRATION_TARGET_DH_DEBPUTY_RRR</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="nam">resolved_migration_target</span> <span class="op">=</span> <span class="nam">MIGRATION_TARGET_DH_DEBPUTY</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="key">if</span> <span class="nam">migration_target</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="nam">resolved_migration_target</span> <span class="op">=</span> <span class="nam">migration_target</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="key">if</span> <span class="nam">has_any_existing</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="str">f'Using "{resolved_migration_target}" as migration target based on the packaging'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="str">f'Using "{resolved_migration_target}" as default migration target. Use --migration-target to choose!'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="key">return</span> <span class="nam">resolved_migration_target</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"><span class="key">def</span> <span class="nam">migrate_from_dh</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="nam">manifest</span><span class="op">:</span> <span class="nam">HighLevelManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="nam">acceptable_migration_issues</span><span class="op">:</span> <span class="nam">AcceptableMigrationIssues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="nam">permit_destructive_changes</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="nam">migration_target</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="nam">manifest_parser_factory</span><span class="op">:</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">HighLevelManifest</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="nam">migrations</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="nam">compat</span> <span class="op">=</span> <span class="nam">_dh_compat_level</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="key">if</span> <span class="nam">compat</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="str">'Cannot detect declared compat level (try running "dh_assistant active-compat-level")'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="nam">debian_dir</span> <span class="op">=</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">debian_dir</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="nam">mutable_manifest</span> <span class="op">=</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">manifest</span><span class="op">.</span><span class="nam">mutable_manifest</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="nam">resolved_migration_target</span> <span class="op">=</span> <span class="nam">_check_migration_target</span><span class="op">(</span><span class="nam">debian_dir</span><span class="op">,</span> <span class="nam">migration_target</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="key">for</span> <span class="nam">migrator</span> <span class="key">in</span> <span class="nam">MIGRATORS</span><span class="op">[</span><span class="nam">resolved_migration_target</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="nam">feature_migration</span> <span class="op">=</span> <span class="nam">FeatureMigration</span><span class="op">(</span><span class="nam">migrator</span><span class="op">.</span><span class="nam">__name__</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="nam">migrator</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="nam">manifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="nam">acceptable_migration_issues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="nam">resolved_migration_target</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="nam">migrations</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">feature_migration</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="key">except</span> <span class="nam">CannotEmulateExecutableDHConfigFile</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="str">f"Unable to process the executable dh config file {e.config_file().fs_path}: {e.message()}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="key">except</span> <span class="nam">UnsupportedFeature</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="nam">msg</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="str">f"Unable to migrate automatically due to missing features in debputy. The feature is:"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="str">f"\n\n * {e.message}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="nam">keys</span> <span class="op">=</span> <span class="nam">e</span><span class="op">.</span><span class="nam">issue_keys</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="key">if</span> <span class="nam">keys</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="nam">primary_key</span> <span class="op">=</span> <span class="nam">keys</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="nam">alt_keys</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">keys</span><span class="op">)</span> <span class="op">></span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="nam">alt_keys</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="str">f' Alternatively you can also use one of: {", ".join(keys[1:])}. Please note that some'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="str">" of these may cover more cases."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="nam">msg</span> <span class="op">+=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="str">f"\n\nUse --acceptable-migration-issues={primary_key} to convert this into a warning and try again."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="str">" However, you should only do that if you believe you can replace the functionality manually"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="str">f" or the usage is obsolete / can be removed. {alt_keys}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span><span class="nam">msg</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="key">except</span> <span class="nam">ConflictingChange</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="str">"The migration tool detected a conflict data being migrated and data already migrated / in the existing"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="str">"manifest."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="str">f"\n\n * {e.message}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="str">"\n\nPlease review the situation and resolve the conflict manually."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="com"># We start on compat 12 for arch:any due to the new dh_makeshlibs and dh_installinit default</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="nam">min_compat</span> <span class="op">=</span> <span class="num">12</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="nam">min_compat</span> <span class="op">=</span> <span class="nam">max</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="op">(</span><span class="nam">m</span><span class="op">.</span><span class="nam">assumed_compat</span> <span class="key">for</span> <span class="nam">m</span> <span class="key">in</span> <span class="nam">migrations</span> <span class="key">if</span> <span class="nam">m</span><span class="op">.</span><span class="nam">assumed_compat</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="nam">default</span><span class="op">=</span><span class="nam">min_compat</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="key">if</span> <span class="nam">compat</span> <span class="op"><</span> <span class="nam">min_compat</span> <span class="key">and</span> <span class="str">"min-compat-level"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">acceptable_migration_issues</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="com"># The migration summary special-cases the compat mismatch and warns for us.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="str">f"The migration tool assumes debhelper compat {min_compat} or later but the package is only on"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="str">f" compat {compat}. This may lead to incorrect result."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="str">f"\n\nUse --acceptable-migration-issues=min-compat-level to convert this into a warning and"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="str">f" try again, if you want to continue regardless."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="nam">requested_plugins</span> <span class="op">=</span> <span class="nam">_requested_debputy_plugins</span><span class="op">(</span><span class="nam">debian_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="nam">required_plugins</span><span class="op">:</span> <span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="nam">required_plugins</span><span class="op">.</span><span class="nam">update</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="nam">chain</span><span class="op">.</span><span class="nam">from_iterable</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="nam">m</span><span class="op">.</span><span class="nam">required_plugins</span> <span class="key">for</span> <span class="nam">m</span> <span class="key">in</span> <span class="nam">migrations</span> <span class="key">if</span> <span class="nam">m</span><span class="op">.</span><span class="nam">required_plugins</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="nam">_print_migration_summary</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="nam">migrations</span><span class="op">,</span> <span class="nam">compat</span><span class="op">,</span> <span class="nam">min_compat</span><span class="op">,</span> <span class="nam">required_plugins</span><span class="op">,</span> <span class="nam">requested_plugins</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="nam">migration_count</span> <span class="op">=</span> <span class="nam">sum</span><span class="op">(</span><span class="op">(</span><span class="nam">m</span><span class="op">.</span><span class="nam">performed_changes</span> <span class="key">for</span> <span class="nam">m</span> <span class="key">in</span> <span class="nam">migrations</span><span class="op">)</span><span class="op">,</span> <span class="num">0</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">migration_count</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="str">"debputy was not able to find any (supported) migrations that it could perform for you."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="key">if</span> <span class="nam">any</span><span class="op">(</span><span class="nam">m</span><span class="op">.</span><span class="nam">successful_manifest_changes</span> <span class="key">for</span> <span class="nam">m</span> <span class="key">in</span> <span class="nam">migrations</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="nam">new_manifest_path</span> <span class="op">=</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">manifest_path</span> <span class="op">+</span> <span class="str">".new"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="key">with</span> <span class="nam">open</span><span class="op">(</span><span class="nam">new_manifest_path</span><span class="op">,</span> <span class="str">"w"</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="nam">mutable_manifest</span><span class="op">.</span><span class="nam">write_to</span><span class="op">(</span><span class="nam">fd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">"Verifying the generating manifest"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="nam">manifest_parser_factory</span><span class="op">(</span><span class="nam">new_manifest_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="key">except</span> <span class="nam">ManifestParseException</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="key">raise</span> <span class="nam">AssertionError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="str">"Could not parse the manifest generated from the migrator"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="op">)</span> <span class="key">from</span> <span class="nam">e</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="key">if</span> <span class="nam">permit_destructive_changes</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> <span class="key">if</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">isfile</span><span class="op">(</span><span class="nam">manifest</span><span class="op">.</span><span class="nam">manifest_path</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">rename</span><span class="op">(</span><span class="nam">manifest</span><span class="op">.</span><span class="nam">manifest_path</span><span class="op">,</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">manifest_path</span> <span class="op">+</span> <span class="str">".orig"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">rename</span><span class="op">(</span><span class="nam">new_manifest_path</span><span class="op">,</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">manifest_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"Updated manifest {manifest.manifest_path}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="str">f'Created draft manifest "{new_manifest_path}" (rename to "{manifest.manifest_path}"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="str">" to activate it)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">"No manifest changes detected; skipping update of manifest."</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> <span class="nam">removals</span><span class="op">:</span> <span class="nam">int</span> <span class="op">=</span> <span class="nam">sum</span><span class="op">(</span><span class="op">(</span><span class="nam">len</span><span class="op">(</span><span class="nam">m</span><span class="op">.</span><span class="nam">remove_paths_on_success</span><span class="op">)</span> <span class="key">for</span> <span class="nam">m</span> <span class="key">in</span> <span class="nam">migrations</span><span class="op">)</span><span class="op">,</span> <span class="num">0</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="nam">renames</span><span class="op">:</span> <span class="nam">int</span> <span class="op">=</span> <span class="nam">sum</span><span class="op">(</span><span class="op">(</span><span class="nam">len</span><span class="op">(</span><span class="nam">m</span><span class="op">.</span><span class="nam">rename_paths_on_success</span><span class="op">)</span> <span class="key">for</span> <span class="nam">m</span> <span class="key">in</span> <span class="nam">migrations</span><span class="op">)</span><span class="op">,</span> <span class="num">0</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="key">if</span> <span class="nam">renames</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="key">if</span> <span class="nam">permit_destructive_changes</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">"Paths being renamed:"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">"Migration *would* rename the following paths:"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="key">for</span> <span class="nam">previous_path</span><span class="op">,</span> <span class="nam">new_path</span> <span class="key">in</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="nam">p</span> <span class="key">for</span> <span class="nam">m</span> <span class="key">in</span> <span class="nam">migrations</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">m</span><span class="op">.</span><span class="nam">rename_paths_on_success</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f" mv {escape_shell(previous_path, new_path)}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="key">if</span> <span class="nam">removals</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="key">if</span> <span class="nam">permit_destructive_changes</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">"Removals:"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">"Migration *would* remove the following files:"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="key">for</span> <span class="nam">path</span> <span class="key">in</span> <span class="op">(</span><span class="nam">p</span> <span class="key">for</span> <span class="nam">m</span> <span class="key">in</span> <span class="nam">migrations</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">m</span><span class="op">.</span><span class="nam">remove_paths_on_success</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f" rm -f {escape_shell(path)}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> <span class="key">if</span> <span class="nam">permit_destructive_changes</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> <span class="str">"If you would like to perform the migration, please re-run with --apply-changes."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> <span class="key">elif</span> <span class="nam">permit_destructive_changes</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> <span class="key">for</span> <span class="nam">previous_path</span><span class="op">,</span> <span class="nam">new_path</span> <span class="key">in</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> <span class="nam">p</span> <span class="key">for</span> <span class="nam">m</span> <span class="key">in</span> <span class="nam">migrations</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">m</span><span class="op">.</span><span class="nam">rename_paths_on_success</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">rename</span><span class="op">(</span><span class="nam">previous_path</span><span class="op">,</span> <span class="nam">new_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> <span class="key">for</span> <span class="nam">path</span> <span class="key">in</span> <span class="op">(</span><span class="nam">p</span> <span class="key">for</span> <span class="nam">m</span> <span class="key">in</span> <span class="nam">migrations</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">m</span><span class="op">.</span><span class="nam">remove_paths_on_success</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">unlink</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">"Migrations performed successfully"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"> <span class="str">"Remember to validate the resulting binary packages after rebuilding with debputy"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">"No migrations performed as requested"</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_23db3c975895bd86___init___py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_23db3c975895bd86_migrators_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_23db3c975895bd86_migrators_impl_py.html b/coverage-report/d_23db3c975895bd86_migrators_impl_py.html deleted file mode 100644 index 34ee9ac..0000000 --- a/coverage-report/d_23db3c975895bd86_migrators_impl_py.html +++ /dev/null @@ -1,1829 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/dh_migration/migrators_impl.py: 81%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/dh_migration/migrators_impl.py</b>: - <span class="pc_cov">81%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">669 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">555<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">114<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">39<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_23db3c975895bd86_migrators_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_23db3c975895bd86_models_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">collections</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">dataclasses</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">functools</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">import</span> <span class="nam">json</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">import</span> <span class="nam">re</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">import</span> <span class="nam">subprocess</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">Iterable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">List</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">Set</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">Mapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">Callable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">TypeVar</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">Dict</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"><span class="key">from</span> <span class="nam">debian</span><span class="op">.</span><span class="nam">deb822</span> <span class="key">import</span> <span class="nam">Deb822</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span> <span class="key">import</span> <span class="nam">DEBPUTY_DOC_ROOT_DIR</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">architecture_support</span> <span class="key">import</span> <span class="nam">dpkg_architecture_table</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">deb_packaging_support</span> <span class="key">import</span> <span class="nam">dpkg_field_list_pkg_dep</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">debhelper_emulation</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="nam">dhe_filedoublearray</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="nam">DHConfigFileLine</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="nam">dhe_pkgfile</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="nam">parse_drules_for_addons</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="nam">extract_dh_addons_from_control</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">dh_migration</span><span class="op">.</span><span class="nam">models</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="nam">ConflictingChange</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="nam">FeatureMigration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="nam">UnsupportedFeature</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="nam">AcceptableMigrationIssues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">DHMigrationSubstitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">highlevel_manifest</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">MutableYAMLSymlink</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">HighLevelManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="nam">MutableYAMLConffileManagementItem</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="nam">AbstractMutableYAMLInstallRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">installations</span> <span class="key">import</span> <span class="nam">MAN_GUESS_FROM_BASENAME</span><span class="op">,</span> <span class="nam">MAN_GUESS_LANG_FROM_PATH</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">packages</span> <span class="key">import</span> <span class="nam">BinaryPackage</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="nam">VirtualPath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="nam">_error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="nam">PKGVERSION_REGEX</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="nam">PKGNAME_REGEX</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="nam">_normalize_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="nam">assume_not_none</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">has_glob_magic</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"><span class="nam">MIGRATION_TARGET_DH_DEBPUTY_RRR</span> <span class="op">=</span> <span class="str">"dh-sequence-zz-debputy-rrr"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"><span class="nam">MIGRATION_TARGET_DH_DEBPUTY</span> <span class="op">=</span> <span class="str">"dh-sequence-zz-debputy"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"><span class="com"># Align with debputy.py</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"><span class="nam">DH_COMMANDS_REPLACED</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="nam">MIGRATION_TARGET_DH_DEBPUTY_RRR</span><span class="op">:</span> <span class="nam">frozenset</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="str">"dh_fixperms"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="str">"dh_shlibdeps"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="str">"dh_gencontrol"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="str">"dh_md5sums"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="str">"dh_builddeb"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="nam">MIGRATION_TARGET_DH_DEBPUTY</span><span class="op">:</span> <span class="nam">frozenset</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="str">"dh_install"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="str">"dh_installdocs"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="str">"dh_installchangelogs"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="str">"dh_installexamples"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="str">"dh_installman"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="str">"dh_installcatalogs"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="str">"dh_installcron"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="str">"dh_installdebconf"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="str">"dh_installemacsen"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="str">"dh_installifupdown"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="str">"dh_installinfo"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="str">"dh_installinit"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="str">"dh_installsysusers"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="str">"dh_installtmpfiles"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="str">"dh_installsystemd"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="str">"dh_installsystemduser"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="str">"dh_installmenu"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="str">"dh_installmime"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="str">"dh_installmodules"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="str">"dh_installlogcheck"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="str">"dh_installlogrotate"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="str">"dh_installpam"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="str">"dh_installppp"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="str">"dh_installudev"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="str">"dh_installgsettings"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="str">"dh_installinitramfs"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="str">"dh_installalternatives"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="str">"dh_bugfiles"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="str">"dh_ucf"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="str">"dh_lintian"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="str">"dh_icons"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="str">"dh_usrlocal"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="str">"dh_perl"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="str">"dh_link"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="str">"dh_installwm"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="str">"dh_installxfonts"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="str">"dh_strip_nondeterminism"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="str">"dh_compress"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="str">"dh_fixperms"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="str">"dh_dwz"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="str">"dh_strip"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="str">"dh_makeshlibs"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="str">"dh_shlibdeps"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="str">"dh_missing"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="str">"dh_installdeb"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="str">"dh_gencontrol"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="str">"dh_md5sums"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="str">"dh_builddeb"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"><span class="nam">_GS_DOC</span> <span class="op">=</span> <span class="str">f"{DEBPUTY_DOC_ROOT_DIR}/GETTING-STARTED-WITH-dh-debputy.md"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"><span class="nam">MIGRATION_AID_FOR_OVERRIDDEN_COMMANDS</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="str">"dh_installinit"</span><span class="op">:</span> <span class="str">f"{_GS_DOC}#covert-your-overrides-for-dh_installsystemd-dh_installinit-if-any"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="str">"dh_installsystemd"</span><span class="op">:</span> <span class="str">f"{_GS_DOC}#covert-your-overrides-for-dh_installsystemd-dh_installinit-if-any"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="str">"dh_fixperms"</span><span class="op">:</span> <span class="str">f"{_GS_DOC}#convert-your-overrides-or-excludes-for-dh_fixperms-if-any"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="str">"dh_gencontrol"</span><span class="op">:</span> <span class="str">f"{_GS_DOC}#convert-your-overrides-for-dh_gencontrol-if-any"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"><span class="key">class</span> <span class="nam">UnsupportedDHConfig</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="nam">dh_config_basename</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="nam">dh_tool</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="nam">bug_950723_prefix_matching</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="nam">is_missing_migration</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"><span class="key">class</span> <span class="nam">DHSequenceMigration</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="nam">debputy_plugin</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="nam">remove_dh_sequence</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="nam">must_use_zz_debputy</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"><span class="nam">UNSUPPORTED_DH_CONFIGS_AND_TOOLS_FOR_ZZ_DEBPUTY</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="nam">UnsupportedDHConfig</span><span class="op">(</span><span class="str">"config"</span><span class="op">,</span> <span class="str">"dh_installdebconf"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="nam">UnsupportedDHConfig</span><span class="op">(</span><span class="str">"templates"</span><span class="op">,</span> <span class="str">"dh_installdebconf"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="nam">UnsupportedDHConfig</span><span class="op">(</span><span class="str">"emacsen-compat"</span><span class="op">,</span> <span class="str">"dh_installemacsen"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="nam">UnsupportedDHConfig</span><span class="op">(</span><span class="str">"emacsen-install"</span><span class="op">,</span> <span class="str">"dh_installemacsen"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="nam">UnsupportedDHConfig</span><span class="op">(</span><span class="str">"emacsen-remove"</span><span class="op">,</span> <span class="str">"dh_installemacsen"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="nam">UnsupportedDHConfig</span><span class="op">(</span><span class="str">"emacsen-startup"</span><span class="op">,</span> <span class="str">"dh_installemacsen"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="com"># The `upstart` file should be long dead, but we might as well detect it.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="nam">UnsupportedDHConfig</span><span class="op">(</span><span class="str">"upstart"</span><span class="op">,</span> <span class="str">"dh_installinit"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="com"># dh_installsystemduser</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="nam">UnsupportedDHConfig</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="str">"user.path"</span><span class="op">,</span> <span class="str">"dh_installsystemduser"</span><span class="op">,</span> <span class="nam">bug_950723_prefix_matching</span><span class="op">=</span><span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="nam">UnsupportedDHConfig</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="str">"user.path"</span><span class="op">,</span> <span class="str">"dh_installsystemduser"</span><span class="op">,</span> <span class="nam">bug_950723_prefix_matching</span><span class="op">=</span><span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="nam">UnsupportedDHConfig</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="str">"user.service"</span><span class="op">,</span> <span class="str">"dh_installsystemduser"</span><span class="op">,</span> <span class="nam">bug_950723_prefix_matching</span><span class="op">=</span><span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="nam">UnsupportedDHConfig</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="str">"user.service"</span><span class="op">,</span> <span class="str">"dh_installsystemduser"</span><span class="op">,</span> <span class="nam">bug_950723_prefix_matching</span><span class="op">=</span><span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="nam">UnsupportedDHConfig</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="str">"user.socket"</span><span class="op">,</span> <span class="str">"dh_installsystemduser"</span><span class="op">,</span> <span class="nam">bug_950723_prefix_matching</span><span class="op">=</span><span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="nam">UnsupportedDHConfig</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="str">"user.socket"</span><span class="op">,</span> <span class="str">"dh_installsystemduser"</span><span class="op">,</span> <span class="nam">bug_950723_prefix_matching</span><span class="op">=</span><span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="nam">UnsupportedDHConfig</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="str">"user.target"</span><span class="op">,</span> <span class="str">"dh_installsystemduser"</span><span class="op">,</span> <span class="nam">bug_950723_prefix_matching</span><span class="op">=</span><span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="nam">UnsupportedDHConfig</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="str">"user.target"</span><span class="op">,</span> <span class="str">"dh_installsystemduser"</span><span class="op">,</span> <span class="nam">bug_950723_prefix_matching</span><span class="op">=</span><span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="nam">UnsupportedDHConfig</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="str">"user.timer"</span><span class="op">,</span> <span class="str">"dh_installsystemduser"</span><span class="op">,</span> <span class="nam">bug_950723_prefix_matching</span><span class="op">=</span><span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="nam">UnsupportedDHConfig</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="str">"user.timer"</span><span class="op">,</span> <span class="str">"dh_installsystemduser"</span><span class="op">,</span> <span class="nam">bug_950723_prefix_matching</span><span class="op">=</span><span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="nam">UnsupportedDHConfig</span><span class="op">(</span><span class="str">"udev"</span><span class="op">,</span> <span class="str">"dh_installudev"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="nam">UnsupportedDHConfig</span><span class="op">(</span><span class="str">"menu"</span><span class="op">,</span> <span class="str">"dh_installmenu"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="nam">UnsupportedDHConfig</span><span class="op">(</span><span class="str">"menu-method"</span><span class="op">,</span> <span class="str">"dh_installmenu"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="nam">UnsupportedDHConfig</span><span class="op">(</span><span class="str">"ucf"</span><span class="op">,</span> <span class="str">"dh_ucf"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="nam">UnsupportedDHConfig</span><span class="op">(</span><span class="str">"wm"</span><span class="op">,</span> <span class="str">"dh_installwm"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="nam">UnsupportedDHConfig</span><span class="op">(</span><span class="str">"triggers"</span><span class="op">,</span> <span class="str">"dh_installdeb"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="nam">UnsupportedDHConfig</span><span class="op">(</span><span class="str">"postinst"</span><span class="op">,</span> <span class="str">"dh_installdeb"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="nam">UnsupportedDHConfig</span><span class="op">(</span><span class="str">"postrm"</span><span class="op">,</span> <span class="str">"dh_installdeb"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="nam">UnsupportedDHConfig</span><span class="op">(</span><span class="str">"preinst"</span><span class="op">,</span> <span class="str">"dh_installdeb"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="nam">UnsupportedDHConfig</span><span class="op">(</span><span class="str">"prerm"</span><span class="op">,</span> <span class="str">"dh_installdeb"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="nam">UnsupportedDHConfig</span><span class="op">(</span><span class="str">"menutest"</span><span class="op">,</span> <span class="str">"dh_installdeb"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="nam">UnsupportedDHConfig</span><span class="op">(</span><span class="str">"isinstallable"</span><span class="op">,</span> <span class="str">"dh_installdeb"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"><span class="nam">SUPPORTED_DH_ADDONS</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="com"># debputy's own</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="str">"zz-debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="com"># debhelper provided sequences that should work.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="str">"single-binary"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"><span class="nam">DH_ADDONS_TO_REMOVE</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="com"># Sequences debputy directly replaces</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="str">"dwz"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="str">"elf-tools"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="str">"installinitramfs"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="str">"installsysusers"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="str">"doxygen"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="com"># Sequences that are embedded fully into debputy</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="str">"bash-completion"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="str">"sodeps"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"><span class="nam">DH_ADDONS_TO_PLUGINS</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="str">"gnome"</span><span class="op">:</span> <span class="nam">DHSequenceMigration</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="str">"gnome"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="com"># The sequence still provides a command for the clean sequence</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="nam">remove_dh_sequence</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="nam">must_use_zz_debputy</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="str">"numpy3"</span><span class="op">:</span> <span class="nam">DHSequenceMigration</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="str">"numpy3"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="com"># The sequence provides (build-time) dependencies that we cannot provide</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="nam">remove_dh_sequence</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="nam">must_use_zz_debputy</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="str">"perl-openssl"</span><span class="op">:</span> <span class="nam">DHSequenceMigration</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="str">"perl-openssl"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="com"># The sequence provides (build-time) dependencies that we cannot provide</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="nam">remove_dh_sequence</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="nam">must_use_zz_debputy</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"><span class="key">def</span> <span class="nam">_dh_config_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="nam">basename</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="nam">helper_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="nam">acceptable_migration_issues</span><span class="op">:</span> <span class="nam">AcceptableMigrationIssues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">:</span> <span class="nam">FeatureMigration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="nam">manifest</span><span class="op">:</span> <span class="nam">HighLevelManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="nam">support_executable_files</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="nam">allow_dh_exec_rename</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="nam">pkgfile_lookup</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="nam">remove_on_migration</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Union</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="key">None</span><span class="op">,</span> <span class="key">None</span><span class="op">]</span><span class="op">,</span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">,</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">DHConfigFileLine</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="nam">mutable_manifest</span> <span class="op">=</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">manifest</span><span class="op">.</span><span class="nam">mutable_manifest</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="nam">dh_config_file</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="nam">dhe_pkgfile</span><span class="op">(</span><span class="nam">debian_dir</span><span class="op">,</span> <span class="nam">dctrl_bin</span><span class="op">,</span> <span class="nam">basename</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="key">if</span> <span class="nam">pkgfile_lookup</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="key">else</span> <span class="nam">debian_dir</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">basename</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="key">if</span> <span class="nam">dh_config_file</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">dh_config_file</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span><span class="op">,</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="key">if</span> <span class="nam">dh_config_file</span><span class="op">.</span><span class="nam">is_executable</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">support_executable_files</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="nam">primary_key</span> <span class="op">=</span> <span class="str">f"executable-{helper_name}-config"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="nam">primary_key</span> <span class="key">in</span> <span class="nam">acceptable_migration_issues</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="key">or</span> <span class="str">"any-executable-dh-configs"</span> <span class="key">in</span> <span class="nam">acceptable_migration_issues</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="str">f'TODO: MANUAL MIGRATION of executable dh config "{dh_config_file}" is required.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span><span class="op">,</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="key">raise</span> <span class="nam">UnsupportedFeature</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="str">f"Executable configuration files not supported (found: {dh_config_file})."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="op">[</span><span class="nam">primary_key</span><span class="op">,</span> <span class="str">"any-executable-dh-configs"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="key">if</span> <span class="nam">remove_on_migration</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">remove_on_success</span><span class="op">(</span><span class="nam">dh_config_file</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="nam">substitution</span> <span class="op">=</span> <span class="nam">DHMigrationSubstitution</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="nam">dpkg_architecture_table</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="nam">acceptable_migration_issues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="nam">mutable_manifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="nam">content</span> <span class="op">=</span> <span class="nam">dhe_filedoublearray</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> <span class="nam">dh_config_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="nam">substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> <span class="nam">allow_dh_exec_rename</span><span class="op">=</span><span class="nam">allow_dh_exec_rename</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="key">return</span> <span class="nam">dh_config_file</span><span class="op">,</span> <span class="nam">content</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"><span class="key">def</span> <span class="nam">_validate_rm_mv_conffile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="nam">package</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="nam">config_line</span><span class="op">:</span> <span class="nam">DHConfigFileLine</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="nam">cmd</span><span class="op">,</span> <span class="op">*</span><span class="nam">args</span> <span class="op">=</span> <span class="nam">config_line</span><span class="op">.</span><span class="nam">tokens</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> <span class="key">if</span> <span class="str">"--"</span> <span class="key">in</span> <span class="nam">config_line</span><span class="op">.</span><span class="nam">tokens</span><span class="op">:</span> </span><span class="r"><span class="annotate short">306 ↛ 307</span><span class="annotate long">line 306 didn't jump to line 307, because the condition on line 306 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="str">f'The maintscripts file "{config_line.config_file.path}" for {package} includes a "--" in line'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="str">f" {config_line.line_no}. The offending line is: {config_line.original_line}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="key">if</span> <span class="nam">cmd</span> <span class="op">==</span> <span class="str">"rm_conffile"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="nam">min_args</span> <span class="op">=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="nam">max_args</span> <span class="op">=</span> <span class="num">3</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="nam">min_args</span> <span class="op">=</span> <span class="num">2</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="nam">max_args</span> <span class="op">=</span> <span class="num">4</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">args</span><span class="op">)</span> <span class="op">></span> <span class="nam">max_args</span> <span class="key">or</span> <span class="nam">len</span><span class="op">(</span><span class="nam">args</span><span class="op">)</span> <span class="op"><</span> <span class="nam">min_args</span><span class="op">:</span> </span><span class="r"><span class="annotate short">317 ↛ 318</span><span class="annotate long">line 317 didn't jump to line 318, because the condition on line 317 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="str">f'The "{cmd}" command takes at least {min_args} and at most {max_args} arguments. However,'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="str">f' in "{config_line.config_file.path}" line {config_line.line_no} (for {package}), there'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="str">f" are {len(args)} arguments. The offending line is: {config_line.original_line}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> <span class="nam">obsolete_conffile</span> <span class="op">=</span> <span class="nam">args</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> <span class="nam">new_conffile</span> <span class="op">=</span> <span class="nam">args</span><span class="op">[</span><span class="num">1</span><span class="op">]</span> <span class="key">if</span> <span class="nam">cmd</span> <span class="op">==</span> <span class="str">"mv_conffile"</span> <span class="key">else</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> <span class="nam">prior_version</span> <span class="op">=</span> <span class="nam">args</span><span class="op">[</span><span class="nam">min_args</span><span class="op">]</span> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">args</span><span class="op">)</span> <span class="op">></span> <span class="nam">min_args</span> <span class="key">else</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> <span class="nam">owning_package</span> <span class="op">=</span> <span class="nam">args</span><span class="op">[</span><span class="nam">min_args</span> <span class="op">+</span> <span class="num">1</span><span class="op">]</span> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">args</span><span class="op">)</span> <span class="op">></span> <span class="nam">min_args</span> <span class="op">+</span> <span class="num">1</span> <span class="key">else</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">obsolete_conffile</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">328 ↛ 329</span><span class="annotate long">line 328 didn't jump to line 329, because the condition on line 328 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> <span class="str">f'The (old-)conffile parameter for {cmd} must be absolute (i.e., start with "/"). However,'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> <span class="str">f' in "{config_line.config_file.path}" line {config_line.line_no} (for {package}), it was specified'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> <span class="str">f' as "{obsolete_conffile}". The offending line is: {config_line.original_line}'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> <span class="key">if</span> <span class="nam">new_conffile</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">new_conffile</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">334 ↛ 335</span><span class="annotate long">line 334 didn't jump to line 335, because the condition on line 334 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> <span class="str">f'The new-conffile parameter for {cmd} must be absolute (i.e., start with "/"). However,'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> <span class="str">f' in "{config_line.config_file.path}" line {config_line.line_no} (for {package}), it was specified'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> <span class="str">f' as "{new_conffile}". The offending line is: {config_line.original_line}'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> <span class="key">if</span> <span class="nam">prior_version</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">PKGVERSION_REGEX</span><span class="op">.</span><span class="nam">fullmatch</span><span class="op">(</span><span class="nam">prior_version</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">340 ↛ 341</span><span class="annotate long">line 340 didn't jump to line 341, because the condition on line 340 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"> <span class="str">f"The prior-version parameter for {cmd} must be a valid package version (i.e., match"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"> <span class="str">f' {PKGVERSION_REGEX}). However, in "{config_line.config_file.path}" line {config_line.line_no}'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> <span class="str">f' (for {package}), it was specified as "{prior_version}". The offending line is:'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"> <span class="str">f" {config_line.original_line}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"> <span class="key">if</span> <span class="nam">owning_package</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">PKGNAME_REGEX</span><span class="op">.</span><span class="nam">fullmatch</span><span class="op">(</span><span class="nam">owning_package</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">347 ↛ 348</span><span class="annotate long">line 347 didn't jump to line 348, because the condition on line 347 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"> <span class="str">f"The package parameter for {cmd} must be a valid package name (i.e., match {PKGNAME_REGEX})."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"> <span class="str">f' However, in "{config_line.config_file.path}" line {config_line.line_no} (for {package}), it'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"> <span class="str">f' was specified as "{owning_package}". The offending line is: {config_line.original_line}'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"> <span class="key">return</span> <span class="nam">cmd</span><span class="op">,</span> <span class="nam">obsolete_conffile</span><span class="op">,</span> <span class="nam">new_conffile</span><span class="op">,</span> <span class="nam">prior_version</span><span class="op">,</span> <span class="nam">owning_package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"><span class="nam">_BASH_COMPLETION_RE</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"> <span class="str">r"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"><span class="str"> (^|[|&;])\s*complete.*-[A-Za-z].*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"><span class="str"> | \$\(.*\)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"><span class="str"> | \s*compgen.*-[A-Za-z].*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"><span class="str"> | \s*if.*;.*then/</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"><span class="str">"""</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"> <span class="nam">re</span><span class="op">.</span><span class="nam">VERBOSE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"><span class="key">def</span> <span class="nam">migrate_bash_completion</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"> <span class="nam">manifest</span><span class="op">:</span> <span class="nam">HighLevelManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"> <span class="nam">acceptable_migration_issues</span><span class="op">:</span> <span class="nam">AcceptableMigrationIssues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">:</span> <span class="nam">FeatureMigration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"> <span class="nam">_migration_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">tagline</span> <span class="op">=</span> <span class="str">"dh_bash-completion files"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"> <span class="nam">is_single_binary</span> <span class="op">=</span> <span class="nam">sum</span><span class="op">(</span><span class="num">1</span> <span class="key">for</span> <span class="nam">_</span> <span class="key">in</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">all_packages</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"> <span class="nam">mutable_manifest</span> <span class="op">=</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">manifest</span><span class="op">.</span><span class="nam">mutable_manifest</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"> <span class="nam">installations</span> <span class="op">=</span> <span class="nam">mutable_manifest</span><span class="op">.</span><span class="nam">installations</span><span class="op">(</span><span class="nam">create_if_absent</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"> <span class="key">for</span> <span class="nam">dctrl_bin</span> <span class="key">in</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">all_packages</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"> <span class="nam">dh_file</span> <span class="op">=</span> <span class="nam">dhe_pkgfile</span><span class="op">(</span><span class="nam">debian_dir</span><span class="op">,</span> <span class="nam">dctrl_bin</span><span class="op">,</span> <span class="str">"bash-completion"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"> <span class="key">if</span> <span class="nam">dh_file</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"> <span class="nam">is_bash_completion_file</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"> <span class="key">with</span> <span class="nam">dh_file</span><span class="op">.</span><span class="nam">open</span><span class="op">(</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t385" href="#t385">385</a></span><span class="t"> <span class="key">for</span> <span class="nam">line</span> <span class="key">in</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t386" href="#t386">386</a></span><span class="t"> <span class="nam">line</span> <span class="op">=</span> <span class="nam">line</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t387" href="#t387">387</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">line</span> <span class="key">or</span> <span class="nam">line</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="op">==</span> <span class="str">"#"</span><span class="op">:</span> </span><span class="r"><span class="annotate short">387 ↛ 388</span><span class="annotate long">line 387 didn't jump to line 388, because the condition on line 387 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t388" href="#t388">388</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t389" href="#t389">389</a></span><span class="t"> <span class="key">if</span> <span class="nam">_BASH_COMPLETION_RE</span><span class="op">.</span><span class="nam">search</span><span class="op">(</span><span class="nam">line</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t390" href="#t390">390</a></span><span class="t"> <span class="nam">is_bash_completion_file</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t391" href="#t391">391</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t392" href="#t392">392</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">is_bash_completion_file</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t393" href="#t393">393</a></span><span class="t"> <span class="nam">_</span><span class="op">,</span> <span class="nam">content</span> <span class="op">=</span> <span class="nam">_dh_config_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t394" href="#t394">394</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t395" href="#t395">395</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t396" href="#t396">396</a></span><span class="t"> <span class="str">"bash-completion"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t397" href="#t397">397</a></span><span class="t"> <span class="str">"dh_bash-completion"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t398" href="#t398">398</a></span><span class="t"> <span class="nam">acceptable_migration_issues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t399" href="#t399">399</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t400" href="#t400">400</a></span><span class="t"> <span class="nam">manifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t401" href="#t401">401</a></span><span class="t"> <span class="nam">support_executable_files</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t402" href="#t402">402</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t403" href="#t403">403</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t404" href="#t404">404</a></span><span class="t"> <span class="nam">content</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t405" href="#t405">405</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t406" href="#t406">406</a></span><span class="t"> <span class="key">if</span> <span class="nam">content</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t407" href="#t407">407</a></span><span class="t"> <span class="nam">install_dest_sources</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t408" href="#t408">408</a></span><span class="t"> <span class="nam">install_as_rules</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t409" href="#t409">409</a></span><span class="t"> <span class="key">for</span> <span class="nam">dhe_line</span> <span class="key">in</span> <span class="nam">content</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t410" href="#t410">410</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">dhe_line</span><span class="op">.</span><span class="nam">tokens</span><span class="op">)</span> <span class="op">></span> <span class="num">2</span><span class="op">:</span> </span><span class="r"><span class="annotate short">410 ↛ 411</span><span class="annotate long">line 410 didn't jump to line 411, because the condition on line 410 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t411" href="#t411">411</a></span><span class="t"> <span class="key">raise</span> <span class="nam">UnsupportedFeature</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t412" href="#t412">412</a></span><span class="t"> <span class="str">f"The dh_bash-completion file {dh_file.path} more than two words on"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t413" href="#t413">413</a></span><span class="t"> <span class="str">f' line {dhe_line.line_no} (line: "{dhe_line.original_line}").'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t414" href="#t414">414</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t415" href="#t415">415</a></span><span class="t"> <span class="nam">source</span> <span class="op">=</span> <span class="nam">dhe_line</span><span class="op">.</span><span class="nam">tokens</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t416" href="#t416">416</a></span><span class="t"> <span class="nam">dest_basename</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t417" href="#t417">417</a></span><span class="t"> <span class="nam">dhe_line</span><span class="op">.</span><span class="nam">tokens</span><span class="op">[</span><span class="num">1</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t418" href="#t418">418</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">dhe_line</span><span class="op">.</span><span class="nam">tokens</span><span class="op">)</span> <span class="op">></span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t419" href="#t419">419</a></span><span class="t"> <span class="key">else</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">basename</span><span class="op">(</span><span class="nam">source</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t420" href="#t420">420</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t421" href="#t421">421</a></span><span class="t"> <span class="key">if</span> <span class="nam">source</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"debian/"</span><span class="op">)</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">has_glob_magic</span><span class="op">(</span><span class="nam">source</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t422" href="#t422">422</a></span><span class="t"> <span class="key">if</span> <span class="nam">dctrl_bin</span><span class="op">.</span><span class="nam">name</span> <span class="op">!=</span> <span class="nam">dest_basename</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t423" href="#t423">423</a></span><span class="t"> <span class="nam">dest_path</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t424" href="#t424">424</a></span><span class="t"> <span class="str">f"debian/{dctrl_bin.name}.{dest_basename}.bash-completion"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t425" href="#t425">425</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t426" href="#t426">426</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t427" href="#t427">427</a></span><span class="t"> <span class="nam">dest_path</span> <span class="op">=</span> <span class="str">f"debian/{dest_basename}.bash-completion"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t428" href="#t428">428</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">rename_on_success</span><span class="op">(</span><span class="nam">source</span><span class="op">,</span> <span class="nam">dest_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t429" href="#t429">429</a></span><span class="t"> <span class="key">elif</span> <span class="nam">len</span><span class="op">(</span><span class="nam">dhe_line</span><span class="op">.</span><span class="nam">tokens</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t430" href="#t430">430</a></span><span class="t"> <span class="nam">install_dest_sources</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">source</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t431" href="#t431">431</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t432" href="#t432">432</a></span><span class="t"> <span class="nam">install_as_rules</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="op">(</span><span class="nam">source</span><span class="op">,</span> <span class="nam">dest_basename</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t433" href="#t433">433</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t434" href="#t434">434</a></span><span class="t"> <span class="key">if</span> <span class="nam">install_dest_sources</span><span class="op">:</span> </span><span class="r"><span class="annotate short">434 ↛ 448</span><span class="annotate long">line 434 didn't jump to line 448, because the condition on line 434 was never false</span></span></p> - <p class="run"><span class="n"><a id="t435" href="#t435">435</a></span><span class="t"> <span class="nam">sources</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t436" href="#t436">436</a></span><span class="t"> <span class="nam">install_dest_sources</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t437" href="#t437">437</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">install_dest_sources</span><span class="op">)</span> <span class="op">></span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t438" href="#t438">438</a></span><span class="t"> <span class="key">else</span> <span class="nam">install_dest_sources</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t439" href="#t439">439</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t440" href="#t440">440</a></span><span class="t"> <span class="nam">installations</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t441" href="#t441">441</a></span><span class="t"> <span class="nam">AbstractMutableYAMLInstallRule</span><span class="op">.</span><span class="nam">install_dest</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t442" href="#t442">442</a></span><span class="t"> <span class="nam">sources</span><span class="op">=</span><span class="nam">sources</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t443" href="#t443">443</a></span><span class="t"> <span class="nam">dest_dir</span><span class="op">=</span><span class="str">"{{path:BASH_COMPLETION_DIR}}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t444" href="#t444">444</a></span><span class="t"> <span class="nam">into</span><span class="op">=</span><span class="nam">dctrl_bin</span><span class="op">.</span><span class="nam">name</span> <span class="key">if</span> <span class="key">not</span> <span class="nam">is_single_binary</span> <span class="key">else</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t445" href="#t445">445</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t446" href="#t446">446</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t447" href="#t447">447</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t448" href="#t448">448</a></span><span class="t"> <span class="key">for</span> <span class="nam">source</span><span class="op">,</span> <span class="nam">dest_basename</span> <span class="key">in</span> <span class="nam">install_as_rules</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t449" href="#t449">449</a></span><span class="t"> <span class="nam">installations</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t450" href="#t450">450</a></span><span class="t"> <span class="nam">AbstractMutableYAMLInstallRule</span><span class="op">.</span><span class="nam">install_as</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t451" href="#t451">451</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="nam">source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t452" href="#t452">452</a></span><span class="t"> <span class="nam">install_as</span><span class="op">=</span><span class="str">"{{path:BASH_COMPLETION_DIR}}/"</span> <span class="op">+</span> <span class="nam">dest_basename</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t453" href="#t453">453</a></span><span class="t"> <span class="nam">into</span><span class="op">=</span><span class="nam">dctrl_bin</span><span class="op">.</span><span class="nam">name</span> <span class="key">if</span> <span class="key">not</span> <span class="nam">is_single_binary</span> <span class="key">else</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t454" href="#t454">454</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t455" href="#t455">455</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t456" href="#t456">456</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t457" href="#t457">457</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t458" href="#t458">458</a></span><span class="t"><span class="key">def</span> <span class="nam">migrate_dh_installsystemd_files</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t459" href="#t459">459</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t460" href="#t460">460</a></span><span class="t"> <span class="nam">manifest</span><span class="op">:</span> <span class="nam">HighLevelManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t461" href="#t461">461</a></span><span class="t"> <span class="nam">_acceptable_migration_issues</span><span class="op">:</span> <span class="nam">AcceptableMigrationIssues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t462" href="#t462">462</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">:</span> <span class="nam">FeatureMigration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t463" href="#t463">463</a></span><span class="t"> <span class="nam">_migration_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t464" href="#t464">464</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t465" href="#t465">465</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">tagline</span> <span class="op">=</span> <span class="str">"dh_installsystemd files"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t466" href="#t466">466</a></span><span class="t"> <span class="key">for</span> <span class="nam">dctrl_bin</span> <span class="key">in</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">all_packages</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t467" href="#t467">467</a></span><span class="t"> <span class="key">for</span> <span class="nam">stem</span> <span class="key">in</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t468" href="#t468">468</a></span><span class="t"> <span class="str">"path"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t469" href="#t469">469</a></span><span class="t"> <span class="str">"service"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t470" href="#t470">470</a></span><span class="t"> <span class="str">"socket"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t471" href="#t471">471</a></span><span class="t"> <span class="str">"target"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t472" href="#t472">472</a></span><span class="t"> <span class="str">"timer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t473" href="#t473">473</a></span><span class="t"> <span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t474" href="#t474">474</a></span><span class="t"> <span class="nam">pkgfile</span> <span class="op">=</span> <span class="nam">dhe_pkgfile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t475" href="#t475">475</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">,</span> <span class="nam">dctrl_bin</span><span class="op">,</span> <span class="nam">stem</span><span class="op">,</span> <span class="nam">bug_950723_prefix_matching</span><span class="op">=</span><span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t476" href="#t476">476</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t477" href="#t477">477</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">pkgfile</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t478" href="#t478">478</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t479" href="#t479">479</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">pkgfile</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">f".{stem}"</span><span class="op">)</span> <span class="key">or</span> <span class="str">"@."</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">pkgfile</span><span class="op">.</span><span class="nam">name</span><span class="op">:</span> </span><span class="r"><span class="annotate short">479 ↛ 480</span><span class="annotate long">line 479 didn't jump to line 480, because the condition on line 479 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t480" href="#t480">480</a></span><span class="t"> <span class="key">raise</span> <span class="nam">UnsupportedFeature</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t481" href="#t481">481</a></span><span class="t"> <span class="str">f'Unable to determine the correct name for {pkgfile.fs_path}. It should be a ".@{stem}"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t482" href="#t482">482</a></span><span class="t"> <span class="str">f" file now (foo@.service => foo.@service)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t483" href="#t483">483</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t484" href="#t484">484</a></span><span class="t"> <span class="nam">newname</span> <span class="op">=</span> <span class="nam">pkgfile</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">"@."</span><span class="op">,</span> <span class="str">"."</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t485" href="#t485">485</a></span><span class="t"> <span class="nam">newname</span> <span class="op">=</span> <span class="nam">newname</span><span class="op">[</span><span class="op">:</span> <span class="op">-</span><span class="nam">len</span><span class="op">(</span><span class="nam">stem</span><span class="op">)</span><span class="op">]</span> <span class="op">+</span> <span class="str">f"@{stem}"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t486" href="#t486">486</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">rename_on_success</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t487" href="#t487">487</a></span><span class="t"> <span class="nam">pkgfile</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">,</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">debian_dir</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">,</span> <span class="nam">newname</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t488" href="#t488">488</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t489" href="#t489">489</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t490" href="#t490">490</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t491" href="#t491">491</a></span><span class="t"><span class="key">def</span> <span class="nam">migrate_maintscript</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t492" href="#t492">492</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t493" href="#t493">493</a></span><span class="t"> <span class="nam">manifest</span><span class="op">:</span> <span class="nam">HighLevelManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t494" href="#t494">494</a></span><span class="t"> <span class="nam">acceptable_migration_issues</span><span class="op">:</span> <span class="nam">AcceptableMigrationIssues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t495" href="#t495">495</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">:</span> <span class="nam">FeatureMigration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t496" href="#t496">496</a></span><span class="t"> <span class="nam">_migration_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t497" href="#t497">497</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t498" href="#t498">498</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">tagline</span> <span class="op">=</span> <span class="str">"dh_installdeb files"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t499" href="#t499">499</a></span><span class="t"> <span class="nam">mutable_manifest</span> <span class="op">=</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">manifest</span><span class="op">.</span><span class="nam">mutable_manifest</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t500" href="#t500">500</a></span><span class="t"> <span class="key">for</span> <span class="nam">dctrl_bin</span> <span class="key">in</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">all_packages</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t501" href="#t501">501</a></span><span class="t"> <span class="nam">mainscript_file</span><span class="op">,</span> <span class="nam">content</span> <span class="op">=</span> <span class="nam">_dh_config_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t502" href="#t502">502</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t503" href="#t503">503</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t504" href="#t504">504</a></span><span class="t"> <span class="str">"maintscript"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t505" href="#t505">505</a></span><span class="t"> <span class="str">"dh_installdeb"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t506" href="#t506">506</a></span><span class="t"> <span class="nam">acceptable_migration_issues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t507" href="#t507">507</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t508" href="#t508">508</a></span><span class="t"> <span class="nam">manifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t509" href="#t509">509</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t510" href="#t510">510</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t511" href="#t511">511</a></span><span class="t"> <span class="key">if</span> <span class="nam">mainscript_file</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t512" href="#t512">512</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t513" href="#t513">513</a></span><span class="t"> <span class="key">assert</span> <span class="nam">content</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t514" href="#t514">514</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t515" href="#t515">515</a></span><span class="t"> <span class="nam">package_definition</span> <span class="op">=</span> <span class="nam">mutable_manifest</span><span class="op">.</span><span class="nam">package</span><span class="op">(</span><span class="nam">dctrl_bin</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t516" href="#t516">516</a></span><span class="t"> <span class="nam">conffiles</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t517" href="#t517">517</a></span><span class="t"> <span class="nam">it</span><span class="op">.</span><span class="nam">obsolete_conffile</span><span class="op">:</span> <span class="nam">it</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t518" href="#t518">518</a></span><span class="t"> <span class="key">for</span> <span class="nam">it</span> <span class="key">in</span> <span class="nam">package_definition</span><span class="op">.</span><span class="nam">conffile_management_items</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t519" href="#t519">519</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t520" href="#t520">520</a></span><span class="t"> <span class="nam">seen_conffiles</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t521" href="#t521">521</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t522" href="#t522">522</a></span><span class="t"> <span class="key">for</span> <span class="nam">dhe_line</span> <span class="key">in</span> <span class="nam">content</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t523" href="#t523">523</a></span><span class="t"> <span class="nam">cmd</span> <span class="op">=</span> <span class="nam">dhe_line</span><span class="op">.</span><span class="nam">tokens</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t524" href="#t524">524</a></span><span class="t"> <span class="key">if</span> <span class="nam">cmd</span> <span class="key">not</span> <span class="key">in</span> <span class="op">{</span><span class="str">"rm_conffile"</span><span class="op">,</span> <span class="str">"mv_conffile"</span><span class="op">}</span><span class="op">:</span> </span><span class="r"><span class="annotate short">524 ↛ 525</span><span class="annotate long">line 524 didn't jump to line 525, because the condition on line 524 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t525" href="#t525">525</a></span><span class="t"> <span class="key">raise</span> <span class="nam">UnsupportedFeature</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t526" href="#t526">526</a></span><span class="t"> <span class="str">f"The dh_installdeb file {mainscript_file.path} contains the (currently)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t527" href="#t527">527</a></span><span class="t"> <span class="str">f' unsupported command "{cmd}" on line {dhe_line.line_no}'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t528" href="#t528">528</a></span><span class="t"> <span class="str">f' (line: "{dhe_line.original_line}")'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t529" href="#t529">529</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t530" href="#t530">530</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t531" href="#t531">531</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t532" href="#t532">532</a></span><span class="t"> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t533" href="#t533">533</a></span><span class="t"> <span class="nam">_</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t534" href="#t534">534</a></span><span class="t"> <span class="nam">obsolete_conffile</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t535" href="#t535">535</a></span><span class="t"> <span class="nam">new_conffile</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t536" href="#t536">536</a></span><span class="t"> <span class="nam">prior_to_version</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t537" href="#t537">537</a></span><span class="t"> <span class="nam">owning_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t538" href="#t538">538</a></span><span class="t"> <span class="op">)</span> <span class="op">=</span> <span class="nam">_validate_rm_mv_conffile</span><span class="op">(</span><span class="nam">dctrl_bin</span><span class="op">.</span><span class="nam">name</span><span class="op">,</span> <span class="nam">dhe_line</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t539" href="#t539">539</a></span><span class="t"> <span class="key">except</span> <span class="nam">ValueError</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t540" href="#t540">540</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t541" href="#t541">541</a></span><span class="t"> <span class="str">f"Validation error in {mainscript_file} on line {dhe_line.line_no}. The error was: {e.args[0]}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t542" href="#t542">542</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t543" href="#t543">543</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t544" href="#t544">544</a></span><span class="t"> <span class="key">if</span> <span class="nam">obsolete_conffile</span> <span class="key">in</span> <span class="nam">seen_conffiles</span><span class="op">:</span> </span><span class="r"><span class="annotate short">544 ↛ 545</span><span class="annotate long">line 544 didn't jump to line 545, because the condition on line 544 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t545" href="#t545">545</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ConflictingChange</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t546" href="#t546">546</a></span><span class="t"> <span class="str">f'The {mainscript_file} file defines actions for "{obsolete_conffile}" twice!'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t547" href="#t547">547</a></span><span class="t"> <span class="str">f" Please ensure that it is defined at most once in that file."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t548" href="#t548">548</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t549" href="#t549">549</a></span><span class="t"> <span class="nam">seen_conffiles</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">obsolete_conffile</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t550" href="#t550">550</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t551" href="#t551">551</a></span><span class="t"> <span class="key">if</span> <span class="nam">cmd</span> <span class="op">==</span> <span class="str">"rm_conffile"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t552" href="#t552">552</a></span><span class="t"> <span class="nam">item</span> <span class="op">=</span> <span class="nam">MutableYAMLConffileManagementItem</span><span class="op">.</span><span class="nam">rm_conffile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t553" href="#t553">553</a></span><span class="t"> <span class="nam">obsolete_conffile</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t554" href="#t554">554</a></span><span class="t"> <span class="nam">prior_to_version</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t555" href="#t555">555</a></span><span class="t"> <span class="nam">owning_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t556" href="#t556">556</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t557" href="#t557">557</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t558" href="#t558">558</a></span><span class="t"> <span class="key">assert</span> <span class="nam">cmd</span> <span class="op">==</span> <span class="str">"mv_conffile"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t559" href="#t559">559</a></span><span class="t"> <span class="nam">item</span> <span class="op">=</span> <span class="nam">MutableYAMLConffileManagementItem</span><span class="op">.</span><span class="nam">mv_conffile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t560" href="#t560">560</a></span><span class="t"> <span class="nam">obsolete_conffile</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t561" href="#t561">561</a></span><span class="t"> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">new_conffile</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t562" href="#t562">562</a></span><span class="t"> <span class="nam">prior_to_version</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t563" href="#t563">563</a></span><span class="t"> <span class="nam">owning_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t564" href="#t564">564</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t565" href="#t565">565</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t566" href="#t566">566</a></span><span class="t"> <span class="nam">existing_def</span> <span class="op">=</span> <span class="nam">conffiles</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">item</span><span class="op">.</span><span class="nam">obsolete_conffile</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t567" href="#t567">567</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing_def</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">567 ↛ 568</span><span class="annotate long">line 567 didn't jump to line 568, because the condition on line 567 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t568" href="#t568">568</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t569" href="#t569">569</a></span><span class="t"> <span class="nam">item</span><span class="op">.</span><span class="nam">command</span> <span class="op">==</span> <span class="nam">existing_def</span><span class="op">.</span><span class="nam">command</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t570" href="#t570">570</a></span><span class="t"> <span class="key">and</span> <span class="nam">item</span><span class="op">.</span><span class="nam">new_conffile</span> <span class="op">==</span> <span class="nam">existing_def</span><span class="op">.</span><span class="nam">new_conffile</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t571" href="#t571">571</a></span><span class="t"> <span class="key">and</span> <span class="nam">item</span><span class="op">.</span><span class="nam">prior_to_version</span> <span class="op">==</span> <span class="nam">existing_def</span><span class="op">.</span><span class="nam">prior_to_version</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t572" href="#t572">572</a></span><span class="t"> <span class="key">and</span> <span class="nam">item</span><span class="op">.</span><span class="nam">owning_package</span> <span class="op">==</span> <span class="nam">existing_def</span><span class="op">.</span><span class="nam">owning_package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t573" href="#t573">573</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t574" href="#t574">574</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ConflictingChange</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t575" href="#t575">575</a></span><span class="t"> <span class="str">f"The maintscript defines the action {item.command} for"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t576" href="#t576">576</a></span><span class="t"> <span class="str">f' "{obsolete_conffile}" in {mainscript_file}, but there is another'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t577" href="#t577">577</a></span><span class="t"> <span class="str">f" conffile management definition for same path defined already (in the"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t578" href="#t578">578</a></span><span class="t"> <span class="str">f" existing manifest or an migration e.g., inside {mainscript_file})"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t579" href="#t579">579</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t580" href="#t580">580</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">already_present</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t581" href="#t581">581</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t582" href="#t582">582</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t583" href="#t583">583</a></span><span class="t"> <span class="nam">package_definition</span><span class="op">.</span><span class="nam">add_conffile_management</span><span class="op">(</span><span class="nam">item</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t584" href="#t584">584</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">successful_manifest_changes</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t585" href="#t585">585</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t586" href="#t586">586</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t587" href="#t587">587</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t588" href="#t588">588</a></span><span class="t"><span class="key">class</span> <span class="nam">SourcesAndConditional</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t589" href="#t589">589</a></span><span class="t"> <span class="nam">dest_dir</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t590" href="#t590">590</a></span><span class="t"> <span class="nam">sources</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="nam">dataclasses</span><span class="op">.</span><span class="nam">field</span><span class="op">(</span><span class="nam">default_factory</span><span class="op">=</span><span class="nam">list</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t591" href="#t591">591</a></span><span class="t"> <span class="nam">conditional</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t592" href="#t592">592</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t593" href="#t593">593</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t594" href="#t594">594</a></span><span class="t"><span class="key">def</span> <span class="nam">_strip_d_tmp</span><span class="op">(</span><span class="nam">p</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t595" href="#t595">595</a></span><span class="t"> <span class="key">if</span> <span class="nam">p</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"debian/tmp/"</span><span class="op">)</span> <span class="key">and</span> <span class="nam">len</span><span class="op">(</span><span class="nam">p</span><span class="op">)</span> <span class="op">></span> <span class="num">11</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t596" href="#t596">596</a></span><span class="t"> <span class="key">return</span> <span class="nam">p</span><span class="op">[</span><span class="num">11</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t597" href="#t597">597</a></span><span class="t"> <span class="key">return</span> <span class="nam">p</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t598" href="#t598">598</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t599" href="#t599">599</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t600" href="#t600">600</a></span><span class="t"><span class="key">def</span> <span class="nam">migrate_install_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t601" href="#t601">601</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t602" href="#t602">602</a></span><span class="t"> <span class="nam">manifest</span><span class="op">:</span> <span class="nam">HighLevelManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t603" href="#t603">603</a></span><span class="t"> <span class="nam">acceptable_migration_issues</span><span class="op">:</span> <span class="nam">AcceptableMigrationIssues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t604" href="#t604">604</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">:</span> <span class="nam">FeatureMigration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t605" href="#t605">605</a></span><span class="t"> <span class="nam">_migration_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t606" href="#t606">606</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t607" href="#t607">607</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">tagline</span> <span class="op">=</span> <span class="str">"dh_install config files"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t608" href="#t608">608</a></span><span class="t"> <span class="nam">mutable_manifest</span> <span class="op">=</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">manifest</span><span class="op">.</span><span class="nam">mutable_manifest</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t609" href="#t609">609</a></span><span class="t"> <span class="nam">installations</span> <span class="op">=</span> <span class="nam">mutable_manifest</span><span class="op">.</span><span class="nam">installations</span><span class="op">(</span><span class="nam">create_if_absent</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t610" href="#t610">610</a></span><span class="t"> <span class="nam">priority_lines</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t611" href="#t611">611</a></span><span class="t"> <span class="nam">remaining_install_lines</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t612" href="#t612">612</a></span><span class="t"> <span class="nam">warn_about_fixmes_in_dest_dir</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t613" href="#t613">613</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t614" href="#t614">614</a></span><span class="t"> <span class="nam">is_single_binary</span> <span class="op">=</span> <span class="nam">sum</span><span class="op">(</span><span class="num">1</span> <span class="key">for</span> <span class="nam">_</span> <span class="key">in</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">all_packages</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t615" href="#t615">615</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t616" href="#t616">616</a></span><span class="t"> <span class="key">for</span> <span class="nam">dctrl_bin</span> <span class="key">in</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">all_packages</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t617" href="#t617">617</a></span><span class="t"> <span class="nam">install_file</span><span class="op">,</span> <span class="nam">content</span> <span class="op">=</span> <span class="nam">_dh_config_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t618" href="#t618">618</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t619" href="#t619">619</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t620" href="#t620">620</a></span><span class="t"> <span class="str">"install"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t621" href="#t621">621</a></span><span class="t"> <span class="str">"dh_install"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t622" href="#t622">622</a></span><span class="t"> <span class="nam">acceptable_migration_issues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t623" href="#t623">623</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t624" href="#t624">624</a></span><span class="t"> <span class="nam">manifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t625" href="#t625">625</a></span><span class="t"> <span class="nam">support_executable_files</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t626" href="#t626">626</a></span><span class="t"> <span class="nam">allow_dh_exec_rename</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t627" href="#t627">627</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t628" href="#t628">628</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">install_file</span> <span class="key">or</span> <span class="key">not</span> <span class="nam">content</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t629" href="#t629">629</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t630" href="#t630">630</a></span><span class="t"> <span class="nam">current_sources</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t631" href="#t631">631</a></span><span class="t"> <span class="nam">sources_by_destdir</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="op">...</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> <span class="nam">SourcesAndConditional</span><span class="op">]</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t632" href="#t632">632</a></span><span class="t"> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t633" href="#t633">633</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t634" href="#t634">634</a></span><span class="t"> <span class="nam">install_as_rules</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t635" href="#t635">635</a></span><span class="t"> <span class="nam">multi_dest</span> <span class="op">=</span> <span class="nam">collections</span><span class="op">.</span><span class="nam">defaultdict</span><span class="op">(</span><span class="nam">list</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t636" href="#t636">636</a></span><span class="t"> <span class="nam">seen_sources</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t637" href="#t637">637</a></span><span class="t"> <span class="nam">multi_dest_sources</span><span class="op">:</span> <span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t638" href="#t638">638</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t639" href="#t639">639</a></span><span class="t"> <span class="key">for</span> <span class="nam">dhe_line</span> <span class="key">in</span> <span class="nam">content</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t640" href="#t640">640</a></span><span class="t"> <span class="nam">special_rule</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t641" href="#t641">641</a></span><span class="t"> <span class="key">if</span> <span class="str">"=>"</span> <span class="key">in</span> <span class="nam">dhe_line</span><span class="op">.</span><span class="nam">tokens</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t642" href="#t642">642</a></span><span class="t"> <span class="key">if</span> <span class="nam">dhe_line</span><span class="op">.</span><span class="nam">tokens</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="op">==</span> <span class="str">"=>"</span> <span class="key">and</span> <span class="nam">len</span><span class="op">(</span><span class="nam">dhe_line</span><span class="op">.</span><span class="nam">tokens</span><span class="op">)</span> <span class="op">==</span> <span class="num">2</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t643" href="#t643">643</a></span><span class="t"> <span class="com"># This rule must be as early as possible to retain the semantics</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t644" href="#t644">644</a></span><span class="t"> <span class="nam">path</span> <span class="op">=</span> <span class="nam">_strip_d_tmp</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t645" href="#t645">645</a></span><span class="t"> <span class="nam">_normalize_path</span><span class="op">(</span><span class="nam">dhe_line</span><span class="op">.</span><span class="nam">tokens</span><span class="op">[</span><span class="num">1</span><span class="op">]</span><span class="op">,</span> <span class="nam">with_prefix</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t646" href="#t646">646</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t647" href="#t647">647</a></span><span class="t"> <span class="nam">special_rule</span> <span class="op">=</span> <span class="nam">AbstractMutableYAMLInstallRule</span><span class="op">.</span><span class="nam">install_dest</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t648" href="#t648">648</a></span><span class="t"> <span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t649" href="#t649">649</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">.</span><span class="nam">name</span> <span class="key">if</span> <span class="key">not</span> <span class="nam">is_single_binary</span> <span class="key">else</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t650" href="#t650">650</a></span><span class="t"> <span class="nam">dest_dir</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t651" href="#t651">651</a></span><span class="t"> <span class="nam">when</span><span class="op">=</span><span class="nam">dhe_line</span><span class="op">.</span><span class="nam">conditional</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t652" href="#t652">652</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t653" href="#t653">653</a></span><span class="t"> <span class="key">elif</span> <span class="nam">len</span><span class="op">(</span><span class="nam">dhe_line</span><span class="op">.</span><span class="nam">tokens</span><span class="op">)</span> <span class="op">!=</span> <span class="num">3</span><span class="op">:</span> </span><span class="r"><span class="annotate short">653 ↛ 654</span><span class="annotate long">line 653 didn't jump to line 654, because the condition on line 653 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t654" href="#t654">654</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t655" href="#t655">655</a></span><span class="t"> <span class="str">f"Validation error in {install_file.path} on line {dhe_line.line_no}. Cannot migrate dh-exec"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t656" href="#t656">656</a></span><span class="t"> <span class="str">' renames that is not exactly "SOURCE => TARGET" or "=> TARGET".'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t657" href="#t657">657</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t658" href="#t658">658</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t659" href="#t659">659</a></span><span class="t"> <span class="nam">install_rule</span> <span class="op">=</span> <span class="nam">AbstractMutableYAMLInstallRule</span><span class="op">.</span><span class="nam">install_as</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t660" href="#t660">660</a></span><span class="t"> <span class="nam">_strip_d_tmp</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t661" href="#t661">661</a></span><span class="t"> <span class="nam">_normalize_path</span><span class="op">(</span><span class="nam">dhe_line</span><span class="op">.</span><span class="nam">tokens</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">,</span> <span class="nam">with_prefix</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t662" href="#t662">662</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t663" href="#t663">663</a></span><span class="t"> <span class="nam">_normalize_path</span><span class="op">(</span><span class="nam">dhe_line</span><span class="op">.</span><span class="nam">tokens</span><span class="op">[</span><span class="num">2</span><span class="op">]</span><span class="op">,</span> <span class="nam">with_prefix</span><span class="op">=</span><span class="key">False</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t664" href="#t664">664</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">.</span><span class="nam">name</span> <span class="key">if</span> <span class="key">not</span> <span class="nam">is_single_binary</span> <span class="key">else</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t665" href="#t665">665</a></span><span class="t"> <span class="nam">when</span><span class="op">=</span><span class="nam">dhe_line</span><span class="op">.</span><span class="nam">conditional</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t666" href="#t666">666</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t667" href="#t667">667</a></span><span class="t"> <span class="nam">install_as_rules</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">install_rule</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t668" href="#t668">668</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t669" href="#t669">669</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">dhe_line</span><span class="op">.</span><span class="nam">tokens</span><span class="op">)</span> <span class="op">></span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t670" href="#t670">670</a></span><span class="t"> <span class="nam">sources</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t671" href="#t671">671</a></span><span class="t"> <span class="nam">_strip_d_tmp</span><span class="op">(</span><span class="nam">_normalize_path</span><span class="op">(</span><span class="nam">w</span><span class="op">,</span> <span class="nam">with_prefix</span><span class="op">=</span><span class="key">False</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t672" href="#t672">672</a></span><span class="t"> <span class="key">for</span> <span class="nam">w</span> <span class="key">in</span> <span class="nam">dhe_line</span><span class="op">.</span><span class="nam">tokens</span><span class="op">[</span><span class="op">:</span><span class="op">-</span><span class="num">1</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t673" href="#t673">673</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t674" href="#t674">674</a></span><span class="t"> <span class="nam">dest_dir</span> <span class="op">=</span> <span class="nam">_normalize_path</span><span class="op">(</span><span class="nam">dhe_line</span><span class="op">.</span><span class="nam">tokens</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span><span class="op">,</span> <span class="nam">with_prefix</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t675" href="#t675">675</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t676" href="#t676">676</a></span><span class="t"> <span class="nam">sources</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t677" href="#t677">677</a></span><span class="t"> <span class="nam">_strip_d_tmp</span><span class="op">(</span><span class="nam">_normalize_path</span><span class="op">(</span><span class="nam">w</span><span class="op">,</span> <span class="nam">with_prefix</span><span class="op">=</span><span class="key">False</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t678" href="#t678">678</a></span><span class="t"> <span class="key">for</span> <span class="nam">w</span> <span class="key">in</span> <span class="nam">dhe_line</span><span class="op">.</span><span class="nam">tokens</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t679" href="#t679">679</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t680" href="#t680">680</a></span><span class="t"> <span class="nam">dest_dir</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t681" href="#t681">681</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t682" href="#t682">682</a></span><span class="t"> <span class="nam">multi_dest_sources</span><span class="op">.</span><span class="nam">update</span><span class="op">(</span><span class="nam">s</span> <span class="key">for</span> <span class="nam">s</span> <span class="key">in</span> <span class="nam">sources</span> <span class="key">if</span> <span class="nam">s</span> <span class="key">in</span> <span class="nam">seen_sources</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t683" href="#t683">683</a></span><span class="t"> <span class="nam">seen_sources</span><span class="op">.</span><span class="nam">update</span><span class="op">(</span><span class="nam">sources</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t684" href="#t684">684</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t685" href="#t685">685</a></span><span class="t"> <span class="key">if</span> <span class="nam">dest_dir</span> <span class="key">is</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">dhe_line</span><span class="op">.</span><span class="nam">conditional</span><span class="op">(</span><span class="op">)</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t686" href="#t686">686</a></span><span class="t"> <span class="nam">current_sources</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">sources</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t687" href="#t687">687</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t688" href="#t688">688</a></span><span class="t"> <span class="nam">key</span> <span class="op">=</span> <span class="op">(</span><span class="nam">dest_dir</span><span class="op">,</span> <span class="nam">dhe_line</span><span class="op">.</span><span class="nam">conditional_key</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t689" href="#t689">689</a></span><span class="t"> <span class="nam">ctor</span> <span class="op">=</span> <span class="nam">functools</span><span class="op">.</span><span class="nam">partial</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t690" href="#t690">690</a></span><span class="t"> <span class="nam">SourcesAndConditional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t691" href="#t691">691</a></span><span class="t"> <span class="nam">dest_dir</span><span class="op">=</span><span class="nam">dest_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t692" href="#t692">692</a></span><span class="t"> <span class="nam">conditional</span><span class="op">=</span><span class="nam">dhe_line</span><span class="op">.</span><span class="nam">conditional</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t693" href="#t693">693</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t694" href="#t694">694</a></span><span class="t"> <span class="nam">md</span> <span class="op">=</span> <span class="nam">_fetch_or_create</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t695" href="#t695">695</a></span><span class="t"> <span class="nam">sources_by_destdir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t696" href="#t696">696</a></span><span class="t"> <span class="nam">key</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t697" href="#t697">697</a></span><span class="t"> <span class="nam">ctor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t698" href="#t698">698</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t699" href="#t699">699</a></span><span class="t"> <span class="nam">md</span><span class="op">.</span><span class="nam">sources</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">sources</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t700" href="#t700">700</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t701" href="#t701">701</a></span><span class="t"> <span class="key">if</span> <span class="nam">special_rule</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t702" href="#t702">702</a></span><span class="t"> <span class="nam">priority_lines</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">special_rule</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t703" href="#t703">703</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t704" href="#t704">704</a></span><span class="t"> <span class="nam">remaining_install_lines</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">install_as_rules</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t705" href="#t705">705</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t706" href="#t706">706</a></span><span class="t"> <span class="key">for</span> <span class="nam">md</span> <span class="key">in</span> <span class="nam">sources_by_destdir</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t707" href="#t707">707</a></span><span class="t"> <span class="key">if</span> <span class="nam">multi_dest_sources</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t708" href="#t708">708</a></span><span class="t"> <span class="nam">sources</span> <span class="op">=</span> <span class="op">[</span><span class="nam">s</span> <span class="key">for</span> <span class="nam">s</span> <span class="key">in</span> <span class="nam">md</span><span class="op">.</span><span class="nam">sources</span> <span class="key">if</span> <span class="nam">s</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">multi_dest_sources</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t709" href="#t709">709</a></span><span class="t"> <span class="nam">already_installed</span> <span class="op">=</span> <span class="op">(</span><span class="nam">s</span> <span class="key">for</span> <span class="nam">s</span> <span class="key">in</span> <span class="nam">md</span><span class="op">.</span><span class="nam">sources</span> <span class="key">if</span> <span class="nam">s</span> <span class="key">in</span> <span class="nam">multi_dest_sources</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t710" href="#t710">710</a></span><span class="t"> <span class="key">for</span> <span class="nam">s</span> <span class="key">in</span> <span class="nam">already_installed</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t711" href="#t711">711</a></span><span class="t"> <span class="com"># The sources are ignored, so we can reuse the object as-is</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t712" href="#t712">712</a></span><span class="t"> <span class="nam">multi_dest</span><span class="op">[</span><span class="nam">s</span><span class="op">]</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">md</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t713" href="#t713">713</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">sources</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t714" href="#t714">714</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t715" href="#t715">715</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t716" href="#t716">716</a></span><span class="t"> <span class="nam">sources</span> <span class="op">=</span> <span class="nam">md</span><span class="op">.</span><span class="nam">sources</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t717" href="#t717">717</a></span><span class="t"> <span class="nam">install_rule</span> <span class="op">=</span> <span class="nam">AbstractMutableYAMLInstallRule</span><span class="op">.</span><span class="nam">install_dest</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t718" href="#t718">718</a></span><span class="t"> <span class="nam">sources</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">sources</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span> <span class="key">else</span> <span class="nam">sources</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t719" href="#t719">719</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">.</span><span class="nam">name</span> <span class="key">if</span> <span class="key">not</span> <span class="nam">is_single_binary</span> <span class="key">else</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t720" href="#t720">720</a></span><span class="t"> <span class="nam">dest_dir</span><span class="op">=</span><span class="nam">md</span><span class="op">.</span><span class="nam">dest_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t721" href="#t721">721</a></span><span class="t"> <span class="nam">when</span><span class="op">=</span><span class="nam">md</span><span class="op">.</span><span class="nam">conditional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t722" href="#t722">722</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t723" href="#t723">723</a></span><span class="t"> <span class="nam">remaining_install_lines</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">install_rule</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t724" href="#t724">724</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t725" href="#t725">725</a></span><span class="t"> <span class="key">if</span> <span class="nam">current_sources</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t726" href="#t726">726</a></span><span class="t"> <span class="key">if</span> <span class="nam">multi_dest_sources</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t727" href="#t727">727</a></span><span class="t"> <span class="nam">sources</span> <span class="op">=</span> <span class="op">[</span><span class="nam">s</span> <span class="key">for</span> <span class="nam">s</span> <span class="key">in</span> <span class="nam">current_sources</span> <span class="key">if</span> <span class="nam">s</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">multi_dest_sources</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t728" href="#t728">728</a></span><span class="t"> <span class="nam">already_installed</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t729" href="#t729">729</a></span><span class="t"> <span class="nam">s</span> <span class="key">for</span> <span class="nam">s</span> <span class="key">in</span> <span class="nam">current_sources</span> <span class="key">if</span> <span class="nam">s</span> <span class="key">in</span> <span class="nam">multi_dest_sources</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t730" href="#t730">730</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t731" href="#t731">731</a></span><span class="t"> <span class="key">for</span> <span class="nam">s</span> <span class="key">in</span> <span class="nam">already_installed</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t732" href="#t732">732</a></span><span class="t"> <span class="com"># The sources are ignored, so we can reuse the object as-is</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t733" href="#t733">733</a></span><span class="t"> <span class="nam">dest_dir</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">dirname</span><span class="op">(</span><span class="nam">s</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t734" href="#t734">734</a></span><span class="t"> <span class="key">if</span> <span class="nam">has_glob_magic</span><span class="op">(</span><span class="nam">dest_dir</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t735" href="#t735">735</a></span><span class="t"> <span class="nam">warn_about_fixmes_in_dest_dir</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t736" href="#t736">736</a></span><span class="t"> <span class="nam">dest_dir</span> <span class="op">=</span> <span class="str">f"FIXME: {dest_dir} (could not reliably compute the dest dir)"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t737" href="#t737">737</a></span><span class="t"> <span class="nam">multi_dest</span><span class="op">[</span><span class="nam">s</span><span class="op">]</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t738" href="#t738">738</a></span><span class="t"> <span class="nam">SourcesAndConditional</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t739" href="#t739">739</a></span><span class="t"> <span class="nam">dest_dir</span><span class="op">=</span><span class="nam">dest_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t740" href="#t740">740</a></span><span class="t"> <span class="nam">conditional</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t741" href="#t741">741</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t742" href="#t742">742</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t743" href="#t743">743</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t744" href="#t744">744</a></span><span class="t"> <span class="nam">sources</span> <span class="op">=</span> <span class="nam">current_sources</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t745" href="#t745">745</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t746" href="#t746">746</a></span><span class="t"> <span class="key">if</span> <span class="nam">sources</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t747" href="#t747">747</a></span><span class="t"> <span class="nam">install_rule</span> <span class="op">=</span> <span class="nam">AbstractMutableYAMLInstallRule</span><span class="op">.</span><span class="nam">install_dest</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t748" href="#t748">748</a></span><span class="t"> <span class="nam">sources</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">sources</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span> <span class="key">else</span> <span class="nam">sources</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t749" href="#t749">749</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">.</span><span class="nam">name</span> <span class="key">if</span> <span class="key">not</span> <span class="nam">is_single_binary</span> <span class="key">else</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t750" href="#t750">750</a></span><span class="t"> <span class="nam">dest_dir</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t751" href="#t751">751</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t752" href="#t752">752</a></span><span class="t"> <span class="nam">remaining_install_lines</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">install_rule</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t753" href="#t753">753</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t754" href="#t754">754</a></span><span class="t"> <span class="key">if</span> <span class="nam">multi_dest</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t755" href="#t755">755</a></span><span class="t"> <span class="key">for</span> <span class="nam">source</span><span class="op">,</span> <span class="nam">dest_and_conditionals</span> <span class="key">in</span> <span class="nam">multi_dest</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t756" href="#t756">756</a></span><span class="t"> <span class="nam">dest_dirs</span> <span class="op">=</span> <span class="op">[</span><span class="nam">dac</span><span class="op">.</span><span class="nam">dest_dir</span> <span class="key">for</span> <span class="nam">dac</span> <span class="key">in</span> <span class="nam">dest_and_conditionals</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t757" href="#t757">757</a></span><span class="t"> <span class="com"># We assume the conditional is the same.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t758" href="#t758">758</a></span><span class="t"> <span class="nam">conditional</span> <span class="op">=</span> <span class="nam">next</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t759" href="#t759">759</a></span><span class="t"> <span class="nam">iter</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t760" href="#t760">760</a></span><span class="t"> <span class="nam">dac</span><span class="op">.</span><span class="nam">conditional</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t761" href="#t761">761</a></span><span class="t"> <span class="key">for</span> <span class="nam">dac</span> <span class="key">in</span> <span class="nam">dest_and_conditionals</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t762" href="#t762">762</a></span><span class="t"> <span class="key">if</span> <span class="nam">dac</span><span class="op">.</span><span class="nam">conditional</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t763" href="#t763">763</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t764" href="#t764">764</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t765" href="#t765">765</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t766" href="#t766">766</a></span><span class="t"> <span class="nam">remaining_install_lines</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t767" href="#t767">767</a></span><span class="t"> <span class="nam">AbstractMutableYAMLInstallRule</span><span class="op">.</span><span class="nam">multi_dest_install</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t768" href="#t768">768</a></span><span class="t"> <span class="nam">source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t769" href="#t769">769</a></span><span class="t"> <span class="nam">dest_dirs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t770" href="#t770">770</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">.</span><span class="nam">name</span> <span class="key">if</span> <span class="key">not</span> <span class="nam">is_single_binary</span> <span class="key">else</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t771" href="#t771">771</a></span><span class="t"> <span class="nam">when</span><span class="op">=</span><span class="nam">conditional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t772" href="#t772">772</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t773" href="#t773">773</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t774" href="#t774">774</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t775" href="#t775">775</a></span><span class="t"> <span class="key">if</span> <span class="nam">priority_lines</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t776" href="#t776">776</a></span><span class="t"> <span class="nam">installations</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">priority_lines</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t777" href="#t777">777</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t778" href="#t778">778</a></span><span class="t"> <span class="key">if</span> <span class="nam">remaining_install_lines</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t779" href="#t779">779</a></span><span class="t"> <span class="nam">installations</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">remaining_install_lines</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t780" href="#t780">780</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t781" href="#t781">781</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">successful_manifest_changes</span> <span class="op">+=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">priority_lines</span><span class="op">)</span> <span class="op">+</span> <span class="nam">len</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t782" href="#t782">782</a></span><span class="t"> <span class="nam">remaining_install_lines</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t783" href="#t783">783</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t784" href="#t784">784</a></span><span class="t"> <span class="key">if</span> <span class="nam">warn_about_fixmes_in_dest_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t785" href="#t785">785</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t786" href="#t786">786</a></span><span class="t"> <span class="str">"TODO: FIXME left in dest-dir(s) of some installation rules."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t787" href="#t787">787</a></span><span class="t"> <span class="str">" Please review these and remove the FIXME (plus correct as necessary)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t788" href="#t788">788</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t789" href="#t789">789</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t790" href="#t790">790</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t791" href="#t791">791</a></span><span class="t"><span class="key">def</span> <span class="nam">migrate_installdocs_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t792" href="#t792">792</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t793" href="#t793">793</a></span><span class="t"> <span class="nam">manifest</span><span class="op">:</span> <span class="nam">HighLevelManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t794" href="#t794">794</a></span><span class="t"> <span class="nam">acceptable_migration_issues</span><span class="op">:</span> <span class="nam">AcceptableMigrationIssues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t795" href="#t795">795</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">:</span> <span class="nam">FeatureMigration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t796" href="#t796">796</a></span><span class="t"> <span class="nam">_migration_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t797" href="#t797">797</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t798" href="#t798">798</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">tagline</span> <span class="op">=</span> <span class="str">"dh_installdocs config files"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t799" href="#t799">799</a></span><span class="t"> <span class="nam">mutable_manifest</span> <span class="op">=</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">manifest</span><span class="op">.</span><span class="nam">mutable_manifest</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t800" href="#t800">800</a></span><span class="t"> <span class="nam">installations</span> <span class="op">=</span> <span class="nam">mutable_manifest</span><span class="op">.</span><span class="nam">installations</span><span class="op">(</span><span class="nam">create_if_absent</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t801" href="#t801">801</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t802" href="#t802">802</a></span><span class="t"> <span class="nam">is_single_binary</span> <span class="op">=</span> <span class="nam">sum</span><span class="op">(</span><span class="num">1</span> <span class="key">for</span> <span class="nam">_</span> <span class="key">in</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">all_packages</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t803" href="#t803">803</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t804" href="#t804">804</a></span><span class="t"> <span class="key">for</span> <span class="nam">dctrl_bin</span> <span class="key">in</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">all_packages</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t805" href="#t805">805</a></span><span class="t"> <span class="nam">install_file</span><span class="op">,</span> <span class="nam">content</span> <span class="op">=</span> <span class="nam">_dh_config_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t806" href="#t806">806</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t807" href="#t807">807</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t808" href="#t808">808</a></span><span class="t"> <span class="str">"docs"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t809" href="#t809">809</a></span><span class="t"> <span class="str">"dh_installdocs"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t810" href="#t810">810</a></span><span class="t"> <span class="nam">acceptable_migration_issues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t811" href="#t811">811</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t812" href="#t812">812</a></span><span class="t"> <span class="nam">manifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t813" href="#t813">813</a></span><span class="t"> <span class="nam">support_executable_files</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t814" href="#t814">814</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t815" href="#t815">815</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">install_file</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t816" href="#t816">816</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t817" href="#t817">817</a></span><span class="t"> <span class="key">assert</span> <span class="nam">content</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t818" href="#t818">818</a></span><span class="t"> <span class="nam">docs</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t819" href="#t819">819</a></span><span class="t"> <span class="key">for</span> <span class="nam">dhe_line</span> <span class="key">in</span> <span class="nam">content</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t820" href="#t820">820</a></span><span class="t"> <span class="key">if</span> <span class="nam">dhe_line</span><span class="op">.</span><span class="nam">arch_filter</span> <span class="key">or</span> <span class="nam">dhe_line</span><span class="op">.</span><span class="nam">build_profile_filter</span><span class="op">:</span> </span><span class="r"><span class="annotate short">820 ↛ 821</span><span class="annotate long">line 820 didn't jump to line 821, because the condition on line 820 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t821" href="#t821">821</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t822" href="#t822">822</a></span><span class="t"> <span class="str">f"Unable to migrate line {dhe_line.line_no} of {install_file.path}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t823" href="#t823">823</a></span><span class="t"> <span class="str">" Missing support for conditions."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t824" href="#t824">824</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t825" href="#t825">825</a></span><span class="t"> <span class="nam">docs</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">_normalize_path</span><span class="op">(</span><span class="nam">w</span><span class="op">,</span> <span class="nam">with_prefix</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> <span class="key">for</span> <span class="nam">w</span> <span class="key">in</span> <span class="nam">dhe_line</span><span class="op">.</span><span class="nam">tokens</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t826" href="#t826">826</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t827" href="#t827">827</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">docs</span><span class="op">:</span> </span><span class="r"><span class="annotate short">827 ↛ 828</span><span class="annotate long">line 827 didn't jump to line 828, because the condition on line 827 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t828" href="#t828">828</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t829" href="#t829">829</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">successful_manifest_changes</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t830" href="#t830">830</a></span><span class="t"> <span class="nam">install_rule</span> <span class="op">=</span> <span class="nam">AbstractMutableYAMLInstallRule</span><span class="op">.</span><span class="nam">install_docs</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t831" href="#t831">831</a></span><span class="t"> <span class="nam">docs</span> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">docs</span><span class="op">)</span> <span class="op">></span> <span class="num">1</span> <span class="key">else</span> <span class="nam">docs</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t832" href="#t832">832</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">.</span><span class="nam">name</span> <span class="key">if</span> <span class="key">not</span> <span class="nam">is_single_binary</span> <span class="key">else</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t833" href="#t833">833</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t834" href="#t834">834</a></span><span class="t"> <span class="nam">installations</span><span class="op">.</span><span class="nam">create_definition_if_missing</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t835" href="#t835">835</a></span><span class="t"> <span class="nam">installations</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">install_rule</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t836" href="#t836">836</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t837" href="#t837">837</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t838" href="#t838">838</a></span><span class="t"><span class="key">def</span> <span class="nam">migrate_installexamples_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t839" href="#t839">839</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t840" href="#t840">840</a></span><span class="t"> <span class="nam">manifest</span><span class="op">:</span> <span class="nam">HighLevelManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t841" href="#t841">841</a></span><span class="t"> <span class="nam">acceptable_migration_issues</span><span class="op">:</span> <span class="nam">AcceptableMigrationIssues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t842" href="#t842">842</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">:</span> <span class="nam">FeatureMigration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t843" href="#t843">843</a></span><span class="t"> <span class="nam">_migration_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t844" href="#t844">844</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t845" href="#t845">845</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">tagline</span> <span class="op">=</span> <span class="str">"dh_installexamples config files"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t846" href="#t846">846</a></span><span class="t"> <span class="nam">mutable_manifest</span> <span class="op">=</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">manifest</span><span class="op">.</span><span class="nam">mutable_manifest</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t847" href="#t847">847</a></span><span class="t"> <span class="nam">installations</span> <span class="op">=</span> <span class="nam">mutable_manifest</span><span class="op">.</span><span class="nam">installations</span><span class="op">(</span><span class="nam">create_if_absent</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t848" href="#t848">848</a></span><span class="t"> <span class="nam">is_single_binary</span> <span class="op">=</span> <span class="nam">sum</span><span class="op">(</span><span class="num">1</span> <span class="key">for</span> <span class="nam">_</span> <span class="key">in</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">all_packages</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t849" href="#t849">849</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t850" href="#t850">850</a></span><span class="t"> <span class="key">for</span> <span class="nam">dctrl_bin</span> <span class="key">in</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">all_packages</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t851" href="#t851">851</a></span><span class="t"> <span class="nam">install_file</span><span class="op">,</span> <span class="nam">content</span> <span class="op">=</span> <span class="nam">_dh_config_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t852" href="#t852">852</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t853" href="#t853">853</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t854" href="#t854">854</a></span><span class="t"> <span class="str">"examples"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t855" href="#t855">855</a></span><span class="t"> <span class="str">"dh_installexamples"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t856" href="#t856">856</a></span><span class="t"> <span class="nam">acceptable_migration_issues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t857" href="#t857">857</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t858" href="#t858">858</a></span><span class="t"> <span class="nam">manifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t859" href="#t859">859</a></span><span class="t"> <span class="nam">support_executable_files</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t860" href="#t860">860</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t861" href="#t861">861</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">install_file</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t862" href="#t862">862</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t863" href="#t863">863</a></span><span class="t"> <span class="key">assert</span> <span class="nam">content</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t864" href="#t864">864</a></span><span class="t"> <span class="nam">examples</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t865" href="#t865">865</a></span><span class="t"> <span class="key">for</span> <span class="nam">dhe_line</span> <span class="key">in</span> <span class="nam">content</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t866" href="#t866">866</a></span><span class="t"> <span class="key">if</span> <span class="nam">dhe_line</span><span class="op">.</span><span class="nam">arch_filter</span> <span class="key">or</span> <span class="nam">dhe_line</span><span class="op">.</span><span class="nam">build_profile_filter</span><span class="op">:</span> </span><span class="r"><span class="annotate short">866 ↛ 867</span><span class="annotate long">line 866 didn't jump to line 867, because the condition on line 866 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t867" href="#t867">867</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t868" href="#t868">868</a></span><span class="t"> <span class="str">f"Unable to migrate line {dhe_line.line_no} of {install_file.path}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t869" href="#t869">869</a></span><span class="t"> <span class="str">" Missing support for conditions."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t870" href="#t870">870</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t871" href="#t871">871</a></span><span class="t"> <span class="nam">examples</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t872" href="#t872">872</a></span><span class="t"> <span class="nam">_normalize_path</span><span class="op">(</span><span class="nam">w</span><span class="op">,</span> <span class="nam">with_prefix</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> <span class="key">for</span> <span class="nam">w</span> <span class="key">in</span> <span class="nam">dhe_line</span><span class="op">.</span><span class="nam">tokens</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t873" href="#t873">873</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t874" href="#t874">874</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t875" href="#t875">875</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">examples</span><span class="op">:</span> </span><span class="r"><span class="annotate short">875 ↛ 876</span><span class="annotate long">line 875 didn't jump to line 876, because the condition on line 875 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t876" href="#t876">876</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t877" href="#t877">877</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">successful_manifest_changes</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t878" href="#t878">878</a></span><span class="t"> <span class="nam">install_rule</span> <span class="op">=</span> <span class="nam">AbstractMutableYAMLInstallRule</span><span class="op">.</span><span class="nam">install_examples</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t879" href="#t879">879</a></span><span class="t"> <span class="nam">examples</span> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">examples</span><span class="op">)</span> <span class="op">></span> <span class="num">1</span> <span class="key">else</span> <span class="nam">examples</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t880" href="#t880">880</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">.</span><span class="nam">name</span> <span class="key">if</span> <span class="key">not</span> <span class="nam">is_single_binary</span> <span class="key">else</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t881" href="#t881">881</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t882" href="#t882">882</a></span><span class="t"> <span class="nam">installations</span><span class="op">.</span><span class="nam">create_definition_if_missing</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t883" href="#t883">883</a></span><span class="t"> <span class="nam">installations</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">install_rule</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t884" href="#t884">884</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t885" href="#t885">885</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t886" href="#t886">886</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t887" href="#t887">887</a></span><span class="t"><span class="key">class</span> <span class="nam">InfoFilesDefinition</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t888" href="#t888">888</a></span><span class="t"> <span class="nam">sources</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="nam">dataclasses</span><span class="op">.</span><span class="nam">field</span><span class="op">(</span><span class="nam">default_factory</span><span class="op">=</span><span class="nam">list</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t889" href="#t889">889</a></span><span class="t"> <span class="nam">conditional</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t890" href="#t890">890</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t891" href="#t891">891</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t892" href="#t892">892</a></span><span class="t"><span class="key">def</span> <span class="nam">migrate_installinfo_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t893" href="#t893">893</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t894" href="#t894">894</a></span><span class="t"> <span class="nam">manifest</span><span class="op">:</span> <span class="nam">HighLevelManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t895" href="#t895">895</a></span><span class="t"> <span class="nam">acceptable_migration_issues</span><span class="op">:</span> <span class="nam">AcceptableMigrationIssues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t896" href="#t896">896</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">:</span> <span class="nam">FeatureMigration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t897" href="#t897">897</a></span><span class="t"> <span class="nam">_migration_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t898" href="#t898">898</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t899" href="#t899">899</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">tagline</span> <span class="op">=</span> <span class="str">"dh_installinfo config files"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t900" href="#t900">900</a></span><span class="t"> <span class="nam">mutable_manifest</span> <span class="op">=</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">manifest</span><span class="op">.</span><span class="nam">mutable_manifest</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t901" href="#t901">901</a></span><span class="t"> <span class="nam">installations</span> <span class="op">=</span> <span class="nam">mutable_manifest</span><span class="op">.</span><span class="nam">installations</span><span class="op">(</span><span class="nam">create_if_absent</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t902" href="#t902">902</a></span><span class="t"> <span class="nam">is_single_binary</span> <span class="op">=</span> <span class="nam">sum</span><span class="op">(</span><span class="num">1</span> <span class="key">for</span> <span class="nam">_</span> <span class="key">in</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">all_packages</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t903" href="#t903">903</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t904" href="#t904">904</a></span><span class="t"> <span class="key">for</span> <span class="nam">dctrl_bin</span> <span class="key">in</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">all_packages</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t905" href="#t905">905</a></span><span class="t"> <span class="nam">info_file</span><span class="op">,</span> <span class="nam">content</span> <span class="op">=</span> <span class="nam">_dh_config_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t906" href="#t906">906</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t907" href="#t907">907</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t908" href="#t908">908</a></span><span class="t"> <span class="str">"info"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t909" href="#t909">909</a></span><span class="t"> <span class="str">"dh_installinfo"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t910" href="#t910">910</a></span><span class="t"> <span class="nam">acceptable_migration_issues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t911" href="#t911">911</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t912" href="#t912">912</a></span><span class="t"> <span class="nam">manifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t913" href="#t913">913</a></span><span class="t"> <span class="nam">support_executable_files</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t914" href="#t914">914</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t915" href="#t915">915</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">info_file</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t916" href="#t916">916</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t917" href="#t917">917</a></span><span class="t"> <span class="key">assert</span> <span class="nam">content</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t918" href="#t918">918</a></span><span class="t"> <span class="nam">info_files_by_condition</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="op">...</span><span class="op">]</span><span class="op">,</span> <span class="nam">InfoFilesDefinition</span><span class="op">]</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t919" href="#t919">919</a></span><span class="t"> <span class="key">for</span> <span class="nam">dhe_line</span> <span class="key">in</span> <span class="nam">content</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t920" href="#t920">920</a></span><span class="t"> <span class="nam">key</span> <span class="op">=</span> <span class="nam">dhe_line</span><span class="op">.</span><span class="nam">conditional_key</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t921" href="#t921">921</a></span><span class="t"> <span class="nam">ctr</span> <span class="op">=</span> <span class="nam">functools</span><span class="op">.</span><span class="nam">partial</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t922" href="#t922">922</a></span><span class="t"> <span class="nam">InfoFilesDefinition</span><span class="op">,</span> <span class="nam">conditional</span><span class="op">=</span><span class="nam">dhe_line</span><span class="op">.</span><span class="nam">conditional</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t923" href="#t923">923</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t924" href="#t924">924</a></span><span class="t"> <span class="nam">info_def</span> <span class="op">=</span> <span class="nam">_fetch_or_create</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t925" href="#t925">925</a></span><span class="t"> <span class="nam">info_files_by_condition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t926" href="#t926">926</a></span><span class="t"> <span class="nam">key</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t927" href="#t927">927</a></span><span class="t"> <span class="nam">ctr</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t928" href="#t928">928</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t929" href="#t929">929</a></span><span class="t"> <span class="nam">info_def</span><span class="op">.</span><span class="nam">sources</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t930" href="#t930">930</a></span><span class="t"> <span class="nam">_normalize_path</span><span class="op">(</span><span class="nam">w</span><span class="op">,</span> <span class="nam">with_prefix</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> <span class="key">for</span> <span class="nam">w</span> <span class="key">in</span> <span class="nam">dhe_line</span><span class="op">.</span><span class="nam">tokens</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t931" href="#t931">931</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t932" href="#t932">932</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t933" href="#t933">933</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">info_files_by_condition</span><span class="op">:</span> </span><span class="r"><span class="annotate short">933 ↛ 934</span><span class="annotate long">line 933 didn't jump to line 934, because the condition on line 933 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t934" href="#t934">934</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t935" href="#t935">935</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">successful_manifest_changes</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t936" href="#t936">936</a></span><span class="t"> <span class="nam">installations</span><span class="op">.</span><span class="nam">create_definition_if_missing</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t937" href="#t937">937</a></span><span class="t"> <span class="key">for</span> <span class="nam">info_def</span> <span class="key">in</span> <span class="nam">info_files_by_condition</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t938" href="#t938">938</a></span><span class="t"> <span class="nam">info_files</span> <span class="op">=</span> <span class="nam">info_def</span><span class="op">.</span><span class="nam">sources</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t939" href="#t939">939</a></span><span class="t"> <span class="nam">install_rule</span> <span class="op">=</span> <span class="nam">AbstractMutableYAMLInstallRule</span><span class="op">.</span><span class="nam">install_docs</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t940" href="#t940">940</a></span><span class="t"> <span class="nam">info_files</span> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">info_files</span><span class="op">)</span> <span class="op">></span> <span class="num">1</span> <span class="key">else</span> <span class="nam">info_files</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t941" href="#t941">941</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">.</span><span class="nam">name</span> <span class="key">if</span> <span class="key">not</span> <span class="nam">is_single_binary</span> <span class="key">else</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t942" href="#t942">942</a></span><span class="t"> <span class="nam">dest_dir</span><span class="op">=</span><span class="str">"{{path:GNU_INFO_DIR}}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t943" href="#t943">943</a></span><span class="t"> <span class="nam">when</span><span class="op">=</span><span class="nam">info_def</span><span class="op">.</span><span class="nam">conditional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t944" href="#t944">944</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t945" href="#t945">945</a></span><span class="t"> <span class="nam">installations</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">install_rule</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t946" href="#t946">946</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t947" href="#t947">947</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t948" href="#t948">948</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t949" href="#t949">949</a></span><span class="t"><span class="key">class</span> <span class="nam">ManpageDefinition</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t950" href="#t950">950</a></span><span class="t"> <span class="nam">sources</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="nam">dataclasses</span><span class="op">.</span><span class="nam">field</span><span class="op">(</span><span class="nam">default_factory</span><span class="op">=</span><span class="nam">list</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t951" href="#t951">951</a></span><span class="t"> <span class="nam">language</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t952" href="#t952">952</a></span><span class="t"> <span class="nam">conditional</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t953" href="#t953">953</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t954" href="#t954">954</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t955" href="#t955">955</a></span><span class="t"><span class="nam">DK</span> <span class="op">=</span> <span class="nam">TypeVar</span><span class="op">(</span><span class="str">"DK"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t956" href="#t956">956</a></span><span class="t"><span class="nam">DV</span> <span class="op">=</span> <span class="nam">TypeVar</span><span class="op">(</span><span class="str">"DV"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t957" href="#t957">957</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t958" href="#t958">958</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t959" href="#t959">959</a></span><span class="t"><span class="key">def</span> <span class="nam">_fetch_or_create</span><span class="op">(</span><span class="nam">d</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">DK</span><span class="op">,</span> <span class="nam">DV</span><span class="op">]</span><span class="op">,</span> <span class="nam">key</span><span class="op">:</span> <span class="nam">DK</span><span class="op">,</span> <span class="nam">factory</span><span class="op">:</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="op">]</span><span class="op">,</span> <span class="nam">DV</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="nam">DV</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t960" href="#t960">960</a></span><span class="t"> <span class="nam">v</span> <span class="op">=</span> <span class="nam">d</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t961" href="#t961">961</a></span><span class="t"> <span class="key">if</span> <span class="nam">v</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t962" href="#t962">962</a></span><span class="t"> <span class="nam">v</span> <span class="op">=</span> <span class="nam">factory</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t963" href="#t963">963</a></span><span class="t"> <span class="nam">d</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> <span class="op">=</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t964" href="#t964">964</a></span><span class="t"> <span class="key">return</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t965" href="#t965">965</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t966" href="#t966">966</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t967" href="#t967">967</a></span><span class="t"><span class="key">def</span> <span class="nam">migrate_installman_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t968" href="#t968">968</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t969" href="#t969">969</a></span><span class="t"> <span class="nam">manifest</span><span class="op">:</span> <span class="nam">HighLevelManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t970" href="#t970">970</a></span><span class="t"> <span class="nam">acceptable_migration_issues</span><span class="op">:</span> <span class="nam">AcceptableMigrationIssues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t971" href="#t971">971</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">:</span> <span class="nam">FeatureMigration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t972" href="#t972">972</a></span><span class="t"> <span class="nam">_migration_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t973" href="#t973">973</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t974" href="#t974">974</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">tagline</span> <span class="op">=</span> <span class="str">"dh_installman config files"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t975" href="#t975">975</a></span><span class="t"> <span class="nam">mutable_manifest</span> <span class="op">=</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">manifest</span><span class="op">.</span><span class="nam">mutable_manifest</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t976" href="#t976">976</a></span><span class="t"> <span class="nam">installations</span> <span class="op">=</span> <span class="nam">mutable_manifest</span><span class="op">.</span><span class="nam">installations</span><span class="op">(</span><span class="nam">create_if_absent</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t977" href="#t977">977</a></span><span class="t"> <span class="nam">is_single_binary</span> <span class="op">=</span> <span class="nam">sum</span><span class="op">(</span><span class="num">1</span> <span class="key">for</span> <span class="nam">_</span> <span class="key">in</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">all_packages</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t978" href="#t978">978</a></span><span class="t"> <span class="nam">warn_about_basename</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t979" href="#t979">979</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t980" href="#t980">980</a></span><span class="t"> <span class="key">for</span> <span class="nam">dctrl_bin</span> <span class="key">in</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">all_packages</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t981" href="#t981">981</a></span><span class="t"> <span class="nam">manpages_file</span><span class="op">,</span> <span class="nam">content</span> <span class="op">=</span> <span class="nam">_dh_config_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t982" href="#t982">982</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t983" href="#t983">983</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t984" href="#t984">984</a></span><span class="t"> <span class="str">"manpages"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t985" href="#t985">985</a></span><span class="t"> <span class="str">"dh_installman"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t986" href="#t986">986</a></span><span class="t"> <span class="nam">acceptable_migration_issues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t987" href="#t987">987</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t988" href="#t988">988</a></span><span class="t"> <span class="nam">manifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t989" href="#t989">989</a></span><span class="t"> <span class="nam">support_executable_files</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t990" href="#t990">990</a></span><span class="t"> <span class="nam">allow_dh_exec_rename</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t991" href="#t991">991</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t992" href="#t992">992</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">manpages_file</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t993" href="#t993">993</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t994" href="#t994">994</a></span><span class="t"> <span class="key">assert</span> <span class="nam">content</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t995" href="#t995">995</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t996" href="#t996">996</a></span><span class="t"> <span class="nam">vanilla_definitions</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t997" href="#t997">997</a></span><span class="t"> <span class="nam">install_as_rules</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t998" href="#t998">998</a></span><span class="t"> <span class="nam">complex_definitions</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t999" href="#t999">999</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="op">...</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> <span class="nam">ManpageDefinition</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1000" href="#t1000">1000</a></span><span class="t"> <span class="op">]</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1001" href="#t1001">1001</a></span><span class="t"> <span class="nam">install_rule</span><span class="op">:</span> <span class="nam">AbstractMutableYAMLInstallRule</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1002" href="#t1002">1002</a></span><span class="t"> <span class="key">for</span> <span class="nam">dhe_line</span> <span class="key">in</span> <span class="nam">content</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1003" href="#t1003">1003</a></span><span class="t"> <span class="key">if</span> <span class="str">"=>"</span> <span class="key">in</span> <span class="nam">dhe_line</span><span class="op">.</span><span class="nam">tokens</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1003 ↛ 1006</span><span class="annotate long">line 1003 didn't jump to line 1006, because the condition on line 1003 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t1004" href="#t1004">1004</a></span><span class="t"> <span class="com"># dh-exec allows renaming features. For `debputy`, we degenerate it into an `install` (w. `as`) feature</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1005" href="#t1005">1005</a></span><span class="t"> <span class="com"># without any of the `install-man` features.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1006" href="#t1006">1006</a></span><span class="t"> <span class="key">if</span> <span class="nam">dhe_line</span><span class="op">.</span><span class="nam">tokens</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="op">==</span> <span class="str">"=>"</span> <span class="key">and</span> <span class="nam">len</span><span class="op">(</span><span class="nam">dhe_line</span><span class="op">.</span><span class="nam">tokens</span><span class="op">)</span> <span class="op">==</span> <span class="num">2</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1007" href="#t1007">1007</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1008" href="#t1008">1008</a></span><span class="t"> <span class="str">f'Unsupported "=> DEST" rule for error in {manpages_file.path} on line {dhe_line.line_no}."'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1009" href="#t1009">1009</a></span><span class="t"> <span class="str">f' Cannot migrate dh-exec renames that is not exactly "SOURCE => TARGET" for d/manpages files.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1010" href="#t1010">1010</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1011" href="#t1011">1011</a></span><span class="t"> <span class="key">elif</span> <span class="nam">len</span><span class="op">(</span><span class="nam">dhe_line</span><span class="op">.</span><span class="nam">tokens</span><span class="op">)</span> <span class="op">!=</span> <span class="num">3</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1012" href="#t1012">1012</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1013" href="#t1013">1013</a></span><span class="t"> <span class="str">f"Validation error in {manpages_file.path} on line {dhe_line.line_no}. Cannot migrate dh-exec"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1014" href="#t1014">1014</a></span><span class="t"> <span class="str">' renames that is not exactly "SOURCE => TARGET" or "=> TARGET".'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1015" href="#t1015">1015</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1016" href="#t1016">1016</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1017" href="#t1017">1017</a></span><span class="t"> <span class="nam">install_rule</span> <span class="op">=</span> <span class="nam">AbstractMutableYAMLInstallRule</span><span class="op">.</span><span class="nam">install_doc_as</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1018" href="#t1018">1018</a></span><span class="t"> <span class="nam">_normalize_path</span><span class="op">(</span><span class="nam">dhe_line</span><span class="op">.</span><span class="nam">tokens</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">,</span> <span class="nam">with_prefix</span><span class="op">=</span><span class="key">False</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1019" href="#t1019">1019</a></span><span class="t"> <span class="nam">_normalize_path</span><span class="op">(</span><span class="nam">dhe_line</span><span class="op">.</span><span class="nam">tokens</span><span class="op">[</span><span class="num">2</span><span class="op">]</span><span class="op">,</span> <span class="nam">with_prefix</span><span class="op">=</span><span class="key">False</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1020" href="#t1020">1020</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">.</span><span class="nam">name</span> <span class="key">if</span> <span class="key">not</span> <span class="nam">is_single_binary</span> <span class="key">else</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1021" href="#t1021">1021</a></span><span class="t"> <span class="nam">when</span><span class="op">=</span><span class="nam">dhe_line</span><span class="op">.</span><span class="nam">conditional</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1022" href="#t1022">1022</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1023" href="#t1023">1023</a></span><span class="t"> <span class="nam">install_as_rules</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">install_rule</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1024" href="#t1024">1024</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1025" href="#t1025">1025</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1026" href="#t1026">1026</a></span><span class="t"> <span class="nam">sources</span> <span class="op">=</span> <span class="op">[</span><span class="nam">_normalize_path</span><span class="op">(</span><span class="nam">w</span><span class="op">,</span> <span class="nam">with_prefix</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> <span class="key">for</span> <span class="nam">w</span> <span class="key">in</span> <span class="nam">dhe_line</span><span class="op">.</span><span class="nam">tokens</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1027" href="#t1027">1027</a></span><span class="t"> <span class="nam">needs_basename</span> <span class="op">=</span> <span class="nam">any</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1028" href="#t1028">1028</a></span><span class="t"> <span class="nam">MAN_GUESS_FROM_BASENAME</span><span class="op">.</span><span class="nam">search</span><span class="op">(</span><span class="nam">x</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1029" href="#t1029">1029</a></span><span class="t"> <span class="key">and</span> <span class="key">not</span> <span class="nam">MAN_GUESS_LANG_FROM_PATH</span><span class="op">.</span><span class="nam">search</span><span class="op">(</span><span class="nam">x</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1030" href="#t1030">1030</a></span><span class="t"> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">sources</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1031" href="#t1031">1031</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1032" href="#t1032">1032</a></span><span class="t"> <span class="key">if</span> <span class="nam">needs_basename</span> <span class="key">or</span> <span class="nam">dhe_line</span><span class="op">.</span><span class="nam">conditional</span><span class="op">(</span><span class="op">)</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1033" href="#t1033">1033</a></span><span class="t"> <span class="key">if</span> <span class="nam">needs_basename</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1033 ↛ 1037</span><span class="annotate long">line 1033 didn't jump to line 1037, because the condition on line 1033 was never false</span></span></p> - <p class="run"><span class="n"><a id="t1034" href="#t1034">1034</a></span><span class="t"> <span class="nam">warn_about_basename</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1035" href="#t1035">1035</a></span><span class="t"> <span class="nam">language</span> <span class="op">=</span> <span class="str">"derive-from-basename"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1036" href="#t1036">1036</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1037" href="#t1037">1037</a></span><span class="t"> <span class="nam">language</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1038" href="#t1038">1038</a></span><span class="t"> <span class="nam">key</span> <span class="op">=</span> <span class="op">(</span><span class="nam">language</span><span class="op">,</span> <span class="nam">dhe_line</span><span class="op">.</span><span class="nam">conditional_key</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1039" href="#t1039">1039</a></span><span class="t"> <span class="nam">ctor</span> <span class="op">=</span> <span class="nam">functools</span><span class="op">.</span><span class="nam">partial</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1040" href="#t1040">1040</a></span><span class="t"> <span class="nam">ManpageDefinition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1041" href="#t1041">1041</a></span><span class="t"> <span class="nam">language</span><span class="op">=</span><span class="nam">language</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1042" href="#t1042">1042</a></span><span class="t"> <span class="nam">conditional</span><span class="op">=</span><span class="nam">dhe_line</span><span class="op">.</span><span class="nam">conditional</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1043" href="#t1043">1043</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1044" href="#t1044">1044</a></span><span class="t"> <span class="nam">manpage_def</span> <span class="op">=</span> <span class="nam">_fetch_or_create</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1045" href="#t1045">1045</a></span><span class="t"> <span class="nam">complex_definitions</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1046" href="#t1046">1046</a></span><span class="t"> <span class="nam">key</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1047" href="#t1047">1047</a></span><span class="t"> <span class="nam">ctor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1048" href="#t1048">1048</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1049" href="#t1049">1049</a></span><span class="t"> <span class="nam">manpage_def</span><span class="op">.</span><span class="nam">sources</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">sources</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1050" href="#t1050">1050</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1051" href="#t1051">1051</a></span><span class="t"> <span class="nam">vanilla_definitions</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">sources</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1052" href="#t1052">1052</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1053" href="#t1053">1053</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">install_as_rules</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">vanilla_definitions</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">complex_definitions</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1053 ↛ 1054</span><span class="annotate long">line 1053 didn't jump to line 1054, because the condition on line 1053 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1054" href="#t1054">1054</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1055" href="#t1055">1055</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">successful_manifest_changes</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1056" href="#t1056">1056</a></span><span class="t"> <span class="nam">installations</span><span class="op">.</span><span class="nam">create_definition_if_missing</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1057" href="#t1057">1057</a></span><span class="t"> <span class="nam">installations</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">install_as_rules</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1058" href="#t1058">1058</a></span><span class="t"> <span class="key">if</span> <span class="nam">vanilla_definitions</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1058 ↛ 1070</span><span class="annotate long">line 1058 didn't jump to line 1070, because the condition on line 1058 was never false</span></span></p> - <p class="run"><span class="n"><a id="t1059" href="#t1059">1059</a></span><span class="t"> <span class="nam">man_source</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1060" href="#t1060">1060</a></span><span class="t"> <span class="nam">vanilla_definitions</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1061" href="#t1061">1061</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">vanilla_definitions</span><span class="op">)</span> <span class="op">></span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1062" href="#t1062">1062</a></span><span class="t"> <span class="key">else</span> <span class="nam">vanilla_definitions</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1063" href="#t1063">1063</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1064" href="#t1064">1064</a></span><span class="t"> <span class="nam">install_rule</span> <span class="op">=</span> <span class="nam">AbstractMutableYAMLInstallRule</span><span class="op">.</span><span class="nam">install_man</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1065" href="#t1065">1065</a></span><span class="t"> <span class="nam">man_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1066" href="#t1066">1066</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">.</span><span class="nam">name</span> <span class="key">if</span> <span class="key">not</span> <span class="nam">is_single_binary</span> <span class="key">else</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1067" href="#t1067">1067</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1068" href="#t1068">1068</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1069" href="#t1069">1069</a></span><span class="t"> <span class="nam">installations</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">install_rule</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1070" href="#t1070">1070</a></span><span class="t"> <span class="key">for</span> <span class="nam">manpage_def</span> <span class="key">in</span> <span class="nam">complex_definitions</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1071" href="#t1071">1071</a></span><span class="t"> <span class="nam">sources</span> <span class="op">=</span> <span class="nam">manpage_def</span><span class="op">.</span><span class="nam">sources</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1072" href="#t1072">1072</a></span><span class="t"> <span class="nam">install_rule</span> <span class="op">=</span> <span class="nam">AbstractMutableYAMLInstallRule</span><span class="op">.</span><span class="nam">install_man</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1073" href="#t1073">1073</a></span><span class="t"> <span class="nam">sources</span> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">sources</span><span class="op">)</span> <span class="op">></span> <span class="num">1</span> <span class="key">else</span> <span class="nam">sources</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1074" href="#t1074">1074</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">.</span><span class="nam">name</span> <span class="key">if</span> <span class="key">not</span> <span class="nam">is_single_binary</span> <span class="key">else</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1075" href="#t1075">1075</a></span><span class="t"> <span class="nam">manpage_def</span><span class="op">.</span><span class="nam">language</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1076" href="#t1076">1076</a></span><span class="t"> <span class="nam">when</span><span class="op">=</span><span class="nam">manpage_def</span><span class="op">.</span><span class="nam">conditional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1077" href="#t1077">1077</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1078" href="#t1078">1078</a></span><span class="t"> <span class="nam">installations</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">install_rule</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1079" href="#t1079">1079</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1080" href="#t1080">1080</a></span><span class="t"> <span class="key">if</span> <span class="nam">warn_about_basename</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1081" href="#t1081">1081</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1082" href="#t1082">1082</a></span><span class="t"> <span class="str">'Detected man pages that might rely on "derive-from-basename" logic. Please double check'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1083" href="#t1083">1083</a></span><span class="t"> <span class="str">" that the generated `install-man` rules are correct"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1084" href="#t1084">1084</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1085" href="#t1085">1085</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1086" href="#t1086">1086</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1087" href="#t1087">1087</a></span><span class="t"><span class="key">def</span> <span class="nam">migrate_not_installed_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1088" href="#t1088">1088</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1089" href="#t1089">1089</a></span><span class="t"> <span class="nam">manifest</span><span class="op">:</span> <span class="nam">HighLevelManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1090" href="#t1090">1090</a></span><span class="t"> <span class="nam">acceptable_migration_issues</span><span class="op">:</span> <span class="nam">AcceptableMigrationIssues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1091" href="#t1091">1091</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">:</span> <span class="nam">FeatureMigration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1092" href="#t1092">1092</a></span><span class="t"> <span class="nam">_migration_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1093" href="#t1093">1093</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1094" href="#t1094">1094</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">tagline</span> <span class="op">=</span> <span class="str">"dh_missing's not-installed config file"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1095" href="#t1095">1095</a></span><span class="t"> <span class="nam">mutable_manifest</span> <span class="op">=</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">manifest</span><span class="op">.</span><span class="nam">mutable_manifest</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1096" href="#t1096">1096</a></span><span class="t"> <span class="nam">installations</span> <span class="op">=</span> <span class="nam">mutable_manifest</span><span class="op">.</span><span class="nam">installations</span><span class="op">(</span><span class="nam">create_if_absent</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1097" href="#t1097">1097</a></span><span class="t"> <span class="nam">main_binary</span> <span class="op">=</span> <span class="op">[</span><span class="nam">p</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">all_packages</span> <span class="key">if</span> <span class="nam">p</span><span class="op">.</span><span class="nam">is_main_package</span><span class="op">]</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1098" href="#t1098">1098</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1099" href="#t1099">1099</a></span><span class="t"> <span class="nam">missing_file</span><span class="op">,</span> <span class="nam">content</span> <span class="op">=</span> <span class="nam">_dh_config_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1100" href="#t1100">1100</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1101" href="#t1101">1101</a></span><span class="t"> <span class="nam">main_binary</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1102" href="#t1102">1102</a></span><span class="t"> <span class="str">"not-installed"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1103" href="#t1103">1103</a></span><span class="t"> <span class="str">"dh_missing"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1104" href="#t1104">1104</a></span><span class="t"> <span class="nam">acceptable_migration_issues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1105" href="#t1105">1105</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1106" href="#t1106">1106</a></span><span class="t"> <span class="nam">manifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1107" href="#t1107">1107</a></span><span class="t"> <span class="nam">support_executable_files</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1108" href="#t1108">1108</a></span><span class="t"> <span class="nam">pkgfile_lookup</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1109" href="#t1109">1109</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1110" href="#t1110">1110</a></span><span class="t"> <span class="nam">discard_rules</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1111" href="#t1111">1111</a></span><span class="t"> <span class="key">if</span> <span class="nam">missing_file</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1112" href="#t1112">1112</a></span><span class="t"> <span class="key">assert</span> <span class="nam">content</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1113" href="#t1113">1113</a></span><span class="t"> <span class="key">for</span> <span class="nam">dhe_line</span> <span class="key">in</span> <span class="nam">content</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1114" href="#t1114">1114</a></span><span class="t"> <span class="nam">discard_rules</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1115" href="#t1115">1115</a></span><span class="t"> <span class="nam">_normalize_path</span><span class="op">(</span><span class="nam">w</span><span class="op">,</span> <span class="nam">with_prefix</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> <span class="key">for</span> <span class="nam">w</span> <span class="key">in</span> <span class="nam">dhe_line</span><span class="op">.</span><span class="nam">tokens</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1116" href="#t1116">1116</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1117" href="#t1117">1117</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1118" href="#t1118">1118</a></span><span class="t"> <span class="key">if</span> <span class="nam">discard_rules</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1119" href="#t1119">1119</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">successful_manifest_changes</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1120" href="#t1120">1120</a></span><span class="t"> <span class="nam">install_rule</span> <span class="op">=</span> <span class="nam">AbstractMutableYAMLInstallRule</span><span class="op">.</span><span class="nam">discard</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1121" href="#t1121">1121</a></span><span class="t"> <span class="nam">discard_rules</span> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">discard_rules</span><span class="op">)</span> <span class="op">></span> <span class="num">1</span> <span class="key">else</span> <span class="nam">discard_rules</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1122" href="#t1122">1122</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1123" href="#t1123">1123</a></span><span class="t"> <span class="nam">installations</span><span class="op">.</span><span class="nam">create_definition_if_missing</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1124" href="#t1124">1124</a></span><span class="t"> <span class="nam">installations</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">install_rule</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1125" href="#t1125">1125</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1126" href="#t1126">1126</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1127" href="#t1127">1127</a></span><span class="t"><span class="key">def</span> <span class="nam">detect_pam_files</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1128" href="#t1128">1128</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1129" href="#t1129">1129</a></span><span class="t"> <span class="nam">manifest</span><span class="op">:</span> <span class="nam">HighLevelManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1130" href="#t1130">1130</a></span><span class="t"> <span class="nam">_acceptable_migration_issues</span><span class="op">:</span> <span class="nam">AcceptableMigrationIssues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1131" href="#t1131">1131</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">:</span> <span class="nam">FeatureMigration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1132" href="#t1132">1132</a></span><span class="t"> <span class="nam">_migration_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1133" href="#t1133">1133</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1134" href="#t1134">1134</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">tagline</span> <span class="op">=</span> <span class="str">"detect dh_installpam files (min dh compat)"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1135" href="#t1135">1135</a></span><span class="t"> <span class="key">for</span> <span class="nam">dctrl_bin</span> <span class="key">in</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">all_packages</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1136" href="#t1136">1136</a></span><span class="t"> <span class="nam">dh_config_file</span> <span class="op">=</span> <span class="nam">dhe_pkgfile</span><span class="op">(</span><span class="nam">debian_dir</span><span class="op">,</span> <span class="nam">dctrl_bin</span><span class="op">,</span> <span class="str">"pam"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1137" href="#t1137">1137</a></span><span class="t"> <span class="key">if</span> <span class="nam">dh_config_file</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1138" href="#t1138">1138</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">assumed_compat</span> <span class="op">=</span> <span class="num">14</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1139" href="#t1139">1139</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1140" href="#t1140">1140</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1141" href="#t1141">1141</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1142" href="#t1142">1142</a></span><span class="t"><span class="key">def</span> <span class="nam">migrate_tmpfile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1143" href="#t1143">1143</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1144" href="#t1144">1144</a></span><span class="t"> <span class="nam">manifest</span><span class="op">:</span> <span class="nam">HighLevelManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1145" href="#t1145">1145</a></span><span class="t"> <span class="nam">_acceptable_migration_issues</span><span class="op">:</span> <span class="nam">AcceptableMigrationIssues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1146" href="#t1146">1146</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">:</span> <span class="nam">FeatureMigration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1147" href="#t1147">1147</a></span><span class="t"> <span class="nam">_migration_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1148" href="#t1148">1148</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1149" href="#t1149">1149</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">tagline</span> <span class="op">=</span> <span class="str">"dh_installtmpfiles config files"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1150" href="#t1150">1150</a></span><span class="t"> <span class="key">for</span> <span class="nam">dctrl_bin</span> <span class="key">in</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">all_packages</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1151" href="#t1151">1151</a></span><span class="t"> <span class="nam">dh_config_file</span> <span class="op">=</span> <span class="nam">dhe_pkgfile</span><span class="op">(</span><span class="nam">debian_dir</span><span class="op">,</span> <span class="nam">dctrl_bin</span><span class="op">,</span> <span class="str">"tmpfile"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1152" href="#t1152">1152</a></span><span class="t"> <span class="key">if</span> <span class="nam">dh_config_file</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1153" href="#t1153">1153</a></span><span class="t"> <span class="nam">target</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1154" href="#t1154">1154</a></span><span class="t"> <span class="nam">dh_config_file</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">".tmpfile"</span><span class="op">,</span> <span class="str">".tmpfiles"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1155" href="#t1155">1155</a></span><span class="t"> <span class="key">if</span> <span class="str">"."</span> <span class="key">in</span> <span class="nam">dh_config_file</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1156" href="#t1156">1156</a></span><span class="t"> <span class="key">else</span> <span class="str">"tmpfiles"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1157" href="#t1157">1157</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1158" href="#t1158">1158</a></span><span class="t"> <span class="nam">_rename_file_if_exists</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1159" href="#t1159">1159</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1160" href="#t1160">1160</a></span><span class="t"> <span class="nam">dh_config_file</span><span class="op">.</span><span class="nam">name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1161" href="#t1161">1161</a></span><span class="t"> <span class="nam">target</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1162" href="#t1162">1162</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1163" href="#t1163">1163</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1164" href="#t1164">1164</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1165" href="#t1165">1165</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1166" href="#t1166">1166</a></span><span class="t"><span class="key">def</span> <span class="nam">migrate_lintian_overrides_files</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1167" href="#t1167">1167</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1168" href="#t1168">1168</a></span><span class="t"> <span class="nam">manifest</span><span class="op">:</span> <span class="nam">HighLevelManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1169" href="#t1169">1169</a></span><span class="t"> <span class="nam">acceptable_migration_issues</span><span class="op">:</span> <span class="nam">AcceptableMigrationIssues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1170" href="#t1170">1170</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">:</span> <span class="nam">FeatureMigration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1171" href="#t1171">1171</a></span><span class="t"> <span class="nam">_migration_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1172" href="#t1172">1172</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1173" href="#t1173">1173</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">tagline</span> <span class="op">=</span> <span class="str">"dh_lintian config files"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1174" href="#t1174">1174</a></span><span class="t"> <span class="key">for</span> <span class="nam">dctrl_bin</span> <span class="key">in</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">all_packages</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1175" href="#t1175">1175</a></span><span class="t"> <span class="com"># We do not support executable lintian-overrides and `_dh_config_file` handles all of that.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1176" href="#t1176">1176</a></span><span class="t"> <span class="com"># Therefore, the return value is irrelevant to us.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1177" href="#t1177">1177</a></span><span class="t"> <span class="nam">_dh_config_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1178" href="#t1178">1178</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1179" href="#t1179">1179</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1180" href="#t1180">1180</a></span><span class="t"> <span class="str">"lintian-overrides"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1181" href="#t1181">1181</a></span><span class="t"> <span class="str">"dh_lintian"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1182" href="#t1182">1182</a></span><span class="t"> <span class="nam">acceptable_migration_issues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1183" href="#t1183">1183</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1184" href="#t1184">1184</a></span><span class="t"> <span class="nam">manifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1185" href="#t1185">1185</a></span><span class="t"> <span class="nam">support_executable_files</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1186" href="#t1186">1186</a></span><span class="t"> <span class="nam">remove_on_migration</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1187" href="#t1187">1187</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1188" href="#t1188">1188</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1189" href="#t1189">1189</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1190" href="#t1190">1190</a></span><span class="t"><span class="key">def</span> <span class="nam">migrate_links_files</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1191" href="#t1191">1191</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1192" href="#t1192">1192</a></span><span class="t"> <span class="nam">manifest</span><span class="op">:</span> <span class="nam">HighLevelManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1193" href="#t1193">1193</a></span><span class="t"> <span class="nam">acceptable_migration_issues</span><span class="op">:</span> <span class="nam">AcceptableMigrationIssues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1194" href="#t1194">1194</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">:</span> <span class="nam">FeatureMigration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1195" href="#t1195">1195</a></span><span class="t"> <span class="nam">_migration_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1196" href="#t1196">1196</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1197" href="#t1197">1197</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">tagline</span> <span class="op">=</span> <span class="str">"dh_link files"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1198" href="#t1198">1198</a></span><span class="t"> <span class="nam">mutable_manifest</span> <span class="op">=</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">manifest</span><span class="op">.</span><span class="nam">mutable_manifest</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1199" href="#t1199">1199</a></span><span class="t"> <span class="key">for</span> <span class="nam">dctrl_bin</span> <span class="key">in</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">all_packages</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1200" href="#t1200">1200</a></span><span class="t"> <span class="nam">links_file</span><span class="op">,</span> <span class="nam">content</span> <span class="op">=</span> <span class="nam">_dh_config_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1201" href="#t1201">1201</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1202" href="#t1202">1202</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1203" href="#t1203">1203</a></span><span class="t"> <span class="str">"links"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1204" href="#t1204">1204</a></span><span class="t"> <span class="str">"dh_link"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1205" href="#t1205">1205</a></span><span class="t"> <span class="nam">acceptable_migration_issues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1206" href="#t1206">1206</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1207" href="#t1207">1207</a></span><span class="t"> <span class="nam">manifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1208" href="#t1208">1208</a></span><span class="t"> <span class="nam">support_executable_files</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1209" href="#t1209">1209</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1210" href="#t1210">1210</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1211" href="#t1211">1211</a></span><span class="t"> <span class="key">if</span> <span class="nam">links_file</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1212" href="#t1212">1212</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1213" href="#t1213">1213</a></span><span class="t"> <span class="key">assert</span> <span class="nam">content</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1214" href="#t1214">1214</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1215" href="#t1215">1215</a></span><span class="t"> <span class="nam">package_definition</span> <span class="op">=</span> <span class="nam">mutable_manifest</span><span class="op">.</span><span class="nam">package</span><span class="op">(</span><span class="nam">dctrl_bin</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1216" href="#t1216">1216</a></span><span class="t"> <span class="nam">defined_symlink</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1217" href="#t1217">1217</a></span><span class="t"> <span class="nam">symlink</span><span class="op">.</span><span class="nam">symlink_path</span><span class="op">:</span> <span class="nam">symlink</span><span class="op">.</span><span class="nam">symlink_target</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1218" href="#t1218">1218</a></span><span class="t"> <span class="key">for</span> <span class="nam">symlink</span> <span class="key">in</span> <span class="nam">package_definition</span><span class="op">.</span><span class="nam">symlinks</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1219" href="#t1219">1219</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1220" href="#t1220">1220</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1221" href="#t1221">1221</a></span><span class="t"> <span class="nam">seen_symlinks</span><span class="op">:</span> <span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1222" href="#t1222">1222</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1223" href="#t1223">1223</a></span><span class="t"> <span class="key">for</span> <span class="nam">dhe_line</span> <span class="key">in</span> <span class="nam">content</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1224" href="#t1224">1224</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">dhe_line</span><span class="op">.</span><span class="nam">tokens</span><span class="op">)</span> <span class="op">!=</span> <span class="num">2</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1224 ↛ 1225</span><span class="annotate long">line 1224 didn't jump to line 1225, because the condition on line 1224 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1225" href="#t1225">1225</a></span><span class="t"> <span class="key">raise</span> <span class="nam">UnsupportedFeature</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1226" href="#t1226">1226</a></span><span class="t"> <span class="str">f"The dh_link file {links_file.fs_path} did not have exactly two paths on line"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1227" href="#t1227">1227</a></span><span class="t"> <span class="str">f' {dhe_line.line_no} (line: "{dhe_line.original_line}"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1228" href="#t1228">1228</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1229" href="#t1229">1229</a></span><span class="t"> <span class="nam">target</span><span class="op">,</span> <span class="nam">source</span> <span class="op">=</span> <span class="nam">dhe_line</span><span class="op">.</span><span class="nam">tokens</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1230" href="#t1230">1230</a></span><span class="t"> <span class="key">if</span> <span class="nam">source</span> <span class="key">in</span> <span class="nam">seen_symlinks</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1230 ↛ 1232</span><span class="annotate long">line 1230 didn't jump to line 1232, because the condition on line 1230 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t1231" href="#t1231">1231</a></span><span class="t"> <span class="com"># According to #934499, this has happened in the wild already</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1232" href="#t1232">1232</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ConflictingChange</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1233" href="#t1233">1233</a></span><span class="t"> <span class="str">f"The {links_file.fs_path} file defines the link path {source} twice! Please ensure"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1234" href="#t1234">1234</a></span><span class="t"> <span class="str">" that it is defined at most once in that file"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1235" href="#t1235">1235</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1236" href="#t1236">1236</a></span><span class="t"> <span class="nam">seen_symlinks</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">source</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1237" href="#t1237">1237</a></span><span class="t"> <span class="com"># Symlinks in .links are always considered absolute, but you were not required to have a leading slash.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1238" href="#t1238">1238</a></span><span class="t"> <span class="com"># However, in the debputy manifest, you can have relative links, so we should ensure it is explicitly</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1239" href="#t1239">1239</a></span><span class="t"> <span class="com"># absolute.</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1240" href="#t1240">1240</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">target</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1240 ↛ 1242</span><span class="annotate long">line 1240 didn't jump to line 1242, because the condition on line 1240 was never false</span></span></p> - <p class="run"><span class="n"><a id="t1241" href="#t1241">1241</a></span><span class="t"> <span class="nam">target</span> <span class="op">=</span> <span class="str">"/"</span> <span class="op">+</span> <span class="nam">target</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1242" href="#t1242">1242</a></span><span class="t"> <span class="nam">existing_target</span> <span class="op">=</span> <span class="nam">defined_symlink</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">source</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1243" href="#t1243">1243</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing_target</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1243 ↛ 1244</span><span class="annotate long">line 1243 didn't jump to line 1244, because the condition on line 1243 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1244" href="#t1244">1244</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing_target</span> <span class="op">!=</span> <span class="nam">target</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1245" href="#t1245">1245</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ConflictingChange</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1246" href="#t1246">1246</a></span><span class="t"> <span class="str">f'The symlink "{source}" points to "{target}" in {links_file}, but there is'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1247" href="#t1247">1247</a></span><span class="t"> <span class="str">f' another symlink with same path pointing to "{existing_target}" defined'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1248" href="#t1248">1248</a></span><span class="t"> <span class="str">" already (in the existing manifest or an migration e.g., inside"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1249" href="#t1249">1249</a></span><span class="t"> <span class="str">f" {links_file.fs_path})"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1250" href="#t1250">1250</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1251" href="#t1251">1251</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">already_present</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1252" href="#t1252">1252</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1253" href="#t1253">1253</a></span><span class="t"> <span class="nam">condition</span> <span class="op">=</span> <span class="nam">dhe_line</span><span class="op">.</span><span class="nam">conditional</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1254" href="#t1254">1254</a></span><span class="t"> <span class="nam">package_definition</span><span class="op">.</span><span class="nam">add_symlink</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1255" href="#t1255">1255</a></span><span class="t"> <span class="nam">MutableYAMLSymlink</span><span class="op">.</span><span class="nam">new_symlink</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1256" href="#t1256">1256</a></span><span class="t"> <span class="nam">source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1257" href="#t1257">1257</a></span><span class="t"> <span class="nam">target</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1258" href="#t1258">1258</a></span><span class="t"> <span class="nam">condition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1259" href="#t1259">1259</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1260" href="#t1260">1260</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1261" href="#t1261">1261</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">successful_manifest_changes</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1262" href="#t1262">1262</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1263" href="#t1263">1263</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1264" href="#t1264">1264</a></span><span class="t"><span class="key">def</span> <span class="nam">migrate_misspelled_readme_debian_files</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1265" href="#t1265">1265</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1266" href="#t1266">1266</a></span><span class="t"> <span class="nam">manifest</span><span class="op">:</span> <span class="nam">HighLevelManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1267" href="#t1267">1267</a></span><span class="t"> <span class="nam">acceptable_migration_issues</span><span class="op">:</span> <span class="nam">AcceptableMigrationIssues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1268" href="#t1268">1268</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">:</span> <span class="nam">FeatureMigration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1269" href="#t1269">1269</a></span><span class="t"> <span class="nam">_migration_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1270" href="#t1270">1270</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1271" href="#t1271">1271</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">tagline</span> <span class="op">=</span> <span class="str">"misspelled README.Debian files"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1272" href="#t1272">1272</a></span><span class="t"> <span class="key">for</span> <span class="nam">dctrl_bin</span> <span class="key">in</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">all_packages</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1273" href="#t1273">1273</a></span><span class="t"> <span class="nam">readme</span><span class="op">,</span> <span class="nam">_</span> <span class="op">=</span> <span class="nam">_dh_config_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1274" href="#t1274">1274</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1275" href="#t1275">1275</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1276" href="#t1276">1276</a></span><span class="t"> <span class="str">"README.debian"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1277" href="#t1277">1277</a></span><span class="t"> <span class="str">"dh_installdocs"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1278" href="#t1278">1278</a></span><span class="t"> <span class="nam">acceptable_migration_issues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1279" href="#t1279">1279</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1280" href="#t1280">1280</a></span><span class="t"> <span class="nam">manifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1281" href="#t1281">1281</a></span><span class="t"> <span class="nam">support_executable_files</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1282" href="#t1282">1282</a></span><span class="t"> <span class="nam">remove_on_migration</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1283" href="#t1283">1283</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1284" href="#t1284">1284</a></span><span class="t"> <span class="key">if</span> <span class="nam">readme</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1285" href="#t1285">1285</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1286" href="#t1286">1286</a></span><span class="t"> <span class="nam">new_name</span> <span class="op">=</span> <span class="nam">readme</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">"README.debian"</span><span class="op">,</span> <span class="str">"README.Debian"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1287" href="#t1287">1287</a></span><span class="t"> <span class="key">assert</span> <span class="nam">readme</span><span class="op">.</span><span class="nam">name</span> <span class="op">!=</span> <span class="nam">new_name</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1288" href="#t1288">1288</a></span><span class="t"> <span class="nam">_rename_file_if_exists</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1289" href="#t1289">1289</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1290" href="#t1290">1290</a></span><span class="t"> <span class="nam">readme</span><span class="op">.</span><span class="nam">name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1291" href="#t1291">1291</a></span><span class="t"> <span class="nam">new_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1292" href="#t1292">1292</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1293" href="#t1293">1293</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1294" href="#t1294">1294</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1295" href="#t1295">1295</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1296" href="#t1296">1296</a></span><span class="t"><span class="key">def</span> <span class="nam">migrate_doc_base_files</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1297" href="#t1297">1297</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1298" href="#t1298">1298</a></span><span class="t"> <span class="nam">manifest</span><span class="op">:</span> <span class="nam">HighLevelManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1299" href="#t1299">1299</a></span><span class="t"> <span class="nam">_</span><span class="op">:</span> <span class="nam">AcceptableMigrationIssues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1300" href="#t1300">1300</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">:</span> <span class="nam">FeatureMigration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1301" href="#t1301">1301</a></span><span class="t"> <span class="nam">_migration_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1302" href="#t1302">1302</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1303" href="#t1303">1303</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">tagline</span> <span class="op">=</span> <span class="str">"doc-base files"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1304" href="#t1304">1304</a></span><span class="t"> <span class="com"># ignore the dh_make ".EX" file if one should still be present. The dh_installdocs tool ignores it too.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1305" href="#t1305">1305</a></span><span class="t"> <span class="nam">possible_effected_doc_base_files</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1306" href="#t1306">1306</a></span><span class="t"> <span class="nam">f</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1307" href="#t1307">1307</a></span><span class="t"> <span class="key">for</span> <span class="nam">f</span> <span class="key">in</span> <span class="nam">debian_dir</span><span class="op">.</span><span class="nam">iterdir</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1308" href="#t1308">1308</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1309" href="#t1309">1309</a></span><span class="t"> <span class="op">(</span><span class="str">".doc-base."</span> <span class="key">in</span> <span class="nam">f</span><span class="op">.</span><span class="nam">name</span> <span class="key">or</span> <span class="nam">f</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"doc-base."</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1310" href="#t1310">1310</a></span><span class="t"> <span class="key">and</span> <span class="key">not</span> <span class="nam">f</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"doc-base.EX"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1311" href="#t1311">1311</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1312" href="#t1312">1312</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1313" href="#t1313">1313</a></span><span class="t"> <span class="nam">known_packages</span> <span class="op">=</span> <span class="op">{</span><span class="nam">d</span><span class="op">.</span><span class="nam">name</span><span class="op">:</span> <span class="nam">d</span> <span class="key">for</span> <span class="nam">d</span> <span class="key">in</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">all_packages</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1314" href="#t1314">1314</a></span><span class="t"> <span class="nam">main_package</span> <span class="op">=</span> <span class="op">[</span><span class="nam">d</span> <span class="key">for</span> <span class="nam">d</span> <span class="key">in</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">all_packages</span> <span class="key">if</span> <span class="nam">d</span><span class="op">.</span><span class="nam">is_main_package</span><span class="op">]</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1315" href="#t1315">1315</a></span><span class="t"> <span class="key">for</span> <span class="nam">doc_base_file</span> <span class="key">in</span> <span class="nam">possible_effected_doc_base_files</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1316" href="#t1316">1316</a></span><span class="t"> <span class="nam">parts</span> <span class="op">=</span> <span class="nam">doc_base_file</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="str">"."</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1317" href="#t1317">1317</a></span><span class="t"> <span class="nam">owning_package</span> <span class="op">=</span> <span class="nam">known_packages</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">parts</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1318" href="#t1318">1318</a></span><span class="t"> <span class="key">if</span> <span class="nam">owning_package</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1318 ↛ 1319</span><span class="annotate long">line 1318 didn't jump to line 1319, because the condition on line 1318 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1319" href="#t1319">1319</a></span><span class="t"> <span class="nam">owning_package</span> <span class="op">=</span> <span class="nam">main_package</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1320" href="#t1320">1320</a></span><span class="t"> <span class="nam">package_part</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1321" href="#t1321">1321</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1322" href="#t1322">1322</a></span><span class="t"> <span class="nam">package_part</span> <span class="op">=</span> <span class="nam">parts</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1323" href="#t1323">1323</a></span><span class="t"> <span class="nam">parts</span> <span class="op">=</span> <span class="nam">parts</span><span class="op">[</span><span class="num">1</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1324" href="#t1324">1324</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1325" href="#t1325">1325</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">parts</span> <span class="key">or</span> <span class="nam">parts</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="op">!=</span> <span class="str">"doc-base"</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1325 ↛ 1327</span><span class="annotate long">line 1325 didn't jump to line 1327, because the condition on line 1325 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t1326" href="#t1326">1326</a></span><span class="t"> <span class="com"># Not a doc-base file after all</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1327" href="#t1327">1327</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1328" href="#t1328">1328</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1329" href="#t1329">1329</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">parts</span><span class="op">)</span> <span class="op">></span> <span class="num">1</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1329 ↛ 1336</span><span class="annotate long">line 1329 didn't jump to line 1336, because the condition on line 1329 was never false</span></span></p> - <p class="run"><span class="n"><a id="t1330" href="#t1330">1330</a></span><span class="t"> <span class="nam">name_part</span> <span class="op">=</span> <span class="str">"."</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">parts</span><span class="op">[</span><span class="num">1</span><span class="op">:</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1331" href="#t1331">1331</a></span><span class="t"> <span class="key">if</span> <span class="nam">package_part</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1331 ↛ 1333</span><span class="annotate long">line 1331 didn't jump to line 1333, because the condition on line 1331 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t1332" href="#t1332">1332</a></span><span class="t"> <span class="com"># Named files must have a package prefix</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1333" href="#t1333">1333</a></span><span class="t"> <span class="nam">package_part</span> <span class="op">=</span> <span class="nam">owning_package</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1334" href="#t1334">1334</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1335" href="#t1335">1335</a></span><span class="t"> <span class="com"># No rename needed</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1336" href="#t1336">1336</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1337" href="#t1337">1337</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1338" href="#t1338">1338</a></span><span class="t"> <span class="nam">new_basename</span> <span class="op">=</span> <span class="str">"."</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">filter</span><span class="op">(</span><span class="key">None</span><span class="op">,</span> <span class="op">(</span><span class="nam">package_part</span><span class="op">,</span> <span class="nam">name_part</span><span class="op">,</span> <span class="str">"doc-base"</span><span class="op">)</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1339" href="#t1339">1339</a></span><span class="t"> <span class="nam">_rename_file_if_exists</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1340" href="#t1340">1340</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1341" href="#t1341">1341</a></span><span class="t"> <span class="nam">doc_base_file</span><span class="op">.</span><span class="nam">name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1342" href="#t1342">1342</a></span><span class="t"> <span class="nam">new_basename</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1343" href="#t1343">1343</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1344" href="#t1344">1344</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1345" href="#t1345">1345</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1346" href="#t1346">1346</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1347" href="#t1347">1347</a></span><span class="t"><span class="key">def</span> <span class="nam">migrate_dh_hook_targets</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1348" href="#t1348">1348</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1349" href="#t1349">1349</a></span><span class="t"> <span class="nam">_</span><span class="op">:</span> <span class="nam">HighLevelManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1350" href="#t1350">1350</a></span><span class="t"> <span class="nam">acceptable_migration_issues</span><span class="op">:</span> <span class="nam">AcceptableMigrationIssues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1351" href="#t1351">1351</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">:</span> <span class="nam">FeatureMigration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1352" href="#t1352">1352</a></span><span class="t"> <span class="nam">migration_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1353" href="#t1353">1353</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1354" href="#t1354">1354</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">tagline</span> <span class="op">=</span> <span class="str">"dh hook targets"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1355" href="#t1355">1355</a></span><span class="t"> <span class="nam">source_root</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">dirname</span><span class="op">(</span><span class="nam">debian_dir</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1356" href="#t1356">1356</a></span><span class="t"> <span class="key">if</span> <span class="nam">source_root</span> <span class="op">==</span> <span class="str">""</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1357" href="#t1357">1357</a></span><span class="t"> <span class="nam">source_root</span> <span class="op">=</span> <span class="str">"."</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1358" href="#t1358">1358</a></span><span class="t"> <span class="nam">detected_hook_targets</span> <span class="op">=</span> <span class="nam">json</span><span class="op">.</span><span class="nam">loads</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1359" href="#t1359">1359</a></span><span class="t"> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_output</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1360" href="#t1360">1360</a></span><span class="t"> <span class="op">[</span><span class="str">"dh_assistant"</span><span class="op">,</span> <span class="str">"detect-hook-targets"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1361" href="#t1361">1361</a></span><span class="t"> <span class="nam">cwd</span><span class="op">=</span><span class="nam">source_root</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1362" href="#t1362">1362</a></span><span class="t"> <span class="op">)</span><span class="op">.</span><span class="nam">decode</span><span class="op">(</span><span class="str">"utf-8"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1363" href="#t1363">1363</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1364" href="#t1364">1364</a></span><span class="t"> <span class="nam">sample_hook_target</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1365" href="#t1365">1365</a></span><span class="t"> <span class="nam">replaced_commands</span> <span class="op">=</span> <span class="nam">DH_COMMANDS_REPLACED</span><span class="op">[</span><span class="nam">migration_target</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1366" href="#t1366">1366</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1367" href="#t1367">1367</a></span><span class="t"> <span class="key">for</span> <span class="nam">hook_target_def</span> <span class="key">in</span> <span class="nam">detected_hook_targets</span><span class="op">[</span><span class="str">"hook-targets"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1368" href="#t1368">1368</a></span><span class="t"> <span class="key">if</span> <span class="nam">hook_target_def</span><span class="op">[</span><span class="str">"is-empty"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1369" href="#t1369">1369</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1370" href="#t1370">1370</a></span><span class="t"> <span class="nam">command</span> <span class="op">=</span> <span class="nam">hook_target_def</span><span class="op">[</span><span class="str">"command"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1371" href="#t1371">1371</a></span><span class="t"> <span class="key">if</span> <span class="nam">command</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">replaced_commands</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1372" href="#t1372">1372</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1373" href="#t1373">1373</a></span><span class="t"> <span class="nam">hook_target</span> <span class="op">=</span> <span class="nam">hook_target_def</span><span class="op">[</span><span class="str">"target-name"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1374" href="#t1374">1374</a></span><span class="t"> <span class="nam">advice</span> <span class="op">=</span> <span class="nam">MIGRATION_AID_FOR_OVERRIDDEN_COMMANDS</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">command</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1375" href="#t1375">1375</a></span><span class="t"> <span class="key">if</span> <span class="nam">advice</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1376" href="#t1376">1376</a></span><span class="t"> <span class="key">if</span> <span class="nam">sample_hook_target</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1377" href="#t1377">1377</a></span><span class="t"> <span class="nam">sample_hook_target</span> <span class="op">=</span> <span class="nam">hook_target</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1378" href="#t1378">1378</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1379" href="#t1379">1379</a></span><span class="t"> <span class="str">f"TODO: MANUAL MIGRATION required for hook target {hook_target}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1380" href="#t1380">1380</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1381" href="#t1381">1381</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1382" href="#t1382">1382</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1383" href="#t1383">1383</a></span><span class="t"> <span class="str">f"TODO: MANUAL MIGRATION required for hook target {hook_target}. Please see {advice}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1384" href="#t1384">1384</a></span><span class="t"> <span class="str">f" for migration advice."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1385" href="#t1385">1385</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1386" href="#t1386">1386</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1387" href="#t1387">1387</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">warnings</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1388" href="#t1388">1388</a></span><span class="t"> <span class="key">and</span> <span class="str">"dh-hook-targets"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">acceptable_migration_issues</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1389" href="#t1389">1389</a></span><span class="t"> <span class="key">and</span> <span class="nam">sample_hook_target</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1390" href="#t1390">1390</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1391" href="#t1391">1391</a></span><span class="t"> <span class="key">raise</span> <span class="nam">UnsupportedFeature</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1392" href="#t1392">1392</a></span><span class="t"> <span class="str">f"The debian/rules file contains one or more non empty dh hook targets that will not"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1393" href="#t1393">1393</a></span><span class="t"> <span class="str">f" be run with the requested debputy dh sequence with no known migration advice. One of these would be"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1394" href="#t1394">1394</a></span><span class="t"> <span class="str">f" {sample_hook_target}."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1395" href="#t1395">1395</a></span><span class="t"> <span class="op">[</span><span class="str">"dh-hook-targets"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1396" href="#t1396">1396</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1397" href="#t1397">1397</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1398" href="#t1398">1398</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1399" href="#t1399">1399</a></span><span class="t"><span class="key">def</span> <span class="nam">detect_unsupported_zz_debputy_features</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1400" href="#t1400">1400</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1401" href="#t1401">1401</a></span><span class="t"> <span class="nam">manifest</span><span class="op">:</span> <span class="nam">HighLevelManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1402" href="#t1402">1402</a></span><span class="t"> <span class="nam">acceptable_migration_issues</span><span class="op">:</span> <span class="nam">AcceptableMigrationIssues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1403" href="#t1403">1403</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">:</span> <span class="nam">FeatureMigration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1404" href="#t1404">1404</a></span><span class="t"> <span class="nam">_migration_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1405" href="#t1405">1405</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1406" href="#t1406">1406</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">tagline</span> <span class="op">=</span> <span class="str">"Known unsupported features"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1407" href="#t1407">1407</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1408" href="#t1408">1408</a></span><span class="t"> <span class="key">for</span> <span class="nam">unsupported_config</span> <span class="key">in</span> <span class="nam">UNSUPPORTED_DH_CONFIGS_AND_TOOLS_FOR_ZZ_DEBPUTY</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1409" href="#t1409">1409</a></span><span class="t"> <span class="nam">_unsupported_debhelper_config_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1410" href="#t1410">1410</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1411" href="#t1411">1411</a></span><span class="t"> <span class="nam">manifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1412" href="#t1412">1412</a></span><span class="t"> <span class="nam">unsupported_config</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1413" href="#t1413">1413</a></span><span class="t"> <span class="nam">acceptable_migration_issues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1414" href="#t1414">1414</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1415" href="#t1415">1415</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1416" href="#t1416">1416</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1417" href="#t1417">1417</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1418" href="#t1418">1418</a></span><span class="t"><span class="key">def</span> <span class="nam">detect_obsolete_substvars</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1419" href="#t1419">1419</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1420" href="#t1420">1420</a></span><span class="t"> <span class="nam">_manifest</span><span class="op">:</span> <span class="nam">HighLevelManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1421" href="#t1421">1421</a></span><span class="t"> <span class="nam">_acceptable_migration_issues</span><span class="op">:</span> <span class="nam">AcceptableMigrationIssues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1422" href="#t1422">1422</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">:</span> <span class="nam">FeatureMigration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1423" href="#t1423">1423</a></span><span class="t"> <span class="nam">_migration_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1424" href="#t1424">1424</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1425" href="#t1425">1425</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">tagline</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1426" href="#t1426">1426</a></span><span class="t"> <span class="str">"Check for obsolete ${foo:var} variables in debian/control"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1427" href="#t1427">1427</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1428" href="#t1428">1428</a></span><span class="t"> <span class="nam">ctrl_file</span> <span class="op">=</span> <span class="nam">debian_dir</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"control"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1429" href="#t1429">1429</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">ctrl_file</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1429 ↛ 1430</span><span class="annotate long">line 1429 didn't jump to line 1430, because the condition on line 1429 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1430" href="#t1430">1430</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1431" href="#t1431">1431</a></span><span class="t"> <span class="str">"Cannot find debian/control. Detection of obsolete substvars could not be performed."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1432" href="#t1432">1432</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1433" href="#t1433">1433</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1434" href="#t1434">1434</a></span><span class="t"> <span class="key">with</span> <span class="nam">ctrl_file</span><span class="op">.</span><span class="nam">open</span><span class="op">(</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1435" href="#t1435">1435</a></span><span class="t"> <span class="nam">ctrl</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">Deb822</span><span class="op">.</span><span class="nam">iter_paragraphs</span><span class="op">(</span><span class="nam">fd</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1436" href="#t1436">1436</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1437" href="#t1437">1437</a></span><span class="t"> <span class="nam">relationship_fields</span> <span class="op">=</span> <span class="nam">dpkg_field_list_pkg_dep</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1438" href="#t1438">1438</a></span><span class="t"> <span class="nam">relationship_fields_lc</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span><span class="nam">x</span><span class="op">.</span><span class="nam">lower</span><span class="op">(</span><span class="op">)</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">relationship_fields</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1439" href="#t1439">1439</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1440" href="#t1440">1440</a></span><span class="t"> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">ctrl</span><span class="op">[</span><span class="num">1</span><span class="op">:</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1441" href="#t1441">1441</a></span><span class="t"> <span class="nam">seen_obsolete_relationship_substvars</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1442" href="#t1442">1442</a></span><span class="t"> <span class="nam">obsolete_fields</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1443" href="#t1443">1443</a></span><span class="t"> <span class="nam">is_essential</span> <span class="op">=</span> <span class="nam">p</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"Essential"</span><span class="op">)</span> <span class="op">==</span> <span class="str">"yes"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1444" href="#t1444">1444</a></span><span class="t"> <span class="key">for</span> <span class="nam">df</span> <span class="key">in</span> <span class="nam">relationship_fields</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1445" href="#t1445">1445</a></span><span class="t"> <span class="nam">field</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="nam">p</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">df</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1446" href="#t1446">1446</a></span><span class="t"> <span class="key">if</span> <span class="nam">field</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1447" href="#t1447">1447</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1448" href="#t1448">1448</a></span><span class="t"> <span class="nam">df_lc</span> <span class="op">=</span> <span class="nam">df</span><span class="op">.</span><span class="nam">lower</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1449" href="#t1449">1449</a></span><span class="t"> <span class="nam">number_of_relations</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1450" href="#t1450">1450</a></span><span class="t"> <span class="nam">obsolete_substvars_in_field</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1451" href="#t1451">1451</a></span><span class="t"> <span class="key">for</span> <span class="nam">d</span> <span class="key">in</span> <span class="op">(</span><span class="nam">d</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span> <span class="key">for</span> <span class="nam">d</span> <span class="key">in</span> <span class="nam">field</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="str">","</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1452" href="#t1452">1452</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">d</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1453" href="#t1453">1453</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1454" href="#t1454">1454</a></span><span class="t"> <span class="nam">number_of_relations</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1455" href="#t1455">1455</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">d</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"${"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1456" href="#t1456">1456</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1457" href="#t1457">1457</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1458" href="#t1458">1458</a></span><span class="t"> <span class="nam">end_idx</span> <span class="op">=</span> <span class="nam">d</span><span class="op">.</span><span class="nam">index</span><span class="op">(</span><span class="str">"}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1459" href="#t1459">1459</a></span><span class="t"> <span class="key">except</span> <span class="nam">ValueError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1460" href="#t1460">1460</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1461" href="#t1461">1461</a></span><span class="t"> <span class="nam">substvar_name</span> <span class="op">=</span> <span class="nam">d</span><span class="op">[</span><span class="num">2</span><span class="op">:</span><span class="nam">end_idx</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1462" href="#t1462">1462</a></span><span class="t"> <span class="key">if</span> <span class="str">":"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">substvar_name</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1462 ↛ 1463</span><span class="annotate long">line 1462 didn't jump to line 1463, because the condition on line 1462 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1463" href="#t1463">1463</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1464" href="#t1464">1464</a></span><span class="t"> <span class="nam">_</span><span class="op">,</span> <span class="nam">field</span> <span class="op">=</span> <span class="nam">substvar_name</span><span class="op">.</span><span class="nam">rsplit</span><span class="op">(</span><span class="str">":"</span><span class="op">,</span> <span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1465" href="#t1465">1465</a></span><span class="t"> <span class="nam">field_lc</span> <span class="op">=</span> <span class="nam">field</span><span class="op">.</span><span class="nam">lower</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1466" href="#t1466">1466</a></span><span class="t"> <span class="key">if</span> <span class="nam">field_lc</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">relationship_fields_lc</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1466 ↛ 1467</span><span class="annotate long">line 1466 didn't jump to line 1467, because the condition on line 1466 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1467" href="#t1467">1467</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1468" href="#t1468">1468</a></span><span class="t"> <span class="nam">is_obsolete</span> <span class="op">=</span> <span class="nam">field_lc</span> <span class="op">==</span> <span class="nam">df_lc</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1469" href="#t1469">1469</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1470" href="#t1470">1470</a></span><span class="t"> <span class="key">not</span> <span class="nam">is_obsolete</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1471" href="#t1471">1471</a></span><span class="t"> <span class="key">and</span> <span class="nam">is_essential</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1472" href="#t1472">1472</a></span><span class="t"> <span class="key">and</span> <span class="nam">substvar_name</span><span class="op">.</span><span class="nam">lower</span><span class="op">(</span><span class="op">)</span> <span class="op">==</span> <span class="str">"shlibs:depends"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1473" href="#t1473">1473</a></span><span class="t"> <span class="key">and</span> <span class="nam">df_lc</span> <span class="op">==</span> <span class="str">"pre-depends"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1474" href="#t1474">1474</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1475" href="#t1475">1475</a></span><span class="t"> <span class="nam">is_obsolete</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1476" href="#t1476">1476</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1477" href="#t1477">1477</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_obsolete</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1478" href="#t1478">1478</a></span><span class="t"> <span class="nam">obsolete_substvars_in_field</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1479" href="#t1479">1479</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1480" href="#t1480">1480</a></span><span class="t"> <span class="key">if</span> <span class="nam">number_of_relations</span> <span class="op">==</span> <span class="nam">len</span><span class="op">(</span><span class="nam">obsolete_substvars_in_field</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1481" href="#t1481">1481</a></span><span class="t"> <span class="nam">obsolete_fields</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">df</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1482" href="#t1482">1482</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1483" href="#t1483">1483</a></span><span class="t"> <span class="nam">seen_obsolete_relationship_substvars</span><span class="op">.</span><span class="nam">update</span><span class="op">(</span><span class="nam">obsolete_substvars_in_field</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1484" href="#t1484">1484</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1485" href="#t1485">1485</a></span><span class="t"> <span class="nam">package</span> <span class="op">=</span> <span class="nam">p</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"Package"</span><span class="op">,</span> <span class="str">"(Missing package name!?)"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1486" href="#t1486">1486</a></span><span class="t"> <span class="key">if</span> <span class="nam">obsolete_fields</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1487" href="#t1487">1487</a></span><span class="t"> <span class="nam">fields</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">obsolete_fields</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1488" href="#t1488">1488</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1489" href="#t1489">1489</a></span><span class="t"> <span class="str">f"The following relationship fields can be removed from {package}: {fields}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1490" href="#t1490">1490</a></span><span class="t"> <span class="str">f" (The content in them would be applied automatically.)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1491" href="#t1491">1491</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1492" href="#t1492">1492</a></span><span class="t"> <span class="key">if</span> <span class="nam">seen_obsolete_relationship_substvars</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1493" href="#t1493">1493</a></span><span class="t"> <span class="nam">v</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">sorted</span><span class="op">(</span><span class="nam">seen_obsolete_relationship_substvars</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1494" href="#t1494">1494</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1495" href="#t1495">1495</a></span><span class="t"> <span class="str">f"The following relationship substitution variables can be removed from {package}: {v}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1496" href="#t1496">1496</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1497" href="#t1497">1497</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1498" href="#t1498">1498</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1499" href="#t1499">1499</a></span><span class="t"><span class="key">def</span> <span class="nam">read_dh_addon_sequences</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1500" href="#t1500">1500</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1501" href="#t1501">1501</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1502" href="#t1502">1502</a></span><span class="t"> <span class="nam">ctrl_file</span> <span class="op">=</span> <span class="nam">debian_dir</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"control"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1503" href="#t1503">1503</a></span><span class="t"> <span class="key">if</span> <span class="nam">ctrl_file</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1504" href="#t1504">1504</a></span><span class="t"> <span class="nam">dr_sequences</span><span class="op">:</span> <span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1505" href="#t1505">1505</a></span><span class="t"> <span class="nam">bd_sequences</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1506" href="#t1506">1506</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1507" href="#t1507">1507</a></span><span class="t"> <span class="nam">drules</span> <span class="op">=</span> <span class="nam">debian_dir</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"rules"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1508" href="#t1508">1508</a></span><span class="t"> <span class="key">if</span> <span class="nam">drules</span> <span class="key">and</span> <span class="nam">drules</span><span class="op">.</span><span class="nam">is_file</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1508 ↛ 1509</span><span class="annotate long">line 1508 didn't jump to line 1509, because the condition on line 1508 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1509" href="#t1509">1509</a></span><span class="t"> <span class="key">with</span> <span class="nam">drules</span><span class="op">.</span><span class="nam">open</span><span class="op">(</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1510" href="#t1510">1510</a></span><span class="t"> <span class="nam">parse_drules_for_addons</span><span class="op">(</span><span class="nam">fd</span><span class="op">,</span> <span class="nam">dr_sequences</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1511" href="#t1511">1511</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1512" href="#t1512">1512</a></span><span class="t"> <span class="key">with</span> <span class="nam">ctrl_file</span><span class="op">.</span><span class="nam">open</span><span class="op">(</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1513" href="#t1513">1513</a></span><span class="t"> <span class="nam">ctrl</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">Deb822</span><span class="op">.</span><span class="nam">iter_paragraphs</span><span class="op">(</span><span class="nam">fd</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1514" href="#t1514">1514</a></span><span class="t"> <span class="nam">source_paragraph</span> <span class="op">=</span> <span class="nam">ctrl</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="key">if</span> <span class="nam">ctrl</span> <span class="key">else</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1515" href="#t1515">1515</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1516" href="#t1516">1516</a></span><span class="t"> <span class="nam">extract_dh_addons_from_control</span><span class="op">(</span><span class="nam">source_paragraph</span><span class="op">,</span> <span class="nam">bd_sequences</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1517" href="#t1517">1517</a></span><span class="t"> <span class="key">return</span> <span class="nam">bd_sequences</span><span class="op">,</span> <span class="nam">dr_sequences</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1518" href="#t1518">1518</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1519" href="#t1519">1519</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1520" href="#t1520">1520</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1521" href="#t1521">1521</a></span><span class="t"><span class="key">def</span> <span class="nam">detect_dh_addons_zz_debputy_rrr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1522" href="#t1522">1522</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1523" href="#t1523">1523</a></span><span class="t"> <span class="nam">_manifest</span><span class="op">:</span> <span class="nam">HighLevelManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1524" href="#t1524">1524</a></span><span class="t"> <span class="nam">_acceptable_migration_issues</span><span class="op">:</span> <span class="nam">AcceptableMigrationIssues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1525" href="#t1525">1525</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">:</span> <span class="nam">FeatureMigration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1526" href="#t1526">1526</a></span><span class="t"> <span class="nam">_migration_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1527" href="#t1527">1527</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1528" href="#t1528">1528</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">tagline</span> <span class="op">=</span> <span class="str">"Check for dh-sequence-addons"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1529" href="#t1529">1529</a></span><span class="t"> <span class="nam">r</span> <span class="op">=</span> <span class="nam">read_dh_addon_sequences</span><span class="op">(</span><span class="nam">debian_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1530" href="#t1530">1530</a></span><span class="t"> <span class="key">if</span> <span class="nam">r</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1531" href="#t1531">1531</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1532" href="#t1532">1532</a></span><span class="t"> <span class="str">"Cannot find debian/control. Detection of unsupported/missing dh-sequence addon"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1533" href="#t1533">1533</a></span><span class="t"> <span class="str">" could not be performed. Please ensure the package will Build-Depend on dh-sequence-zz-debputy-rrr."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1534" href="#t1534">1534</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1535" href="#t1535">1535</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1536" href="#t1536">1536</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1537" href="#t1537">1537</a></span><span class="t"> <span class="nam">bd_sequences</span><span class="op">,</span> <span class="nam">dr_sequences</span> <span class="op">=</span> <span class="nam">r</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1538" href="#t1538">1538</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1539" href="#t1539">1539</a></span><span class="t"> <span class="nam">remaining_sequences</span> <span class="op">=</span> <span class="nam">bd_sequences</span> <span class="op">|</span> <span class="nam">dr_sequences</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1540" href="#t1540">1540</a></span><span class="t"> <span class="nam">saw_dh_debputy</span> <span class="op">=</span> <span class="str">"zz-debputy-rrr"</span> <span class="key">in</span> <span class="nam">remaining_sequences</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1541" href="#t1541">1541</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1542" href="#t1542">1542</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">saw_dh_debputy</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1543" href="#t1543">1543</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">warn</span><span class="op">(</span><span class="str">"Missing Build-Depends on dh-sequence-zz-debputy-rrr"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1544" href="#t1544">1544</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1545" href="#t1545">1545</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1546" href="#t1546">1546</a></span><span class="t"><span class="key">def</span> <span class="nam">detect_dh_addons</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1547" href="#t1547">1547</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1548" href="#t1548">1548</a></span><span class="t"> <span class="nam">_manifest</span><span class="op">:</span> <span class="nam">HighLevelManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1549" href="#t1549">1549</a></span><span class="t"> <span class="nam">acceptable_migration_issues</span><span class="op">:</span> <span class="nam">AcceptableMigrationIssues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1550" href="#t1550">1550</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">:</span> <span class="nam">FeatureMigration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1551" href="#t1551">1551</a></span><span class="t"> <span class="nam">_migration_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1552" href="#t1552">1552</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1553" href="#t1553">1553</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">tagline</span> <span class="op">=</span> <span class="str">"Check for dh-sequence-addons"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1554" href="#t1554">1554</a></span><span class="t"> <span class="nam">r</span> <span class="op">=</span> <span class="nam">read_dh_addon_sequences</span><span class="op">(</span><span class="nam">debian_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1555" href="#t1555">1555</a></span><span class="t"> <span class="key">if</span> <span class="nam">r</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1556" href="#t1556">1556</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1557" href="#t1557">1557</a></span><span class="t"> <span class="str">"Cannot find debian/control. Detection of unsupported/missing dh-sequence addon"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1558" href="#t1558">1558</a></span><span class="t"> <span class="str">" could not be performed. Please ensure the package will Build-Depend on dh-sequence-zz-debputy"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1559" href="#t1559">1559</a></span><span class="t"> <span class="str">" and not rely on any other debhelper sequence addons except those debputy explicitly supports."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1560" href="#t1560">1560</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1561" href="#t1561">1561</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1562" href="#t1562">1562</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1563" href="#t1563">1563</a></span><span class="t"> <span class="nam">bd_sequences</span><span class="op">,</span> <span class="nam">dr_sequences</span> <span class="op">=</span> <span class="nam">r</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1564" href="#t1564">1564</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1565" href="#t1565">1565</a></span><span class="t"> <span class="nam">remaining_sequences</span> <span class="op">=</span> <span class="nam">bd_sequences</span> <span class="op">|</span> <span class="nam">dr_sequences</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1566" href="#t1566">1566</a></span><span class="t"> <span class="nam">saw_dh_debputy</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1567" href="#t1567">1567</a></span><span class="t"> <span class="str">"debputy"</span> <span class="key">in</span> <span class="nam">remaining_sequences</span> <span class="key">or</span> <span class="str">"zz-debputy"</span> <span class="key">in</span> <span class="nam">remaining_sequences</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1568" href="#t1568">1568</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1569" href="#t1569">1569</a></span><span class="t"> <span class="nam">saw_zz_debputy</span> <span class="op">=</span> <span class="str">"zz-debputy"</span> <span class="key">in</span> <span class="nam">remaining_sequences</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1570" href="#t1570">1570</a></span><span class="t"> <span class="nam">must_use_zz_debputy</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1571" href="#t1571">1571</a></span><span class="t"> <span class="nam">remaining_sequences</span> <span class="op">-=</span> <span class="nam">SUPPORTED_DH_ADDONS</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1572" href="#t1572">1572</a></span><span class="t"> <span class="key">for</span> <span class="nam">sequence</span> <span class="key">in</span> <span class="nam">remaining_sequences</span> <span class="op">&</span> <span class="nam">DH_ADDONS_TO_PLUGINS</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1573" href="#t1573">1573</a></span><span class="t"> <span class="nam">migration</span> <span class="op">=</span> <span class="nam">DH_ADDONS_TO_PLUGINS</span><span class="op">[</span><span class="nam">sequence</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1574" href="#t1574">1574</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">require_plugin</span><span class="op">(</span><span class="nam">migration</span><span class="op">.</span><span class="nam">debputy_plugin</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1575" href="#t1575">1575</a></span><span class="t"> <span class="key">if</span> <span class="nam">migration</span><span class="op">.</span><span class="nam">remove_dh_sequence</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1575 ↛ 1576</span><span class="annotate long">line 1575 didn't jump to line 1576, because the condition on line 1575 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1576" href="#t1576">1576</a></span><span class="t"> <span class="key">if</span> <span class="nam">migration</span><span class="op">.</span><span class="nam">must_use_zz_debputy</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1577" href="#t1577">1577</a></span><span class="t"> <span class="nam">must_use_zz_debputy</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1578" href="#t1578">1578</a></span><span class="t"> <span class="key">if</span> <span class="nam">sequence</span> <span class="key">in</span> <span class="nam">bd_sequences</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1579" href="#t1579">1579</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1580" href="#t1580">1580</a></span><span class="t"> <span class="str">f"TODO: MANUAL MIGRATION - Remove build-dependency on dh-sequence-{sequence}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1581" href="#t1581">1581</a></span><span class="t"> <span class="str">f" (replaced by debputy-plugin-{migration.debputy_plugin})"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1582" href="#t1582">1582</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1583" href="#t1583">1583</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1584" href="#t1584">1584</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1585" href="#t1585">1585</a></span><span class="t"> <span class="str">f"TODO: MANUAL MIGRATION - Remove --with {sequence} from dh in d/rules"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1586" href="#t1586">1586</a></span><span class="t"> <span class="str">f" (replaced by debputy-plugin-{migration.debputy_plugin})"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1587" href="#t1587">1587</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1588" href="#t1588">1588</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1589" href="#t1589">1589</a></span><span class="t"> <span class="nam">remaining_sequences</span> <span class="op">-=</span> <span class="nam">DH_ADDONS_TO_PLUGINS</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1590" href="#t1590">1590</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1591" href="#t1591">1591</a></span><span class="t"> <span class="nam">alt_key</span> <span class="op">=</span> <span class="str">"unsupported-dh-sequences"</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1592" href="#t1592">1592</a></span><span class="t"> <span class="key">for</span> <span class="nam">sequence</span> <span class="key">in</span> <span class="nam">remaining_sequences</span> <span class="op">&</span> <span class="nam">DH_ADDONS_TO_REMOVE</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1592 ↛ 1593</span><span class="annotate long">line 1592 didn't jump to line 1593, because the loop on line 1592 never started</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1593" href="#t1593">1593</a></span><span class="t"> <span class="key">if</span> <span class="nam">sequence</span> <span class="key">in</span> <span class="nam">bd_sequences</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1594" href="#t1594">1594</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1595" href="#t1595">1595</a></span><span class="t"> <span class="str">f"TODO: MANUAL MIGRATION - Remove build dependency on dh-sequence-{sequence}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1596" href="#t1596">1596</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1597" href="#t1597">1597</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1598" href="#t1598">1598</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1599" href="#t1599">1599</a></span><span class="t"> <span class="str">f"TODO: MANUAL MIGRATION - Remove --with {sequence} from dh in d/rules"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1600" href="#t1600">1600</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1601" href="#t1601">1601</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1602" href="#t1602">1602</a></span><span class="t"> <span class="nam">remaining_sequences</span> <span class="op">-=</span> <span class="nam">DH_ADDONS_TO_REMOVE</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1603" href="#t1603">1603</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1604" href="#t1604">1604</a></span><span class="t"> <span class="key">for</span> <span class="nam">sequence</span> <span class="key">in</span> <span class="nam">remaining_sequences</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1605" href="#t1605">1605</a></span><span class="t"> <span class="nam">key</span> <span class="op">=</span> <span class="str">f"unsupported-dh-sequence-{sequence}"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1606" href="#t1606">1606</a></span><span class="t"> <span class="nam">msg</span> <span class="op">=</span> <span class="str">f'The dh addon "{sequence}" is not known to work with dh-debputy and might malfunction'</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1607" href="#t1607">1607</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1608" href="#t1608">1608</a></span><span class="t"> <span class="nam">key</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">acceptable_migration_issues</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1609" href="#t1609">1609</a></span><span class="t"> <span class="key">and</span> <span class="nam">alt_key</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">acceptable_migration_issues</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1610" href="#t1610">1610</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1611" href="#t1611">1611</a></span><span class="t"> <span class="key">raise</span> <span class="nam">UnsupportedFeature</span><span class="op">(</span><span class="nam">msg</span><span class="op">,</span> <span class="op">[</span><span class="nam">key</span><span class="op">,</span> <span class="nam">alt_key</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1612" href="#t1612">1612</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">warn</span><span class="op">(</span><span class="nam">msg</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1613" href="#t1613">1613</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1614" href="#t1614">1614</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">saw_dh_debputy</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1615" href="#t1615">1615</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">warn</span><span class="op">(</span><span class="str">"Missing Build-Depends on dh-sequence-zz-debputy"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1616" href="#t1616">1616</a></span><span class="t"> <span class="key">elif</span> <span class="nam">must_use_zz_debputy</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">saw_zz_debputy</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1616 ↛ 1617</span><span class="annotate long">line 1616 didn't jump to line 1617, because the condition on line 1616 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1617" href="#t1617">1617</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1618" href="#t1618">1618</a></span><span class="t"> <span class="str">"Please use the zz-debputy sequence rather than the debputy (needed due to dh add-on load order)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1619" href="#t1619">1619</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1620" href="#t1620">1620</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1621" href="#t1621">1621</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1622" href="#t1622">1622</a></span><span class="t"><span class="key">def</span> <span class="nam">_rename_file_if_exists</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1623" href="#t1623">1623</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1624" href="#t1624">1624</a></span><span class="t"> <span class="nam">source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1625" href="#t1625">1625</a></span><span class="t"> <span class="nam">dest</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1626" href="#t1626">1626</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">:</span> <span class="nam">FeatureMigration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1627" href="#t1627">1627</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1628" href="#t1628">1628</a></span><span class="t"> <span class="nam">source_path</span> <span class="op">=</span> <span class="nam">debian_dir</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">source</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1629" href="#t1629">1629</a></span><span class="t"> <span class="nam">dest_path</span> <span class="op">=</span> <span class="nam">debian_dir</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">dest</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1630" href="#t1630">1630</a></span><span class="t"> <span class="nam">spath</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1631" href="#t1631">1631</a></span><span class="t"> <span class="nam">source_path</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1632" href="#t1632">1632</a></span><span class="t"> <span class="key">if</span> <span class="nam">source_path</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1633" href="#t1633">1633</a></span><span class="t"> <span class="key">else</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">debian_dir</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> <span class="nam">source</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1634" href="#t1634">1634</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1635" href="#t1635">1635</a></span><span class="t"> <span class="nam">dpath</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1636" href="#t1636">1636</a></span><span class="t"> <span class="nam">dest_path</span><span class="op">.</span><span class="nam">path</span> <span class="key">if</span> <span class="nam">dest_path</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">else</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">debian_dir</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> <span class="nam">dest</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1637" href="#t1637">1637</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1638" href="#t1638">1638</a></span><span class="t"> <span class="key">if</span> <span class="nam">source_path</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">source_path</span><span class="op">.</span><span class="nam">is_file</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1639" href="#t1639">1639</a></span><span class="t"> <span class="key">if</span> <span class="nam">dest_path</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1640" href="#t1640">1640</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">dest_path</span><span class="op">.</span><span class="nam">is_file</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1641" href="#t1641">1641</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">warnings</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1642" href="#t1642">1642</a></span><span class="t"> <span class="str">f'TODO: MANUAL MIGRATION - there is a "{spath}" (file) and "{dpath}" (not a file).'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1643" href="#t1643">1643</a></span><span class="t"> <span class="str">f' The migration wanted to replace "{spath}" with "{dpath}", but since "{dpath}" is not'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1644" href="#t1644">1644</a></span><span class="t"> <span class="str">" a file, this step is left as a manual migration."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1645" href="#t1645">1645</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1646" href="#t1646">1646</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1647" href="#t1647">1647</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1648" href="#t1648">1648</a></span><span class="t"> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">call</span><span class="op">(</span><span class="op">[</span><span class="str">"cmp"</span><span class="op">,</span> <span class="str">"-s"</span><span class="op">,</span> <span class="nam">source_path</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">,</span> <span class="nam">dest_path</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1649" href="#t1649">1649</a></span><span class="t"> <span class="op">!=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1650" href="#t1650">1650</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1651" href="#t1651">1651</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">warnings</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1652" href="#t1652">1652</a></span><span class="t"> <span class="str">f'TODO: MANUAL MIGRATION - there is a "{source_path.path}" and "{dest_path.path}"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1653" href="#t1653">1653</a></span><span class="t"> <span class="str">f" file. Normally these files are for the same package and there would only be one of"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1654" href="#t1654">1654</a></span><span class="t"> <span class="str">f" them. In this case, they both exist but their content differs. Be advised that"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1655" href="#t1655">1655</a></span><span class="t"> <span class="str">f' debputy tool will use the "{dest_path.path}".'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1656" href="#t1656">1656</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1657" href="#t1657">1657</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1658" href="#t1658">1658</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">remove_on_success</span><span class="op">(</span><span class="nam">dest_path</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1659" href="#t1659">1659</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1660" href="#t1660">1660</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">rename_on_success</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1661" href="#t1661">1661</a></span><span class="t"> <span class="nam">source_path</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1662" href="#t1662">1662</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">debian_dir</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">,</span> <span class="nam">dest</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1663" href="#t1663">1663</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1664" href="#t1664">1664</a></span><span class="t"> <span class="key">elif</span> <span class="nam">source_path</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1664 ↛ exit</span><span class="annotate long">line 1664 didn't return from function '_rename_file_if_exists', because the condition on line 1664 was never false</span></span></p> - <p class="run"><span class="n"><a id="t1665" href="#t1665">1665</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">warnings</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1666" href="#t1666">1666</a></span><span class="t"> <span class="str">f'TODO: MANUAL MIGRATION - The migration would normally have renamed "{spath}" to "{dpath}".'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1667" href="#t1667">1667</a></span><span class="t"> <span class="str">f' However, the migration assumed "{spath}" would be a file and it is not. Therefore, this step'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1668" href="#t1668">1668</a></span><span class="t"> <span class="str">" as a manual migration."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1669" href="#t1669">1669</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1670" href="#t1670">1670</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1671" href="#t1671">1671</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1672" href="#t1672">1672</a></span><span class="t"><span class="key">def</span> <span class="nam">_find_dh_config_file_for_any_pkg</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1673" href="#t1673">1673</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1674" href="#t1674">1674</a></span><span class="t"> <span class="nam">manifest</span><span class="op">:</span> <span class="nam">HighLevelManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1675" href="#t1675">1675</a></span><span class="t"> <span class="nam">unsupported_config</span><span class="op">:</span> <span class="nam">UnsupportedDHConfig</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1676" href="#t1676">1676</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1677" href="#t1677">1677</a></span><span class="t"> <span class="key">for</span> <span class="nam">dctrl_bin</span> <span class="key">in</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">all_packages</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1678" href="#t1678">1678</a></span><span class="t"> <span class="nam">dh_config_file</span> <span class="op">=</span> <span class="nam">dhe_pkgfile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1679" href="#t1679">1679</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1680" href="#t1680">1680</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1681" href="#t1681">1681</a></span><span class="t"> <span class="nam">unsupported_config</span><span class="op">.</span><span class="nam">dh_config_basename</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1682" href="#t1682">1682</a></span><span class="t"> <span class="nam">bug_950723_prefix_matching</span><span class="op">=</span><span class="nam">unsupported_config</span><span class="op">.</span><span class="nam">bug_950723_prefix_matching</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1683" href="#t1683">1683</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1684" href="#t1684">1684</a></span><span class="t"> <span class="key">if</span> <span class="nam">dh_config_file</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1685" href="#t1685">1685</a></span><span class="t"> <span class="key">yield</span> <span class="nam">dh_config_file</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1686" href="#t1686">1686</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1687" href="#t1687">1687</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1688" href="#t1688">1688</a></span><span class="t"><span class="key">def</span> <span class="nam">_unsupported_debhelper_config_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1689" href="#t1689">1689</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1690" href="#t1690">1690</a></span><span class="t"> <span class="nam">manifest</span><span class="op">:</span> <span class="nam">HighLevelManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1691" href="#t1691">1691</a></span><span class="t"> <span class="nam">unsupported_config</span><span class="op">:</span> <span class="nam">UnsupportedDHConfig</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1692" href="#t1692">1692</a></span><span class="t"> <span class="nam">acceptable_migration_issues</span><span class="op">:</span> <span class="nam">AcceptableMigrationIssues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1693" href="#t1693">1693</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">:</span> <span class="nam">FeatureMigration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1694" href="#t1694">1694</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1695" href="#t1695">1695</a></span><span class="t"> <span class="nam">dh_config_files</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1696" href="#t1696">1696</a></span><span class="t"> <span class="nam">_find_dh_config_file_for_any_pkg</span><span class="op">(</span><span class="nam">debian_dir</span><span class="op">,</span> <span class="nam">manifest</span><span class="op">,</span> <span class="nam">unsupported_config</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1697" href="#t1697">1697</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1698" href="#t1698">1698</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">dh_config_files</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1699" href="#t1699">1699</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1700" href="#t1700">1700</a></span><span class="t"> <span class="nam">dh_tool</span> <span class="op">=</span> <span class="nam">unsupported_config</span><span class="op">.</span><span class="nam">dh_tool</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1701" href="#t1701">1701</a></span><span class="t"> <span class="nam">basename</span> <span class="op">=</span> <span class="nam">unsupported_config</span><span class="op">.</span><span class="nam">dh_config_basename</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1702" href="#t1702">1702</a></span><span class="t"> <span class="nam">file_stem</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1703" href="#t1703">1703</a></span><span class="t"> <span class="str">f"@{basename}"</span> <span class="key">if</span> <span class="nam">unsupported_config</span><span class="op">.</span><span class="nam">bug_950723_prefix_matching</span> <span class="key">else</span> <span class="nam">basename</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1704" href="#t1704">1704</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1705" href="#t1705">1705</a></span><span class="t"> <span class="nam">dh_config_file</span> <span class="op">=</span> <span class="nam">dh_config_files</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1706" href="#t1706">1706</a></span><span class="t"> <span class="key">if</span> <span class="nam">unsupported_config</span><span class="op">.</span><span class="nam">is_missing_migration</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1707" href="#t1707">1707</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1708" href="#t1708">1708</a></span><span class="t"> <span class="str">f'Missing migration support for the "{dh_config_file.path}" debhelper config file'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1709" href="#t1709">1709</a></span><span class="t"> <span class="str">f" (used by {dh_tool}). Manual migration may be feasible depending on the exact features"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1710" href="#t1710">1710</a></span><span class="t"> <span class="str">" required."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1711" href="#t1711">1711</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1712" href="#t1712">1712</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1713" href="#t1713">1713</a></span><span class="t"> <span class="nam">primary_key</span> <span class="op">=</span> <span class="str">f"unsupported-dh-config-file-{file_stem}"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1714" href="#t1714">1714</a></span><span class="t"> <span class="nam">secondary_key</span> <span class="op">=</span> <span class="str">"any-unsupported-dh-config-file"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1715" href="#t1715">1715</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1716" href="#t1716">1716</a></span><span class="t"> <span class="nam">primary_key</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">acceptable_migration_issues</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1717" href="#t1717">1717</a></span><span class="t"> <span class="key">and</span> <span class="nam">secondary_key</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">acceptable_migration_issues</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1718" href="#t1718">1718</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1719" href="#t1719">1719</a></span><span class="t"> <span class="nam">msg</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1720" href="#t1720">1720</a></span><span class="t"> <span class="str">f'The "{dh_config_file.path}" debhelper config file (used by {dh_tool} is currently not'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1721" href="#t1721">1721</a></span><span class="t"> <span class="str">" supported by debputy."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1722" href="#t1722">1722</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1723" href="#t1723">1723</a></span><span class="t"> <span class="key">raise</span> <span class="nam">UnsupportedFeature</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1724" href="#t1724">1724</a></span><span class="t"> <span class="nam">msg</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1725" href="#t1725">1725</a></span><span class="t"> <span class="op">[</span><span class="nam">primary_key</span><span class="op">,</span> <span class="nam">secondary_key</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1726" href="#t1726">1726</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1727" href="#t1727">1727</a></span><span class="t"> <span class="key">for</span> <span class="nam">dh_config_file</span> <span class="key">in</span> <span class="nam">dh_config_files</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1728" href="#t1728">1728</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">.</span><span class="nam">warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1729" href="#t1729">1729</a></span><span class="t"> <span class="str">f'TODO: MANUAL MIGRATION - Use of unsupported "{dh_config_file.path}" file (used by {dh_tool})'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1730" href="#t1730">1730</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_23db3c975895bd86_migrators_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_23db3c975895bd86_models_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_23db3c975895bd86_migrators_py.html b/coverage-report/d_23db3c975895bd86_migrators_py.html deleted file mode 100644 index c9693b9..0000000 --- a/coverage-report/d_23db3c975895bd86_migrators_py.html +++ /dev/null @@ -1,166 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/dh_migration/migrators.py: 100%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/dh_migration/migrators.py</b>: - <span class="pc_cov">100%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">7 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">7<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">0<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_23db3c975895bd86_migration_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_23db3c975895bd86_migrators_impl_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Callable</span><span class="op">,</span> <span class="nam">List</span><span class="op">,</span> <span class="nam">Mapping</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">dh_migration</span><span class="op">.</span><span class="nam">migrators_impl</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> <span class="nam">migrate_links_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> <span class="nam">migrate_maintscript</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="nam">migrate_tmpfile</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">migrate_install_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">migrate_installdocs_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">migrate_installexamples_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">migrate_dh_hook_targets</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">migrate_misspelled_readme_debian_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">migrate_doc_base_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">migrate_lintian_overrides_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">detect_unsupported_zz_debputy_features</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">detect_pam_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">detect_dh_addons</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">migrate_not_installed_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">migrate_installman_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">migrate_bash_completion</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">migrate_installinfo_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">migrate_dh_installsystemd_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">detect_obsolete_substvars</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="nam">detect_dh_addons_zz_debputy_rrr</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">MIGRATION_TARGET_DH_DEBPUTY</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="nam">MIGRATION_TARGET_DH_DEBPUTY_RRR</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">dh_migration</span><span class="op">.</span><span class="nam">models</span> <span class="key">import</span> <span class="nam">AcceptableMigrationIssues</span><span class="op">,</span> <span class="nam">FeatureMigration</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">highlevel_manifest</span> <span class="key">import</span> <span class="nam">HighLevelManifest</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="nam">VirtualPath</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"><span class="nam">Migrator</span> <span class="op">=</span> <span class="nam">Callable</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="op">[</span><span class="nam">VirtualPath</span><span class="op">,</span> <span class="nam">HighLevelManifest</span><span class="op">,</span> <span class="nam">AcceptableMigrationIssues</span><span class="op">,</span> <span class="nam">FeatureMigration</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="nam">MIGRATORS</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">Migrator</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="nam">MIGRATION_TARGET_DH_DEBPUTY_RRR</span><span class="op">:</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">migrate_dh_hook_targets</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="nam">migrate_misspelled_readme_debian_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="nam">detect_dh_addons_zz_debputy_rrr</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">detect_obsolete_substvars</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="nam">MIGRATION_TARGET_DH_DEBPUTY</span><span class="op">:</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="nam">detect_unsupported_zz_debputy_features</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="nam">detect_pam_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="nam">migrate_dh_hook_targets</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="nam">migrate_dh_installsystemd_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="nam">migrate_install_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="nam">migrate_installdocs_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="nam">migrate_installexamples_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="nam">migrate_installman_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="nam">migrate_installinfo_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="nam">migrate_misspelled_readme_debian_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="nam">migrate_doc_base_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">migrate_links_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="nam">migrate_maintscript</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="nam">migrate_tmpfile</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="nam">migrate_lintian_overrides_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="nam">migrate_bash_completion</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="nam">detect_dh_addons</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="nam">detect_obsolete_substvars</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="com"># not-installed should go last, so its rules appear after other installations</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="com"># It is not perfect, but it is a start.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="nam">migrate_not_installed_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"><span class="op">}</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_23db3c975895bd86_migration_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_23db3c975895bd86_migrators_impl_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_23db3c975895bd86_models_py.html b/coverage-report/d_23db3c975895bd86_models_py.html deleted file mode 100644 index e78a17b..0000000 --- a/coverage-report/d_23db3c975895bd86_models_py.html +++ /dev/null @@ -1,272 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/dh_migration/models.py: 84%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/dh_migration/models.py</b>: - <span class="pc_cov">84%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">86 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">75<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">11<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">4<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_23db3c975895bd86_migrators_impl_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_elf_util_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">dataclasses</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">re</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Sequence</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">,</span> <span class="nam">FrozenSet</span><span class="op">,</span> <span class="nam">Tuple</span><span class="op">,</span> <span class="nam">List</span><span class="op">,</span> <span class="nam">cast</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">architecture_support</span> <span class="key">import</span> <span class="nam">DpkgArchitectureBuildProcessValuesTable</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">highlevel_manifest</span> <span class="key">import</span> <span class="nam">MutableYAMLManifest</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">substitution</span> <span class="key">import</span> <span class="nam">Substitution</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="nam">_DH_VAR_RE</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r"([$][{])([A-Za-z0-9][-_:0-9A-Za-z]*)([}])"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="key">class</span> <span class="nam">AcceptableMigrationIssues</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">values</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_values</span> <span class="op">=</span> <span class="nam">values</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="key">def</span> <span class="nam">__contains__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">item</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="key">return</span> <span class="nam">item</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_values</span> <span class="key">or</span> <span class="str">"ALL"</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_values</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"><span class="key">class</span> <span class="nam">UnsupportedFeature</span><span class="op">(</span><span class="nam">RuntimeError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="key">def</span> <span class="nam">message</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="key">return</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"str"</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">args</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="key">def</span> <span class="nam">issue_keys</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">args</span><span class="op">)</span> <span class="op"><</span> <span class="num">2</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="key">return</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"Sequence[str]"</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">args</span><span class="op">[</span><span class="num">1</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"><span class="key">class</span> <span class="nam">ConflictingChange</span><span class="op">(</span><span class="nam">RuntimeError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="key">def</span> <span class="nam">message</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="key">return</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"str"</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">args</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"><span class="key">class</span> <span class="nam">FeatureMigration</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="nam">tagline</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="nam">successful_manifest_changes</span><span class="op">:</span> <span class="nam">int</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">already_present</span><span class="op">:</span> <span class="nam">int</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">warnings</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="nam">dataclasses</span><span class="op">.</span><span class="nam">field</span><span class="op">(</span><span class="nam">default_factory</span><span class="op">=</span><span class="nam">list</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="nam">remove_paths_on_success</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="nam">dataclasses</span><span class="op">.</span><span class="nam">field</span><span class="op">(</span><span class="nam">default_factory</span><span class="op">=</span><span class="nam">list</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="nam">rename_paths_on_success</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="nam">dataclasses</span><span class="op">.</span><span class="nam">field</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="nam">default_factory</span><span class="op">=</span><span class="nam">list</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="nam">assumed_compat</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="nam">required_plugins</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="nam">dataclasses</span><span class="op">.</span><span class="nam">field</span><span class="op">(</span><span class="nam">default_factory</span><span class="op">=</span><span class="nam">list</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="key">def</span> <span class="nam">warn</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">msg</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">warnings</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">msg</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="key">def</span> <span class="nam">rename_on_success</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">dest</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">rename_paths_on_success</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="op">(</span><span class="nam">source</span><span class="op">,</span> <span class="nam">dest</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="key">def</span> <span class="nam">remove_on_success</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">path</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">remove_paths_on_success</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="key">def</span> <span class="nam">require_plugin</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">debputy_plugin</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">required_plugins</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">debputy_plugin</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="key">def</span> <span class="nam">anything_to_do</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="key">return</span> <span class="nam">bool</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">total_changes_involved</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="key">def</span> <span class="nam">performed_changes</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="key">return</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">successful_manifest_changes</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="op">+</span> <span class="nam">len</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">remove_paths_on_success</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="op">+</span> <span class="nam">len</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">rename_paths_on_success</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="key">def</span> <span class="nam">total_changes_involved</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="key">return</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">successful_manifest_changes</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="op">+</span> <span class="nam">len</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">warnings</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="op">+</span> <span class="nam">len</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">remove_paths_on_success</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="op">+</span> <span class="nam">len</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">rename_paths_on_success</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"><span class="key">class</span> <span class="nam">DHMigrationSubstitution</span><span class="op">(</span><span class="nam">Substitution</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="nam">dpkg_arch_table</span><span class="op">:</span> <span class="nam">DpkgArchitectureBuildProcessValuesTable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="nam">acceptable_migration_issues</span><span class="op">:</span> <span class="nam">AcceptableMigrationIssues</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="nam">feature_migration</span><span class="op">:</span> <span class="nam">FeatureMigration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="nam">mutable_manifest</span><span class="op">:</span> <span class="nam">MutableYAMLManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_acceptable_migration_issues</span> <span class="op">=</span> <span class="nam">acceptable_migration_issues</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_dpkg_arch_table</span> <span class="op">=</span> <span class="nam">dpkg_arch_table</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_feature_migration</span> <span class="op">=</span> <span class="nam">feature_migration</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_mutable_manifest</span> <span class="op">=</span> <span class="nam">mutable_manifest</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="com"># TODO: load 1:1 variables from the real subst instance (less stuff to keep in sync)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="nam">one2one</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="str">"DEB_SOURCE"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="str">"DEB_VERSION"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="str">"DEB_VERSION_EPOCH_UPSTREAM"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="str">"DEB_VERSION_UPSTREAM_REVISION"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="str">"DEB_VERSION_UPSTREAM"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="str">"SOURCE_DATE_EPOCH"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_builtin_substs</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="str">"Tab"</span><span class="op">:</span> <span class="str">"{{token:TAB}}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="str">"Space"</span><span class="op">:</span> <span class="str">" "</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="str">"Newline"</span><span class="op">:</span> <span class="str">"{{token:NEWLINE}}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="str">"Dollar"</span><span class="op">:</span> <span class="str">"${}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_builtin_substs</span><span class="op">.</span><span class="nam">update</span><span class="op">(</span><span class="op">(</span><span class="nam">x</span><span class="op">,</span> <span class="str">"{{"</span> <span class="op">+</span> <span class="nam">x</span> <span class="op">+</span> <span class="str">"}}"</span><span class="op">)</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">one2one</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="key">def</span> <span class="nam">_replacement</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">key</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="key">if</span> <span class="nam">key</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_builtin_substs</span><span class="op">:</span> </span><span class="r"><span class="annotate short">115 ↛ 116</span><span class="annotate long">line 115 didn't jump to line 116, because the condition on line 115 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_builtin_substs</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="key">if</span> <span class="nam">key</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_dpkg_arch_table</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="key">return</span> <span class="str">"{{"</span> <span class="op">+</span> <span class="nam">key</span> <span class="op">+</span> <span class="str">"}}"</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="key">if</span> <span class="nam">key</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"env:"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">119 ↛ 120</span><span class="annotate long">line 119 didn't jump to line 120, because the condition on line 119 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="key">if</span> <span class="str">"dh-subst-env"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_acceptable_migration_issues</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="key">raise</span> <span class="nam">UnsupportedFeature</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="str">"Use of environment based substitution variable {{"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="op">+</span> <span class="nam">key</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="op">+</span> <span class="str">"}} is not"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="str">f" supported in debputy. The variable was spotted at {definition_source}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="op">[</span><span class="str">"dh-subst-env"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="key">elif</span> <span class="str">"dh-subst-unknown-variable"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_acceptable_migration_issues</span><span class="op">:</span> </span><span class="r"><span class="annotate short">128 ↛ 129</span><span class="annotate long">line 128 didn't jump to line 129, because the condition on line 128 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="key">raise</span> <span class="nam">UnsupportedFeature</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="str">"Unknown substitution variable {{"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="op">+</span> <span class="nam">key</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="op">+</span> <span class="str">"}}, which does not have a known"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="str">f" counter part in debputy. The variable was spotted at {definition_source}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="op">[</span><span class="str">"dh-subst-unknown-variable"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="nam">manifest_definitions</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_mutable_manifest</span><span class="op">.</span><span class="nam">manifest_definitions</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="nam">create_if_absent</span><span class="op">=</span><span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="nam">manifest_variables</span> <span class="op">=</span> <span class="nam">manifest_definitions</span><span class="op">.</span><span class="nam">manifest_variables</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="nam">create_if_absent</span><span class="op">=</span><span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="key">if</span> <span class="nam">key</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">manifest_variables</span><span class="op">.</span><span class="nam">variables</span><span class="op">:</span> </span><span class="r"><span class="annotate short">142 ↛ 153</span><span class="annotate long">line 142 didn't jump to line 153, because the condition on line 142 was never false</span></span></p> - <p class="run"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="nam">manifest_definitions</span><span class="op">.</span><span class="nam">create_definition_if_missing</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="nam">manifest_variables</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> <span class="op">=</span> <span class="str">"TODO: Provide variable value for "</span> <span class="op">+</span> <span class="nam">key</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_feature_migration</span><span class="op">.</span><span class="nam">warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="str">"TODO: MANUAL MIGRATION of unresolved substitution variable {{"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="op">+</span> <span class="nam">key</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="op">+</span> <span class="str">"}} from"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="op">+</span> <span class="str">f" {definition_source}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_feature_migration</span><span class="op">.</span><span class="nam">successful_manifest_changes</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="key">return</span> <span class="str">"{{"</span> <span class="op">+</span> <span class="nam">key</span> <span class="op">+</span> <span class="str">"}}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="key">def</span> <span class="nam">substitute</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="nam">value</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="op">/</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="nam">escape_glob_characters</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="key">if</span> <span class="str">"${"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">value</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="key">return</span> <span class="nam">value</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="nam">replacement</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_apply_substitution</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="nam">_DH_VAR_RE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="nam">value</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="nam">escape_glob_characters</span><span class="op">=</span><span class="nam">escape_glob_characters</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="key">return</span> <span class="nam">replacement</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">"${}"</span><span class="op">,</span> <span class="str">"$"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="key">def</span> <span class="nam">with_extra_substitutions</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">**</span><span class="nam">extra_substitutions</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="str">"Substitution"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_23db3c975895bd86_migrators_impl_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_elf_util_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_267b6307937f1878___init___py.html b/coverage-report/d_267b6307937f1878___init___py.html deleted file mode 100644 index 25e8dea..0000000 --- a/coverage-report/d_267b6307937f1878___init___py.html +++ /dev/null @@ -1,115 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/__init__.py: 78%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/__init__.py</b>: - <span class="pc_cov">78%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">7 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">6<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">1<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">1<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_08cd1ad648464ded_debputy_self_hosting_test_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878__deb_options_profiles_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">pathlib</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">version</span> <span class="key">import</span> <span class="nam">IS_RELEASE_BUILD</span><span class="op">,</span> <span class="nam">__version__</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="com"># Replaced during install; must be a single line</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="com"># fmt: off</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="nam">DEBPUTY_ROOT_DIR</span> <span class="op">=</span> <span class="nam">pathlib</span><span class="op">.</span><span class="nam">Path</span><span class="op">(</span><span class="nam">__file__</span><span class="op">)</span><span class="op">.</span><span class="nam">parent</span><span class="op">.</span><span class="nam">parent</span><span class="op">.</span><span class="nam">parent</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="nam">DEBPUTY_PLUGIN_ROOT_DIR</span> <span class="op">=</span> <span class="nam">pathlib</span><span class="op">.</span><span class="nam">Path</span><span class="op">(</span><span class="nam">__file__</span><span class="op">)</span><span class="op">.</span><span class="nam">parent</span><span class="op">.</span><span class="nam">parent</span><span class="op">.</span><span class="nam">parent</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="com"># fmt: on</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"><span class="key">if</span> <span class="nam">IS_RELEASE_BUILD</span><span class="op">:</span> </span><span class="r"><span class="annotate short">11 ↛ 12</span><span class="annotate long">line 11 didn't jump to line 12</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">DEBPUTY_DOC_ROOT_DIR</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="str">f"https://salsa.debian.org/debian/debputy/-/blob/debian/{__version__}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"><span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">DEBPUTY_DOC_ROOT_DIR</span> <span class="op">=</span> <span class="str">"https://salsa.debian.org/debian/debputy/-/blob/main"</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_08cd1ad648464ded_debputy_self_hosting_test_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878__deb_options_profiles_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_267b6307937f1878__deb_options_profiles_py.html b/coverage-report/d_267b6307937f1878__deb_options_profiles_py.html deleted file mode 100644 index de2dc63..0000000 --- a/coverage-report/d_267b6307937f1878__deb_options_profiles_py.html +++ /dev/null @@ -1,190 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/_deb_options_profiles.py: 93%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/_deb_options_profiles.py</b>: - <span class="pc_cov">93%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">27 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">25<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">2<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">1<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">1<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878___init___py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878__manifest_constants_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">from</span> <span class="nam">functools</span> <span class="key">import</span> <span class="nam">lru_cache</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">FrozenSet</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">,</span> <span class="nam">Mapping</span><span class="op">,</span> <span class="nam">Dict</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">def</span> <span class="nam">_parse_deb_build_options</span><span class="op">(</span><span class="nam">value</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">res</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="key">for</span> <span class="nam">kvish</span> <span class="key">in</span> <span class="nam">value</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="key">if</span> <span class="str">"="</span> <span class="key">in</span> <span class="nam">kvish</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">key</span><span class="op">,</span> <span class="nam">value</span> <span class="op">=</span> <span class="nam">kvish</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="str">"="</span><span class="op">,</span> <span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">res</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> <span class="op">=</span> <span class="nam">value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">res</span><span class="op">[</span><span class="nam">kvish</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="key">return</span> <span class="nam">res</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"><span class="key">class</span> <span class="nam">DebBuildOptionsAndProfiles</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="str">"""Accessor to common environment related values</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"><span class="str"> >>> env = DebBuildOptionsAndProfiles(environ={'DEB_BUILD_PROFILES': 'noudeb nojava'})</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"><span class="str"> >>> 'noudeb' in env.deb_build_profiles</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"><span class="str"> True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"><span class="str"> >>> 'nojava' in env.deb_build_profiles</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"><span class="str"> True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"><span class="str"> >>> 'nopython' in env.deb_build_profiles</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"><span class="str"> False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"><span class="str"> >>> sorted(env.deb_build_profiles)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"><span class="str"> ['nojava', 'noudeb']</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">environ</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="str">"""Provide a view of the options. Though consider using DebBuildOptionsAndProfiles.instance() instead</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"><span class="str"> :param environ: Alternative to os.environ. Mostly useful for testing purposes</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="key">if</span> <span class="nam">environ</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">37 ↛ 38</span><span class="annotate long">line 37 didn't jump to line 38, because the condition on line 37 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="nam">environ</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">environ</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_deb_build_profiles</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="nam">x</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">environ</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"DEB_BUILD_PROFILES"</span><span class="op">,</span> <span class="str">""</span><span class="op">)</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_deb_build_options</span> <span class="op">=</span> <span class="nam">_parse_deb_build_options</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">environ</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"DEB_BUILD_OPTIONS"</span><span class="op">,</span> <span class="str">""</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="op">@</span><span class="nam">staticmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="op">@</span><span class="nam">lru_cache</span><span class="op">(</span><span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="key">def</span> <span class="nam">instance</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="str">"DebBuildOptionsAndProfiles"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="key">return</span> <span class="nam">DebBuildOptionsAndProfiles</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="key">def</span> <span class="nam">deb_build_profiles</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="str">"""A set-like view of all build profiles active during the build</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"><span class="str"> >>> env = DebBuildOptionsAndProfiles(environ={'DEB_BUILD_PROFILES': 'noudeb nojava'})</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"><span class="str"> >>> 'noudeb' in env.deb_build_profiles</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"><span class="str"> True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"><span class="str"> >>> 'nojava' in env.deb_build_profiles</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"><span class="str"> True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"><span class="str"> >>> 'nopython' in env.deb_build_profiles</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"><span class="str"> False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"><span class="str"> >>> sorted(env.deb_build_profiles)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"><span class="str"> ['nojava', 'noudeb']</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_deb_build_profiles</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="key">def</span> <span class="nam">deb_build_options</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="str">"""A set-like view of all build profiles active during the build</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"><span class="str"> >>> env = DebBuildOptionsAndProfiles(environ={'DEB_BUILD_OPTIONS': 'nostrip parallel=4'})</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"><span class="str"> >>> 'nostrip' in env.deb_build_options</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"><span class="str"> True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"><span class="str"> >>> 'parallel' in env.deb_build_options</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"><span class="str"> True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"><span class="str"> >>> 'noautodbgsym' in env.deb_build_options</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"><span class="str"> False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"><span class="str"> >>> env.deb_build_options['nostrip'] is None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"><span class="str"> True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"><span class="str"> >>> env.deb_build_options['parallel']</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"><span class="str"> '4'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"><span class="str"> >>> env.deb_build_options['noautodbgsym']</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"><span class="str"> Traceback (most recent call last):</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"><span class="str"> ...</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"><span class="str"> KeyError: 'noautodbgsym'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"><span class="str"> >>> sorted(env.deb_build_options)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"><span class="str"> ['nostrip', 'parallel']</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_deb_build_options</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878___init___py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878__manifest_constants_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_267b6307937f1878__manifest_constants_py.html b/coverage-report/d_267b6307937f1878__manifest_constants_py.html deleted file mode 100644 index eeed0d1..0000000 --- a/coverage-report/d_267b6307937f1878__manifest_constants_py.html +++ /dev/null @@ -1,148 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/_manifest_constants.py: 100%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/_manifest_constants.py</b>: - <span class="pc_cov">100%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">37 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">37<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">0<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878__deb_options_profiles_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_architecture_support_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Literal</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="nam">DEFAULT_MANIFEST_VERSION</span> <span class="op">=</span> <span class="str">"0.1"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="nam">SUPPORTED_MANIFEST_VERSIONS</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span><span class="op">[</span><span class="str">"0.1"</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="nam">ManifestVersion</span> <span class="op">=</span> <span class="nam">Literal</span><span class="op">[</span><span class="str">"0.1"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">assert</span> <span class="nam">DEFAULT_MANIFEST_VERSION</span> <span class="key">in</span> <span class="nam">SUPPORTED_MANIFEST_VERSIONS</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="nam">MK_MANIFEST_VERSION</span> <span class="op">=</span> <span class="str">"manifest-version"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="nam">MK_PACKAGES</span> <span class="op">=</span> <span class="str">"packages"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"><span class="nam">MK_INSTALLATIONS</span> <span class="op">=</span> <span class="str">"installations"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="nam">MK_INSTALLATIONS_INSTALL</span> <span class="op">=</span> <span class="str">"install"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"><span class="nam">MK_INSTALLATIONS_MULTI_DEST_INSTALL</span> <span class="op">=</span> <span class="str">"multi-dest-install"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"><span class="nam">MK_INSTALLATIONS_INSTALL_DOCS</span> <span class="op">=</span> <span class="str">"install-docs"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"><span class="nam">MK_INSTALLATIONS_INSTALL_EXAMPLES</span> <span class="op">=</span> <span class="str">"install-examples"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"><span class="nam">MK_INSTALLATIONS_INSTALL_MAN</span> <span class="op">=</span> <span class="str">"install-man"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"><span class="nam">MK_INSTALLATIONS_DISCARD</span> <span class="op">=</span> <span class="str">"discard"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"><span class="nam">MK_INSTALLATIONS_INSTALL_SOURCE</span> <span class="op">=</span> <span class="str">"source"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"><span class="nam">MK_INSTALLATIONS_INSTALL_SOURCES</span> <span class="op">=</span> <span class="str">"sources"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"><span class="nam">MK_INSTALLATIONS_INSTALL_DEST_DIR</span> <span class="op">=</span> <span class="str">"dest-dir"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"><span class="nam">MK_INSTALLATIONS_INSTALL_AS</span> <span class="op">=</span> <span class="str">"as"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"><span class="nam">MK_INSTALLATIONS_INSTALL_INTO</span> <span class="op">=</span> <span class="str">"into"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"><span class="nam">MK_INSTALLATIONS_INSTALL_MAN_LANGUAGE</span> <span class="op">=</span> <span class="str">"language"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"><span class="nam">MK_CONDITION_WHEN</span> <span class="op">=</span> <span class="str">"when"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"><span class="nam">MK_CONDITION_ARCH_MATCHES</span> <span class="op">=</span> <span class="str">"arch-matches"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"><span class="nam">MK_CONDITION_BUILD_PROFILES_MATCHES</span> <span class="op">=</span> <span class="str">"build-profiles-matches"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"><span class="nam">MK_TRANSFORMATIONS</span> <span class="op">=</span> <span class="str">"transformations"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"><span class="nam">MK_TRANSFORMATIONS_CREATE_SYMLINK</span> <span class="op">=</span> <span class="str">"create-symlink"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"><span class="nam">MK_TRANSFORMATIONS_CREATE_SYMLINK_LINK_PATH</span> <span class="op">=</span> <span class="str">"path"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"><span class="nam">MK_TRANSFORMATIONS_CREATE_SYMLINK_LINK_TARGET</span> <span class="op">=</span> <span class="str">"target"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="nam">MK_CONFFILE_MANAGEMENT</span> <span class="op">=</span> <span class="str">"conffile-management"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"><span class="nam">MK_CONFFILE_MANAGEMENT_REMOVE</span> <span class="op">=</span> <span class="str">"remove"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"><span class="nam">MK_CONFFILE_MANAGEMENT_RENAME</span> <span class="op">=</span> <span class="str">"rename"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"><span class="nam">MK_CONFFILE_MANAGEMENT_REMOVE_PATH</span> <span class="op">=</span> <span class="str">"path"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"><span class="nam">MK_CONFFILE_MANAGEMENT_RENAME_SOURCE</span> <span class="op">=</span> <span class="str">"source"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"><span class="nam">MK_CONFFILE_MANAGEMENT_RENAME_TARGET</span> <span class="op">=</span> <span class="str">"target"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"><span class="nam">MK_CONFFILE_MANAGEMENT_X_PRIOR_TO_VERSION</span> <span class="op">=</span> <span class="str">"prior-to-version"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"><span class="nam">MK_CONFFILE_MANAGEMENT_X_OWNING_PACKAGE</span> <span class="op">=</span> <span class="str">"owning-package"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"><span class="nam">MK_MANIFEST_DEFINITIONS</span> <span class="op">=</span> <span class="str">"definitions"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"><span class="nam">MK_MANIFEST_VARIABLES</span> <span class="op">=</span> <span class="str">"variables"</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878__deb_options_profiles_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_architecture_support_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_267b6307937f1878_architecture_support_py.html b/coverage-report/d_267b6307937f1878_architecture_support_py.html deleted file mode 100644 index 1c70df9..0000000 --- a/coverage-report/d_267b6307937f1878_architecture_support_py.html +++ /dev/null @@ -1,332 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/architecture_support.py: 95%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/architecture_support.py</b>: - <span class="pc_cov">95%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">107 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">102<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">5<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">1<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878__manifest_constants_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_builtin_manifest_rules_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">subprocess</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">from</span> <span class="nam">functools</span> <span class="key">import</span> <span class="nam">lru_cache</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Dict</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">,</span> <span class="nam">Iterator</span><span class="op">,</span> <span class="nam">Tuple</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">class</span> <span class="nam">DpkgArchitectureBuildProcessValuesTable</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="str">"""Dict-like interface to dpkg-architecture values"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">mocked_answers</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="str">"""Create a new dpkg-architecture table; NO INSTANTIATION</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"><span class="str"> This object will be created for you; if you need a production instance</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"><span class="str"> then call dpkg_architecture_table(). If you need a testing instance,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"><span class="str"> then call mock_arch_table(...)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"><span class="str"> :param mocked_answers: Used for testing purposes. Do not use directly;</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"><span class="str"> instead use mock_arch_table(...) to create the table you want.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_architecture_cache</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_has_run_dpkg_architecture</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="key">if</span> <span class="nam">mocked_answers</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_architecture_cache</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_respect_environ</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_has_run_dpkg_architecture</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_architecture_cache</span> <span class="op">=</span> <span class="nam">mocked_answers</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_respect_environ</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_has_run_dpkg_architecture</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="key">def</span> <span class="nam">__contains__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">item</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="nam">self</span><span class="op">[</span><span class="nam">item</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="key">except</span> <span class="nam">KeyError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="key">def</span> <span class="nam">__getitem__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">item</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="key">if</span> <span class="nam">item</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_architecture_cache</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_respect_environ</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">value</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">environ</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">item</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="key">if</span> <span class="nam">value</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">43 ↛ 44</span><span class="annotate long">line 43 didn't jump to line 44, because the condition on line 43 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_architecture_cache</span><span class="op">[</span><span class="nam">item</span><span class="op">]</span> <span class="op">=</span> <span class="nam">value</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="key">return</span> <span class="nam">value</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_has_run_dpkg_architecture</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_load_dpkg_architecture_values</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="com"># Fall through and look it up in the cache</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_architecture_cache</span><span class="op">[</span><span class="nam">item</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="key">def</span> <span class="nam">__iter__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_has_run_dpkg_architecture</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_load_dpkg_architecture_values</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_architecture_cache</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="key">def</span> <span class="nam">current_host_arch</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="str">"""The architecture we are building for</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"><span class="str"> This is the architecture name you need if you are in doubt.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">[</span><span class="str">"DEB_HOST_ARCH"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="key">def</span> <span class="nam">current_host_multiarch</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="str">"""The multi-arch path basename</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"><span class="str"> This is the multi-arch basename name you need if you are in doubt. It</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"><span class="str"> goes here:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"><span class="str"> "/usr/lib/{MA}".format(table.current_host_multiarch)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">[</span><span class="str">"DEB_HOST_MULTIARCH"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_cross_compiling</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="str">"""Whether we are cross-compiling</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"><span class="str"> This is defined as DEB_BUILD_GNU_TYPE != DEB_HOST_GNU_TYPE and</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"><span class="str"> affects whether we can rely on being able to run the binaries</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"><span class="str"> that are compiled.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">[</span><span class="str">"DEB_BUILD_GNU_TYPE"</span><span class="op">]</span> <span class="op">!=</span> <span class="nam">self</span><span class="op">[</span><span class="str">"DEB_HOST_GNU_TYPE"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="key">def</span> <span class="nam">_load_dpkg_architecture_values</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="nam">env</span> <span class="op">=</span> <span class="nam">dict</span><span class="op">(</span><span class="nam">os</span><span class="op">.</span><span class="nam">environ</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="com"># For performance, disable dpkg's translation later</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="nam">env</span><span class="op">[</span><span class="str">"DPKG_NLS"</span><span class="op">]</span> <span class="op">=</span> <span class="str">"0"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="nam">kw_pairs</span> <span class="op">=</span> <span class="nam">_parse_dpkg_arch_output</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_output</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="op">[</span><span class="str">"dpkg-architecture"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="nam">env</span><span class="op">=</span><span class="nam">env</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="key">for</span> <span class="nam">k</span><span class="op">,</span> <span class="nam">v</span> <span class="key">in</span> <span class="nam">kw_pairs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_architecture_cache</span><span class="op">[</span><span class="nam">k</span><span class="op">]</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">environ</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">k</span><span class="op">,</span> <span class="nam">v</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_has_run_dpkg_architecture</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"><span class="key">def</span> <span class="nam">_parse_dpkg_arch_output</span><span class="op">(</span><span class="nam">output</span><span class="op">:</span> <span class="nam">bytes</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="nam">text</span> <span class="op">=</span> <span class="nam">output</span><span class="op">.</span><span class="nam">decode</span><span class="op">(</span><span class="str">"utf-8"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="key">for</span> <span class="nam">line</span> <span class="key">in</span> <span class="nam">text</span><span class="op">.</span><span class="nam">splitlines</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="nam">k</span><span class="op">,</span> <span class="nam">v</span> <span class="op">=</span> <span class="nam">line</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="str">"="</span><span class="op">,</span> <span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="key">yield</span> <span class="nam">k</span><span class="op">,</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"><span class="key">def</span> <span class="nam">_rewrite</span><span class="op">(</span><span class="nam">value</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">from_pattern</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">to_pattern</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="key">assert</span> <span class="nam">value</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="nam">from_pattern</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="key">return</span> <span class="nam">to_pattern</span> <span class="op">+</span> <span class="nam">value</span><span class="op">[</span><span class="nam">len</span><span class="op">(</span><span class="nam">from_pattern</span><span class="op">)</span> <span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"><span class="key">def</span> <span class="nam">faked_arch_table</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="nam">host_arch</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="nam">build_arch</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="nam">target_arch</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">DpkgArchitectureBuildProcessValuesTable</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="str">"""Creates a mocked instance of DpkgArchitectureBuildProcessValuesTable</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"><span class="str"> :param host_arch: The dpkg architecture to mock answers for. This affects</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"><span class="str"> DEB_HOST_* values and defines the default for DEB_{BUILD,TARGET}_* if</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"><span class="str"> not overridden.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"><span class="str"> :param build_arch: If set and has a different value than host_arch, then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"><span class="str"> pretend this is a cross-build. This value affects the DEB_BUILD_* values.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"><span class="str"> :param target_arch: If set and has a different value than host_arch, then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"><span class="str"> pretend this is a build _of_ a cross-compiler. This value affects the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"><span class="str"> DEB_TARGET_* values.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="key">if</span> <span class="nam">build_arch</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="nam">build_arch</span> <span class="op">=</span> <span class="nam">host_arch</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="key">if</span> <span class="nam">target_arch</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="nam">target_arch</span> <span class="op">=</span> <span class="nam">host_arch</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="key">return</span> <span class="nam">_faked_arch_tables</span><span class="op">(</span><span class="nam">host_arch</span><span class="op">,</span> <span class="nam">build_arch</span><span class="op">,</span> <span class="nam">target_arch</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"><span class="op">@</span><span class="nam">lru_cache</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"><span class="key">def</span> <span class="nam">_faked_arch_tables</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="nam">host_arch</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">build_arch</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">target_arch</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">DpkgArchitectureBuildProcessValuesTable</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="nam">mock_table</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="nam">env</span> <span class="op">=</span> <span class="nam">dict</span><span class="op">(</span><span class="nam">os</span><span class="op">.</span><span class="nam">environ</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="com"># Set CC to /bin/true avoid a warning from dpkg-architecture</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="nam">env</span><span class="op">[</span><span class="str">"CC"</span><span class="op">]</span> <span class="op">=</span> <span class="str">"/bin/true"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="com"># For performance, disable dpkg's translation later</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="nam">env</span><span class="op">[</span><span class="str">"DPKG_NLS"</span><span class="op">]</span> <span class="op">=</span> <span class="str">"0"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="com"># Clear environ variables that might confuse dpkg-architecture</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="key">for</span> <span class="nam">k</span> <span class="key">in</span> <span class="nam">os</span><span class="op">.</span><span class="nam">environ</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="key">if</span> <span class="nam">k</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"DEB_"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="key">del</span> <span class="nam">env</span><span class="op">[</span><span class="nam">k</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="key">if</span> <span class="nam">build_arch</span> <span class="op">==</span> <span class="nam">host_arch</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="com"># easy / common case - we can handle this with a single call</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="nam">kw_pairs</span> <span class="op">=</span> <span class="nam">_parse_dpkg_arch_output</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_output</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="op">[</span><span class="str">"dpkg-architecture"</span><span class="op">,</span> <span class="str">"-a"</span><span class="op">,</span> <span class="nam">host_arch</span><span class="op">,</span> <span class="str">"-A"</span><span class="op">,</span> <span class="nam">target_arch</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="nam">env</span><span class="op">=</span><span class="nam">env</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="key">for</span> <span class="nam">k</span><span class="op">,</span> <span class="nam">v</span> <span class="key">in</span> <span class="nam">kw_pairs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="key">if</span> <span class="nam">k</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="op">(</span><span class="str">"DEB_HOST_"</span><span class="op">,</span> <span class="str">"DEB_TARGET_"</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="nam">mock_table</span><span class="op">[</span><span class="nam">k</span><span class="op">]</span> <span class="op">=</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="com"># Clone DEB_HOST_* into DEB_BUILD_* as well</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="key">if</span> <span class="nam">k</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"DEB_HOST_"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="nam">k2</span> <span class="op">=</span> <span class="nam">_rewrite</span><span class="op">(</span><span class="nam">k</span><span class="op">,</span> <span class="str">"DEB_HOST_"</span><span class="op">,</span> <span class="str">"DEB_BUILD_"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="nam">mock_table</span><span class="op">[</span><span class="nam">k2</span><span class="op">]</span> <span class="op">=</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="key">elif</span> <span class="nam">build_arch</span> <span class="op">!=</span> <span class="nam">host_arch</span> <span class="key">and</span> <span class="nam">host_arch</span> <span class="op">!=</span> <span class="nam">target_arch</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="com"># This will need two dpkg-architecture calls because we cannot set</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="com"># DEB_BUILD_* directly. But we can set DEB_HOST_* and then rewrite</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="com"># it</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="com"># First handle the build arch</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="nam">kw_pairs</span> <span class="op">=</span> <span class="nam">_parse_dpkg_arch_output</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_output</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="op">[</span><span class="str">"dpkg-architecture"</span><span class="op">,</span> <span class="str">"-a"</span><span class="op">,</span> <span class="nam">build_arch</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="nam">env</span><span class="op">=</span><span class="nam">env</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="key">for</span> <span class="nam">k</span><span class="op">,</span> <span class="nam">v</span> <span class="key">in</span> <span class="nam">kw_pairs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="key">if</span> <span class="nam">k</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"DEB_HOST_"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="nam">k</span> <span class="op">=</span> <span class="nam">_rewrite</span><span class="op">(</span><span class="nam">k</span><span class="op">,</span> <span class="str">"DEB_HOST_"</span><span class="op">,</span> <span class="str">"DEB_BUILD_"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="nam">mock_table</span><span class="op">[</span><span class="nam">k</span><span class="op">]</span> <span class="op">=</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="nam">kw_pairs</span> <span class="op">=</span> <span class="nam">_parse_dpkg_arch_output</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_output</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="op">[</span><span class="str">"dpkg-architecture"</span><span class="op">,</span> <span class="str">"-a"</span><span class="op">,</span> <span class="nam">host_arch</span><span class="op">,</span> <span class="str">"-A"</span><span class="op">,</span> <span class="nam">target_arch</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="nam">env</span><span class="op">=</span><span class="nam">env</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="key">for</span> <span class="nam">k</span><span class="op">,</span> <span class="nam">v</span> <span class="key">in</span> <span class="nam">kw_pairs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="key">if</span> <span class="nam">k</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="op">(</span><span class="str">"DEB_HOST_"</span><span class="op">,</span> <span class="str">"DEB_TARGET_"</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="nam">mock_table</span><span class="op">[</span><span class="nam">k</span><span class="op">]</span> <span class="op">=</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="com"># This is a fun special case. We know that:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="com"># * build_arch != host_arch</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="com"># * host_arch == target_arch</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="com"># otherwise we would have hit one of the previous cases.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="com"># We can do this in a single call to dpkg-architecture by</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="com"># a bit of "cleaver" rewriting.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="com"># - Use -a to set DEB_HOST_* and then rewrite that as</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="com"># DEB_BUILD_*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="com"># - use -A to set DEB_TARGET_* and then use that for both</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="com"># DEB_HOST_* and DEB_TARGET_*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="nam">kw_pairs</span> <span class="op">=</span> <span class="nam">_parse_dpkg_arch_output</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_output</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="op">[</span><span class="str">"dpkg-architecture"</span><span class="op">,</span> <span class="str">"-a"</span><span class="op">,</span> <span class="nam">build_arch</span><span class="op">,</span> <span class="str">"-A"</span><span class="op">,</span> <span class="nam">target_arch</span><span class="op">]</span><span class="op">,</span> <span class="nam">env</span><span class="op">=</span><span class="nam">env</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="key">for</span> <span class="nam">k</span><span class="op">,</span> <span class="nam">v</span> <span class="key">in</span> <span class="nam">kw_pairs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="key">if</span> <span class="nam">k</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"DEB_HOST_"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="nam">k2</span> <span class="op">=</span> <span class="nam">_rewrite</span><span class="op">(</span><span class="nam">k</span><span class="op">,</span> <span class="str">"DEB_HOST_"</span><span class="op">,</span> <span class="str">"DEB_BUILD_"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="nam">mock_table</span><span class="op">[</span><span class="nam">k2</span><span class="op">]</span> <span class="op">=</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="key">if</span> <span class="nam">k</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"DEB_TARGET_"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="nam">mock_table</span><span class="op">[</span><span class="nam">k</span><span class="op">]</span> <span class="op">=</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="nam">k2</span> <span class="op">=</span> <span class="nam">_rewrite</span><span class="op">(</span><span class="nam">k</span><span class="op">,</span> <span class="str">"DEB_TARGET_"</span><span class="op">,</span> <span class="str">"DEB_HOST_"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="nam">mock_table</span><span class="op">[</span><span class="nam">k2</span><span class="op">]</span> <span class="op">=</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="nam">table</span> <span class="op">=</span> <span class="nam">DpkgArchitectureBuildProcessValuesTable</span><span class="op">(</span><span class="nam">mocked_answers</span><span class="op">=</span><span class="nam">mock_table</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="key">return</span> <span class="nam">table</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"><span class="nam">_ARCH_TABLE</span> <span class="op">=</span> <span class="nam">DpkgArchitectureBuildProcessValuesTable</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"><span class="key">def</span> <span class="nam">dpkg_architecture_table</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="nam">DpkgArchitectureBuildProcessValuesTable</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="key">return</span> <span class="nam">_ARCH_TABLE</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878__manifest_constants_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_builtin_manifest_rules_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_267b6307937f1878_builtin_manifest_rules_py.html b/coverage-report/d_267b6307937f1878_builtin_manifest_rules_py.html deleted file mode 100644 index 4cf18e4..0000000 --- a/coverage-report/d_267b6307937f1878_builtin_manifest_rules_py.html +++ /dev/null @@ -1,360 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/builtin_manifest_rules.py: 86%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/builtin_manifest_rules.py</b>: - <span class="pc_cov">86%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">79 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">69<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">10<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">4<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_architecture_support_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_2882d0a735873825___init___py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">re</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Iterable</span><span class="op">,</span> <span class="nam">Tuple</span><span class="op">,</span> <span class="nam">Optional</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">architecture_support</span> <span class="key">import</span> <span class="nam">DpkgArchitectureBuildProcessValuesTable</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">exceptions</span> <span class="key">import</span> <span class="nam">PureVirtualPathError</span><span class="op">,</span> <span class="nam">TestPathWithNonExistentFSPathError</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">intermediate_manifest</span> <span class="key">import</span> <span class="nam">PathType</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">base_types</span> <span class="key">import</span> <span class="nam">SymbolicMode</span><span class="op">,</span> <span class="nam">OctalMode</span><span class="op">,</span> <span class="nam">FileSystemMode</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">AttributePath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">packages</span> <span class="key">import</span> <span class="nam">BinaryPackage</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">path_matcher</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">MATCH_ANYTHING</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">MatchRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">ExactFileSystemPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">DirectoryBasedMatch</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">MatchRuleType</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">BasenameGlobMatch</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">substitution</span> <span class="key">import</span> <span class="nam">Substitution</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">types</span> <span class="key">import</span> <span class="nam">VP</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">_normalize_path</span><span class="op">,</span> <span class="nam">perl_module_dirs</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"><span class="com"># Imported from dh_fixperms</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"><span class="nam">_PERMISSION_NORMALIZATION_SOURCE_DEFINITION</span> <span class="op">=</span> <span class="str">"permission normalization"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"><span class="nam">attribute_path</span> <span class="op">=</span> <span class="nam">AttributePath</span><span class="op">.</span><span class="nam">builtin_path</span><span class="op">(</span><span class="op">)</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="nam">_PERMISSION_NORMALIZATION_SOURCE_DEFINITION</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"><span class="nam">_STD_FILE_MODE</span> <span class="op">=</span> <span class="nam">OctalMode</span><span class="op">(</span><span class="num">0o644</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"><span class="nam">_PATH_FILE_MODE</span> <span class="op">=</span> <span class="nam">OctalMode</span><span class="op">(</span><span class="num">0o755</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"><span class="nam">_HAS_BIN_SHBANG_RE</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">rb"^#!\s*/(?:usr/)?s?bin"</span><span class="op">,</span> <span class="nam">re</span><span class="op">.</span><span class="nam">ASCII</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"><span class="key">class</span> <span class="nam">_UsrShareDocMatchRule</span><span class="op">(</span><span class="nam">DirectoryBasedMatch</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="nam">MatchRuleType</span><span class="op">.</span><span class="nam">ANYTHING_BENEATH_DIR</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="nam">_normalize_path</span><span class="op">(</span><span class="str">"usr/share/doc"</span><span class="op">,</span> <span class="nam">with_prefix</span><span class="op">=</span><span class="key">True</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="nam">path_type</span><span class="op">=</span><span class="nam">PathType</span><span class="op">.</span><span class="nam">FILE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="key">def</span> <span class="nam">finditer</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VP</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">ignore_paths</span><span class="op">=</span><span class="key">None</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">VP</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="nam">doc_dir</span> <span class="op">=</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_directory</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="key">if</span> <span class="nam">doc_dir</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="key">for</span> <span class="nam">path_in_doc_dir</span> <span class="key">in</span> <span class="nam">doc_dir</span><span class="op">.</span><span class="nam">iterdir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="key">if</span> <span class="nam">ignore_paths</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">ignore_paths</span><span class="op">(</span><span class="nam">path_in_doc_dir</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">45 ↛ 46</span><span class="annotate long">line 45 didn't jump to line 46, because the condition on line 45 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="key">if</span> <span class="nam">path_in_doc_dir</span><span class="op">.</span><span class="nam">is_file</span><span class="op">:</span> </span><span class="r"><span class="annotate short">47 ↛ 48</span><span class="annotate long">line 47 didn't jump to line 48, because the condition on line 47 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="key">yield</span> <span class="nam">path_in_doc_dir</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="key">for</span> <span class="nam">subpath</span> <span class="key">in</span> <span class="nam">path_in_doc_dir</span><span class="op">.</span><span class="nam">iterdir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="key">if</span> <span class="nam">subpath</span><span class="op">.</span><span class="nam">name</span> <span class="op">==</span> <span class="str">"examples"</span> <span class="key">and</span> <span class="nam">subpath</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"><span class="annotate short">50 ↛ 51</span><span class="annotate long">line 50 didn't jump to line 51, because the condition on line 50 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="key">if</span> <span class="nam">ignore_paths</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">52 ↛ 59</span><span class="annotate long">line 52 didn't jump to line 59, because the condition on line 52 was never false</span></span></p> - <p class="run"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="nam">f</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="key">for</span> <span class="nam">f</span> <span class="key">in</span> <span class="nam">subpath</span><span class="op">.</span><span class="nam">all_paths</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="key">if</span> <span class="nam">f</span><span class="op">.</span><span class="nam">is_file</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">ignore_paths</span><span class="op">(</span><span class="nam">f</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="op">(</span><span class="nam">f</span> <span class="key">for</span> <span class="nam">f</span> <span class="key">in</span> <span class="nam">subpath</span><span class="op">.</span><span class="nam">all_paths</span><span class="op">(</span><span class="op">)</span> <span class="key">if</span> <span class="nam">f</span><span class="op">.</span><span class="nam">is_file</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="key">def</span> <span class="nam">describe_match_short</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="key">return</span> <span class="str">f"All files beneath {self._directory}/ except .../<pkg>/examples"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="key">def</span> <span class="nam">describe_match_exact</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">describe_match_short</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"><span class="key">class</span> <span class="nam">_ShebangScriptFiles</span><span class="op">(</span><span class="nam">MatchRule</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="nam">MatchRuleType</span><span class="op">.</span><span class="nam">GENERIC_GLOB</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="key">def</span> <span class="nam">finditer</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VP</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">ignore_paths</span><span class="op">=</span><span class="key">None</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">VP</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">all_paths</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">p</span><span class="op">.</span><span class="nam">is_file</span> <span class="key">or</span> <span class="op">(</span><span class="nam">ignore_paths</span> <span class="key">and</span> <span class="nam">ignore_paths</span><span class="op">(</span><span class="nam">p</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="key">with</span> <span class="nam">p</span><span class="op">.</span><span class="nam">open</span><span class="op">(</span><span class="nam">byte_io</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="nam">c</span> <span class="op">=</span> <span class="nam">fd</span><span class="op">.</span><span class="nam">read</span><span class="op">(</span><span class="num">32</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="key">except</span> <span class="op">(</span><span class="nam">PureVirtualPathError</span><span class="op">,</span> <span class="nam">TestPathWithNonExistentFSPathError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="key">if</span> <span class="nam">_HAS_BIN_SHBANG_RE</span><span class="op">.</span><span class="nam">match</span><span class="op">(</span><span class="nam">c</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="key">yield</span> <span class="nam">p</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="key">def</span> <span class="nam">path_type</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">PathType</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="key">return</span> <span class="nam">PathType</span><span class="op">.</span><span class="nam">FILE</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="key">def</span> <span class="nam">_full_pattern</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="key">return</span> <span class="str">"built-in - not a valid pattern"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="key">def</span> <span class="nam">describe_match_short</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="key">return</span> <span class="str">"All scripts with a absolute #!-line for /(s)bin or /usr/(s)bin"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="key">def</span> <span class="nam">describe_match_exact</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">describe_match_short</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"><span class="nam">USR_SHARE_DOC_MATCH_RULE</span> <span class="op">=</span> <span class="nam">_UsrShareDocMatchRule</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"><span class="nam">SHEBANG_SCRIPTS</span> <span class="op">=</span> <span class="nam">_ShebangScriptFiles</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"><span class="key">del</span> <span class="nam">_UsrShareDocMatchRule</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"><span class="key">del</span> <span class="nam">_ShebangScriptFiles</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"><span class="key">def</span> <span class="nam">builtin_mode_normalization_rules</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="nam">dpkg_architecture_variables</span><span class="op">:</span> <span class="nam">DpkgArchitectureBuildProcessValuesTable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="nam">substitution</span><span class="op">:</span> <span class="nam">Substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">MatchRule</span><span class="op">,</span> <span class="nam">FileSystemMode</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="nam">MatchRule</span><span class="op">.</span><span class="nam">from_path_or_glob</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="nam">x</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="nam">_PERMISSION_NORMALIZATION_SOURCE_DEFINITION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="nam">path_type</span><span class="op">=</span><span class="nam">PathType</span><span class="op">.</span><span class="nam">FILE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="nam">_STD_FILE_MODE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="str">"*.so.*"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="str">"*.so"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="str">"*.la"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="str">"*.a"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="str">"*.js"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="str">"*.css"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="str">"*.scss"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="str">"*.sass"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="str">"*.jpeg"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="str">"*.jpg"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="str">"*.png"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="str">"*.gif"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="str">"*.cmxs"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="str">"*.node"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="nam">MatchRule</span><span class="op">.</span><span class="nam">recursive_beneath_directory</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="nam">x</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="nam">_PERMISSION_NORMALIZATION_SOURCE_DEFINITION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="nam">path_type</span><span class="op">=</span><span class="nam">PathType</span><span class="op">.</span><span class="nam">FILE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="nam">_STD_FILE_MODE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="str">"usr/share/man"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="str">"usr/include"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="str">"usr/share/applications"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="str">"usr/share/lintian/overrides"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="com"># The dh_fixperms tool recuses for these directories, but probably should not (see #1006927)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="nam">MatchRule</span><span class="op">.</span><span class="nam">from_path_or_glob</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="str">f"{x}/*"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="nam">_PERMISSION_NORMALIZATION_SOURCE_DEFINITION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="nam">path_type</span><span class="op">=</span><span class="nam">PathType</span><span class="op">.</span><span class="nam">FILE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="nam">_PATH_FILE_MODE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="str">"usr/bin"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="str">"usr/bin/mh"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="str">"bin"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="str">"usr/sbin"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="str">"sbin"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="str">"usr/games"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="str">"usr/libexec"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="str">"etc/init.d"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="key">yield</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="com"># Strictly speaking, dh_fixperms does a recursive search but in practice, it does not matter.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="nam">MatchRule</span><span class="op">.</span><span class="nam">from_path_or_glob</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="str">"etc/sudoers.d/*"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="nam">_PERMISSION_NORMALIZATION_SOURCE_DEFINITION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="nam">path_type</span><span class="op">=</span><span class="nam">PathType</span><span class="op">.</span><span class="nam">FILE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="nam">OctalMode</span><span class="op">(</span><span class="num">0o440</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="com"># The reportbug rule</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="key">yield</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="nam">ExactFileSystemPath</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="nam">substitution</span><span class="op">.</span><span class="nam">substitute</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="nam">_normalize_path</span><span class="op">(</span><span class="str">"usr/share/bug/{{PACKAGE}}"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="nam">_PERMISSION_NORMALIZATION_SOURCE_DEFINITION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="nam">OctalMode</span><span class="op">(</span><span class="num">0o755</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="key">yield</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="nam">MatchRule</span><span class="op">.</span><span class="nam">recursive_beneath_directory</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="str">"usr/share/bug/{{PACKAGE}}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="nam">_PERMISSION_NORMALIZATION_SOURCE_DEFINITION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="nam">path_type</span><span class="op">=</span><span class="nam">PathType</span><span class="op">.</span><span class="nam">FILE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="nam">substitution</span><span class="op">=</span><span class="nam">substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="nam">OctalMode</span><span class="op">(</span><span class="num">0o644</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="key">yield</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="nam">ExactFileSystemPath</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="nam">substitution</span><span class="op">.</span><span class="nam">substitute</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="nam">_normalize_path</span><span class="op">(</span><span class="str">"usr/share/bug/{{PACKAGE}}/script"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="nam">_PERMISSION_NORMALIZATION_SOURCE_DEFINITION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="nam">OctalMode</span><span class="op">(</span><span class="num">0o755</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="key">yield</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="nam">USR_SHARE_DOC_MATCH_RULE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="nam">OctalMode</span><span class="op">(</span><span class="num">0o0644</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="nam">BasenameGlobMatch</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="str">"*.pm"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="nam">only_when_in_directory</span><span class="op">=</span><span class="nam">perl_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="nam">path_type</span><span class="op">=</span><span class="nam">PathType</span><span class="op">.</span><span class="nam">FILE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="nam">recursive_match</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="nam">SymbolicMode</span><span class="op">.</span><span class="nam">parse_filesystem_mode</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="str">"a-x"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">[</span><span class="str">'"*.pm'</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="key">for</span> <span class="nam">perl_dir</span> <span class="key">in</span> <span class="nam">perl_module_dirs</span><span class="op">(</span><span class="nam">dpkg_architecture_variables</span><span class="op">,</span> <span class="nam">dctrl_bin</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="key">yield</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="nam">BasenameGlobMatch</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="str">"*.ali"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="nam">only_when_in_directory</span><span class="op">=</span><span class="nam">_normalize_path</span><span class="op">(</span><span class="str">"usr/lib"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="nam">path_type</span><span class="op">=</span><span class="nam">PathType</span><span class="op">.</span><span class="nam">FILE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="nam">recursive_match</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="nam">SymbolicMode</span><span class="op">.</span><span class="nam">parse_filesystem_mode</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="str">"a-w"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">[</span><span class="str">'"*.ali"'</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="key">yield</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="nam">SHEBANG_SCRIPTS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="nam">_PATH_FILE_MODE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="key">yield</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="nam">MATCH_ANYTHING</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="nam">SymbolicMode</span><span class="op">.</span><span class="nam">parse_filesystem_mode</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="str">"go=rX,u+rw,a-s"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">[</span><span class="str">"**/*"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_architecture_support_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_2882d0a735873825___init___py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_267b6307937f1878_deb_packaging_support_py.html b/coverage-report/d_267b6307937f1878_deb_packaging_support_py.html deleted file mode 100644 index e2bda35..0000000 --- a/coverage-report/d_267b6307937f1878_deb_packaging_support_py.html +++ /dev/null @@ -1,1794 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/deb_packaging_support.py: 13%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/deb_packaging_support.py</b>: - <span class="pc_cov">13%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">799 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">133<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">666<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">1<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">1<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_6e57078c9ef7177d_plugin_cmds_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_debhelper_emulation_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">collections</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">contextlib</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">dataclasses</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">import</span> <span class="nam">datetime</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">import</span> <span class="nam">functools</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">import</span> <span class="nam">hashlib</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">import</span> <span class="nam">itertools</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="key">import</span> <span class="nam">operator</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"><span class="key">import</span> <span class="nam">re</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"><span class="key">import</span> <span class="nam">subprocess</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="key">import</span> <span class="nam">tempfile</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"><span class="key">import</span> <span class="nam">textwrap</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"><span class="key">from</span> <span class="nam">contextlib</span> <span class="key">import</span> <span class="nam">ExitStack</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"><span class="key">from</span> <span class="nam">tempfile</span> <span class="key">import</span> <span class="nam">mkstemp</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">Iterable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">List</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">Set</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">Dict</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">Sequence</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">Iterator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="nam">Literal</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="nam">TypeVar</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="nam">FrozenSet</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="nam">cast</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="nam">Mapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"><span class="key">import</span> <span class="nam">debian</span><span class="op">.</span><span class="nam">deb822</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"><span class="key">from</span> <span class="nam">debian</span><span class="op">.</span><span class="nam">changelog</span> <span class="key">import</span> <span class="nam">Changelog</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"><span class="key">from</span> <span class="nam">debian</span><span class="op">.</span><span class="nam">deb822</span> <span class="key">import</span> <span class="nam">Deb822</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">_deb_options_profiles</span> <span class="key">import</span> <span class="nam">DebBuildOptionsAndProfiles</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">architecture_support</span> <span class="key">import</span> <span class="nam">DpkgArchitectureBuildProcessValuesTable</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">debhelper_emulation</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="nam">dhe_install_pkg_file_as_ctrl_file_if_present</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">dhe_dbgsym_root_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">elf_util</span> <span class="key">import</span> <span class="nam">find_all_elf_files</span><span class="op">,</span> <span class="nam">ELF_MAGIC</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">exceptions</span> <span class="key">import</span> <span class="nam">DebputyDpkgGensymbolsError</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">filesystem_scan</span> <span class="key">import</span> <span class="nam">FSPath</span><span class="op">,</span> <span class="nam">FSROOverlay</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">highlevel_manifest</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="nam">HighLevelManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="nam">PackageTransformationDefinition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="nam">BinaryPackageData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">maintscript_snippet</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="nam">ALL_CONTROL_SCRIPTS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="nam">MaintscriptSnippetContainer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="nam">STD_CONTROL_SCRIPTS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">packages</span> <span class="key">import</span> <span class="nam">BinaryPackage</span><span class="op">,</span> <span class="nam">SourcePackage</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">packaging</span><span class="op">.</span><span class="nam">alternatives</span> <span class="key">import</span> <span class="nam">process_alternatives</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">packaging</span><span class="op">.</span><span class="nam">debconf_templates</span> <span class="key">import</span> <span class="nam">process_debconf_templates</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">packaging</span><span class="op">.</span><span class="nam">makeshlibs</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="nam">compute_shlibs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="nam">ShlibsContent</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="nam">generate_shlib_dirs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">feature_set</span> <span class="key">import</span> <span class="nam">PluginProvidedFeatureSet</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">impl</span> <span class="key">import</span> <span class="nam">ServiceRegistryImpl</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">impl_types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="nam">MetadataOrMaintscriptDetector</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="nam">PackageDataTable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="nam">ServiceManagerDetails</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">spec</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="nam">FlushableSubstvars</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="nam">ServiceDefinition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">debputy</span><span class="op">.</span><span class="nam">binary_package_rules</span> <span class="key">import</span> <span class="nam">ServiceRule</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="nam">_error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="nam">ensure_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="nam">assume_not_none</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="nam">perl_module_dirs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="nam">perlxs_api_dependency</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="nam">detect_fakeroot</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="nam">grouper</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="nam">_info</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="nam">xargs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="nam">escape_shell</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="nam">generated_content_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="nam">print_command</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="nam">_warn</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"><span class="nam">VP</span> <span class="op">=</span> <span class="nam">TypeVar</span><span class="op">(</span><span class="str">"VP"</span><span class="op">,</span> <span class="nam">bound</span><span class="op">=</span><span class="nam">VirtualPath</span><span class="op">,</span> <span class="nam">covariant</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"><span class="nam">_T64_REGEX</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">"^lib.*t64(?:-nss)?$"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"><span class="nam">_T64_PROVIDES</span> <span class="op">=</span> <span class="str">"t64:Provides"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"><span class="key">def</span> <span class="nam">generate_md5sums_file</span><span class="op">(</span><span class="nam">control_output_dir</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="nam">conffiles</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">control_output_dir</span><span class="op">,</span> <span class="str">"conffiles"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="nam">md5sums</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">control_output_dir</span><span class="op">,</span> <span class="str">"md5sums"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="nam">exclude</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="key">if</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">isfile</span><span class="op">(</span><span class="nam">conffiles</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="key">with</span> <span class="nam">open</span><span class="op">(</span><span class="nam">conffiles</span><span class="op">,</span> <span class="str">"rt"</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="key">for</span> <span class="nam">line</span> <span class="key">in</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">line</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="nam">exclude</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="str">"."</span> <span class="op">+</span> <span class="nam">line</span><span class="op">.</span><span class="nam">rstrip</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="nam">had_content</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="nam">files</span> <span class="op">=</span> <span class="nam">sorted</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="nam">path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="key">for</span> <span class="nam">path</span> <span class="key">in</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">all_paths</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_file</span> <span class="key">and</span> <span class="nam">path</span><span class="op">.</span><span class="nam">path</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">exclude</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="com"># Sort in the same order as dh_md5sums, which is not quite the same as dpkg/`all_paths()`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="com"># Compare `.../doc/...` vs `.../doc-base/...` if you want to see the difference between</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="com"># the two approaches.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="nam">key</span><span class="op">=</span><span class="key">lambda</span> <span class="nam">p</span><span class="op">:</span> <span class="nam">p</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="key">with</span> <span class="nam">open</span><span class="op">(</span><span class="nam">md5sums</span><span class="op">,</span> <span class="str">"wt"</span><span class="op">)</span> <span class="key">as</span> <span class="nam">md5fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="key">for</span> <span class="nam">member</span> <span class="key">in</span> <span class="nam">files</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="nam">path</span> <span class="op">=</span> <span class="nam">member</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="key">assert</span> <span class="nam">path</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"./"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="nam">path</span> <span class="op">=</span> <span class="nam">path</span><span class="op">[</span><span class="num">2</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="key">with</span> <span class="nam">member</span><span class="op">.</span><span class="nam">open</span><span class="op">(</span><span class="nam">byte_io</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> <span class="key">as</span> <span class="nam">f</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="nam">file_hash</span> <span class="op">=</span> <span class="nam">hashlib</span><span class="op">.</span><span class="nam">md5</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="key">while</span> <span class="nam">chunk</span> <span class="op">:=</span> <span class="nam">f</span><span class="op">.</span><span class="nam">read</span><span class="op">(</span><span class="num">8192</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="nam">file_hash</span><span class="op">.</span><span class="nam">update</span><span class="op">(</span><span class="nam">chunk</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="nam">had_content</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="nam">md5fd</span><span class="op">.</span><span class="nam">write</span><span class="op">(</span><span class="str">f"{file_hash.hexdigest()} {path}\n"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">had_content</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">unlink</span><span class="op">(</span><span class="nam">md5sums</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"><span class="key">def</span> <span class="nam">install_or_generate_conffiles</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="nam">root_dir</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="nam">conffiles_dest</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">root_dir</span><span class="op">,</span> <span class="str">"conffiles"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="nam">dhe_install_pkg_file_as_ctrl_file_if_present</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="str">"conffiles"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="nam">root_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="num">0o0644</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="nam">etc_dir</span> <span class="op">=</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="str">"etc"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="key">if</span> <span class="nam">etc_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="nam">_add_conffiles</span><span class="op">(</span><span class="nam">conffiles_dest</span><span class="op">,</span> <span class="op">(</span><span class="nam">p</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">etc_dir</span><span class="op">.</span><span class="nam">all_paths</span><span class="op">(</span><span class="op">)</span> <span class="key">if</span> <span class="nam">p</span><span class="op">.</span><span class="nam">is_file</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="key">if</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">isfile</span><span class="op">(</span><span class="nam">conffiles_dest</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">chmod</span><span class="op">(</span><span class="nam">conffiles_dest</span><span class="op">,</span> <span class="num">0o0644</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"><span class="nam">PERL_DEP_PROGRAM</span> <span class="op">=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"><span class="nam">PERL_DEP_INDEP_PM_MODULE</span> <span class="op">=</span> <span class="num">2</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"><span class="nam">PERL_DEP_XS_MODULE</span> <span class="op">=</span> <span class="num">4</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"><span class="nam">PERL_DEP_ARCH_PM_MODULE</span> <span class="op">=</span> <span class="num">8</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"><span class="nam">PERL_DEP_MA_ANY_INCOMPATIBLE_TYPES</span> <span class="op">=</span> <span class="op">~</span><span class="op">(</span><span class="nam">PERL_DEP_PROGRAM</span> <span class="op">|</span> <span class="nam">PERL_DEP_INDEP_PM_MODULE</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"><span class="op">@</span><span class="nam">functools</span><span class="op">.</span><span class="nam">lru_cache</span><span class="op">(</span><span class="num">2</span><span class="op">)</span> <span class="com"># In practice, param will be "perl" or "perl-base"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"><span class="key">def</span> <span class="nam">_dpkg_perl_version</span><span class="op">(</span><span class="nam">package</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="nam">dpkg_version</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="nam">lines</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_output</span><span class="op">(</span><span class="op">[</span><span class="str">"dpkg"</span><span class="op">,</span> <span class="str">"-s"</span><span class="op">,</span> <span class="nam">package</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="op">.</span><span class="nam">decode</span><span class="op">(</span><span class="str">"utf-8"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="op">.</span><span class="nam">splitlines</span><span class="op">(</span><span class="nam">keepends</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="key">for</span> <span class="nam">line</span> <span class="key">in</span> <span class="nam">lines</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="key">if</span> <span class="nam">line</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"Version: "</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="nam">dpkg_version</span> <span class="op">=</span> <span class="nam">line</span><span class="op">[</span><span class="num">8</span><span class="op">:</span><span class="op">]</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="key">assert</span> <span class="nam">dpkg_version</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="key">return</span> <span class="nam">dpkg_version</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"><span class="key">def</span> <span class="nam">handle_perl_code</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="nam">dpkg_architecture_variables</span><span class="op">:</span> <span class="nam">DpkgArchitectureBuildProcessValuesTable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">FSPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="nam">substvars</span><span class="op">:</span> <span class="nam">FlushableSubstvars</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="nam">known_perl_inc_dirs</span> <span class="op">=</span> <span class="nam">perl_module_dirs</span><span class="op">(</span><span class="nam">dpkg_architecture_variables</span><span class="op">,</span> <span class="nam">dctrl_bin</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="nam">detected_dep_requirements</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="com"># MakeMaker always makes lib and share dirs, but typically only one directory is actually used.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="key">for</span> <span class="nam">perl_inc_dir</span> <span class="key">in</span> <span class="nam">known_perl_inc_dirs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="nam">p</span> <span class="op">=</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="nam">perl_inc_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="key">if</span> <span class="nam">p</span> <span class="key">and</span> <span class="nam">p</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="nam">p</span><span class="op">.</span><span class="nam">prune_if_empty_dir</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="com"># FIXME: 80% of this belongs in a metadata detector, but that requires us to expose .walk() in the public API,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="com"># which will not be today.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="key">for</span> <span class="nam">d</span><span class="op">,</span> <span class="nam">pm_mode</span> <span class="key">in</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="op">(</span><span class="nam">known_perl_inc_dirs</span><span class="op">.</span><span class="nam">vendorlib</span><span class="op">,</span> <span class="nam">PERL_DEP_INDEP_PM_MODULE</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="op">(</span><span class="nam">known_perl_inc_dirs</span><span class="op">.</span><span class="nam">vendorarch</span><span class="op">,</span> <span class="nam">PERL_DEP_ARCH_PM_MODULE</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="nam">inc_dir</span> <span class="op">=</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">inc_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="key">for</span> <span class="nam">path</span> <span class="key">in</span> <span class="nam">inc_dir</span><span class="op">.</span><span class="nam">all_paths</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_file</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">".so"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="nam">detected_dep_requirements</span> <span class="op">|=</span> <span class="nam">PERL_DEP_XS_MODULE</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="key">elif</span> <span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">".pm"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="nam">detected_dep_requirements</span> <span class="op">|=</span> <span class="nam">pm_mode</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="key">for</span> <span class="nam">path</span><span class="op">,</span> <span class="nam">children</span> <span class="key">in</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">walk</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span><span class="op">.</span><span class="nam">path</span> <span class="op">==</span> <span class="str">"./usr/share/doc"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="nam">children</span><span class="op">.</span><span class="nam">clear</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="key">not</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_file</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="key">or</span> <span class="key">not</span> <span class="nam">path</span><span class="op">.</span><span class="nam">has_fs_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="key">or</span> <span class="key">not</span> <span class="op">(</span><span class="nam">path</span><span class="op">.</span><span class="nam">is_executable</span> <span class="key">or</span> <span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">".pl"</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="nam">interpreter</span> <span class="op">=</span> <span class="nam">path</span><span class="op">.</span><span class="nam">interpreter</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="key">if</span> <span class="nam">interpreter</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">interpreter</span><span class="op">.</span><span class="nam">command_full_basename</span> <span class="op">==</span> <span class="str">"perl"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="nam">detected_dep_requirements</span> <span class="op">|=</span> <span class="nam">PERL_DEP_PROGRAM</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">detected_dep_requirements</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="nam">dpackage</span> <span class="op">=</span> <span class="str">"perl"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="com"># FIXME: Currently, dh_perl supports perl-base via manual toggle.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="nam">dependency</span> <span class="op">=</span> <span class="nam">dpackage</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="op">(</span><span class="nam">detected_dep_requirements</span> <span class="op">&</span> <span class="nam">PERL_DEP_MA_ANY_INCOMPATIBLE_TYPES</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="nam">dependency</span> <span class="op">+=</span> <span class="str">":any"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="key">if</span> <span class="nam">detected_dep_requirements</span> <span class="op">&</span> <span class="nam">PERL_DEP_XS_MODULE</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="nam">dpkg_version</span> <span class="op">=</span> <span class="nam">_dpkg_perl_version</span><span class="op">(</span><span class="nam">dpackage</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="nam">dependency</span> <span class="op">+=</span> <span class="str">f" (>= {dpkg_version})"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="nam">substvars</span><span class="op">.</span><span class="nam">add_dependency</span><span class="op">(</span><span class="str">"perl:Depends"</span><span class="op">,</span> <span class="nam">dependency</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="key">if</span> <span class="nam">detected_dep_requirements</span> <span class="op">&</span> <span class="op">(</span><span class="nam">PERL_DEP_XS_MODULE</span> <span class="op">|</span> <span class="nam">PERL_DEP_ARCH_PM_MODULE</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="nam">substvars</span><span class="op">.</span><span class="nam">add_dependency</span><span class="op">(</span><span class="str">"perl:Depends"</span><span class="op">,</span> <span class="nam">perlxs_api_dependency</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"><span class="key">def</span> <span class="nam">usr_local_transformation</span><span class="op">(</span><span class="nam">dctrl</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="nam">path</span> <span class="op">=</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="str">"./usr/local"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span> <span class="key">and</span> <span class="nam">any</span><span class="op">(</span><span class="nam">path</span><span class="op">.</span><span class="nam">iterdir</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="com"># There are two key issues:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="com"># 1) Getting the generated maintscript carried on to the final maintscript</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="com"># 2) Making sure that manifest created directories do not trigger the "unused error".</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="str">f"Replacement of /usr/local paths is currently not supported in debputy (triggered by: {dctrl.name})."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"><span class="key">def</span> <span class="nam">_find_and_analyze_systemd_service_files</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="nam">systemd_service_dir</span><span class="op">:</span> <span class="nam">Literal</span><span class="op">[</span><span class="str">"system"</span><span class="op">,</span> <span class="str">"user"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="nam">service_dirs</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="str">f"./usr/lib/systemd/{systemd_service_dir}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="str">f"./lib/systemd/{systemd_service_dir}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="nam">aliases</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="nam">collections</span><span class="op">.</span><span class="nam">defaultdict</span><span class="op">(</span><span class="nam">list</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="nam">seen</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="nam">all_files</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="key">for</span> <span class="nam">d</span> <span class="key">in</span> <span class="nam">service_dirs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="nam">system_dir</span> <span class="op">=</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">system_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="key">for</span> <span class="nam">child</span> <span class="key">in</span> <span class="nam">system_dir</span><span class="op">.</span><span class="nam">iterdir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="key">if</span> <span class="nam">child</span><span class="op">.</span><span class="nam">is_symlink</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="nam">dest</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">basename</span><span class="op">(</span><span class="nam">child</span><span class="op">.</span><span class="nam">readlink</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="nam">aliases</span><span class="op">[</span><span class="nam">dest</span><span class="op">]</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">child</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="key">elif</span> <span class="nam">child</span><span class="op">.</span><span class="nam">is_file</span> <span class="key">and</span> <span class="nam">child</span><span class="op">.</span><span class="nam">name</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">seen</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="nam">seen</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">child</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="nam">all_files</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">child</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="key">return</span> <span class="nam">all_files</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"><span class="key">def</span> <span class="nam">detect_systemd_user_service_files</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="nam">dctrl</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="key">for</span> <span class="nam">service_file</span> <span class="key">in</span> <span class="nam">_find_and_analyze_systemd_service_files</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">,</span> <span class="str">"user"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="str">f'Sorry, systemd user services files are not supported at the moment (saw "{service_file.path}"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> <span class="str">f" in {dctrl.name})"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"><span class="com"># Generally, this should match the release date of oldstable or oldoldstable</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"><span class="nam">_DCH_PRUNE_CUT_OFF_DATE</span> <span class="op">=</span> <span class="nam">datetime</span><span class="op">.</span><span class="nam">date</span><span class="op">(</span><span class="num">2019</span><span class="op">,</span> <span class="num">7</span><span class="op">,</span> <span class="num">6</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"><span class="nam">_DCH_MIN_NUM_OF_ENTRIES</span> <span class="op">=</span> <span class="num">4</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"><span class="key">def</span> <span class="nam">_prune_dch_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="nam">package</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> <span class="nam">is_changelog</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="nam">keep_versions</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="nam">trim</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">bool</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="com"># TODO: Process `d/changelog` once</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="com"># Note we cannot assume that changelog_file is always `d/changelog` as you can have</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="com"># per-package changelogs.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="key">with</span> <span class="nam">path</span><span class="op">.</span><span class="nam">open</span><span class="op">(</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="nam">dch</span> <span class="op">=</span> <span class="nam">Changelog</span><span class="op">(</span><span class="nam">fd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="nam">shortened</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="nam">important_entries</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="nam">binnmu_entries</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_changelog</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="nam">kept_entries</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="key">for</span> <span class="nam">block</span> <span class="key">in</span> <span class="nam">dch</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="key">if</span> <span class="nam">block</span><span class="op">.</span><span class="nam">other_pairs</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"binary-only"</span><span class="op">,</span> <span class="str">"no"</span><span class="op">)</span> <span class="op">==</span> <span class="str">"yes"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="com"># Always keep binNMU entries (they are always in the top) and they do not count</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="com"># towards our kept_entries limit</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> <span class="nam">binnmu_entries</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">block</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> <span class="nam">block_date</span> <span class="op">=</span> <span class="nam">block</span><span class="op">.</span><span class="nam">date</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> <span class="key">if</span> <span class="nam">block_date</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span><span class="str">f"The Debian changelog was missing date in sign off line"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> <span class="nam">entry_date</span> <span class="op">=</span> <span class="nam">datetime</span><span class="op">.</span><span class="nam">datetime</span><span class="op">.</span><span class="nam">strptime</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> <span class="nam">block_date</span><span class="op">,</span> <span class="str">"%a, %d %b %Y %H:%M:%S %z"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> <span class="op">)</span><span class="op">.</span><span class="nam">date</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> <span class="nam">trim</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> <span class="key">and</span> <span class="nam">entry_date</span> <span class="op"><</span> <span class="nam">_DCH_PRUNE_CUT_OFF_DATE</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> <span class="key">and</span> <span class="nam">important_entries</span> <span class="op">>=</span> <span class="nam">_DCH_MIN_NUM_OF_ENTRIES</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> <span class="nam">shortened</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> <span class="com"># Match debhelper in incrementing after the check.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"> <span class="nam">important_entries</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> <span class="nam">kept_entries</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">block</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"> <span class="key">assert</span> <span class="nam">keep_versions</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"> <span class="com"># The NEWS files should match the version for the dch to avoid lintian warnings.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> <span class="com"># If that means we remove all entries in the NEWS file, then we delete the NEWS</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"> <span class="com"># file (see #1021607)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"> <span class="nam">kept_entries</span> <span class="op">=</span> <span class="op">[</span><span class="nam">b</span> <span class="key">for</span> <span class="nam">b</span> <span class="key">in</span> <span class="nam">dch</span> <span class="key">if</span> <span class="nam">b</span><span class="op">.</span><span class="nam">version</span> <span class="key">in</span> <span class="nam">keep_versions</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"> <span class="nam">shortened</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">dch</span><span class="op">)</span> <span class="op">></span> <span class="nam">len</span><span class="op">(</span><span class="nam">kept_entries</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"> <span class="key">if</span> <span class="nam">shortened</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">kept_entries</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"> <span class="nam">path</span><span class="op">.</span><span class="nam">unlink</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span><span class="op">,</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">shortened</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">binnmu_entries</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span><span class="op">,</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"> <span class="nam">parent_dir</span> <span class="op">=</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">path</span><span class="op">.</span><span class="nam">parent_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"> <span class="key">with</span> <span class="nam">path</span><span class="op">.</span><span class="nam">replace_fs_path_content</span><span class="op">(</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fs_path</span><span class="op">,</span> <span class="nam">open</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"> <span class="nam">fs_path</span><span class="op">,</span> <span class="str">"wt"</span><span class="op">,</span> <span class="nam">encoding</span><span class="op">=</span><span class="str">"utf-8"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"> <span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"> <span class="key">for</span> <span class="nam">entry</span> <span class="key">in</span> <span class="nam">kept_entries</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"> <span class="nam">fd</span><span class="op">.</span><span class="nam">write</span><span class="op">(</span><span class="nam">str</span><span class="op">(</span><span class="nam">entry</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_changelog</span> <span class="key">and</span> <span class="nam">shortened</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"> <span class="com"># For changelog (rather than NEWS) files, add a note about how to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"> <span class="com"># get the full version.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"> <span class="nam">msg</span> <span class="op">=</span> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"> <span class="str">f"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"><span class="str"> # Older entries have been removed from this changelog.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"><span class="str"> # To read the complete changelog use `apt changelog {package.name}`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"> <span class="nam">fd</span><span class="op">.</span><span class="nam">write</span><span class="op">(</span><span class="nam">msg</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"> <span class="key">if</span> <span class="nam">binnmu_entries</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"> <span class="key">if</span> <span class="nam">package</span><span class="op">.</span><span class="nam">is_arch_all</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"> <span class="str">f"The package {package.name} is architecture all, but it is built during a binNMU. A binNMU build"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"> <span class="str">" must not include architecture all packages"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"> <span class="key">with</span> <span class="nam">parent_dir</span><span class="op">.</span><span class="nam">add_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"> <span class="str">f"{path.name}.{package.resolved_architecture}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"> <span class="op">)</span> <span class="key">as</span> <span class="nam">binnmu_changelog</span><span class="op">,</span> <span class="nam">open</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"> <span class="nam">binnmu_changelog</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t385" href="#t385">385</a></span><span class="t"> <span class="str">"wt"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t386" href="#t386">386</a></span><span class="t"> <span class="nam">encoding</span><span class="op">=</span><span class="str">"utf-8"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t387" href="#t387">387</a></span><span class="t"> <span class="op">)</span> <span class="key">as</span> <span class="nam">binnmu_fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t388" href="#t388">388</a></span><span class="t"> <span class="key">for</span> <span class="nam">entry</span> <span class="key">in</span> <span class="nam">binnmu_entries</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t389" href="#t389">389</a></span><span class="t"> <span class="nam">binnmu_fd</span><span class="op">.</span><span class="nam">write</span><span class="op">(</span><span class="nam">str</span><span class="op">(</span><span class="nam">entry</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t390" href="#t390">390</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t391" href="#t391">391</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">shortened</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t392" href="#t392">392</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span><span class="op">,</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t393" href="#t393">393</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span><span class="op">,</span> <span class="op">{</span><span class="nam">b</span><span class="op">.</span><span class="nam">version</span> <span class="key">for</span> <span class="nam">b</span> <span class="key">in</span> <span class="nam">kept_entries</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t394" href="#t394">394</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t395" href="#t395">395</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t396" href="#t396">396</a></span><span class="t"><span class="key">def</span> <span class="nam">fixup_debian_changelog_and_news_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t397" href="#t397">397</a></span><span class="t"> <span class="nam">dctrl</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t398" href="#t398">398</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t399" href="#t399">399</a></span><span class="t"> <span class="nam">is_native</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t400" href="#t400">400</a></span><span class="t"> <span class="nam">build_env</span><span class="op">:</span> <span class="nam">DebBuildOptionsAndProfiles</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t401" href="#t401">401</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t402" href="#t402">402</a></span><span class="t"> <span class="nam">doc_dir</span> <span class="op">=</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="str">f"./usr/share/doc/{dctrl.name}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t403" href="#t403">403</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">doc_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t404" href="#t404">404</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t405" href="#t405">405</a></span><span class="t"> <span class="nam">changelog</span> <span class="op">=</span> <span class="nam">doc_dir</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"changelog.Debian"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t406" href="#t406">406</a></span><span class="t"> <span class="key">if</span> <span class="nam">changelog</span> <span class="key">and</span> <span class="nam">is_native</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t407" href="#t407">407</a></span><span class="t"> <span class="nam">changelog</span><span class="op">.</span><span class="nam">name</span> <span class="op">=</span> <span class="str">"changelog"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t408" href="#t408">408</a></span><span class="t"> <span class="key">elif</span> <span class="nam">is_native</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t409" href="#t409">409</a></span><span class="t"> <span class="nam">changelog</span> <span class="op">=</span> <span class="nam">doc_dir</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"changelog"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t410" href="#t410">410</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t411" href="#t411">411</a></span><span class="t"> <span class="nam">trim</span> <span class="op">=</span> <span class="key">False</span> <span class="key">if</span> <span class="str">"notrimdch"</span> <span class="key">in</span> <span class="nam">build_env</span><span class="op">.</span><span class="nam">deb_build_options</span> <span class="key">else</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t412" href="#t412">412</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t413" href="#t413">413</a></span><span class="t"> <span class="nam">kept_entries</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t414" href="#t414">414</a></span><span class="t"> <span class="nam">pruned_changelog</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t415" href="#t415">415</a></span><span class="t"> <span class="key">if</span> <span class="nam">changelog</span> <span class="key">and</span> <span class="nam">changelog</span><span class="op">.</span><span class="nam">has_fs_path</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t416" href="#t416">416</a></span><span class="t"> <span class="nam">pruned_changelog</span><span class="op">,</span> <span class="nam">kept_entries</span> <span class="op">=</span> <span class="nam">_prune_dch_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t417" href="#t417">417</a></span><span class="t"> <span class="nam">dctrl</span><span class="op">,</span> <span class="nam">changelog</span><span class="op">,</span> <span class="key">True</span><span class="op">,</span> <span class="key">None</span><span class="op">,</span> <span class="nam">trim</span><span class="op">=</span><span class="nam">trim</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t418" href="#t418">418</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t419" href="#t419">419</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t420" href="#t420">420</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">trim</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t421" href="#t421">421</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t422" href="#t422">422</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t423" href="#t423">423</a></span><span class="t"> <span class="nam">news_file</span> <span class="op">=</span> <span class="nam">doc_dir</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"NEWS.Debian"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t424" href="#t424">424</a></span><span class="t"> <span class="key">if</span> <span class="nam">news_file</span> <span class="key">and</span> <span class="nam">news_file</span><span class="op">.</span><span class="nam">has_fs_path</span> <span class="key">and</span> <span class="nam">pruned_changelog</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t425" href="#t425">425</a></span><span class="t"> <span class="nam">_prune_dch_file</span><span class="op">(</span><span class="nam">dctrl</span><span class="op">,</span> <span class="nam">news_file</span><span class="op">,</span> <span class="key">False</span><span class="op">,</span> <span class="nam">kept_entries</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t426" href="#t426">426</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t427" href="#t427">427</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t428" href="#t428">428</a></span><span class="t"><span class="nam">_UPSTREAM_CHANGELOG_SOURCE_DIRS</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t429" href="#t429">429</a></span><span class="t"> <span class="str">"."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t430" href="#t430">430</a></span><span class="t"> <span class="str">"doc"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t431" href="#t431">431</a></span><span class="t"> <span class="str">"docs"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t432" href="#t432">432</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t433" href="#t433">433</a></span><span class="t"><span class="nam">_UPSTREAM_CHANGELOG_NAMES</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t434" href="#t434">434</a></span><span class="t"> <span class="com"># The value is a priority to match the debhelper order.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t435" href="#t435">435</a></span><span class="t"> <span class="com"># - The suffix weights heavier than the basename (because that is what debhelper did)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t436" href="#t436">436</a></span><span class="t"> <span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t437" href="#t437">437</a></span><span class="t"> <span class="com"># We list the name/suffix in order of priority in the code. That makes it easier to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t438" href="#t438">438</a></span><span class="t"> <span class="com"># see the priority directly, but it gives the "lowest" value to the most important items</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t439" href="#t439">439</a></span><span class="t"> <span class="str">f"{n}{s}"</span><span class="op">:</span> <span class="op">(</span><span class="nam">sw</span><span class="op">,</span> <span class="nam">nw</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t440" href="#t440">440</a></span><span class="t"> <span class="key">for</span> <span class="op">(</span><span class="nam">nw</span><span class="op">,</span> <span class="nam">n</span><span class="op">)</span><span class="op">,</span> <span class="op">(</span><span class="nam">sw</span><span class="op">,</span> <span class="nam">s</span><span class="op">)</span> <span class="key">in</span> <span class="nam">itertools</span><span class="op">.</span><span class="nam">product</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t441" href="#t441">441</a></span><span class="t"> <span class="nam">enumerate</span><span class="op">(</span><span class="op">[</span><span class="str">"changelog"</span><span class="op">,</span> <span class="str">"changes"</span><span class="op">,</span> <span class="str">"history"</span><span class="op">]</span><span class="op">,</span> <span class="nam">start</span><span class="op">=</span><span class="num">1</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t442" href="#t442">442</a></span><span class="t"> <span class="nam">enumerate</span><span class="op">(</span><span class="op">[</span><span class="str">""</span><span class="op">,</span> <span class="str">".txt"</span><span class="op">,</span> <span class="str">".md"</span><span class="op">,</span> <span class="str">".rst"</span><span class="op">]</span><span class="op">,</span> <span class="nam">start</span><span class="op">=</span><span class="num">1</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t443" href="#t443">443</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t444" href="#t444">444</a></span><span class="t"><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t445" href="#t445">445</a></span><span class="t"><span class="nam">_NONE_TUPLE</span> <span class="op">=</span> <span class="op">(</span><span class="key">None</span><span class="op">,</span> <span class="op">(</span><span class="num">0</span><span class="op">,</span> <span class="num">0</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t446" href="#t446">446</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t447" href="#t447">447</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t448" href="#t448">448</a></span><span class="t"><span class="key">def</span> <span class="nam">_detect_upstream_changelog</span><span class="op">(</span><span class="nam">names</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t449" href="#t449">449</a></span><span class="t"> <span class="nam">matches</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t450" href="#t450">450</a></span><span class="t"> <span class="key">for</span> <span class="nam">name</span> <span class="key">in</span> <span class="nam">names</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t451" href="#t451">451</a></span><span class="t"> <span class="nam">match_priority</span> <span class="op">=</span> <span class="nam">_UPSTREAM_CHANGELOG_NAMES</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">name</span><span class="op">.</span><span class="nam">lower</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t452" href="#t452">452</a></span><span class="t"> <span class="key">if</span> <span class="nam">match_priority</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t453" href="#t453">453</a></span><span class="t"> <span class="nam">matches</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="op">(</span><span class="nam">name</span><span class="op">,</span> <span class="nam">match_priority</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t454" href="#t454">454</a></span><span class="t"> <span class="key">return</span> <span class="nam">min</span><span class="op">(</span><span class="nam">matches</span><span class="op">,</span> <span class="nam">default</span><span class="op">=</span><span class="nam">_NONE_TUPLE</span><span class="op">,</span> <span class="nam">key</span><span class="op">=</span><span class="nam">operator</span><span class="op">.</span><span class="nam">itemgetter</span><span class="op">(</span><span class="num">1</span><span class="op">)</span><span class="op">)</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t455" href="#t455">455</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t456" href="#t456">456</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t457" href="#t457">457</a></span><span class="t"><span class="key">def</span> <span class="nam">install_upstream_changelog</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t458" href="#t458">458</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t459" href="#t459">459</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">FSPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t460" href="#t460">460</a></span><span class="t"> <span class="nam">source_fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t461" href="#t461">461</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t462" href="#t462">462</a></span><span class="t"> <span class="nam">doc_dir</span> <span class="op">=</span> <span class="str">f"./usr/share/doc/{dctrl_bin.name}"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t463" href="#t463">463</a></span><span class="t"> <span class="nam">bdir</span> <span class="op">=</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="nam">doc_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t464" href="#t464">464</a></span><span class="t"> <span class="key">if</span> <span class="nam">bdir</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">bdir</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t465" href="#t465">465</a></span><span class="t"> <span class="com"># "/usr/share/doc/foo -> bar" symlink. Avoid croaking on those per:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t466" href="#t466">466</a></span><span class="t"> <span class="com"># https://salsa.debian.org/debian/debputy/-/issues/49</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t467" href="#t467">467</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t468" href="#t468">468</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t469" href="#t469">469</a></span><span class="t"> <span class="key">if</span> <span class="nam">bdir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t470" href="#t470">470</a></span><span class="t"> <span class="key">if</span> <span class="nam">bdir</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"changelog"</span><span class="op">)</span> <span class="key">or</span> <span class="nam">bdir</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"changelog.gz"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t471" href="#t471">471</a></span><span class="t"> <span class="com"># Upstream's build system already provided the changelog with the correct name.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t472" href="#t472">472</a></span><span class="t"> <span class="com"># Accept that as the canonical one.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t473" href="#t473">473</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t474" href="#t474">474</a></span><span class="t"> <span class="nam">upstream_changelog</span> <span class="op">=</span> <span class="nam">_detect_upstream_changelog</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t475" href="#t475">475</a></span><span class="t"> <span class="nam">p</span><span class="op">.</span><span class="nam">name</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">bdir</span><span class="op">.</span><span class="nam">iterdir</span> <span class="key">if</span> <span class="nam">p</span><span class="op">.</span><span class="nam">is_file</span> <span class="key">and</span> <span class="nam">p</span><span class="op">.</span><span class="nam">has_fs_path</span> <span class="key">and</span> <span class="nam">p</span><span class="op">.</span><span class="nam">size</span> <span class="op">></span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t476" href="#t476">476</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t477" href="#t477">477</a></span><span class="t"> <span class="key">if</span> <span class="nam">upstream_changelog</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t478" href="#t478">478</a></span><span class="t"> <span class="nam">p</span> <span class="op">=</span> <span class="nam">bdir</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="nam">upstream_changelog</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t479" href="#t479">479</a></span><span class="t"> <span class="key">assert</span> <span class="nam">p</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="com"># Mostly as a typing hint</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t480" href="#t480">480</a></span><span class="t"> <span class="nam">p</span><span class="op">.</span><span class="nam">name</span> <span class="op">=</span> <span class="str">"changelog"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t481" href="#t481">481</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t482" href="#t482">482</a></span><span class="t"> <span class="key">for</span> <span class="nam">dirname</span> <span class="key">in</span> <span class="nam">_UPSTREAM_CHANGELOG_SOURCE_DIRS</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t483" href="#t483">483</a></span><span class="t"> <span class="nam">dir_path</span> <span class="op">=</span> <span class="nam">source_fs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="nam">dirname</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t484" href="#t484">484</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">dir_path</span> <span class="key">or</span> <span class="key">not</span> <span class="nam">dir_path</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t485" href="#t485">485</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t486" href="#t486">486</a></span><span class="t"> <span class="nam">changelog_name</span> <span class="op">=</span> <span class="nam">_detect_upstream_changelog</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t487" href="#t487">487</a></span><span class="t"> <span class="nam">p</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t488" href="#t488">488</a></span><span class="t"> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">dir_path</span><span class="op">.</span><span class="nam">iterdir</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t489" href="#t489">489</a></span><span class="t"> <span class="key">if</span> <span class="nam">p</span><span class="op">.</span><span class="nam">is_file</span> <span class="key">and</span> <span class="nam">p</span><span class="op">.</span><span class="nam">has_fs_path</span> <span class="key">and</span> <span class="nam">p</span><span class="op">.</span><span class="nam">size</span> <span class="op">></span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t490" href="#t490">490</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t491" href="#t491">491</a></span><span class="t"> <span class="key">if</span> <span class="nam">changelog_name</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t492" href="#t492">492</a></span><span class="t"> <span class="key">if</span> <span class="nam">bdir</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">492 ↛ 494</span><span class="annotate long">line 492 didn't jump to line 494, because the condition on line 492 was never false</span></span></p> - <p class="run"><span class="n"><a id="t493" href="#t493">493</a></span><span class="t"> <span class="nam">bdir</span> <span class="op">=</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">mkdirs</span><span class="op">(</span><span class="nam">doc_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t494" href="#t494">494</a></span><span class="t"> <span class="nam">bdir</span><span class="op">.</span><span class="nam">insert_file_from_fs_path</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t495" href="#t495">495</a></span><span class="t"> <span class="str">"changelog"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t496" href="#t496">496</a></span><span class="t"> <span class="nam">dir_path</span><span class="op">[</span><span class="nam">changelog_name</span><span class="op">]</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t497" href="#t497">497</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t498" href="#t498">498</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t499" href="#t499">499</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t500" href="#t500">500</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t501" href="#t501">501</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t502" href="#t502">502</a></span><span class="t"><span class="key">class</span> <span class="nam">_ElfInfo</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t503" href="#t503">503</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t504" href="#t504">504</a></span><span class="t"> <span class="nam">fs_path</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t505" href="#t505">505</a></span><span class="t"> <span class="nam">is_stripped</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t506" href="#t506">506</a></span><span class="t"> <span class="nam">build_id</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t507" href="#t507">507</a></span><span class="t"> <span class="nam">dbgsym</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">FSPath</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t508" href="#t508">508</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t509" href="#t509">509</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t510" href="#t510">510</a></span><span class="t"><span class="key">def</span> <span class="nam">_elf_static_lib_walk_filter</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t511" href="#t511">511</a></span><span class="t"> <span class="nam">fs_path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t512" href="#t512">512</a></span><span class="t"> <span class="nam">children</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">VP</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t513" href="#t513">513</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t514" href="#t514">514</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t515" href="#t515">515</a></span><span class="t"> <span class="nam">fs_path</span><span class="op">.</span><span class="nam">name</span> <span class="op">==</span> <span class="str">".build-id"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t516" href="#t516">516</a></span><span class="t"> <span class="key">and</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">fs_path</span><span class="op">.</span><span class="nam">parent_dir</span><span class="op">)</span><span class="op">.</span><span class="nam">name</span> <span class="op">==</span> <span class="str">"debug"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t517" href="#t517">517</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t518" href="#t518">518</a></span><span class="t"> <span class="nam">children</span><span class="op">.</span><span class="nam">clear</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t519" href="#t519">519</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t520" href="#t520">520</a></span><span class="t"> <span class="com"># Deal with some special cases, where certain files are not supposed to be stripped in a given directory</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t521" href="#t521">521</a></span><span class="t"> <span class="key">if</span> <span class="str">"debug/"</span> <span class="key">in</span> <span class="nam">fs_path</span><span class="op">.</span><span class="nam">path</span> <span class="key">or</span> <span class="nam">fs_path</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"debug/"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t522" href="#t522">522</a></span><span class="t"> <span class="com"># FIXME: We need a way to opt out of this per #468333/#1016122</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t523" href="#t523">523</a></span><span class="t"> <span class="key">for</span> <span class="nam">so_file</span> <span class="key">in</span> <span class="op">(</span><span class="nam">f</span> <span class="key">for</span> <span class="nam">f</span> <span class="key">in</span> <span class="nam">list</span><span class="op">(</span><span class="nam">children</span><span class="op">)</span> <span class="key">if</span> <span class="nam">f</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">".so"</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t524" href="#t524">524</a></span><span class="t"> <span class="nam">children</span><span class="op">.</span><span class="nam">remove</span><span class="op">(</span><span class="nam">so_file</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t525" href="#t525">525</a></span><span class="t"> <span class="key">if</span> <span class="str">"/guile/"</span> <span class="key">in</span> <span class="nam">fs_path</span><span class="op">.</span><span class="nam">path</span> <span class="key">or</span> <span class="nam">fs_path</span><span class="op">.</span><span class="nam">name</span> <span class="op">==</span> <span class="str">"guile"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t526" href="#t526">526</a></span><span class="t"> <span class="key">for</span> <span class="nam">go_file</span> <span class="key">in</span> <span class="op">(</span><span class="nam">f</span> <span class="key">for</span> <span class="nam">f</span> <span class="key">in</span> <span class="nam">list</span><span class="op">(</span><span class="nam">children</span><span class="op">)</span> <span class="key">if</span> <span class="nam">f</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">".go"</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t527" href="#t527">527</a></span><span class="t"> <span class="nam">children</span><span class="op">.</span><span class="nam">remove</span><span class="op">(</span><span class="nam">go_file</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t528" href="#t528">528</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t529" href="#t529">529</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t530" href="#t530">530</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t531" href="#t531">531</a></span><span class="t"><span class="op">@</span><span class="nam">contextlib</span><span class="op">.</span><span class="nam">contextmanager</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t532" href="#t532">532</a></span><span class="t"><span class="key">def</span> <span class="nam">_all_elf_files</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">_ElfInfo</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t533" href="#t533">533</a></span><span class="t"> <span class="nam">all_elf_files</span> <span class="op">=</span> <span class="nam">find_all_elf_files</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t534" href="#t534">534</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t535" href="#t535">535</a></span><span class="t"> <span class="nam">walk_filter</span><span class="op">=</span><span class="nam">_elf_static_lib_walk_filter</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t536" href="#t536">536</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t537" href="#t537">537</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">all_elf_files</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t538" href="#t538">538</a></span><span class="t"> <span class="key">yield</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t539" href="#t539">539</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t540" href="#t540">540</a></span><span class="t"> <span class="key">with</span> <span class="nam">ExitStack</span><span class="op">(</span><span class="op">)</span> <span class="key">as</span> <span class="nam">cm_stack</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t541" href="#t541">541</a></span><span class="t"> <span class="nam">resolved</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t542" href="#t542">542</a></span><span class="t"> <span class="op">(</span><span class="nam">p</span><span class="op">,</span> <span class="nam">cm_stack</span><span class="op">.</span><span class="nam">enter_context</span><span class="op">(</span><span class="nam">p</span><span class="op">.</span><span class="nam">replace_fs_path_content</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t543" href="#t543">543</a></span><span class="t"> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">all_elf_files</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t544" href="#t544">544</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t545" href="#t545">545</a></span><span class="t"> <span class="nam">elf_info</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t546" href="#t546">546</a></span><span class="t"> <span class="nam">fs_path</span><span class="op">:</span> <span class="nam">_ElfInfo</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t547" href="#t547">547</a></span><span class="t"> <span class="nam">path</span><span class="op">=</span><span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="nam">detached_path</span><span class="op">.</span><span class="nam">path</span><span class="op">)</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t548" href="#t548">548</a></span><span class="t"> <span class="nam">fs_path</span><span class="op">=</span><span class="nam">fs_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t549" href="#t549">549</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t550" href="#t550">550</a></span><span class="t"> <span class="key">for</span> <span class="nam">detached_path</span><span class="op">,</span> <span class="nam">fs_path</span> <span class="key">in</span> <span class="nam">resolved</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t551" href="#t551">551</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t552" href="#t552">552</a></span><span class="t"> <span class="nam">_resolve_build_ids</span><span class="op">(</span><span class="nam">elf_info</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t553" href="#t553">553</a></span><span class="t"> <span class="key">yield</span> <span class="nam">elf_info</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t554" href="#t554">554</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t555" href="#t555">555</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t556" href="#t556">556</a></span><span class="t"><span class="key">def</span> <span class="nam">_find_all_static_libs</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t557" href="#t557">557</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">FSPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t558" href="#t558">558</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">FSPath</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t559" href="#t559">559</a></span><span class="t"> <span class="key">for</span> <span class="nam">path</span><span class="op">,</span> <span class="nam">children</span> <span class="key">in</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">walk</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t560" href="#t560">560</a></span><span class="t"> <span class="com"># Matching the logic of dh_strip for now.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t561" href="#t561">561</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">_elf_static_lib_walk_filter</span><span class="op">(</span><span class="nam">path</span><span class="op">,</span> <span class="nam">children</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t562" href="#t562">562</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t563" href="#t563">563</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_file</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t564" href="#t564">564</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t565" href="#t565">565</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"lib"</span><span class="op">)</span> <span class="key">and</span> <span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"_g.a"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t566" href="#t566">566</a></span><span class="t"> <span class="com"># _g.a are historically ignored. I do not remember why, but guessing the "_g" is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t567" href="#t567">567</a></span><span class="t"> <span class="com"># an encoding of gcc's -g parameter into the filename (with -g meaning "I want debug</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t568" href="#t568">568</a></span><span class="t"> <span class="com"># symbols")</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t569" href="#t569">569</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t570" href="#t570">570</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">path</span><span class="op">.</span><span class="nam">has_fs_path</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t571" href="#t571">571</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t572" href="#t572">572</a></span><span class="t"> <span class="key">with</span> <span class="nam">path</span><span class="op">.</span><span class="nam">open</span><span class="op">(</span><span class="nam">byte_io</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t573" href="#t573">573</a></span><span class="t"> <span class="nam">magic</span> <span class="op">=</span> <span class="nam">fd</span><span class="op">.</span><span class="nam">read</span><span class="op">(</span><span class="num">8</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t574" href="#t574">574</a></span><span class="t"> <span class="key">if</span> <span class="nam">magic</span> <span class="key">not</span> <span class="key">in</span> <span class="op">(</span><span class="str">b"!<arch>\n"</span><span class="op">,</span> <span class="str">b"!<thin>\n"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t575" href="#t575">575</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t576" href="#t576">576</a></span><span class="t"> <span class="com"># Maybe we should see if the first file looks like an index file.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t577" href="#t577">577</a></span><span class="t"> <span class="com"># Three random .a samples suggests the index file is named "/"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t578" href="#t578">578</a></span><span class="t"> <span class="com"># Not sure if we should skip past it and then do the ELF check or just assume</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t579" href="#t579">579</a></span><span class="t"> <span class="com"># that "index => static lib".</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t580" href="#t580">580</a></span><span class="t"> <span class="nam">data</span> <span class="op">=</span> <span class="nam">fd</span><span class="op">.</span><span class="nam">read</span><span class="op">(</span><span class="num">1024</span> <span class="op">*</span> <span class="num">1024</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t581" href="#t581">581</a></span><span class="t"> <span class="key">if</span> <span class="str">b"\0"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">data</span> <span class="key">and</span> <span class="nam">ELF_MAGIC</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">data</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t582" href="#t582">582</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t583" href="#t583">583</a></span><span class="t"> <span class="key">yield</span> <span class="nam">path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t584" href="#t584">584</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t585" href="#t585">585</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t586" href="#t586">586</a></span><span class="t"><span class="op">@</span><span class="nam">contextlib</span><span class="op">.</span><span class="nam">contextmanager</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t587" href="#t587">587</a></span><span class="t"><span class="key">def</span> <span class="nam">_all_static_libs</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">:</span> <span class="nam">FSPath</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t588" href="#t588">588</a></span><span class="t"> <span class="nam">all_static_libs</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">_find_all_static_libs</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t589" href="#t589">589</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">all_static_libs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t590" href="#t590">590</a></span><span class="t"> <span class="key">yield</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t591" href="#t591">591</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t592" href="#t592">592</a></span><span class="t"> <span class="key">with</span> <span class="nam">ExitStack</span><span class="op">(</span><span class="op">)</span> <span class="key">as</span> <span class="nam">cm_stack</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t593" href="#t593">593</a></span><span class="t"> <span class="nam">resolved</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t594" href="#t594">594</a></span><span class="t"> <span class="nam">cm_stack</span><span class="op">.</span><span class="nam">enter_context</span><span class="op">(</span><span class="nam">p</span><span class="op">.</span><span class="nam">replace_fs_path_content</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">all_static_libs</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t595" href="#t595">595</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t596" href="#t596">596</a></span><span class="t"> <span class="key">yield</span> <span class="nam">resolved</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t597" href="#t597">597</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t598" href="#t598">598</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t599" href="#t599">599</a></span><span class="t"><span class="nam">_FILE_BUILD_ID_RE</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">rb"BuildID(?:\[\S+\])?=([A-Fa-f0-9]+)"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t600" href="#t600">600</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t601" href="#t601">601</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t602" href="#t602">602</a></span><span class="t"><span class="key">def</span> <span class="nam">_resolve_build_ids</span><span class="op">(</span><span class="nam">elf_info</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">_ElfInfo</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t603" href="#t603">603</a></span><span class="t"> <span class="nam">static_cmd</span> <span class="op">=</span> <span class="op">[</span><span class="str">"file"</span><span class="op">,</span> <span class="str">"-00"</span><span class="op">,</span> <span class="str">"-N"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t604" href="#t604">604</a></span><span class="t"> <span class="key">if</span> <span class="nam">detect_fakeroot</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t605" href="#t605">605</a></span><span class="t"> <span class="nam">static_cmd</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">"--no-sandbox"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t606" href="#t606">606</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t607" href="#t607">607</a></span><span class="t"> <span class="key">for</span> <span class="nam">cmd</span> <span class="key">in</span> <span class="nam">xargs</span><span class="op">(</span><span class="nam">static_cmd</span><span class="op">,</span> <span class="op">(</span><span class="nam">i</span><span class="op">.</span><span class="nam">fs_path</span> <span class="key">for</span> <span class="nam">i</span> <span class="key">in</span> <span class="nam">elf_info</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t608" href="#t608">608</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"Looking up build-ids via: {escape_shell(*cmd)}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t609" href="#t609">609</a></span><span class="t"> <span class="nam">output</span> <span class="op">=</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_output</span><span class="op">(</span><span class="nam">cmd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t610" href="#t610">610</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t611" href="#t611">611</a></span><span class="t"> <span class="com"># Trailing "\0" gives an empty element in the end when splitting, so strip it out</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t612" href="#t612">612</a></span><span class="t"> <span class="nam">lines</span> <span class="op">=</span> <span class="nam">output</span><span class="op">.</span><span class="nam">rstrip</span><span class="op">(</span><span class="str">b"\0"</span><span class="op">)</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="str">b"\0"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t613" href="#t613">613</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t614" href="#t614">614</a></span><span class="t"> <span class="key">for</span> <span class="nam">fs_path_b</span><span class="op">,</span> <span class="nam">verdict</span> <span class="key">in</span> <span class="nam">grouper</span><span class="op">(</span><span class="nam">lines</span><span class="op">,</span> <span class="num">2</span><span class="op">,</span> <span class="nam">incomplete</span><span class="op">=</span><span class="str">"strict"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t615" href="#t615">615</a></span><span class="t"> <span class="nam">fs_path</span> <span class="op">=</span> <span class="nam">fs_path_b</span><span class="op">.</span><span class="nam">decode</span><span class="op">(</span><span class="str">"utf-8"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t616" href="#t616">616</a></span><span class="t"> <span class="nam">info</span> <span class="op">=</span> <span class="nam">elf_info</span><span class="op">[</span><span class="nam">fs_path</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t617" href="#t617">617</a></span><span class="t"> <span class="nam">info</span><span class="op">.</span><span class="nam">is_stripped</span> <span class="op">=</span> <span class="str">b"not stripped"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">verdict</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t618" href="#t618">618</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="nam">_FILE_BUILD_ID_RE</span><span class="op">.</span><span class="nam">search</span><span class="op">(</span><span class="nam">verdict</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t619" href="#t619">619</a></span><span class="t"> <span class="key">if</span> <span class="nam">m</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t620" href="#t620">620</a></span><span class="t"> <span class="nam">info</span><span class="op">.</span><span class="nam">build_id</span> <span class="op">=</span> <span class="nam">m</span><span class="op">.</span><span class="nam">group</span><span class="op">(</span><span class="num">1</span><span class="op">)</span><span class="op">.</span><span class="nam">decode</span><span class="op">(</span><span class="str">"utf-8"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t621" href="#t621">621</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t622" href="#t622">622</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t623" href="#t623">623</a></span><span class="t"><span class="key">def</span> <span class="nam">_make_debug_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t624" href="#t624">624</a></span><span class="t"> <span class="nam">objcopy</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">fs_path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">build_id</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">dbgsym_fs_root</span><span class="op">:</span> <span class="nam">FSPath</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t625" href="#t625">625</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">FSPath</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t626" href="#t626">626</a></span><span class="t"> <span class="nam">dbgsym_dirname</span> <span class="op">=</span> <span class="str">f"./usr/lib/debug/.build-id/{build_id[0:2]}/"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t627" href="#t627">627</a></span><span class="t"> <span class="nam">dbgsym_basename</span> <span class="op">=</span> <span class="str">f"{build_id[2:]}.debug"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t628" href="#t628">628</a></span><span class="t"> <span class="nam">dbgsym_dir</span> <span class="op">=</span> <span class="nam">dbgsym_fs_root</span><span class="op">.</span><span class="nam">mkdirs</span><span class="op">(</span><span class="nam">dbgsym_dirname</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t629" href="#t629">629</a></span><span class="t"> <span class="key">if</span> <span class="nam">dbgsym_basename</span> <span class="key">in</span> <span class="nam">dbgsym_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t630" href="#t630">630</a></span><span class="t"> <span class="key">return</span> <span class="nam">dbgsym_dir</span><span class="op">[</span><span class="nam">dbgsym_basename</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t631" href="#t631">631</a></span><span class="t"> <span class="com"># objcopy is a pain and includes the basename verbatim when you do `--add-gnu-debuglink` without having an option</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t632" href="#t632">632</a></span><span class="t"> <span class="com"># to overwrite the physical basename. So we have to ensure that the physical basename matches the installed</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t633" href="#t633">633</a></span><span class="t"> <span class="com"># basename.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t634" href="#t634">634</a></span><span class="t"> <span class="key">with</span> <span class="nam">dbgsym_dir</span><span class="op">.</span><span class="nam">add_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t635" href="#t635">635</a></span><span class="t"> <span class="nam">dbgsym_basename</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t636" href="#t636">636</a></span><span class="t"> <span class="nam">unlink_if_exists</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t637" href="#t637">637</a></span><span class="t"> <span class="nam">fs_basename_matters</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t638" href="#t638">638</a></span><span class="t"> <span class="nam">subdir_key</span><span class="op">=</span><span class="str">"dbgsym-build-ids"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t639" href="#t639">639</a></span><span class="t"> <span class="op">)</span> <span class="key">as</span> <span class="nam">dbgsym</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t640" href="#t640">640</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t641" href="#t641">641</a></span><span class="t"> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_call</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t642" href="#t642">642</a></span><span class="t"> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t643" href="#t643">643</a></span><span class="t"> <span class="nam">objcopy</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t644" href="#t644">644</a></span><span class="t"> <span class="str">"--only-keep-debug"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t645" href="#t645">645</a></span><span class="t"> <span class="str">"--compress-debug-sections"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t646" href="#t646">646</a></span><span class="t"> <span class="nam">fs_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t647" href="#t647">647</a></span><span class="t"> <span class="nam">dbgsym</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t648" href="#t648">648</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t649" href="#t649">649</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t650" href="#t650">650</a></span><span class="t"> <span class="key">except</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">CalledProcessError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t651" href="#t651">651</a></span><span class="t"> <span class="nam">full_command</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t652" href="#t652">652</a></span><span class="t"> <span class="str">f"{objcopy} --only-keep-debug --compress-debug-sections"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t653" href="#t653">653</a></span><span class="t"> <span class="str">f" {escape_shell(fs_path, dbgsym.fs_path)}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t654" href="#t654">654</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t655" href="#t655">655</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t656" href="#t656">656</a></span><span class="t"> <span class="str">f"Attempting to create a .debug file failed. Please review the error message from {objcopy} to"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t657" href="#t657">657</a></span><span class="t"> <span class="str">f" understand what went wrong. Full command was: {full_command}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t658" href="#t658">658</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t659" href="#t659">659</a></span><span class="t"> <span class="key">return</span> <span class="nam">dbgsym</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t660" href="#t660">660</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t661" href="#t661">661</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t662" href="#t662">662</a></span><span class="t"><span class="key">def</span> <span class="nam">_strip_binary</span><span class="op">(</span><span class="nam">strip</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">options</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">paths</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t663" href="#t663">663</a></span><span class="t"> <span class="com"># We assume the paths are obtained via `p.replace_fs_path_content()`,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t664" href="#t664">664</a></span><span class="t"> <span class="com"># which is the case at the time of written and should remain so forever.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t665" href="#t665">665</a></span><span class="t"> <span class="nam">it</span> <span class="op">=</span> <span class="nam">iter</span><span class="op">(</span><span class="nam">paths</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t666" href="#t666">666</a></span><span class="t"> <span class="nam">first</span> <span class="op">=</span> <span class="nam">next</span><span class="op">(</span><span class="nam">it</span><span class="op">,</span> <span class="key">None</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t667" href="#t667">667</a></span><span class="t"> <span class="key">if</span> <span class="nam">first</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t668" href="#t668">668</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t669" href="#t669">669</a></span><span class="t"> <span class="nam">static_cmd</span> <span class="op">=</span> <span class="op">[</span><span class="nam">strip</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t670" href="#t670">670</a></span><span class="t"> <span class="nam">static_cmd</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">options</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t671" href="#t671">671</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t672" href="#t672">672</a></span><span class="t"> <span class="key">for</span> <span class="nam">cmd</span> <span class="key">in</span> <span class="nam">xargs</span><span class="op">(</span><span class="nam">static_cmd</span><span class="op">,</span> <span class="nam">itertools</span><span class="op">.</span><span class="nam">chain</span><span class="op">(</span><span class="op">(</span><span class="nam">first</span><span class="op">,</span><span class="op">)</span><span class="op">,</span> <span class="op">(</span><span class="nam">f</span> <span class="key">for</span> <span class="nam">f</span> <span class="key">in</span> <span class="nam">it</span><span class="op">)</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t673" href="#t673">673</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"Removing unnecessary ELF debug info via: {escape_shell(*cmd)}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t674" href="#t674">674</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t675" href="#t675">675</a></span><span class="t"> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_call</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t676" href="#t676">676</a></span><span class="t"> <span class="nam">cmd</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t677" href="#t677">677</a></span><span class="t"> <span class="nam">stdin</span><span class="op">=</span><span class="nam">subprocess</span><span class="op">.</span><span class="nam">DEVNULL</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t678" href="#t678">678</a></span><span class="t"> <span class="nam">restore_signals</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t679" href="#t679">679</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t680" href="#t680">680</a></span><span class="t"> <span class="key">except</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">CalledProcessError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t681" href="#t681">681</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t682" href="#t682">682</a></span><span class="t"> <span class="str">f"Attempting to remove ELF debug info failed. Please review the error from {strip} above"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t683" href="#t683">683</a></span><span class="t"> <span class="str">f" understand what went wrong."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t684" href="#t684">684</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t685" href="#t685">685</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t686" href="#t686">686</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t687" href="#t687">687</a></span><span class="t"><span class="key">def</span> <span class="nam">_attach_debug</span><span class="op">(</span><span class="nam">objcopy</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">elf_binary</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> <span class="nam">dbgsym</span><span class="op">:</span> <span class="nam">FSPath</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t688" href="#t688">688</a></span><span class="t"> <span class="nam">dbgsym_fs_path</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t689" href="#t689">689</a></span><span class="t"> <span class="key">with</span> <span class="nam">dbgsym</span><span class="op">.</span><span class="nam">replace_fs_path_content</span><span class="op">(</span><span class="op">)</span> <span class="key">as</span> <span class="nam">dbgsym_fs_path</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t690" href="#t690">690</a></span><span class="t"> <span class="nam">cmd</span> <span class="op">=</span> <span class="op">[</span><span class="nam">objcopy</span><span class="op">,</span> <span class="str">"--add-gnu-debuglink"</span><span class="op">,</span> <span class="nam">dbgsym_fs_path</span><span class="op">,</span> <span class="nam">elf_binary</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t691" href="#t691">691</a></span><span class="t"> <span class="nam">print_command</span><span class="op">(</span><span class="op">*</span><span class="nam">cmd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t692" href="#t692">692</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t693" href="#t693">693</a></span><span class="t"> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_call</span><span class="op">(</span><span class="nam">cmd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t694" href="#t694">694</a></span><span class="t"> <span class="key">except</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">CalledProcessError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t695" href="#t695">695</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t696" href="#t696">696</a></span><span class="t"> <span class="str">f"Attempting to attach ELF debug link to ELF binary failed. Please review the error from {objcopy}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t697" href="#t697">697</a></span><span class="t"> <span class="str">f" above understand what went wrong."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t698" href="#t698">698</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t699" href="#t699">699</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t700" href="#t700">700</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t701" href="#t701">701</a></span><span class="t"><span class="key">def</span> <span class="nam">_run_dwz</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t702" href="#t702">702</a></span><span class="t"> <span class="nam">dctrl</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t703" href="#t703">703</a></span><span class="t"> <span class="nam">dbgsym_fs_root</span><span class="op">:</span> <span class="nam">FSPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t704" href="#t704">704</a></span><span class="t"> <span class="nam">unstripped_elf_info</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">_ElfInfo</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t705" href="#t705">705</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t706" href="#t706">706</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">unstripped_elf_info</span> <span class="key">or</span> <span class="nam">dctrl</span><span class="op">.</span><span class="nam">is_udeb</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t707" href="#t707">707</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t708" href="#t708">708</a></span><span class="t"> <span class="nam">dwz_cmd</span> <span class="op">=</span> <span class="op">[</span><span class="str">"dwz"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t709" href="#t709">709</a></span><span class="t"> <span class="nam">dwz_ma_dir_name</span> <span class="op">=</span> <span class="str">f"usr/lib/debug/.dwz/{dctrl.deb_multiarch}"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t710" href="#t710">710</a></span><span class="t"> <span class="nam">dwz_ma_basename</span> <span class="op">=</span> <span class="str">f"{dctrl.name}.debug"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t711" href="#t711">711</a></span><span class="t"> <span class="nam">multifile</span> <span class="op">=</span> <span class="str">f"{dwz_ma_dir_name}/{dwz_ma_basename}"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t712" href="#t712">712</a></span><span class="t"> <span class="nam">build_time_multifile</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t713" href="#t713">713</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">unstripped_elf_info</span><span class="op">)</span> <span class="op">></span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t714" href="#t714">714</a></span><span class="t"> <span class="nam">fs_content_dir</span> <span class="op">=</span> <span class="nam">generated_content_dir</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t715" href="#t715">715</a></span><span class="t"> <span class="nam">fd</span><span class="op">,</span> <span class="nam">build_time_multifile</span> <span class="op">=</span> <span class="nam">mkstemp</span><span class="op">(</span><span class="nam">suffix</span><span class="op">=</span><span class="nam">dwz_ma_basename</span><span class="op">,</span> <span class="nam">dir</span><span class="op">=</span><span class="nam">fs_content_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t716" href="#t716">716</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">close</span><span class="op">(</span><span class="nam">fd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t717" href="#t717">717</a></span><span class="t"> <span class="nam">dwz_cmd</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">f"-m{build_time_multifile}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t718" href="#t718">718</a></span><span class="t"> <span class="nam">dwz_cmd</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">f"-M/{multifile}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t719" href="#t719">719</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t720" href="#t720">720</a></span><span class="t"> <span class="com"># TODO: configuration for disabling multi-file and tweaking memory limits</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t721" href="#t721">721</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t722" href="#t722">722</a></span><span class="t"> <span class="nam">dwz_cmd</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">e</span><span class="op">.</span><span class="nam">fs_path</span> <span class="key">for</span> <span class="nam">e</span> <span class="key">in</span> <span class="nam">unstripped_elf_info</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t723" href="#t723">723</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t724" href="#t724">724</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"Deduplicating ELF debug info via: {escape_shell(*dwz_cmd)}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t725" href="#t725">725</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t726" href="#t726">726</a></span><span class="t"> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_call</span><span class="op">(</span><span class="nam">dwz_cmd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t727" href="#t727">727</a></span><span class="t"> <span class="key">except</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">CalledProcessError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t728" href="#t728">728</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t729" href="#t729">729</a></span><span class="t"> <span class="str">"Attempting to deduplicate ELF info via dwz failed. Please review the output from dwz above"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t730" href="#t730">730</a></span><span class="t"> <span class="str">" to understand what went wrong."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t731" href="#t731">731</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t732" href="#t732">732</a></span><span class="t"> <span class="key">if</span> <span class="nam">build_time_multifile</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">os</span><span class="op">.</span><span class="nam">stat</span><span class="op">(</span><span class="nam">build_time_multifile</span><span class="op">)</span><span class="op">.</span><span class="nam">st_size</span> <span class="op">></span> <span class="num">0</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t733" href="#t733">733</a></span><span class="t"> <span class="nam">dwz_dir</span> <span class="op">=</span> <span class="nam">dbgsym_fs_root</span><span class="op">.</span><span class="nam">mkdirs</span><span class="op">(</span><span class="nam">dwz_ma_dir_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t734" href="#t734">734</a></span><span class="t"> <span class="nam">dwz_dir</span><span class="op">.</span><span class="nam">insert_file_from_fs_path</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t735" href="#t735">735</a></span><span class="t"> <span class="nam">dwz_ma_basename</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t736" href="#t736">736</a></span><span class="t"> <span class="nam">build_time_multifile</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t737" href="#t737">737</a></span><span class="t"> <span class="nam">mode</span><span class="op">=</span><span class="num">0o644</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t738" href="#t738">738</a></span><span class="t"> <span class="nam">require_copy_on_write</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t739" href="#t739">739</a></span><span class="t"> <span class="nam">follow_symlinks</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t740" href="#t740">740</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t741" href="#t741">741</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t742" href="#t742">742</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t743" href="#t743">743</a></span><span class="t"><span class="key">def</span> <span class="nam">relocate_dwarves_into_dbgsym_packages</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t744" href="#t744">744</a></span><span class="t"> <span class="nam">dctrl</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t745" href="#t745">745</a></span><span class="t"> <span class="nam">package_fs_root</span><span class="op">:</span> <span class="nam">FSPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t746" href="#t746">746</a></span><span class="t"> <span class="nam">dbgsym_fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t747" href="#t747">747</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t748" href="#t748">748</a></span><span class="t"> <span class="com"># FIXME: hardlinks</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t749" href="#t749">749</a></span><span class="t"> <span class="key">with</span> <span class="nam">_all_static_libs</span><span class="op">(</span><span class="nam">package_fs_root</span><span class="op">)</span> <span class="key">as</span> <span class="nam">all_static_files</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t750" href="#t750">750</a></span><span class="t"> <span class="key">if</span> <span class="nam">all_static_files</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t751" href="#t751">751</a></span><span class="t"> <span class="nam">strip</span> <span class="op">=</span> <span class="nam">dctrl</span><span class="op">.</span><span class="nam">cross_command</span><span class="op">(</span><span class="str">"strip"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t752" href="#t752">752</a></span><span class="t"> <span class="nam">_strip_binary</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t753" href="#t753">753</a></span><span class="t"> <span class="nam">strip</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t754" href="#t754">754</a></span><span class="t"> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t755" href="#t755">755</a></span><span class="t"> <span class="str">"--strip-debug"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t756" href="#t756">756</a></span><span class="t"> <span class="str">"--remove-section=.comment"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t757" href="#t757">757</a></span><span class="t"> <span class="str">"--remove-section=.note"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t758" href="#t758">758</a></span><span class="t"> <span class="str">"--enable-deterministic-archives"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t759" href="#t759">759</a></span><span class="t"> <span class="str">"-R"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t760" href="#t760">760</a></span><span class="t"> <span class="str">".gnu.lto_*"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t761" href="#t761">761</a></span><span class="t"> <span class="str">"-R"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t762" href="#t762">762</a></span><span class="t"> <span class="str">".gnu.debuglto_*"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t763" href="#t763">763</a></span><span class="t"> <span class="str">"-N"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t764" href="#t764">764</a></span><span class="t"> <span class="str">"__gnu_lto_slim"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t765" href="#t765">765</a></span><span class="t"> <span class="str">"-N"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t766" href="#t766">766</a></span><span class="t"> <span class="str">"__gnu_lto_v1"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t767" href="#t767">767</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t768" href="#t768">768</a></span><span class="t"> <span class="nam">all_static_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t769" href="#t769">769</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t770" href="#t770">770</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t771" href="#t771">771</a></span><span class="t"> <span class="key">with</span> <span class="nam">_all_elf_files</span><span class="op">(</span><span class="nam">package_fs_root</span><span class="op">)</span> <span class="key">as</span> <span class="nam">all_elf_files</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t772" href="#t772">772</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">all_elf_files</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t773" href="#t773">773</a></span><span class="t"> <span class="key">return</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t774" href="#t774">774</a></span><span class="t"> <span class="nam">objcopy</span> <span class="op">=</span> <span class="nam">dctrl</span><span class="op">.</span><span class="nam">cross_command</span><span class="op">(</span><span class="str">"objcopy"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t775" href="#t775">775</a></span><span class="t"> <span class="nam">strip</span> <span class="op">=</span> <span class="nam">dctrl</span><span class="op">.</span><span class="nam">cross_command</span><span class="op">(</span><span class="str">"strip"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t776" href="#t776">776</a></span><span class="t"> <span class="nam">unstripped_elf_info</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t777" href="#t777">777</a></span><span class="t"> <span class="nam">e</span> <span class="key">for</span> <span class="nam">e</span> <span class="key">in</span> <span class="nam">all_elf_files</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span> <span class="key">if</span> <span class="key">not</span> <span class="nam">e</span><span class="op">.</span><span class="nam">is_stripped</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t778" href="#t778">778</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t779" href="#t779">779</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t780" href="#t780">780</a></span><span class="t"> <span class="nam">_run_dwz</span><span class="op">(</span><span class="nam">dctrl</span><span class="op">,</span> <span class="nam">dbgsym_fs_root</span><span class="op">,</span> <span class="nam">unstripped_elf_info</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t781" href="#t781">781</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t782" href="#t782">782</a></span><span class="t"> <span class="key">for</span> <span class="nam">elf_info</span> <span class="key">in</span> <span class="nam">unstripped_elf_info</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t783" href="#t783">783</a></span><span class="t"> <span class="nam">elf_info</span><span class="op">.</span><span class="nam">dbgsym</span> <span class="op">=</span> <span class="nam">_make_debug_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t784" href="#t784">784</a></span><span class="t"> <span class="nam">objcopy</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t785" href="#t785">785</a></span><span class="t"> <span class="nam">elf_info</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t786" href="#t786">786</a></span><span class="t"> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">elf_info</span><span class="op">.</span><span class="nam">build_id</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t787" href="#t787">787</a></span><span class="t"> <span class="nam">dbgsym_fs_root</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t788" href="#t788">788</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t789" href="#t789">789</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t790" href="#t790">790</a></span><span class="t"> <span class="com"># Note: When run strip, we do so also on already stripped ELF binaries because that is what debhelper does!</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t791" href="#t791">791</a></span><span class="t"> <span class="com"># Executables (defined by mode)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t792" href="#t792">792</a></span><span class="t"> <span class="nam">_strip_binary</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t793" href="#t793">793</a></span><span class="t"> <span class="nam">strip</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t794" href="#t794">794</a></span><span class="t"> <span class="op">[</span><span class="str">"--remove-section=.comment"</span><span class="op">,</span> <span class="str">"--remove-section=.note"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t795" href="#t795">795</a></span><span class="t"> <span class="op">(</span><span class="nam">i</span><span class="op">.</span><span class="nam">fs_path</span> <span class="key">for</span> <span class="nam">i</span> <span class="key">in</span> <span class="nam">all_elf_files</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span> <span class="key">if</span> <span class="nam">i</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">is_executable</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t796" href="#t796">796</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t797" href="#t797">797</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t798" href="#t798">798</a></span><span class="t"> <span class="com"># Libraries (defined by mode)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t799" href="#t799">799</a></span><span class="t"> <span class="nam">_strip_binary</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t800" href="#t800">800</a></span><span class="t"> <span class="nam">strip</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t801" href="#t801">801</a></span><span class="t"> <span class="op">[</span><span class="str">"--remove-section=.comment"</span><span class="op">,</span> <span class="str">"--remove-section=.note"</span><span class="op">,</span> <span class="str">"--strip-unneeded"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t802" href="#t802">802</a></span><span class="t"> <span class="op">(</span><span class="nam">i</span><span class="op">.</span><span class="nam">fs_path</span> <span class="key">for</span> <span class="nam">i</span> <span class="key">in</span> <span class="nam">all_elf_files</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span> <span class="key">if</span> <span class="key">not</span> <span class="nam">i</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">is_executable</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t803" href="#t803">803</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t804" href="#t804">804</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t805" href="#t805">805</a></span><span class="t"> <span class="key">for</span> <span class="nam">elf_info</span> <span class="key">in</span> <span class="nam">unstripped_elf_info</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t806" href="#t806">806</a></span><span class="t"> <span class="nam">_attach_debug</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t807" href="#t807">807</a></span><span class="t"> <span class="nam">objcopy</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t808" href="#t808">808</a></span><span class="t"> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">elf_info</span><span class="op">.</span><span class="nam">path</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t809" href="#t809">809</a></span><span class="t"> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">elf_info</span><span class="op">.</span><span class="nam">dbgsym</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t810" href="#t810">810</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t811" href="#t811">811</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t812" href="#t812">812</a></span><span class="t"> <span class="com"># Set for uniqueness</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t813" href="#t813">813</a></span><span class="t"> <span class="nam">all_debug_info</span> <span class="op">=</span> <span class="nam">sorted</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t814" href="#t814">814</a></span><span class="t"> <span class="op">{</span><span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">i</span><span class="op">.</span><span class="nam">build_id</span><span class="op">)</span> <span class="key">for</span> <span class="nam">i</span> <span class="key">in</span> <span class="nam">unstripped_elf_info</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t815" href="#t815">815</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t816" href="#t816">816</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t817" href="#t817">817</a></span><span class="t"> <span class="nam">dbgsym_doc_dir</span> <span class="op">=</span> <span class="nam">dbgsym_fs_root</span><span class="op">.</span><span class="nam">mkdirs</span><span class="op">(</span><span class="str">"./usr/share/doc/"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t818" href="#t818">818</a></span><span class="t"> <span class="nam">dbgsym_doc_dir</span><span class="op">.</span><span class="nam">add_symlink</span><span class="op">(</span><span class="str">f"{dctrl.name}-dbgsym"</span><span class="op">,</span> <span class="nam">dctrl</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t819" href="#t819">819</a></span><span class="t"> <span class="key">return</span> <span class="nam">all_debug_info</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t820" href="#t820">820</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t821" href="#t821">821</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t822" href="#t822">822</a></span><span class="t"><span class="key">def</span> <span class="nam">run_package_processors</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t823" href="#t823">823</a></span><span class="t"> <span class="nam">manifest</span><span class="op">:</span> <span class="nam">HighLevelManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t824" href="#t824">824</a></span><span class="t"> <span class="nam">package_metadata_context</span><span class="op">:</span> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t825" href="#t825">825</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t826" href="#t826">826</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t827" href="#t827">827</a></span><span class="t"> <span class="nam">pppps</span> <span class="op">=</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">plugin_provided_feature_set</span><span class="op">.</span><span class="nam">package_processors_in_order</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t828" href="#t828">828</a></span><span class="t"> <span class="nam">binary_package</span> <span class="op">=</span> <span class="nam">package_metadata_context</span><span class="op">.</span><span class="nam">binary_package</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t829" href="#t829">829</a></span><span class="t"> <span class="key">for</span> <span class="nam">pppp</span> <span class="key">in</span> <span class="nam">pppps</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t830" href="#t830">830</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">pppp</span><span class="op">.</span><span class="nam">applies_to</span><span class="op">(</span><span class="nam">binary_package</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t831" href="#t831">831</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t832" href="#t832">832</a></span><span class="t"> <span class="nam">pppp</span><span class="op">.</span><span class="nam">run_package_processor</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">,</span> <span class="key">None</span><span class="op">,</span> <span class="nam">package_metadata_context</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t833" href="#t833">833</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t834" href="#t834">834</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t835" href="#t835">835</a></span><span class="t"><span class="key">def</span> <span class="nam">cross_package_control_files</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t836" href="#t836">836</a></span><span class="t"> <span class="nam">package_data_table</span><span class="op">:</span> <span class="nam">PackageDataTable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t837" href="#t837">837</a></span><span class="t"> <span class="nam">manifest</span><span class="op">:</span> <span class="nam">HighLevelManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t838" href="#t838">838</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t839" href="#t839">839</a></span><span class="t"> <span class="nam">errors</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t840" href="#t840">840</a></span><span class="t"> <span class="nam">combined_shlibs</span> <span class="op">=</span> <span class="nam">ShlibsContent</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t841" href="#t841">841</a></span><span class="t"> <span class="nam">shlibs_dir</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t842" href="#t842">842</a></span><span class="t"> <span class="nam">shlib_dirs</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t843" href="#t843">843</a></span><span class="t"> <span class="nam">shlibs_local</span> <span class="op">=</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">debian_dir</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"shlibs.local"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t844" href="#t844">844</a></span><span class="t"> <span class="key">if</span> <span class="nam">shlibs_local</span> <span class="key">and</span> <span class="nam">shlibs_local</span><span class="op">.</span><span class="nam">is_file</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t845" href="#t845">845</a></span><span class="t"> <span class="key">with</span> <span class="nam">shlibs_local</span><span class="op">.</span><span class="nam">open</span><span class="op">(</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t846" href="#t846">846</a></span><span class="t"> <span class="nam">combined_shlibs</span><span class="op">.</span><span class="nam">add_entries_from_shlibs_file</span><span class="op">(</span><span class="nam">fd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t847" href="#t847">847</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t848" href="#t848">848</a></span><span class="t"> <span class="nam">debputy_plugin_metadata</span> <span class="op">=</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">plugin_provided_feature_set</span><span class="op">.</span><span class="nam">plugin_data</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t849" href="#t849">849</a></span><span class="t"> <span class="str">"debputy"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t850" href="#t850">850</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t851" href="#t851">851</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t852" href="#t852">852</a></span><span class="t"> <span class="key">for</span> <span class="nam">binary_package_data</span> <span class="key">in</span> <span class="nam">package_data_table</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t853" href="#t853">853</a></span><span class="t"> <span class="nam">binary_package</span> <span class="op">=</span> <span class="nam">binary_package_data</span><span class="op">.</span><span class="nam">binary_package</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t854" href="#t854">854</a></span><span class="t"> <span class="key">if</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">is_arch_all</span> <span class="key">or</span> <span class="key">not</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">should_be_acted_on</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t855" href="#t855">855</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t856" href="#t856">856</a></span><span class="t"> <span class="nam">control_output_dir</span> <span class="op">=</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">binary_package_data</span><span class="op">.</span><span class="nam">control_output_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t857" href="#t857">857</a></span><span class="t"> <span class="nam">fs_root</span> <span class="op">=</span> <span class="nam">binary_package_data</span><span class="op">.</span><span class="nam">fs_root</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t858" href="#t858">858</a></span><span class="t"> <span class="nam">package_state</span> <span class="op">=</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">package_state_for</span><span class="op">(</span><span class="nam">binary_package</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t859" href="#t859">859</a></span><span class="t"> <span class="nam">related_udeb_package</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t860" href="#t860">860</a></span><span class="t"> <span class="nam">binary_package_data</span><span class="op">.</span><span class="nam">package_metadata_context</span><span class="op">.</span><span class="nam">related_udeb_package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t861" href="#t861">861</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t862" href="#t862">862</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t863" href="#t863">863</a></span><span class="t"> <span class="nam">udeb_package_name</span> <span class="op">=</span> <span class="nam">related_udeb_package</span><span class="op">.</span><span class="nam">name</span> <span class="key">if</span> <span class="nam">related_udeb_package</span> <span class="key">else</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t864" href="#t864">864</a></span><span class="t"> <span class="nam">ctrl</span> <span class="op">=</span> <span class="nam">binary_package_data</span><span class="op">.</span><span class="nam">ctrl_creator</span><span class="op">.</span><span class="nam">for_plugin</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t865" href="#t865">865</a></span><span class="t"> <span class="nam">debputy_plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t866" href="#t866">866</a></span><span class="t"> <span class="str">"compute_shlibs"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t867" href="#t867">867</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t868" href="#t868">868</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t869" href="#t869">869</a></span><span class="t"> <span class="nam">soname_info_list</span> <span class="op">=</span> <span class="nam">compute_shlibs</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t870" href="#t870">870</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t871" href="#t871">871</a></span><span class="t"> <span class="nam">control_output_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t872" href="#t872">872</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t873" href="#t873">873</a></span><span class="t"> <span class="nam">manifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t874" href="#t874">874</a></span><span class="t"> <span class="nam">udeb_package_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t875" href="#t875">875</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t876" href="#t876">876</a></span><span class="t"> <span class="nam">package_state</span><span class="op">.</span><span class="nam">reserved_packager_provided_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t877" href="#t877">877</a></span><span class="t"> <span class="nam">combined_shlibs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t878" href="#t878">878</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t879" href="#t879">879</a></span><span class="t"> <span class="key">except</span> <span class="nam">DebputyDpkgGensymbolsError</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t880" href="#t880">880</a></span><span class="t"> <span class="nam">errors</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">e</span><span class="op">.</span><span class="nam">message</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t881" href="#t881">881</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t882" href="#t882">882</a></span><span class="t"> <span class="key">if</span> <span class="nam">soname_info_list</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t883" href="#t883">883</a></span><span class="t"> <span class="key">if</span> <span class="nam">shlibs_dir</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t884" href="#t884">884</a></span><span class="t"> <span class="nam">shlibs_dir</span> <span class="op">=</span> <span class="nam">generated_content_dir</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t885" href="#t885">885</a></span><span class="t"> <span class="nam">subdir_key</span><span class="op">=</span><span class="str">"_shlibs_materialization_dir"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t886" href="#t886">886</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t887" href="#t887">887</a></span><span class="t"> <span class="nam">generate_shlib_dirs</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t888" href="#t888">888</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t889" href="#t889">889</a></span><span class="t"> <span class="nam">shlibs_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t890" href="#t890">890</a></span><span class="t"> <span class="nam">soname_info_list</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t891" href="#t891">891</a></span><span class="t"> <span class="nam">shlib_dirs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t892" href="#t892">892</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t893" href="#t893">893</a></span><span class="t"> <span class="key">if</span> <span class="nam">errors</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t894" href="#t894">894</a></span><span class="t"> <span class="key">for</span> <span class="nam">error</span> <span class="key">in</span> <span class="nam">errors</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t895" href="#t895">895</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span><span class="nam">error</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t896" href="#t896">896</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span><span class="str">"Stopping due to the errors above"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t897" href="#t897">897</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t898" href="#t898">898</a></span><span class="t"> <span class="nam">generated_shlibs_local</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t899" href="#t899">899</a></span><span class="t"> <span class="key">if</span> <span class="nam">combined_shlibs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t900" href="#t900">900</a></span><span class="t"> <span class="key">if</span> <span class="nam">shlibs_dir</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t901" href="#t901">901</a></span><span class="t"> <span class="nam">shlibs_dir</span> <span class="op">=</span> <span class="nam">generated_content_dir</span><span class="op">(</span><span class="nam">subdir_key</span><span class="op">=</span><span class="str">"_shlibs_materialization_dir"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t902" href="#t902">902</a></span><span class="t"> <span class="nam">generated_shlibs_local</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">shlibs_dir</span><span class="op">,</span> <span class="str">"shlibs.local"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t903" href="#t903">903</a></span><span class="t"> <span class="key">with</span> <span class="nam">open</span><span class="op">(</span><span class="nam">generated_shlibs_local</span><span class="op">,</span> <span class="str">"wt"</span><span class="op">,</span> <span class="nam">encoding</span><span class="op">=</span><span class="str">"utf-8"</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t904" href="#t904">904</a></span><span class="t"> <span class="nam">combined_shlibs</span><span class="op">.</span><span class="nam">write_to</span><span class="op">(</span><span class="nam">fd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t905" href="#t905">905</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"Generated {generated_shlibs_local} for dpkg-shlibdeps"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t906" href="#t906">906</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t907" href="#t907">907</a></span><span class="t"> <span class="key">for</span> <span class="nam">binary_package_data</span> <span class="key">in</span> <span class="nam">package_data_table</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t908" href="#t908">908</a></span><span class="t"> <span class="nam">binary_package</span> <span class="op">=</span> <span class="nam">binary_package_data</span><span class="op">.</span><span class="nam">binary_package</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t909" href="#t909">909</a></span><span class="t"> <span class="key">if</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">is_arch_all</span> <span class="key">or</span> <span class="key">not</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">should_be_acted_on</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t910" href="#t910">910</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t911" href="#t911">911</a></span><span class="t"> <span class="nam">binary_package_data</span><span class="op">.</span><span class="nam">ctrl_creator</span><span class="op">.</span><span class="nam">shlibs_details</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t912" href="#t912">912</a></span><span class="t"> <span class="nam">generated_shlibs_local</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t913" href="#t913">913</a></span><span class="t"> <span class="nam">shlib_dirs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t914" href="#t914">914</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t915" href="#t915">915</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t916" href="#t916">916</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t917" href="#t917">917</a></span><span class="t"><span class="key">def</span> <span class="nam">_relevant_service_definitions</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t918" href="#t918">918</a></span><span class="t"> <span class="nam">service_rule</span><span class="op">:</span> <span class="nam">ServiceRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t919" href="#t919">919</a></span><span class="t"> <span class="nam">service_managers</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t920" href="#t920">920</a></span><span class="t"> <span class="nam">by_service_manager_key</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t921" href="#t921">921</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">ServiceManagerDetails</span><span class="op">,</span> <span class="nam">ServiceDefinition</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t922" href="#t922">922</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t923" href="#t923">923</a></span><span class="t"> <span class="nam">aliases</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t924" href="#t924">924</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">ServiceDefinition</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t925" href="#t925">925</a></span><span class="t"> <span class="nam">as_keys</span> <span class="op">=</span> <span class="op">(</span><span class="nam">key</span> <span class="key">for</span> <span class="nam">key</span> <span class="key">in</span> <span class="nam">aliases</span><span class="op">[</span><span class="nam">service_rule</span><span class="op">.</span><span class="nam">service</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t926" href="#t926">926</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t927" href="#t927">927</a></span><span class="t"> <span class="nam">pending_queue</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t928" href="#t928">928</a></span><span class="t"> <span class="nam">key</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t929" href="#t929">929</a></span><span class="t"> <span class="key">for</span> <span class="nam">key</span> <span class="key">in</span> <span class="nam">as_keys</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t930" href="#t930">930</a></span><span class="t"> <span class="key">if</span> <span class="nam">key</span> <span class="key">in</span> <span class="nam">by_service_manager_key</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t931" href="#t931">931</a></span><span class="t"> <span class="key">and</span> <span class="nam">service_rule</span><span class="op">.</span><span class="nam">applies_to_service_manager</span><span class="op">(</span><span class="nam">key</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t932" href="#t932">932</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t933" href="#t933">933</a></span><span class="t"> <span class="nam">relevant_names</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t934" href="#t934">934</a></span><span class="t"> <span class="nam">seen_keys</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t935" href="#t935">935</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t936" href="#t936">936</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">pending_queue</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t937" href="#t937">937</a></span><span class="t"> <span class="nam">service_manager_names</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">sorted</span><span class="op">(</span><span class="nam">service_managers</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t938" href="#t938">938</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t939" href="#t939">939</a></span><span class="t"> <span class="str">f"No none of the service managers ({service_manager_names}) detected a service named"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t940" href="#t940">940</a></span><span class="t"> <span class="str">f" {service_rule.service} (type: {service_rule.type_of_service}, scope: {service_rule.service_scope}),"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t941" href="#t941">941</a></span><span class="t"> <span class="str">f" but the manifest definition at {service_rule.definition_source} requested that."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t942" href="#t942">942</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t943" href="#t943">943</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t944" href="#t944">944</a></span><span class="t"> <span class="key">while</span> <span class="nam">pending_queue</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t945" href="#t945">945</a></span><span class="t"> <span class="nam">next_key</span> <span class="op">=</span> <span class="nam">pending_queue</span><span class="op">.</span><span class="nam">pop</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t946" href="#t946">946</a></span><span class="t"> <span class="nam">seen_keys</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">next_key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t947" href="#t947">947</a></span><span class="t"> <span class="nam">_</span><span class="op">,</span> <span class="nam">definition</span> <span class="op">=</span> <span class="nam">by_service_manager_key</span><span class="op">[</span><span class="nam">next_key</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t948" href="#t948">948</a></span><span class="t"> <span class="key">yield</span> <span class="nam">next_key</span><span class="op">,</span> <span class="nam">definition</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t949" href="#t949">949</a></span><span class="t"> <span class="key">for</span> <span class="nam">name</span> <span class="key">in</span> <span class="nam">definition</span><span class="op">.</span><span class="nam">names</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t950" href="#t950">950</a></span><span class="t"> <span class="key">for</span> <span class="nam">target_key</span> <span class="key">in</span> <span class="nam">aliases</span><span class="op">[</span><span class="nam">name</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t951" href="#t951">951</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t952" href="#t952">952</a></span><span class="t"> <span class="nam">target_key</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">seen_keys</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t953" href="#t953">953</a></span><span class="t"> <span class="key">and</span> <span class="nam">service_rule</span><span class="op">.</span><span class="nam">applies_to_service_manager</span><span class="op">(</span><span class="nam">target_key</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t954" href="#t954">954</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t955" href="#t955">955</a></span><span class="t"> <span class="nam">pending_queue</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">target_key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t956" href="#t956">956</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t957" href="#t957">957</a></span><span class="t"> <span class="key">return</span> <span class="nam">relevant_names</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t958" href="#t958">958</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t959" href="#t959">959</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t960" href="#t960">960</a></span><span class="t"><span class="key">def</span> <span class="nam">handle_service_management</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t961" href="#t961">961</a></span><span class="t"> <span class="nam">binary_package_data</span><span class="op">:</span> <span class="nam">BinaryPackageData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t962" href="#t962">962</a></span><span class="t"> <span class="nam">manifest</span><span class="op">:</span> <span class="nam">HighLevelManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t963" href="#t963">963</a></span><span class="t"> <span class="nam">package_metadata_context</span><span class="op">:</span> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t964" href="#t964">964</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t965" href="#t965">965</a></span><span class="t"> <span class="nam">feature_set</span><span class="op">:</span> <span class="nam">PluginProvidedFeatureSet</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t966" href="#t966">966</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t967" href="#t967">967</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t968" href="#t968">968</a></span><span class="t"> <span class="nam">by_service_manager_key</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t969" href="#t969">969</a></span><span class="t"> <span class="nam">aliases_by_name</span> <span class="op">=</span> <span class="nam">collections</span><span class="op">.</span><span class="nam">defaultdict</span><span class="op">(</span><span class="nam">list</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t970" href="#t970">970</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t971" href="#t971">971</a></span><span class="t"> <span class="nam">state</span> <span class="op">=</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">package_state_for</span><span class="op">(</span><span class="nam">binary_package_data</span><span class="op">.</span><span class="nam">binary_package</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t972" href="#t972">972</a></span><span class="t"> <span class="nam">all_service_managers</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">feature_set</span><span class="op">.</span><span class="nam">service_managers</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t973" href="#t973">973</a></span><span class="t"> <span class="nam">requested_service_rules</span> <span class="op">=</span> <span class="nam">state</span><span class="op">.</span><span class="nam">requested_service_rules</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t974" href="#t974">974</a></span><span class="t"> <span class="key">for</span> <span class="nam">requested_service_rule</span> <span class="key">in</span> <span class="nam">requested_service_rules</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t975" href="#t975">975</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">requested_service_rule</span><span class="op">.</span><span class="nam">service_managers</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t976" href="#t976">976</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t977" href="#t977">977</a></span><span class="t"> <span class="key">for</span> <span class="nam">manager</span> <span class="key">in</span> <span class="nam">requested_service_rule</span><span class="op">.</span><span class="nam">service_managers</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t978" href="#t978">978</a></span><span class="t"> <span class="key">if</span> <span class="nam">manager</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">feature_set</span><span class="op">.</span><span class="nam">service_managers</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t979" href="#t979">979</a></span><span class="t"> <span class="com"># FIXME: Missing definition source; move to parsing.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t980" href="#t980">980</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t981" href="#t981">981</a></span><span class="t"> <span class="str">f"Unknown service manager {manager} used at {requested_service_rule.definition_source}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t982" href="#t982">982</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t983" href="#t983">983</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t984" href="#t984">984</a></span><span class="t"> <span class="key">for</span> <span class="nam">service_manager_details</span> <span class="key">in</span> <span class="nam">feature_set</span><span class="op">.</span><span class="nam">service_managers</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t985" href="#t985">985</a></span><span class="t"> <span class="nam">service_registry</span> <span class="op">=</span> <span class="nam">ServiceRegistryImpl</span><span class="op">(</span><span class="nam">service_manager_details</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t986" href="#t986">986</a></span><span class="t"> <span class="nam">service_manager_details</span><span class="op">.</span><span class="nam">service_detector</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t987" href="#t987">987</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t988" href="#t988">988</a></span><span class="t"> <span class="nam">service_registry</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t989" href="#t989">989</a></span><span class="t"> <span class="nam">package_metadata_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t990" href="#t990">990</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t991" href="#t991">991</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t992" href="#t992">992</a></span><span class="t"> <span class="nam">service_definitions</span> <span class="op">=</span> <span class="nam">service_registry</span><span class="op">.</span><span class="nam">detected_services</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t993" href="#t993">993</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">service_definitions</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t994" href="#t994">994</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t995" href="#t995">995</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t996" href="#t996">996</a></span><span class="t"> <span class="key">for</span> <span class="nam">plugin_provided_definition</span> <span class="key">in</span> <span class="nam">service_definitions</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t997" href="#t997">997</a></span><span class="t"> <span class="nam">key</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t998" href="#t998">998</a></span><span class="t"> <span class="nam">plugin_provided_definition</span><span class="op">.</span><span class="nam">name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t999" href="#t999">999</a></span><span class="t"> <span class="nam">plugin_provided_definition</span><span class="op">.</span><span class="nam">type_of_service</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1000" href="#t1000">1000</a></span><span class="t"> <span class="nam">plugin_provided_definition</span><span class="op">.</span><span class="nam">service_scope</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1001" href="#t1001">1001</a></span><span class="t"> <span class="nam">service_manager_details</span><span class="op">.</span><span class="nam">service_manager</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1002" href="#t1002">1002</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1003" href="#t1003">1003</a></span><span class="t"> <span class="nam">by_service_manager_key</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1004" href="#t1004">1004</a></span><span class="t"> <span class="nam">service_manager_details</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1005" href="#t1005">1005</a></span><span class="t"> <span class="nam">plugin_provided_definition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1006" href="#t1006">1006</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1007" href="#t1007">1007</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1008" href="#t1008">1008</a></span><span class="t"> <span class="key">for</span> <span class="nam">name</span> <span class="key">in</span> <span class="nam">plugin_provided_definition</span><span class="op">.</span><span class="nam">names</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1009" href="#t1009">1009</a></span><span class="t"> <span class="nam">aliases_by_name</span><span class="op">[</span><span class="nam">name</span><span class="op">]</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1010" href="#t1010">1010</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1011" href="#t1011">1011</a></span><span class="t"> <span class="key">for</span> <span class="nam">requested_service_rule</span> <span class="key">in</span> <span class="nam">requested_service_rules</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1012" href="#t1012">1012</a></span><span class="t"> <span class="nam">explicit_service_managers</span> <span class="op">=</span> <span class="nam">requested_service_rule</span><span class="op">.</span><span class="nam">service_managers</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1013" href="#t1013">1013</a></span><span class="t"> <span class="nam">related_service_managers</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1014" href="#t1014">1014</a></span><span class="t"> <span class="nam">requested_service_rule</span><span class="op">.</span><span class="nam">service_managers</span> <span class="key">or</span> <span class="nam">all_service_managers</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1015" href="#t1015">1015</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1016" href="#t1016">1016</a></span><span class="t"> <span class="nam">seen_service_managers</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1017" href="#t1017">1017</a></span><span class="t"> <span class="key">for</span> <span class="nam">service_key</span><span class="op">,</span> <span class="nam">service_definition</span> <span class="key">in</span> <span class="nam">_relevant_service_definitions</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1018" href="#t1018">1018</a></span><span class="t"> <span class="nam">requested_service_rule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1019" href="#t1019">1019</a></span><span class="t"> <span class="nam">related_service_managers</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1020" href="#t1020">1020</a></span><span class="t"> <span class="nam">by_service_manager_key</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1021" href="#t1021">1021</a></span><span class="t"> <span class="nam">aliases_by_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1022" href="#t1022">1022</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1023" href="#t1023">1023</a></span><span class="t"> <span class="nam">sm</span> <span class="op">=</span> <span class="nam">service_key</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1024" href="#t1024">1024</a></span><span class="t"> <span class="nam">seen_service_managers</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">sm</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1025" href="#t1025">1025</a></span><span class="t"> <span class="nam">by_service_manager_key</span><span class="op">[</span><span class="nam">service_key</span><span class="op">]</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1026" href="#t1026">1026</a></span><span class="t"> <span class="nam">by_service_manager_key</span><span class="op">[</span><span class="nam">service_key</span><span class="op">]</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1027" href="#t1027">1027</a></span><span class="t"> <span class="nam">requested_service_rule</span><span class="op">.</span><span class="nam">apply_to_service_definition</span><span class="op">(</span><span class="nam">service_definition</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1028" href="#t1028">1028</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1029" href="#t1029">1029</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1030" href="#t1030">1030</a></span><span class="t"> <span class="nam">explicit_service_managers</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1031" href="#t1031">1031</a></span><span class="t"> <span class="key">and</span> <span class="nam">seen_service_managers</span> <span class="op">!=</span> <span class="nam">related_service_managers</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1032" href="#t1032">1032</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1033" href="#t1033">1033</a></span><span class="t"> <span class="nam">missing_sms</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1034" href="#t1034">1034</a></span><span class="t"> <span class="nam">sorted</span><span class="op">(</span><span class="nam">related_service_managers</span> <span class="op">-</span> <span class="nam">seen_service_managers</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1035" href="#t1035">1035</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1036" href="#t1036">1036</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1037" href="#t1037">1037</a></span><span class="t"> <span class="str">f"The rule {requested_service_rule.definition_source} explicitly requested which service managers"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1038" href="#t1038">1038</a></span><span class="t"> <span class="str">f" it should apply to. However, the following service managers did not provide a service of that"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1039" href="#t1039">1039</a></span><span class="t"> <span class="str">f" name, type and scope: {missing_sms}. Please check the rule is correct and either provide the"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1040" href="#t1040">1040</a></span><span class="t"> <span class="str">f" missing service or update the definition match the relevant services."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1041" href="#t1041">1041</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1042" href="#t1042">1042</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1043" href="#t1043">1043</a></span><span class="t"> <span class="nam">per_service_manager</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1044" href="#t1044">1044</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1045" href="#t1045">1045</a></span><span class="t"> <span class="key">for</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1046" href="#t1046">1046</a></span><span class="t"> <span class="nam">service_manager_details</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1047" href="#t1047">1047</a></span><span class="t"> <span class="nam">plugin_provided_definition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1048" href="#t1048">1048</a></span><span class="t"> <span class="op">)</span> <span class="key">in</span> <span class="nam">by_service_manager_key</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1049" href="#t1049">1049</a></span><span class="t"> <span class="nam">service_manager</span> <span class="op">=</span> <span class="nam">service_manager_details</span><span class="op">.</span><span class="nam">service_manager</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1050" href="#t1050">1050</a></span><span class="t"> <span class="key">if</span> <span class="nam">service_manager</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">per_service_manager</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1051" href="#t1051">1051</a></span><span class="t"> <span class="nam">per_service_manager</span><span class="op">[</span><span class="nam">service_manager</span><span class="op">]</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1052" href="#t1052">1052</a></span><span class="t"> <span class="nam">service_manager_details</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1053" href="#t1053">1053</a></span><span class="t"> <span class="op">[</span><span class="nam">plugin_provided_definition</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1054" href="#t1054">1054</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1055" href="#t1055">1055</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1056" href="#t1056">1056</a></span><span class="t"> <span class="nam">per_service_manager</span><span class="op">[</span><span class="nam">service_manager</span><span class="op">]</span><span class="op">[</span><span class="num">1</span><span class="op">]</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">plugin_provided_definition</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1057" href="#t1057">1057</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1058" href="#t1058">1058</a></span><span class="t"> <span class="key">for</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1059" href="#t1059">1059</a></span><span class="t"> <span class="nam">service_manager_details</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1060" href="#t1060">1060</a></span><span class="t"> <span class="nam">final_service_definitions</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1061" href="#t1061">1061</a></span><span class="t"> <span class="op">)</span> <span class="key">in</span> <span class="nam">per_service_manager</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1062" href="#t1062">1062</a></span><span class="t"> <span class="nam">ctrl</span> <span class="op">=</span> <span class="nam">binary_package_data</span><span class="op">.</span><span class="nam">ctrl_creator</span><span class="op">.</span><span class="nam">for_plugin</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1063" href="#t1063">1063</a></span><span class="t"> <span class="nam">service_manager_details</span><span class="op">.</span><span class="nam">plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1064" href="#t1064">1064</a></span><span class="t"> <span class="nam">service_manager_details</span><span class="op">.</span><span class="nam">service_manager</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1065" href="#t1065">1065</a></span><span class="t"> <span class="nam">default_snippet_order</span><span class="op">=</span><span class="str">"service"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1066" href="#t1066">1066</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1067" href="#t1067">1067</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"Applying {final_service_definitions}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1068" href="#t1068">1068</a></span><span class="t"> <span class="nam">service_manager_details</span><span class="op">.</span><span class="nam">service_integrator</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1069" href="#t1069">1069</a></span><span class="t"> <span class="nam">final_service_definitions</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1070" href="#t1070">1070</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1071" href="#t1071">1071</a></span><span class="t"> <span class="nam">package_metadata_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1072" href="#t1072">1072</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1073" href="#t1073">1073</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1074" href="#t1074">1074</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1075" href="#t1075">1075</a></span><span class="t"><span class="key">def</span> <span class="nam">setup_control_files</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1076" href="#t1076">1076</a></span><span class="t"> <span class="nam">binary_package_data</span><span class="op">:</span> <span class="nam">BinaryPackageData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1077" href="#t1077">1077</a></span><span class="t"> <span class="nam">manifest</span><span class="op">:</span> <span class="nam">HighLevelManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1078" href="#t1078">1078</a></span><span class="t"> <span class="nam">dbgsym_fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1079" href="#t1079">1079</a></span><span class="t"> <span class="nam">dbgsym_ids</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1080" href="#t1080">1080</a></span><span class="t"> <span class="nam">package_metadata_context</span><span class="op">:</span> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1081" href="#t1081">1081</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1082" href="#t1082">1082</a></span><span class="t"> <span class="nam">allow_ctrl_file_management</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1083" href="#t1083">1083</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1084" href="#t1084">1084</a></span><span class="t"> <span class="nam">binary_package</span> <span class="op">=</span> <span class="nam">package_metadata_context</span><span class="op">.</span><span class="nam">binary_package</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1085" href="#t1085">1085</a></span><span class="t"> <span class="nam">control_output_dir</span> <span class="op">=</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">binary_package_data</span><span class="op">.</span><span class="nam">control_output_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1086" href="#t1086">1086</a></span><span class="t"> <span class="nam">fs_root</span> <span class="op">=</span> <span class="nam">binary_package_data</span><span class="op">.</span><span class="nam">fs_root</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1087" href="#t1087">1087</a></span><span class="t"> <span class="nam">package_state</span> <span class="op">=</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">package_state_for</span><span class="op">(</span><span class="nam">binary_package</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1088" href="#t1088">1088</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1089" href="#t1089">1089</a></span><span class="t"> <span class="nam">feature_set</span><span class="op">:</span> <span class="nam">PluginProvidedFeatureSet</span> <span class="op">=</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">plugin_provided_feature_set</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1090" href="#t1090">1090</a></span><span class="t"> <span class="nam">metadata_maintscript_detectors</span> <span class="op">=</span> <span class="nam">feature_set</span><span class="op">.</span><span class="nam">metadata_maintscript_detectors</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1091" href="#t1091">1091</a></span><span class="t"> <span class="nam">substvars</span> <span class="op">=</span> <span class="nam">binary_package_data</span><span class="op">.</span><span class="nam">substvars</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1092" href="#t1092">1092</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1093" href="#t1093">1093</a></span><span class="t"> <span class="nam">snippets</span> <span class="op">=</span> <span class="nam">STD_CONTROL_SCRIPTS</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1094" href="#t1094">1094</a></span><span class="t"> <span class="nam">generated_triggers</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">binary_package_data</span><span class="op">.</span><span class="nam">ctrl_creator</span><span class="op">.</span><span class="nam">generated_triggers</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1095" href="#t1095">1095</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1096" href="#t1096">1096</a></span><span class="t"> <span class="key">if</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">is_udeb</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1097" href="#t1097">1097</a></span><span class="t"> <span class="com"># FIXME: Add missing udeb scripts</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1098" href="#t1098">1098</a></span><span class="t"> <span class="nam">snippets</span> <span class="op">=</span> <span class="op">[</span><span class="str">"postinst"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1099" href="#t1099">1099</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1100" href="#t1100">1100</a></span><span class="t"> <span class="key">if</span> <span class="nam">allow_ctrl_file_management</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1101" href="#t1101">1101</a></span><span class="t"> <span class="nam">process_alternatives</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1102" href="#t1102">1102</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1103" href="#t1103">1103</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1104" href="#t1104">1104</a></span><span class="t"> <span class="nam">package_state</span><span class="op">.</span><span class="nam">reserved_packager_provided_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1105" href="#t1105">1105</a></span><span class="t"> <span class="nam">package_state</span><span class="op">.</span><span class="nam">maintscript_snippets</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1106" href="#t1106">1106</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1107" href="#t1107">1107</a></span><span class="t"> <span class="nam">process_debconf_templates</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1108" href="#t1108">1108</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1109" href="#t1109">1109</a></span><span class="t"> <span class="nam">package_state</span><span class="op">.</span><span class="nam">reserved_packager_provided_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1110" href="#t1110">1110</a></span><span class="t"> <span class="nam">package_state</span><span class="op">.</span><span class="nam">maintscript_snippets</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1111" href="#t1111">1111</a></span><span class="t"> <span class="nam">substvars</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1112" href="#t1112">1112</a></span><span class="t"> <span class="nam">control_output_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1113" href="#t1113">1113</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1114" href="#t1114">1114</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1115" href="#t1115">1115</a></span><span class="t"> <span class="nam">handle_service_management</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1116" href="#t1116">1116</a></span><span class="t"> <span class="nam">binary_package_data</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1117" href="#t1117">1117</a></span><span class="t"> <span class="nam">manifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1118" href="#t1118">1118</a></span><span class="t"> <span class="nam">package_metadata_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1119" href="#t1119">1119</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1120" href="#t1120">1120</a></span><span class="t"> <span class="nam">feature_set</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1121" href="#t1121">1121</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1122" href="#t1122">1122</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1123" href="#t1123">1123</a></span><span class="t"> <span class="nam">plugin_detector_definition</span><span class="op">:</span> <span class="nam">MetadataOrMaintscriptDetector</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1124" href="#t1124">1124</a></span><span class="t"> <span class="key">for</span> <span class="nam">plugin_detector_definition</span> <span class="key">in</span> <span class="nam">itertools</span><span class="op">.</span><span class="nam">chain</span><span class="op">.</span><span class="nam">from_iterable</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1125" href="#t1125">1125</a></span><span class="t"> <span class="nam">metadata_maintscript_detectors</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1126" href="#t1126">1126</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1127" href="#t1127">1127</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">plugin_detector_definition</span><span class="op">.</span><span class="nam">applies_to</span><span class="op">(</span><span class="nam">binary_package</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1128" href="#t1128">1128</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1129" href="#t1129">1129</a></span><span class="t"> <span class="nam">ctrl</span> <span class="op">=</span> <span class="nam">binary_package_data</span><span class="op">.</span><span class="nam">ctrl_creator</span><span class="op">.</span><span class="nam">for_plugin</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1130" href="#t1130">1130</a></span><span class="t"> <span class="nam">plugin_detector_definition</span><span class="op">.</span><span class="nam">plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1131" href="#t1131">1131</a></span><span class="t"> <span class="nam">plugin_detector_definition</span><span class="op">.</span><span class="nam">detector_id</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1132" href="#t1132">1132</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1133" href="#t1133">1133</a></span><span class="t"> <span class="nam">plugin_detector_definition</span><span class="op">.</span><span class="nam">run_detector</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1134" href="#t1134">1134</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">,</span> <span class="nam">ctrl</span><span class="op">,</span> <span class="nam">package_metadata_context</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1135" href="#t1135">1135</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1136" href="#t1136">1136</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1137" href="#t1137">1137</a></span><span class="t"> <span class="key">for</span> <span class="nam">script</span> <span class="key">in</span> <span class="nam">snippets</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1138" href="#t1138">1138</a></span><span class="t"> <span class="nam">_generate_snippet</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1139" href="#t1139">1139</a></span><span class="t"> <span class="nam">control_output_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1140" href="#t1140">1140</a></span><span class="t"> <span class="nam">script</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1141" href="#t1141">1141</a></span><span class="t"> <span class="nam">package_state</span><span class="op">.</span><span class="nam">maintscript_snippets</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1142" href="#t1142">1142</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1143" href="#t1143">1143</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1144" href="#t1144">1144</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1145" href="#t1145">1145</a></span><span class="t"> <span class="nam">state</span> <span class="op">=</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">package_state_for</span><span class="op">(</span><span class="nam">binary_package_data</span><span class="op">.</span><span class="nam">binary_package</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1146" href="#t1146">1146</a></span><span class="t"> <span class="key">if</span> <span class="nam">state</span><span class="op">.</span><span class="nam">requested_service_rules</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1147" href="#t1147">1147</a></span><span class="t"> <span class="nam">service_source</span> <span class="op">=</span> <span class="nam">state</span><span class="op">.</span><span class="nam">requested_service_rules</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">.</span><span class="nam">definition_source</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1148" href="#t1148">1148</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1149" href="#t1149">1149</a></span><span class="t"> <span class="str">f"Use of service definitions (such as {service_source}) is not supported in this integration mode"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1150" href="#t1150">1150</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1151" href="#t1151">1151</a></span><span class="t"> <span class="key">for</span> <span class="nam">script</span><span class="op">,</span> <span class="nam">snippet_container</span> <span class="key">in</span> <span class="nam">package_state</span><span class="op">.</span><span class="nam">maintscript_snippets</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1152" href="#t1152">1152</a></span><span class="t"> <span class="key">for</span> <span class="nam">snippet</span> <span class="key">in</span> <span class="nam">snippet_container</span><span class="op">.</span><span class="nam">all_snippets</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1153" href="#t1153">1153</a></span><span class="t"> <span class="nam">source</span> <span class="op">=</span> <span class="nam">snippet</span><span class="op">.</span><span class="nam">definition_source</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1154" href="#t1154">1154</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1155" href="#t1155">1155</a></span><span class="t"> <span class="str">f"This integration mode cannot use maintscript snippets"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1156" href="#t1156">1156</a></span><span class="t"> <span class="str">f' (since dh_installdeb has already been called). However, "{source}" triggered'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1157" href="#t1157">1157</a></span><span class="t"> <span class="str">f" a snippet for {script}. Please remove the offending definition if it is from"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1158" href="#t1158">1158</a></span><span class="t"> <span class="str">f" the manifest or file a bug if it is caused by a built-in rule."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1159" href="#t1159">1159</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1160" href="#t1160">1160</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1161" href="#t1161">1161</a></span><span class="t"> <span class="key">for</span> <span class="nam">trigger</span> <span class="key">in</span> <span class="nam">generated_triggers</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1162" href="#t1162">1162</a></span><span class="t"> <span class="nam">source</span> <span class="op">=</span> <span class="str">f"{trigger.provider.plugin_name}:{trigger.provider_source_id}"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1163" href="#t1163">1163</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1164" href="#t1164">1164</a></span><span class="t"> <span class="str">f"This integration mode must not generate triggers"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1165" href="#t1165">1165</a></span><span class="t"> <span class="str">f' (since dh_installdeb has already been called). However, "{source}" created'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1166" href="#t1166">1166</a></span><span class="t"> <span class="str">f" a trigger. Please remove the offending definition if it is from"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1167" href="#t1167">1167</a></span><span class="t"> <span class="str">f" the manifest or file a bug if it is caused by a built-in rule."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1168" href="#t1168">1168</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1169" href="#t1169">1169</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1170" href="#t1170">1170</a></span><span class="t"> <span class="nam">shlibdeps_definition</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1171" href="#t1171">1171</a></span><span class="t"> <span class="nam">d</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1172" href="#t1172">1172</a></span><span class="t"> <span class="key">for</span> <span class="nam">d</span> <span class="key">in</span> <span class="nam">metadata_maintscript_detectors</span><span class="op">[</span><span class="str">"debputy"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1173" href="#t1173">1173</a></span><span class="t"> <span class="key">if</span> <span class="nam">d</span><span class="op">.</span><span class="nam">detector_id</span> <span class="op">==</span> <span class="str">"dpkg-shlibdeps"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1174" href="#t1174">1174</a></span><span class="t"> <span class="op">]</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1175" href="#t1175">1175</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1176" href="#t1176">1176</a></span><span class="t"> <span class="nam">ctrl</span> <span class="op">=</span> <span class="nam">binary_package_data</span><span class="op">.</span><span class="nam">ctrl_creator</span><span class="op">.</span><span class="nam">for_plugin</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1177" href="#t1177">1177</a></span><span class="t"> <span class="nam">shlibdeps_definition</span><span class="op">.</span><span class="nam">plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1178" href="#t1178">1178</a></span><span class="t"> <span class="nam">shlibdeps_definition</span><span class="op">.</span><span class="nam">detector_id</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1179" href="#t1179">1179</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1180" href="#t1180">1180</a></span><span class="t"> <span class="nam">shlibdeps_definition</span><span class="op">.</span><span class="nam">run_detector</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">,</span> <span class="nam">ctrl</span><span class="op">,</span> <span class="nam">package_metadata_context</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1181" href="#t1181">1181</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1182" href="#t1182">1182</a></span><span class="t"> <span class="nam">dh_staging_dir</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="str">"debian"</span><span class="op">,</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">name</span><span class="op">,</span> <span class="str">"DEBIAN"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1183" href="#t1183">1183</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1184" href="#t1184">1184</a></span><span class="t"> <span class="key">with</span> <span class="nam">os</span><span class="op">.</span><span class="nam">scandir</span><span class="op">(</span><span class="nam">dh_staging_dir</span><span class="op">)</span> <span class="key">as</span> <span class="nam">it</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1185" href="#t1185">1185</a></span><span class="t"> <span class="nam">existing_control_files</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1186" href="#t1186">1186</a></span><span class="t"> <span class="nam">f</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1187" href="#t1187">1187</a></span><span class="t"> <span class="key">for</span> <span class="nam">f</span> <span class="key">in</span> <span class="nam">it</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1188" href="#t1188">1188</a></span><span class="t"> <span class="key">if</span> <span class="nam">f</span><span class="op">.</span><span class="nam">is_file</span><span class="op">(</span><span class="nam">follow_symlinks</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1189" href="#t1189">1189</a></span><span class="t"> <span class="key">and</span> <span class="nam">f</span><span class="op">.</span><span class="nam">name</span> <span class="key">not</span> <span class="key">in</span> <span class="op">(</span><span class="str">"control"</span><span class="op">,</span> <span class="str">"md5sums"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1190" href="#t1190">1190</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1191" href="#t1191">1191</a></span><span class="t"> <span class="key">except</span> <span class="nam">FileNotFoundError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1192" href="#t1192">1192</a></span><span class="t"> <span class="nam">existing_control_files</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1193" href="#t1193">1193</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1194" href="#t1194">1194</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing_control_files</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1195" href="#t1195">1195</a></span><span class="t"> <span class="nam">cmd</span> <span class="op">=</span> <span class="op">[</span><span class="str">"cp"</span><span class="op">,</span> <span class="str">"-a"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1196" href="#t1196">1196</a></span><span class="t"> <span class="nam">cmd</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">existing_control_files</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1197" href="#t1197">1197</a></span><span class="t"> <span class="nam">cmd</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">control_output_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1198" href="#t1198">1198</a></span><span class="t"> <span class="nam">print_command</span><span class="op">(</span><span class="op">*</span><span class="nam">cmd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1199" href="#t1199">1199</a></span><span class="t"> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_call</span><span class="op">(</span><span class="nam">cmd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1200" href="#t1200">1200</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1201" href="#t1201">1201</a></span><span class="t"> <span class="key">if</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">is_udeb</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1202" href="#t1202">1202</a></span><span class="t"> <span class="nam">_generate_control_files</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1203" href="#t1203">1203</a></span><span class="t"> <span class="nam">binary_package_data</span><span class="op">.</span><span class="nam">source_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1204" href="#t1204">1204</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1205" href="#t1205">1205</a></span><span class="t"> <span class="nam">package_state</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1206" href="#t1206">1206</a></span><span class="t"> <span class="nam">control_output_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1207" href="#t1207">1207</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1208" href="#t1208">1208</a></span><span class="t"> <span class="nam">substvars</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1209" href="#t1209">1209</a></span><span class="t"> <span class="com"># We never built udebs due to #797391, so skip over this information,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1210" href="#t1210">1210</a></span><span class="t"> <span class="com"># when creating the udeb</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1211" href="#t1211">1211</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1212" href="#t1212">1212</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1213" href="#t1213">1213</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1214" href="#t1214">1214</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1215" href="#t1215">1215</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1216" href="#t1216">1216</a></span><span class="t"> <span class="key">if</span> <span class="nam">generated_triggers</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1217" href="#t1217">1217</a></span><span class="t"> <span class="key">assert</span> <span class="key">not</span> <span class="nam">allow_ctrl_file_management</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1218" href="#t1218">1218</a></span><span class="t"> <span class="nam">dest_file</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">control_output_dir</span><span class="op">,</span> <span class="str">"triggers"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1219" href="#t1219">1219</a></span><span class="t"> <span class="key">with</span> <span class="nam">open</span><span class="op">(</span><span class="nam">dest_file</span><span class="op">,</span> <span class="str">"at"</span><span class="op">,</span> <span class="nam">encoding</span><span class="op">=</span><span class="str">"utf-8"</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1220" href="#t1220">1220</a></span><span class="t"> <span class="nam">fd</span><span class="op">.</span><span class="nam">writelines</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1221" href="#t1221">1221</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1222" href="#t1222">1222</a></span><span class="t"> <span class="str">f"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1223" href="#t1223">1223</a></span><span class="t"><span class="str"> # Added by {t.provider_source_id} from {t.provider.plugin_name}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1224" href="#t1224">1224</a></span><span class="t"><span class="str"> {t.dpkg_trigger_type} {t.dpkg_trigger_target}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1225" href="#t1225">1225</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1226" href="#t1226">1226</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1227" href="#t1227">1227</a></span><span class="t"> <span class="key">for</span> <span class="nam">t</span> <span class="key">in</span> <span class="nam">generated_triggers</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1228" href="#t1228">1228</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1229" href="#t1229">1229</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">chmod</span><span class="op">(</span><span class="nam">fd</span><span class="op">.</span><span class="nam">fileno</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> <span class="num">0o644</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1230" href="#t1230">1230</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1231" href="#t1231">1231</a></span><span class="t"> <span class="key">if</span> <span class="nam">allow_ctrl_file_management</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1232" href="#t1232">1232</a></span><span class="t"> <span class="nam">install_or_generate_conffiles</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1233" href="#t1233">1233</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1234" href="#t1234">1234</a></span><span class="t"> <span class="nam">control_output_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1235" href="#t1235">1235</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1236" href="#t1236">1236</a></span><span class="t"> <span class="nam">manifest</span><span class="op">.</span><span class="nam">debian_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1237" href="#t1237">1237</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1238" href="#t1238">1238</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1239" href="#t1239">1239</a></span><span class="t"> <span class="nam">_generate_control_files</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1240" href="#t1240">1240</a></span><span class="t"> <span class="nam">binary_package_data</span><span class="op">.</span><span class="nam">source_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1241" href="#t1241">1241</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1242" href="#t1242">1242</a></span><span class="t"> <span class="nam">package_state</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1243" href="#t1243">1243</a></span><span class="t"> <span class="nam">control_output_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1244" href="#t1244">1244</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1245" href="#t1245">1245</a></span><span class="t"> <span class="nam">substvars</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1246" href="#t1246">1246</a></span><span class="t"> <span class="nam">dbgsym_fs_root</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1247" href="#t1247">1247</a></span><span class="t"> <span class="nam">dbgsym_ids</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1248" href="#t1248">1248</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1249" href="#t1249">1249</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1250" href="#t1250">1250</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1251" href="#t1251">1251</a></span><span class="t"><span class="key">def</span> <span class="nam">_generate_snippet</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1252" href="#t1252">1252</a></span><span class="t"> <span class="nam">control_output_dir</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1253" href="#t1253">1253</a></span><span class="t"> <span class="nam">script</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1254" href="#t1254">1254</a></span><span class="t"> <span class="nam">maintscript_snippets</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">MaintscriptSnippetContainer</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1255" href="#t1255">1255</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1256" href="#t1256">1256</a></span><span class="t"> <span class="nam">debputy_snippets</span> <span class="op">=</span> <span class="nam">maintscript_snippets</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">script</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1257" href="#t1257">1257</a></span><span class="t"> <span class="key">if</span> <span class="nam">debputy_snippets</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1258" href="#t1258">1258</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1259" href="#t1259">1259</a></span><span class="t"> <span class="nam">reverse</span> <span class="op">=</span> <span class="nam">script</span> <span class="key">in</span> <span class="op">(</span><span class="str">"prerm"</span><span class="op">,</span> <span class="str">"postrm"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1260" href="#t1260">1260</a></span><span class="t"> <span class="nam">snippets</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1261" href="#t1261">1261</a></span><span class="t"> <span class="nam">debputy_snippets</span><span class="op">.</span><span class="nam">generate_snippet</span><span class="op">(</span><span class="nam">reverse</span><span class="op">=</span><span class="nam">reverse</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1262" href="#t1262">1262</a></span><span class="t"> <span class="nam">debputy_snippets</span><span class="op">.</span><span class="nam">generate_snippet</span><span class="op">(</span><span class="nam">snippet_order</span><span class="op">=</span><span class="str">"service"</span><span class="op">,</span> <span class="nam">reverse</span><span class="op">=</span><span class="nam">reverse</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1263" href="#t1263">1263</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1264" href="#t1264">1264</a></span><span class="t"> <span class="key">if</span> <span class="nam">reverse</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1265" href="#t1265">1265</a></span><span class="t"> <span class="nam">snippets</span> <span class="op">=</span> <span class="nam">reversed</span><span class="op">(</span><span class="nam">snippets</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1266" href="#t1266">1266</a></span><span class="t"> <span class="nam">full_content</span> <span class="op">=</span> <span class="str">""</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="str">f"{s}\n"</span> <span class="key">for</span> <span class="nam">s</span> <span class="key">in</span> <span class="nam">filter</span><span class="op">(</span><span class="key">None</span><span class="op">,</span> <span class="nam">snippets</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1267" href="#t1267">1267</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">full_content</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1268" href="#t1268">1268</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1269" href="#t1269">1269</a></span><span class="t"> <span class="nam">filename</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">control_output_dir</span><span class="op">,</span> <span class="nam">script</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1270" href="#t1270">1270</a></span><span class="t"> <span class="key">with</span> <span class="nam">open</span><span class="op">(</span><span class="nam">filename</span><span class="op">,</span> <span class="str">"wt"</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1271" href="#t1271">1271</a></span><span class="t"> <span class="nam">fd</span><span class="op">.</span><span class="nam">write</span><span class="op">(</span><span class="str">"#!/bin/sh\nset -e\n\n"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1272" href="#t1272">1272</a></span><span class="t"> <span class="nam">fd</span><span class="op">.</span><span class="nam">write</span><span class="op">(</span><span class="nam">full_content</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1273" href="#t1273">1273</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">chmod</span><span class="op">(</span><span class="nam">fd</span><span class="op">.</span><span class="nam">fileno</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> <span class="num">0o755</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1274" href="#t1274">1274</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1275" href="#t1275">1275</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1276" href="#t1276">1276</a></span><span class="t"><span class="key">def</span> <span class="nam">_add_conffiles</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1277" href="#t1277">1277</a></span><span class="t"> <span class="nam">conffiles_dest</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1278" href="#t1278">1278</a></span><span class="t"> <span class="nam">conffile_matches</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1279" href="#t1279">1279</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1280" href="#t1280">1280</a></span><span class="t"> <span class="key">with</span> <span class="nam">open</span><span class="op">(</span><span class="nam">conffiles_dest</span><span class="op">,</span> <span class="str">"at"</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1281" href="#t1281">1281</a></span><span class="t"> <span class="key">for</span> <span class="nam">conffile_match</span> <span class="key">in</span> <span class="nam">conffile_matches</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1282" href="#t1282">1282</a></span><span class="t"> <span class="nam">conffile</span> <span class="op">=</span> <span class="nam">conffile_match</span><span class="op">.</span><span class="nam">absolute</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1283" href="#t1283">1283</a></span><span class="t"> <span class="key">assert</span> <span class="nam">conffile_match</span><span class="op">.</span><span class="nam">is_file</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1284" href="#t1284">1284</a></span><span class="t"> <span class="nam">fd</span><span class="op">.</span><span class="nam">write</span><span class="op">(</span><span class="str">f"{conffile}\n"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1285" href="#t1285">1285</a></span><span class="t"> <span class="key">if</span> <span class="nam">os</span><span class="op">.</span><span class="nam">stat</span><span class="op">(</span><span class="nam">conffiles_dest</span><span class="op">)</span><span class="op">.</span><span class="nam">st_size</span> <span class="op">==</span> <span class="num">0</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1286" href="#t1286">1286</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">unlink</span><span class="op">(</span><span class="nam">conffiles_dest</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1287" href="#t1287">1287</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1288" href="#t1288">1288</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1289" href="#t1289">1289</a></span><span class="t"><span class="key">def</span> <span class="nam">_ensure_base_substvars_defined</span><span class="op">(</span><span class="nam">substvars</span><span class="op">:</span> <span class="nam">FlushableSubstvars</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1290" href="#t1290">1290</a></span><span class="t"> <span class="key">for</span> <span class="nam">substvar</span> <span class="key">in</span> <span class="op">(</span><span class="str">"misc:Depends"</span><span class="op">,</span> <span class="str">"misc:Pre-Depends"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1291" href="#t1291">1291</a></span><span class="t"> <span class="key">if</span> <span class="nam">substvar</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">substvars</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1292" href="#t1292">1292</a></span><span class="t"> <span class="nam">substvars</span><span class="op">[</span><span class="nam">substvar</span><span class="op">]</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1293" href="#t1293">1293</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1294" href="#t1294">1294</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1295" href="#t1295">1295</a></span><span class="t"><span class="key">def</span> <span class="nam">_compute_installed_size</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1296" href="#t1296">1296</a></span><span class="t"> <span class="str">"""Emulate dpkg-gencontrol's code for computing the default Installed-Size"""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1297" href="#t1297">1297</a></span><span class="t"> <span class="nam">size_in_kb</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1298" href="#t1298">1298</a></span><span class="t"> <span class="nam">hard_links</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1299" href="#t1299">1299</a></span><span class="t"> <span class="key">for</span> <span class="nam">path</span> <span class="key">in</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">all_paths</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1300" href="#t1300">1300</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_dir</span> <span class="key">and</span> <span class="nam">path</span><span class="op">.</span><span class="nam">has_fs_path</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1301" href="#t1301">1301</a></span><span class="t"> <span class="nam">st</span> <span class="op">=</span> <span class="nam">path</span><span class="op">.</span><span class="nam">stat</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1302" href="#t1302">1302</a></span><span class="t"> <span class="key">if</span> <span class="nam">st</span><span class="op">.</span><span class="nam">st_nlink</span> <span class="op">></span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1303" href="#t1303">1303</a></span><span class="t"> <span class="nam">hl_key</span> <span class="op">=</span> <span class="op">(</span><span class="nam">st</span><span class="op">.</span><span class="nam">st_dev</span><span class="op">,</span> <span class="nam">st</span><span class="op">.</span><span class="nam">st_ino</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1304" href="#t1304">1304</a></span><span class="t"> <span class="key">if</span> <span class="nam">hl_key</span> <span class="key">in</span> <span class="nam">hard_links</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1305" href="#t1305">1305</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1306" href="#t1306">1306</a></span><span class="t"> <span class="nam">hard_links</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">hl_key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1307" href="#t1307">1307</a></span><span class="t"> <span class="nam">path_size</span> <span class="op">=</span> <span class="op">(</span><span class="nam">st</span><span class="op">.</span><span class="nam">st_size</span> <span class="op">+</span> <span class="num">1023</span><span class="op">)</span> <span class="op">//</span> <span class="num">1024</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1308" href="#t1308">1308</a></span><span class="t"> <span class="key">elif</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_symlink</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1309" href="#t1309">1309</a></span><span class="t"> <span class="nam">path_size</span> <span class="op">=</span> <span class="op">(</span><span class="nam">len</span><span class="op">(</span><span class="nam">path</span><span class="op">.</span><span class="nam">readlink</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> <span class="op">+</span> <span class="num">1023</span><span class="op">)</span> <span class="op">//</span> <span class="num">1024</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1310" href="#t1310">1310</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1311" href="#t1311">1311</a></span><span class="t"> <span class="nam">path_size</span> <span class="op">=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1312" href="#t1312">1312</a></span><span class="t"> <span class="nam">size_in_kb</span> <span class="op">+=</span> <span class="nam">path_size</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1313" href="#t1313">1313</a></span><span class="t"> <span class="key">return</span> <span class="nam">size_in_kb</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1314" href="#t1314">1314</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1315" href="#t1315">1315</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1316" href="#t1316">1316</a></span><span class="t"><span class="key">def</span> <span class="nam">_generate_dbgsym_control_file_if_relevant</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1317" href="#t1317">1317</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1318" href="#t1318">1318</a></span><span class="t"> <span class="nam">dbgsym_fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1319" href="#t1319">1319</a></span><span class="t"> <span class="nam">dbgsym_root_dir</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1320" href="#t1320">1320</a></span><span class="t"> <span class="nam">dbgsym_ids</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1321" href="#t1321">1321</a></span><span class="t"> <span class="nam">multi_arch</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1322" href="#t1322">1322</a></span><span class="t"> <span class="nam">dctrl</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1323" href="#t1323">1323</a></span><span class="t"> <span class="nam">extra_common_params</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1324" href="#t1324">1324</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1325" href="#t1325">1325</a></span><span class="t"> <span class="nam">section</span> <span class="op">=</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">archive_section</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1326" href="#t1326">1326</a></span><span class="t"> <span class="nam">component</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1327" href="#t1327">1327</a></span><span class="t"> <span class="nam">extra_params</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1328" href="#t1328">1328</a></span><span class="t"> <span class="key">if</span> <span class="nam">section</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="str">"/"</span> <span class="key">in</span> <span class="nam">section</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">section</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"main/"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1329" href="#t1329">1329</a></span><span class="t"> <span class="nam">component</span> <span class="op">=</span> <span class="nam">section</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="str">"/"</span><span class="op">,</span> <span class="num">1</span><span class="op">)</span><span class="op">[</span><span class="num">1</span><span class="op">]</span> <span class="op">+</span> <span class="str">"/"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1330" href="#t1330">1330</a></span><span class="t"> <span class="key">if</span> <span class="nam">multi_arch</span> <span class="op">!=</span> <span class="str">"same"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1331" href="#t1331">1331</a></span><span class="t"> <span class="nam">extra_params</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">"-UMulti-Arch"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1332" href="#t1332">1332</a></span><span class="t"> <span class="nam">extra_params</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">"-UReplaces"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1333" href="#t1333">1333</a></span><span class="t"> <span class="nam">extra_params</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">"-UBreaks"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1334" href="#t1334">1334</a></span><span class="t"> <span class="nam">dbgsym_control_dir</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">dbgsym_root_dir</span><span class="op">,</span> <span class="str">"DEBIAN"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1335" href="#t1335">1335</a></span><span class="t"> <span class="nam">ensure_dir</span><span class="op">(</span><span class="nam">dbgsym_control_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1336" href="#t1336">1336</a></span><span class="t"> <span class="com"># Pass it via cmd-line to make it more visible that we are providing the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1337" href="#t1337">1337</a></span><span class="t"> <span class="com"># value. It also prevents the dbgsym package from picking up this value.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1338" href="#t1338">1338</a></span><span class="t"> <span class="nam">ctrl_fs_root</span> <span class="op">=</span> <span class="nam">FSROOverlay</span><span class="op">.</span><span class="nam">create_root_dir</span><span class="op">(</span><span class="str">"DEBIAN"</span><span class="op">,</span> <span class="nam">dbgsym_control_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1339" href="#t1339">1339</a></span><span class="t"> <span class="nam">total_size</span> <span class="op">=</span> <span class="nam">_compute_installed_size</span><span class="op">(</span><span class="nam">dbgsym_fs_root</span><span class="op">)</span> <span class="op">+</span> <span class="nam">_compute_installed_size</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1340" href="#t1340">1340</a></span><span class="t"> <span class="nam">ctrl_fs_root</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1341" href="#t1341">1341</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1342" href="#t1342">1342</a></span><span class="t"> <span class="nam">extra_params</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">f"-VInstalled-Size={total_size}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1343" href="#t1343">1343</a></span><span class="t"> <span class="nam">extra_params</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">extra_common_params</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1344" href="#t1344">1344</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1345" href="#t1345">1345</a></span><span class="t"> <span class="nam">package</span> <span class="op">=</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1346" href="#t1346">1346</a></span><span class="t"> <span class="nam">package_selector</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1347" href="#t1347">1347</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1348" href="#t1348">1348</a></span><span class="t"> <span class="key">if</span> <span class="nam">dctrl</span> <span class="op">==</span> <span class="str">"debian/control"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1349" href="#t1349">1349</a></span><span class="t"> <span class="key">else</span> <span class="str">f"{binary_package.name}-dbgsym"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1350" href="#t1350">1350</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1351" href="#t1351">1351</a></span><span class="t"> <span class="nam">dpkg_cmd</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1352" href="#t1352">1352</a></span><span class="t"> <span class="str">"dpkg-gencontrol"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1353" href="#t1353">1353</a></span><span class="t"> <span class="str">f"-p{package_selector}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1354" href="#t1354">1354</a></span><span class="t"> <span class="com"># FIXME: Support d/<pkg>.changelog at some point.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1355" href="#t1355">1355</a></span><span class="t"> <span class="str">"-ldebian/changelog"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1356" href="#t1356">1356</a></span><span class="t"> <span class="str">"-T/dev/null"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1357" href="#t1357">1357</a></span><span class="t"> <span class="str">f"-c{dctrl}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1358" href="#t1358">1358</a></span><span class="t"> <span class="str">f"-P{dbgsym_root_dir}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1359" href="#t1359">1359</a></span><span class="t"> <span class="str">f"-DPackage={package}-dbgsym"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1360" href="#t1360">1360</a></span><span class="t"> <span class="str">"-DDepends="</span> <span class="op">+</span> <span class="nam">package</span> <span class="op">+</span> <span class="str">" (= ${binary:Version})"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1361" href="#t1361">1361</a></span><span class="t"> <span class="str">f"-DDescription=debug symbols for {package}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1362" href="#t1362">1362</a></span><span class="t"> <span class="str">f"-DSection={component}debug"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1363" href="#t1363">1363</a></span><span class="t"> <span class="str">f"-DBuild-Ids={dbgsym_ids}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1364" href="#t1364">1364</a></span><span class="t"> <span class="str">"-UPre-Depends"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1365" href="#t1365">1365</a></span><span class="t"> <span class="str">"-URecommends"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1366" href="#t1366">1366</a></span><span class="t"> <span class="str">"-USuggests"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1367" href="#t1367">1367</a></span><span class="t"> <span class="str">"-UEnhances"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1368" href="#t1368">1368</a></span><span class="t"> <span class="str">"-UProvides"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1369" href="#t1369">1369</a></span><span class="t"> <span class="str">"-UEssential"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1370" href="#t1370">1370</a></span><span class="t"> <span class="str">"-UConflicts"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1371" href="#t1371">1371</a></span><span class="t"> <span class="str">"-DPriority=optional"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1372" href="#t1372">1372</a></span><span class="t"> <span class="str">"-UHomepage"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1373" href="#t1373">1373</a></span><span class="t"> <span class="str">"-UImportant"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1374" href="#t1374">1374</a></span><span class="t"> <span class="str">"-UBuilt-Using"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1375" href="#t1375">1375</a></span><span class="t"> <span class="str">"-UStatic-Built-Using"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1376" href="#t1376">1376</a></span><span class="t"> <span class="str">"-DAuto-Built-Package=debug-symbols"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1377" href="#t1377">1377</a></span><span class="t"> <span class="str">"-UProtected"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1378" href="#t1378">1378</a></span><span class="t"> <span class="op">*</span><span class="nam">extra_params</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1379" href="#t1379">1379</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1380" href="#t1380">1380</a></span><span class="t"> <span class="nam">print_command</span><span class="op">(</span><span class="op">*</span><span class="nam">dpkg_cmd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1381" href="#t1381">1381</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1382" href="#t1382">1382</a></span><span class="t"> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_call</span><span class="op">(</span><span class="nam">dpkg_cmd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1383" href="#t1383">1383</a></span><span class="t"> <span class="key">except</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">CalledProcessError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1384" href="#t1384">1384</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1385" href="#t1385">1385</a></span><span class="t"> <span class="str">f"Attempting to generate DEBIAN/control file for {package}-dbgsym failed. Please review the output from "</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1386" href="#t1386">1386</a></span><span class="t"> <span class="str">" dpkg-gencontrol above to understand what went wrong."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1387" href="#t1387">1387</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1388" href="#t1388">1388</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">chmod</span><span class="op">(</span><span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">dbgsym_root_dir</span><span class="op">,</span> <span class="str">"DEBIAN"</span><span class="op">,</span> <span class="str">"control"</span><span class="op">)</span><span class="op">,</span> <span class="num">0o644</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1389" href="#t1389">1389</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1390" href="#t1390">1390</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1391" href="#t1391">1391</a></span><span class="t"><span class="key">def</span> <span class="nam">_all_parent_directories_of</span><span class="op">(</span><span class="nam">directories</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1392" href="#t1392">1392</a></span><span class="t"> <span class="nam">result</span> <span class="op">=</span> <span class="op">{</span><span class="str">"."</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1393" href="#t1393">1393</a></span><span class="t"> <span class="key">for</span> <span class="nam">path</span> <span class="key">in</span> <span class="nam">directories</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1394" href="#t1394">1394</a></span><span class="t"> <span class="nam">current</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">dirname</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1395" href="#t1395">1395</a></span><span class="t"> <span class="key">while</span> <span class="nam">current</span> <span class="key">and</span> <span class="nam">current</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">result</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1396" href="#t1396">1396</a></span><span class="t"> <span class="nam">result</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">current</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1397" href="#t1397">1397</a></span><span class="t"> <span class="nam">current</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">dirname</span><span class="op">(</span><span class="nam">current</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1398" href="#t1398">1398</a></span><span class="t"> <span class="key">return</span> <span class="nam">result</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1399" href="#t1399">1399</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1400" href="#t1400">1400</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1401" href="#t1401">1401</a></span><span class="t"><span class="key">def</span> <span class="nam">_auto_compute_multi_arch</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1402" href="#t1402">1402</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1403" href="#t1403">1403</a></span><span class="t"> <span class="nam">control_output_dir</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1404" href="#t1404">1404</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">FSPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1405" href="#t1405">1405</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1406" href="#t1406">1406</a></span><span class="t"> <span class="nam">resolved_arch</span> <span class="op">=</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">resolved_architecture</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1407" href="#t1407">1407</a></span><span class="t"> <span class="key">if</span> <span class="nam">resolved_arch</span> <span class="op">==</span> <span class="str">"all"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1408" href="#t1408">1408</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1409" href="#t1409">1409</a></span><span class="t"> <span class="key">if</span> <span class="nam">any</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1410" href="#t1410">1410</a></span><span class="t"> <span class="nam">script</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1411" href="#t1411">1411</a></span><span class="t"> <span class="key">for</span> <span class="nam">script</span> <span class="key">in</span> <span class="nam">ALL_CONTROL_SCRIPTS</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1412" href="#t1412">1412</a></span><span class="t"> <span class="key">if</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">isfile</span><span class="op">(</span><span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">control_output_dir</span><span class="op">,</span> <span class="nam">script</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1413" href="#t1413">1413</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1414" href="#t1414">1414</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1415" href="#t1415">1415</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1416" href="#t1416">1416</a></span><span class="t"> <span class="nam">resolved_multiarch</span> <span class="op">=</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">deb_multiarch</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1417" href="#t1417">1417</a></span><span class="t"> <span class="key">assert</span> <span class="nam">resolved_arch</span> <span class="op">!=</span> <span class="str">"all"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1418" href="#t1418">1418</a></span><span class="t"> <span class="nam">acceptable_no_descend_paths</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1419" href="#t1419">1419</a></span><span class="t"> <span class="str">f"./usr/lib/{resolved_multiarch}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1420" href="#t1420">1420</a></span><span class="t"> <span class="str">f"./usr/include/{resolved_multiarch}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1421" href="#t1421">1421</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1422" href="#t1422">1422</a></span><span class="t"> <span class="nam">acceptable_files</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1423" href="#t1423">1423</a></span><span class="t"> <span class="str">f"./usr/share/doc/{binary_package.name}/{basename}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1424" href="#t1424">1424</a></span><span class="t"> <span class="key">for</span> <span class="nam">basename</span> <span class="key">in</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1425" href="#t1425">1425</a></span><span class="t"> <span class="str">"copyright"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1426" href="#t1426">1426</a></span><span class="t"> <span class="str">"changelog.gz"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1427" href="#t1427">1427</a></span><span class="t"> <span class="str">"changelog.Debian.gz"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1428" href="#t1428">1428</a></span><span class="t"> <span class="str">f"changelog.Debian.{resolved_arch}.gz"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1429" href="#t1429">1429</a></span><span class="t"> <span class="str">"NEWS.Debian"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1430" href="#t1430">1430</a></span><span class="t"> <span class="str">"NEWS.Debian.gz"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1431" href="#t1431">1431</a></span><span class="t"> <span class="str">"README.Debian"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1432" href="#t1432">1432</a></span><span class="t"> <span class="str">"README.Debian.gz"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1433" href="#t1433">1433</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1434" href="#t1434">1434</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1435" href="#t1435">1435</a></span><span class="t"> <span class="nam">acceptable_intermediate_dirs</span> <span class="op">=</span> <span class="nam">_all_parent_directories_of</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1436" href="#t1436">1436</a></span><span class="t"> <span class="nam">itertools</span><span class="op">.</span><span class="nam">chain</span><span class="op">(</span><span class="nam">acceptable_no_descend_paths</span><span class="op">,</span> <span class="nam">acceptable_files</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1437" href="#t1437">1437</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1438" href="#t1438">1438</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1439" href="#t1439">1439</a></span><span class="t"> <span class="key">for</span> <span class="nam">fs_path</span><span class="op">,</span> <span class="nam">children</span> <span class="key">in</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">walk</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1440" href="#t1440">1440</a></span><span class="t"> <span class="nam">path</span> <span class="op">=</span> <span class="nam">fs_path</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1441" href="#t1441">1441</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span> <span class="key">in</span> <span class="nam">acceptable_no_descend_paths</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1442" href="#t1442">1442</a></span><span class="t"> <span class="nam">children</span><span class="op">.</span><span class="nam">clear</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1443" href="#t1443">1443</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1444" href="#t1444">1444</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span> <span class="key">in</span> <span class="nam">acceptable_intermediate_dirs</span> <span class="key">or</span> <span class="nam">path</span> <span class="key">in</span> <span class="nam">acceptable_files</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1445" href="#t1445">1445</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1446" href="#t1446">1446</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1447" href="#t1447">1447</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1448" href="#t1448">1448</a></span><span class="t"> <span class="key">return</span> <span class="str">"same"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1449" href="#t1449">1449</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1450" href="#t1450">1450</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1451" href="#t1451">1451</a></span><span class="t"><span class="op">@</span><span class="nam">functools</span><span class="op">.</span><span class="nam">lru_cache</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1452" href="#t1452">1452</a></span><span class="t"><span class="key">def</span> <span class="nam">_has_t64_enabled</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1453" href="#t1453">1453</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1454" href="#t1454">1454</a></span><span class="t"> <span class="nam">output</span> <span class="op">=</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_output</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1455" href="#t1455">1455</a></span><span class="t"> <span class="op">[</span><span class="str">"dpkg-buildflags"</span><span class="op">,</span> <span class="str">"--query-features"</span><span class="op">,</span> <span class="str">"abi"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1456" href="#t1456">1456</a></span><span class="t"> <span class="op">)</span><span class="op">.</span><span class="nam">decode</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1457" href="#t1457">1457</a></span><span class="t"> <span class="key">except</span> <span class="op">(</span><span class="nam">subprocess</span><span class="op">.</span><span class="nam">CalledProcessError</span><span class="op">,</span> <span class="nam">FileNotFoundError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1458" href="#t1458">1458</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1459" href="#t1459">1459</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1460" href="#t1460">1460</a></span><span class="t"> <span class="key">for</span> <span class="nam">stanza</span> <span class="key">in</span> <span class="nam">Deb822</span><span class="op">.</span><span class="nam">iter_paragraphs</span><span class="op">(</span><span class="nam">output</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1461" href="#t1461">1461</a></span><span class="t"> <span class="key">if</span> <span class="nam">stanza</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"Feature"</span><span class="op">)</span> <span class="op">==</span> <span class="str">"time64"</span> <span class="key">and</span> <span class="nam">stanza</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"Enabled"</span><span class="op">)</span> <span class="op">==</span> <span class="str">"yes"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1462" href="#t1462">1462</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1463" href="#t1463">1463</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1464" href="#t1464">1464</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1465" href="#t1465">1465</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1466" href="#t1466">1466</a></span><span class="t"><span class="key">def</span> <span class="nam">_t64_migration_substvar</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1467" href="#t1467">1467</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1468" href="#t1468">1468</a></span><span class="t"> <span class="nam">control_output_dir</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1469" href="#t1469">1469</a></span><span class="t"> <span class="nam">substvars</span><span class="op">:</span> <span class="nam">FlushableSubstvars</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1470" href="#t1470">1470</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1471" href="#t1471">1471</a></span><span class="t"> <span class="nam">name</span> <span class="op">=</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1472" href="#t1472">1472</a></span><span class="t"> <span class="nam">compat_name</span> <span class="op">=</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">fields</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"X-Time64-Compat"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1473" href="#t1473">1473</a></span><span class="t"> <span class="key">if</span> <span class="nam">compat_name</span> <span class="key">is</span> <span class="key">None</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">_T64_REGEX</span><span class="op">.</span><span class="nam">match</span><span class="op">(</span><span class="nam">name</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1474" href="#t1474">1474</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1475" href="#t1475">1475</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1476" href="#t1476">1476</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">any</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1477" href="#t1477">1477</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">isfile</span><span class="op">(</span><span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">control_output_dir</span><span class="op">,</span> <span class="nam">n</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1478" href="#t1478">1478</a></span><span class="t"> <span class="key">for</span> <span class="nam">n</span> <span class="key">in</span> <span class="op">[</span><span class="str">"symbols"</span><span class="op">,</span> <span class="str">"shlibs"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1479" href="#t1479">1479</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1480" href="#t1480">1480</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1481" href="#t1481">1481</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1482" href="#t1482">1482</a></span><span class="t"> <span class="key">if</span> <span class="nam">compat_name</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1483" href="#t1483">1483</a></span><span class="t"> <span class="nam">compat_name</span> <span class="op">=</span> <span class="nam">name</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">"t64"</span><span class="op">,</span> <span class="str">""</span><span class="op">,</span> <span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1484" href="#t1484">1484</a></span><span class="t"> <span class="key">if</span> <span class="nam">compat_name</span> <span class="op">==</span> <span class="nam">name</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1485" href="#t1485">1485</a></span><span class="t"> <span class="key">raise</span> <span class="nam">AssertionError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1486" href="#t1486">1486</a></span><span class="t"> <span class="str">f"Failed to derive a t64 compat name for {name}. Please file a bug against debputy."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1487" href="#t1487">1487</a></span><span class="t"> <span class="str">" As a work around, you can explicitly provide a X-Time64-Compat header in debian/control"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1488" href="#t1488">1488</a></span><span class="t"> <span class="str">" where you specify the desired compat name."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1489" href="#t1489">1489</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1490" href="#t1490">1490</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1491" href="#t1491">1491</a></span><span class="t"> <span class="nam">arch_bits</span> <span class="op">=</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">package_deb_architecture_variable</span><span class="op">(</span><span class="str">"ARCH_BITS"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1492" href="#t1492">1492</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1493" href="#t1493">1493</a></span><span class="t"> <span class="key">if</span> <span class="nam">arch_bits</span> <span class="op">!=</span> <span class="str">"32"</span> <span class="key">or</span> <span class="key">not</span> <span class="nam">_has_t64_enabled</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1494" href="#t1494">1494</a></span><span class="t"> <span class="nam">substvars</span><span class="op">.</span><span class="nam">add_dependency</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1495" href="#t1495">1495</a></span><span class="t"> <span class="nam">_T64_PROVIDES</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1496" href="#t1496">1496</a></span><span class="t"> <span class="str">f"{compat_name} (= ${{binary:Version}})"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1497" href="#t1497">1497</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1498" href="#t1498">1498</a></span><span class="t"> <span class="key">elif</span> <span class="nam">_T64_PROVIDES</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">substvars</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1499" href="#t1499">1499</a></span><span class="t"> <span class="nam">substvars</span><span class="op">[</span><span class="nam">_T64_PROVIDES</span><span class="op">]</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1500" href="#t1500">1500</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1501" href="#t1501">1501</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1502" href="#t1502">1502</a></span><span class="t"><span class="op">@</span><span class="nam">functools</span><span class="op">.</span><span class="nam">lru_cache</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1503" href="#t1503">1503</a></span><span class="t"><span class="key">def</span> <span class="nam">dpkg_field_list_pkg_dep</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1504" href="#t1504">1504</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1505" href="#t1505">1505</a></span><span class="t"> <span class="nam">output</span> <span class="op">=</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_output</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1506" href="#t1506">1506</a></span><span class="t"> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1507" href="#t1507">1507</a></span><span class="t"> <span class="str">"perl"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1508" href="#t1508">1508</a></span><span class="t"> <span class="str">"-MDpkg::Control::Fields"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1509" href="#t1509">1509</a></span><span class="t"> <span class="str">"-e"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1510" href="#t1510">1510</a></span><span class="t"> <span class="str">r'print "$_\n" for field_list_pkg_dep'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1511" href="#t1511">1511</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1512" href="#t1512">1512</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1513" href="#t1513">1513</a></span><span class="t"> <span class="key">except</span> <span class="op">(</span><span class="nam">FileNotFoundError</span><span class="op">,</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">CalledProcessError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1514" href="#t1514">1514</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span><span class="str">"Could not run perl -MDpkg::Control::Fields to get a list of fields"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1515" href="#t1515">1515</a></span><span class="t"> <span class="key">return</span> <span class="nam">output</span><span class="op">.</span><span class="nam">decode</span><span class="op">(</span><span class="str">"utf-8"</span><span class="op">)</span><span class="op">.</span><span class="nam">splitlines</span><span class="op">(</span><span class="nam">keepends</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1516" href="#t1516">1516</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1517" href="#t1517">1517</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1518" href="#t1518">1518</a></span><span class="t"><span class="key">def</span> <span class="nam">_handle_relationship_substvars</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1519" href="#t1519">1519</a></span><span class="t"> <span class="nam">source</span><span class="op">:</span> <span class="nam">SourcePackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1520" href="#t1520">1520</a></span><span class="t"> <span class="nam">dctrl_file</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1521" href="#t1521">1521</a></span><span class="t"> <span class="nam">substvars</span><span class="op">:</span> <span class="nam">FlushableSubstvars</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1522" href="#t1522">1522</a></span><span class="t"> <span class="nam">has_dbgsym</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1523" href="#t1523">1523</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1524" href="#t1524">1524</a></span><span class="t"> <span class="nam">relationship_fields</span> <span class="op">=</span> <span class="nam">dpkg_field_list_pkg_dep</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1525" href="#t1525">1525</a></span><span class="t"> <span class="nam">relationship_fields_lc</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span><span class="nam">x</span><span class="op">.</span><span class="nam">lower</span><span class="op">(</span><span class="op">)</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">relationship_fields</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1526" href="#t1526">1526</a></span><span class="t"> <span class="nam">substvar_fields</span> <span class="op">=</span> <span class="nam">collections</span><span class="op">.</span><span class="nam">defaultdict</span><span class="op">(</span><span class="nam">list</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1527" href="#t1527">1527</a></span><span class="t"> <span class="nam">needs_dbgsym_stanza</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1528" href="#t1528">1528</a></span><span class="t"> <span class="key">for</span> <span class="nam">substvar_name</span><span class="op">,</span> <span class="nam">substvar</span> <span class="key">in</span> <span class="nam">substvars</span><span class="op">.</span><span class="nam">as_substvar</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1529" href="#t1529">1529</a></span><span class="t"> <span class="key">if</span> <span class="str">":"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">substvar_name</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1530" href="#t1530">1530</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1531" href="#t1531">1531</a></span><span class="t"> <span class="key">if</span> <span class="nam">substvar</span><span class="op">.</span><span class="nam">assignment_operator</span> <span class="key">in</span> <span class="op">(</span><span class="str">"$="</span><span class="op">,</span> <span class="str">"!="</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1532" href="#t1532">1532</a></span><span class="t"> <span class="com"># Will create incorrect results if there is a dbgsym and we do nothing</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1533" href="#t1533">1533</a></span><span class="t"> <span class="nam">needs_dbgsym_stanza</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1534" href="#t1534">1534</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1535" href="#t1535">1535</a></span><span class="t"> <span class="key">if</span> <span class="nam">substvar</span><span class="op">.</span><span class="nam">assignment_operator</span> <span class="op">==</span> <span class="str">"$="</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1536" href="#t1536">1536</a></span><span class="t"> <span class="com"># Automatically handled; no need for manual merging.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1537" href="#t1537">1537</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1538" href="#t1538">1538</a></span><span class="t"> <span class="nam">_</span><span class="op">,</span> <span class="nam">field</span> <span class="op">=</span> <span class="nam">substvar_name</span><span class="op">.</span><span class="nam">rsplit</span><span class="op">(</span><span class="str">":"</span><span class="op">,</span> <span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1539" href="#t1539">1539</a></span><span class="t"> <span class="nam">field_lc</span> <span class="op">=</span> <span class="nam">field</span><span class="op">.</span><span class="nam">lower</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1540" href="#t1540">1540</a></span><span class="t"> <span class="key">if</span> <span class="nam">field_lc</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">relationship_fields_lc</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1541" href="#t1541">1541</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1542" href="#t1542">1542</a></span><span class="t"> <span class="nam">substvar_fields</span><span class="op">[</span><span class="nam">field_lc</span><span class="op">]</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">"${"</span> <span class="op">+</span> <span class="nam">substvar_name</span> <span class="op">+</span> <span class="str">"}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1543" href="#t1543">1543</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1544" href="#t1544">1544</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">has_dbgsym</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1545" href="#t1545">1545</a></span><span class="t"> <span class="nam">needs_dbgsym_stanza</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1546" href="#t1546">1546</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1547" href="#t1547">1547</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">substvar_fields</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">needs_dbgsym_stanza</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1548" href="#t1548">1548</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1549" href="#t1549">1549</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1550" href="#t1550">1550</a></span><span class="t"> <span class="nam">replacement_stanza</span> <span class="op">=</span> <span class="nam">debian</span><span class="op">.</span><span class="nam">deb822</span><span class="op">.</span><span class="nam">Deb822</span><span class="op">(</span><span class="nam">dctrl_file</span><span class="op">.</span><span class="nam">fields</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1551" href="#t1551">1551</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1552" href="#t1552">1552</a></span><span class="t"> <span class="key">for</span> <span class="nam">field_name</span> <span class="key">in</span> <span class="nam">relationship_fields</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1553" href="#t1553">1553</a></span><span class="t"> <span class="nam">field_name_lc</span> <span class="op">=</span> <span class="nam">field_name</span><span class="op">.</span><span class="nam">lower</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1554" href="#t1554">1554</a></span><span class="t"> <span class="nam">addendum</span> <span class="op">=</span> <span class="nam">substvar_fields</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">field_name_lc</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1555" href="#t1555">1555</a></span><span class="t"> <span class="key">if</span> <span class="nam">addendum</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1556" href="#t1556">1556</a></span><span class="t"> <span class="com"># No merging required</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1557" href="#t1557">1557</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1558" href="#t1558">1558</a></span><span class="t"> <span class="nam">substvars_part</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">addendum</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1559" href="#t1559">1559</a></span><span class="t"> <span class="nam">existing_value</span> <span class="op">=</span> <span class="nam">replacement_stanza</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">field_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1560" href="#t1560">1560</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1561" href="#t1561">1561</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing_value</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">existing_value</span><span class="op">.</span><span class="nam">isspace</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1562" href="#t1562">1562</a></span><span class="t"> <span class="nam">final_value</span> <span class="op">=</span> <span class="nam">substvars_part</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1563" href="#t1563">1563</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1564" href="#t1564">1564</a></span><span class="t"> <span class="nam">existing_value</span> <span class="op">=</span> <span class="nam">existing_value</span><span class="op">.</span><span class="nam">rstrip</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">rstrip</span><span class="op">(</span><span class="str">","</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1565" href="#t1565">1565</a></span><span class="t"> <span class="nam">final_value</span> <span class="op">=</span> <span class="str">f"{existing_value}, {substvars_part}"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1566" href="#t1566">1566</a></span><span class="t"> <span class="nam">replacement_stanza</span><span class="op">[</span><span class="nam">field_name</span><span class="op">]</span> <span class="op">=</span> <span class="nam">final_value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1567" href="#t1567">1567</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1568" href="#t1568">1568</a></span><span class="t"> <span class="nam">tmpdir</span> <span class="op">=</span> <span class="nam">generated_content_dir</span><span class="op">(</span><span class="nam">package</span><span class="op">=</span><span class="nam">dctrl_file</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1569" href="#t1569">1569</a></span><span class="t"> <span class="key">with</span> <span class="nam">tempfile</span><span class="op">.</span><span class="nam">NamedTemporaryFile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1570" href="#t1570">1570</a></span><span class="t"> <span class="nam">mode</span><span class="op">=</span><span class="str">"wb"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1571" href="#t1571">1571</a></span><span class="t"> <span class="nam">dir</span><span class="op">=</span><span class="nam">tmpdir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1572" href="#t1572">1572</a></span><span class="t"> <span class="nam">suffix</span><span class="op">=</span><span class="str">"__DEBIAN_control"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1573" href="#t1573">1573</a></span><span class="t"> <span class="nam">delete</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1574" href="#t1574">1574</a></span><span class="t"> <span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1575" href="#t1575">1575</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1576" href="#t1576">1576</a></span><span class="t"> <span class="nam">cast</span><span class="op">(</span><span class="str">"Any"</span><span class="op">,</span> <span class="nam">source</span><span class="op">.</span><span class="nam">fields</span><span class="op">)</span><span class="op">.</span><span class="nam">dump</span><span class="op">(</span><span class="nam">fd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1577" href="#t1577">1577</a></span><span class="t"> <span class="key">except</span> <span class="nam">AttributeError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1578" href="#t1578">1578</a></span><span class="t"> <span class="nam">debian</span><span class="op">.</span><span class="nam">deb822</span><span class="op">.</span><span class="nam">Deb822</span><span class="op">(</span><span class="nam">source</span><span class="op">.</span><span class="nam">fields</span><span class="op">)</span><span class="op">.</span><span class="nam">dump</span><span class="op">(</span><span class="nam">fd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1579" href="#t1579">1579</a></span><span class="t"> <span class="nam">fd</span><span class="op">.</span><span class="nam">write</span><span class="op">(</span><span class="str">b"\n"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1580" href="#t1580">1580</a></span><span class="t"> <span class="nam">replacement_stanza</span><span class="op">.</span><span class="nam">dump</span><span class="op">(</span><span class="nam">fd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1581" href="#t1581">1581</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1582" href="#t1582">1582</a></span><span class="t"> <span class="key">if</span> <span class="nam">has_dbgsym</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1583" href="#t1583">1583</a></span><span class="t"> <span class="com"># Minimal stanza to avoid substvars warnings. Most fields are still set</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1584" href="#t1584">1584</a></span><span class="t"> <span class="com"># via -D.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1585" href="#t1585">1585</a></span><span class="t"> <span class="nam">dbgsym_stanza</span> <span class="op">=</span> <span class="nam">Deb822</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1586" href="#t1586">1586</a></span><span class="t"> <span class="nam">dbgsym_stanza</span><span class="op">[</span><span class="str">"Package"</span><span class="op">]</span> <span class="op">=</span> <span class="str">f"{dctrl_file.name}-dbgsym"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1587" href="#t1587">1587</a></span><span class="t"> <span class="nam">dbgsym_stanza</span><span class="op">[</span><span class="str">"Architecture"</span><span class="op">]</span> <span class="op">=</span> <span class="nam">dctrl_file</span><span class="op">.</span><span class="nam">fields</span><span class="op">[</span><span class="str">"Architecture"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1588" href="#t1588">1588</a></span><span class="t"> <span class="nam">dbgsym_stanza</span><span class="op">[</span><span class="str">"Description"</span><span class="op">]</span> <span class="op">=</span> <span class="str">f"debug symbols for {dctrl_file.name}"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1589" href="#t1589">1589</a></span><span class="t"> <span class="nam">fd</span><span class="op">.</span><span class="nam">write</span><span class="op">(</span><span class="str">b"\n"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1590" href="#t1590">1590</a></span><span class="t"> <span class="nam">dbgsym_stanza</span><span class="op">.</span><span class="nam">dump</span><span class="op">(</span><span class="nam">fd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1591" href="#t1591">1591</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1592" href="#t1592">1592</a></span><span class="t"> <span class="key">return</span> <span class="nam">fd</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1593" href="#t1593">1593</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1594" href="#t1594">1594</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1595" href="#t1595">1595</a></span><span class="t"><span class="key">def</span> <span class="nam">_generate_control_files</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1596" href="#t1596">1596</a></span><span class="t"> <span class="nam">source_package</span><span class="op">:</span> <span class="nam">SourcePackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1597" href="#t1597">1597</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1598" href="#t1598">1598</a></span><span class="t"> <span class="nam">package_state</span><span class="op">:</span> <span class="nam">PackageTransformationDefinition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1599" href="#t1599">1599</a></span><span class="t"> <span class="nam">control_output_dir</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1600" href="#t1600">1600</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">FSPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1601" href="#t1601">1601</a></span><span class="t"> <span class="nam">substvars</span><span class="op">:</span> <span class="nam">FlushableSubstvars</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1602" href="#t1602">1602</a></span><span class="t"> <span class="nam">dbgsym_root_fs</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1603" href="#t1603">1603</a></span><span class="t"> <span class="nam">dbgsym_build_ids</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1604" href="#t1604">1604</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1605" href="#t1605">1605</a></span><span class="t"> <span class="nam">package</span> <span class="op">=</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1606" href="#t1606">1606</a></span><span class="t"> <span class="nam">extra_common_params</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1607" href="#t1607">1607</a></span><span class="t"> <span class="nam">extra_params_specific</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1608" href="#t1608">1608</a></span><span class="t"> <span class="nam">_ensure_base_substvars_defined</span><span class="op">(</span><span class="nam">substvars</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1609" href="#t1609">1609</a></span><span class="t"> <span class="key">if</span> <span class="str">"Installed-Size"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">substvars</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1610" href="#t1610">1610</a></span><span class="t"> <span class="com"># Pass it via cmd-line to make it more visible that we are providing the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1611" href="#t1611">1611</a></span><span class="t"> <span class="com"># value. It also prevents the dbgsym package from picking up this value.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1612" href="#t1612">1612</a></span><span class="t"> <span class="nam">ctrl_fs_root</span> <span class="op">=</span> <span class="nam">FSROOverlay</span><span class="op">.</span><span class="nam">create_root_dir</span><span class="op">(</span><span class="str">"DEBIAN"</span><span class="op">,</span> <span class="nam">control_output_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1613" href="#t1613">1613</a></span><span class="t"> <span class="nam">total_size</span> <span class="op">=</span> <span class="nam">_compute_installed_size</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">)</span> <span class="op">+</span> <span class="nam">_compute_installed_size</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1614" href="#t1614">1614</a></span><span class="t"> <span class="nam">ctrl_fs_root</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1615" href="#t1615">1615</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1616" href="#t1616">1616</a></span><span class="t"> <span class="nam">extra_params_specific</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">f"-VInstalled-Size={total_size}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1617" href="#t1617">1617</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1618" href="#t1618">1618</a></span><span class="t"> <span class="nam">ma_value</span> <span class="op">=</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">fields</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"Multi-Arch"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1619" href="#t1619">1619</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">is_udeb</span> <span class="key">and</span> <span class="nam">ma_value</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1620" href="#t1620">1620</a></span><span class="t"> <span class="nam">ma_value</span> <span class="op">=</span> <span class="nam">_auto_compute_multi_arch</span><span class="op">(</span><span class="nam">binary_package</span><span class="op">,</span> <span class="nam">control_output_dir</span><span class="op">,</span> <span class="nam">fs_root</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1621" href="#t1621">1621</a></span><span class="t"> <span class="key">if</span> <span class="nam">ma_value</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1622" href="#t1622">1622</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1623" href="#t1623">1623</a></span><span class="t"> <span class="str">f'The package "{binary_package.name}" looks like it should be "Multi-Arch: {ma_value}" based'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1624" href="#t1624">1624</a></span><span class="t"> <span class="str">' on the contents and there is no explicit "Multi-Arch" field. Setting the Multi-Arch field'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1625" href="#t1625">1625</a></span><span class="t"> <span class="str">' accordingly in the binary. If this auto-correction is wrong, please add "Multi-Arch: no" to the'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1626" href="#t1626">1626</a></span><span class="t"> <span class="str">' relevant part of "debian/control" to disable this feature.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1627" href="#t1627">1627</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1628" href="#t1628">1628</a></span><span class="t"> <span class="com"># We want this to apply to the `-dbgsym` package as well to avoid</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1629" href="#t1629">1629</a></span><span class="t"> <span class="com"># lintian `debug-package-for-multi-arch-same-pkg-not-coinstallable`</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1630" href="#t1630">1630</a></span><span class="t"> <span class="nam">extra_common_params</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">f"-DMulti-Arch={ma_value}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1631" href="#t1631">1631</a></span><span class="t"> <span class="key">elif</span> <span class="nam">ma_value</span> <span class="op">==</span> <span class="str">"no"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1632" href="#t1632">1632</a></span><span class="t"> <span class="nam">extra_common_params</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">"-UMulti-Arch"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1633" href="#t1633">1633</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1634" href="#t1634">1634</a></span><span class="t"> <span class="nam">dbgsym_root_dir</span> <span class="op">=</span> <span class="nam">dhe_dbgsym_root_dir</span><span class="op">(</span><span class="nam">binary_package</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1635" href="#t1635">1635</a></span><span class="t"> <span class="nam">dbgsym_ids</span> <span class="op">=</span> <span class="str">" "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">dbgsym_build_ids</span><span class="op">)</span> <span class="key">if</span> <span class="nam">dbgsym_build_ids</span> <span class="key">else</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1636" href="#t1636">1636</a></span><span class="t"> <span class="key">if</span> <span class="nam">package_state</span><span class="op">.</span><span class="nam">binary_version</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1637" href="#t1637">1637</a></span><span class="t"> <span class="nam">extra_common_params</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">f"-v{package_state.binary_version}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1638" href="#t1638">1638</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1639" href="#t1639">1639</a></span><span class="t"> <span class="nam">_t64_migration_substvar</span><span class="op">(</span><span class="nam">binary_package</span><span class="op">,</span> <span class="nam">control_output_dir</span><span class="op">,</span> <span class="nam">substvars</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1640" href="#t1640">1640</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1641" href="#t1641">1641</a></span><span class="t"> <span class="key">with</span> <span class="nam">substvars</span><span class="op">.</span><span class="nam">flush</span><span class="op">(</span><span class="op">)</span> <span class="key">as</span> <span class="nam">flushed_substvars</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1642" href="#t1642">1642</a></span><span class="t"> <span class="nam">has_dbgsym</span> <span class="op">=</span> <span class="nam">dbgsym_root_fs</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">any</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1643" href="#t1643">1643</a></span><span class="t"> <span class="nam">f</span> <span class="key">for</span> <span class="nam">f</span> <span class="key">in</span> <span class="nam">dbgsym_root_fs</span><span class="op">.</span><span class="nam">all_paths</span><span class="op">(</span><span class="op">)</span> <span class="key">if</span> <span class="nam">f</span><span class="op">.</span><span class="nam">is_file</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1644" href="#t1644">1644</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1645" href="#t1645">1645</a></span><span class="t"> <span class="nam">dctrl_file</span> <span class="op">=</span> <span class="nam">_handle_relationship_substvars</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1646" href="#t1646">1646</a></span><span class="t"> <span class="nam">source_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1647" href="#t1647">1647</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1648" href="#t1648">1648</a></span><span class="t"> <span class="nam">substvars</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1649" href="#t1649">1649</a></span><span class="t"> <span class="nam">has_dbgsym</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1650" href="#t1650">1650</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1651" href="#t1651">1651</a></span><span class="t"> <span class="key">if</span> <span class="nam">dctrl_file</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1652" href="#t1652">1652</a></span><span class="t"> <span class="nam">dctrl_file</span> <span class="op">=</span> <span class="str">"debian/control"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1653" href="#t1653">1653</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1654" href="#t1654">1654</a></span><span class="t"> <span class="key">if</span> <span class="nam">has_dbgsym</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1655" href="#t1655">1655</a></span><span class="t"> <span class="nam">_generate_dbgsym_control_file_if_relevant</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1656" href="#t1656">1656</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1657" href="#t1657">1657</a></span><span class="t"> <span class="nam">dbgsym_root_fs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1658" href="#t1658">1658</a></span><span class="t"> <span class="nam">dbgsym_root_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1659" href="#t1659">1659</a></span><span class="t"> <span class="nam">dbgsym_ids</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1660" href="#t1660">1660</a></span><span class="t"> <span class="nam">ma_value</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1661" href="#t1661">1661</a></span><span class="t"> <span class="nam">dctrl_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1662" href="#t1662">1662</a></span><span class="t"> <span class="nam">extra_common_params</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1663" href="#t1663">1663</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1664" href="#t1664">1664</a></span><span class="t"> <span class="nam">generate_md5sums_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1665" href="#t1665">1665</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">dbgsym_root_dir</span><span class="op">,</span> <span class="str">"DEBIAN"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1666" href="#t1666">1666</a></span><span class="t"> <span class="nam">dbgsym_root_fs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1667" href="#t1667">1667</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1668" href="#t1668">1668</a></span><span class="t"> <span class="key">elif</span> <span class="nam">dbgsym_ids</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1669" href="#t1669">1669</a></span><span class="t"> <span class="nam">extra_common_params</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">f"-DBuild-Ids={dbgsym_ids}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1670" href="#t1670">1670</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1671" href="#t1671">1671</a></span><span class="t"> <span class="nam">ctrl_file</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">control_output_dir</span><span class="op">,</span> <span class="str">"control"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1672" href="#t1672">1672</a></span><span class="t"> <span class="nam">dpkg_cmd</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1673" href="#t1673">1673</a></span><span class="t"> <span class="str">"dpkg-gencontrol"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1674" href="#t1674">1674</a></span><span class="t"> <span class="str">f"-p{package}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1675" href="#t1675">1675</a></span><span class="t"> <span class="com"># FIXME: Support d/<pkg>.changelog at some point.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1676" href="#t1676">1676</a></span><span class="t"> <span class="str">"-ldebian/changelog"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1677" href="#t1677">1677</a></span><span class="t"> <span class="str">f"-c{dctrl_file}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1678" href="#t1678">1678</a></span><span class="t"> <span class="str">f"-T{flushed_substvars}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1679" href="#t1679">1679</a></span><span class="t"> <span class="str">f"-O{ctrl_file}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1680" href="#t1680">1680</a></span><span class="t"> <span class="str">f"-P{control_output_dir}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1681" href="#t1681">1681</a></span><span class="t"> <span class="op">*</span><span class="nam">extra_common_params</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1682" href="#t1682">1682</a></span><span class="t"> <span class="op">*</span><span class="nam">extra_params_specific</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1683" href="#t1683">1683</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1684" href="#t1684">1684</a></span><span class="t"> <span class="nam">print_command</span><span class="op">(</span><span class="op">*</span><span class="nam">dpkg_cmd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1685" href="#t1685">1685</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1686" href="#t1686">1686</a></span><span class="t"> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_call</span><span class="op">(</span><span class="nam">dpkg_cmd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1687" href="#t1687">1687</a></span><span class="t"> <span class="key">except</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">CalledProcessError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1688" href="#t1688">1688</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1689" href="#t1689">1689</a></span><span class="t"> <span class="str">f"Attempting to generate DEBIAN/control file for {package} failed. Please review the output from "</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1690" href="#t1690">1690</a></span><span class="t"> <span class="str">" dpkg-gencontrol above to understand what went wrong."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1691" href="#t1691">1691</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1692" href="#t1692">1692</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">chmod</span><span class="op">(</span><span class="nam">ctrl_file</span><span class="op">,</span> <span class="num">0o644</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1693" href="#t1693">1693</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1694" href="#t1694">1694</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">is_udeb</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1695" href="#t1695">1695</a></span><span class="t"> <span class="nam">generate_md5sums_file</span><span class="op">(</span><span class="nam">control_output_dir</span><span class="op">,</span> <span class="nam">fs_root</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_6e57078c9ef7177d_plugin_cmds_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_debhelper_emulation_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_267b6307937f1878_debhelper_emulation_py.html b/coverage-report/d_267b6307937f1878_debhelper_emulation_py.html deleted file mode 100644 index 735f581..0000000 --- a/coverage-report/d_267b6307937f1878_debhelper_emulation_py.html +++ /dev/null @@ -1,368 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/debhelper_emulation.py: 73%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/debhelper_emulation.py</b>: - <span class="pc_cov">73%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">143 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">107<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">36<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">3<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_deb_packaging_support_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_23db3c975895bd86___init___py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">dataclasses</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">re</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">import</span> <span class="nam">shutil</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">from</span> <span class="nam">re</span> <span class="key">import</span> <span class="nam">Match</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">Callable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">Iterable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">Sequence</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">cast</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">Mapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">Set</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">List</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">packages</span> <span class="key">import</span> <span class="nam">BinaryPackage</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="nam">VirtualPath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">substitution</span> <span class="key">import</span> <span class="nam">Substitution</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">ensure_dir</span><span class="op">,</span> <span class="nam">print_command</span><span class="op">,</span> <span class="nam">_error</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"><span class="nam">SnippetReplacement</span> <span class="op">=</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"><span class="nam">MAINTSCRIPT_TOKEN_NAME_PATTERN</span> <span class="op">=</span> <span class="str">r"[A-Za-z0-9_.+]+"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"><span class="nam">MAINTSCRIPT_TOKEN_NAME_REGEX</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="nam">MAINTSCRIPT_TOKEN_NAME_PATTERN</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"><span class="nam">MAINTSCRIPT_TOKEN_REGEX</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">f"#({MAINTSCRIPT_TOKEN_NAME_PATTERN})#"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"><span class="nam">_ARCH_FILTER_START</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r"^\s*(\[([^]]*)])[ \t]+"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"><span class="nam">_ARCH_FILTER_END</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r"\s+(\[([^]]*)])\s*$"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"><span class="nam">_BUILD_PROFILE_FILTER</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r"(<([^>]*)>(?:\s+<([^>]*)>)*)"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"><span class="key">class</span> <span class="nam">CannotEmulateExecutableDHConfigFile</span><span class="op">(</span><span class="nam">Exception</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="key">def</span> <span class="nam">message</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="key">return</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"str"</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">args</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="key">def</span> <span class="nam">config_file</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">VirtualPath</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="key">return</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"VirtualPath"</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">args</span><span class="op">[</span><span class="num">1</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"><span class="key">class</span> <span class="nam">DHConfigFileLine</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="nam">config_file</span><span class="op">:</span> <span class="nam">VirtualPath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="nam">line_no</span><span class="op">:</span> <span class="nam">int</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="nam">executable_config</span><span class="op">:</span> <span class="nam">bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="nam">original_line</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="nam">tokens</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="nam">arch_filter</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="nam">build_profile_filter</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="key">def</span> <span class="nam">conditional_key</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="op">...</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="nam">k</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">arch_filter</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="nam">k</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">"arch"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">k</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">arch_filter</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">build_profile_filter</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="nam">k</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">"build-profiles"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="nam">k</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">build_profile_filter</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="key">return</span> <span class="nam">tuple</span><span class="op">(</span><span class="nam">k</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="key">def</span> <span class="nam">conditional</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="nam">filters</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">arch_filter</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="nam">filters</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="op">{</span><span class="str">"arch-matches"</span><span class="op">:</span> <span class="nam">self</span><span class="op">.</span><span class="nam">arch_filter</span><span class="op">}</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">build_profile_filter</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="nam">filters</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="op">{</span><span class="str">"build-profiles-matches"</span><span class="op">:</span> <span class="nam">self</span><span class="op">.</span><span class="nam">build_profile_filter</span><span class="op">}</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">filters</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">filters</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="key">return</span> <span class="nam">filters</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="key">return</span> <span class="op">{</span><span class="str">"all-of"</span><span class="op">:</span> <span class="nam">filters</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"><span class="key">def</span> <span class="nam">dhe_dbgsym_root_dir</span><span class="op">(</span><span class="nam">binary_package</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="key">return</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="str">"debian"</span><span class="op">,</span> <span class="str">".debhelper"</span><span class="op">,</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">name</span><span class="op">,</span> <span class="str">"dbgsym-root"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"><span class="key">def</span> <span class="nam">read_dbgsym_file</span><span class="op">(</span><span class="nam">binary_package</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">)</span> <span class="op">-></span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="nam">dbgsym_id_file</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="str">"debian"</span><span class="op">,</span> <span class="str">".debhelper"</span><span class="op">,</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">name</span><span class="op">,</span> <span class="str">"dbgsym-build-ids"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="key">with</span> <span class="nam">open</span><span class="op">(</span><span class="nam">dbgsym_id_file</span><span class="op">,</span> <span class="str">"rt"</span><span class="op">,</span> <span class="nam">encoding</span><span class="op">=</span><span class="str">"utf-8"</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="key">return</span> <span class="nam">fd</span><span class="op">.</span><span class="nam">read</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="key">except</span> <span class="nam">FileNotFoundError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="key">return</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"><span class="key">def</span> <span class="nam">assert_no_dbgsym_migration</span><span class="op">(</span><span class="nam">binary_package</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="nam">dbgsym_migration_file</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="str">"debian"</span><span class="op">,</span> <span class="str">".debhelper"</span><span class="op">,</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">name</span><span class="op">,</span> <span class="str">"dbgsym-migration"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="key">if</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">lexists</span><span class="op">(</span><span class="nam">dbgsym_migration_file</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="str">"Sorry, debputy does not support dh_strip --dbgsym-migration feature. Please either finish the"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="str">" migration first or migrate to debputy later"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"><span class="key">def</span> <span class="nam">_prune_match</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="nam">line</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="nam">match</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Match</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="nam">match_mapper</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">Match</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="key">if</span> <span class="nam">match</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="key">return</span> <span class="nam">line</span><span class="op">,</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="nam">s</span><span class="op">,</span> <span class="nam">e</span> <span class="op">=</span> <span class="nam">match</span><span class="op">.</span><span class="nam">span</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="key">if</span> <span class="nam">match_mapper</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="nam">matched_part</span> <span class="op">=</span> <span class="nam">match_mapper</span><span class="op">(</span><span class="nam">match</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="nam">matched_part</span> <span class="op">=</span> <span class="nam">line</span><span class="op">[</span><span class="nam">s</span><span class="op">:</span><span class="nam">e</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="com"># We prune exactly the matched part and assume the regexes leaves behind spaces if they were important.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="nam">line</span> <span class="op">=</span> <span class="nam">line</span><span class="op">[</span><span class="op">:</span><span class="nam">s</span><span class="op">]</span> <span class="op">+</span> <span class="nam">line</span><span class="op">[</span><span class="nam">e</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="com"># One special-case, if the match is at the beginning or end, then we can safely discard left</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="com"># over whitespace.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="key">return</span> <span class="nam">line</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> <span class="nam">matched_part</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"><span class="key">def</span> <span class="nam">dhe_filedoublearray</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="nam">config_file</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="nam">substitution</span><span class="op">:</span> <span class="nam">Substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="nam">allow_dh_exec_rename</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">DHConfigFileLine</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="key">with</span> <span class="nam">config_file</span><span class="op">.</span><span class="nam">open</span><span class="op">(</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="nam">is_executable</span> <span class="op">=</span> <span class="nam">config_file</span><span class="op">.</span><span class="nam">is_executable</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="key">for</span> <span class="nam">line_no</span><span class="op">,</span> <span class="nam">orig_line</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">fd</span><span class="op">,</span> <span class="nam">start</span><span class="op">=</span><span class="num">1</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="nam">arch_filter</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="nam">build_profile_filter</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"><span class="annotate short">131 ↛ 138</span><span class="annotate long">line 131 didn't jump to line 138</span></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="nam">line_no</span> <span class="op">==</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="key">and</span> <span class="nam">is_executable</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="key">and</span> <span class="key">not</span> <span class="nam">orig_line</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="op">(</span><span class="str">"#!/usr/bin/dh-exec"</span><span class="op">,</span> <span class="str">"#! /usr/bin/dh-exec"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="key">raise</span> <span class="nam">CannotEmulateExecutableDHConfigFile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="str">"Only #!/usr/bin/dh-exec based executables can be emulated"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="nam">config_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="nam">orig_line</span> <span class="op">=</span> <span class="nam">orig_line</span><span class="op">.</span><span class="nam">rstrip</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="nam">line</span> <span class="op">=</span> <span class="nam">orig_line</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">line</span> <span class="key">or</span> <span class="nam">line</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"#"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_executable</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="key">if</span> <span class="str">"=>"</span> <span class="key">in</span> <span class="nam">line</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">allow_dh_exec_rename</span><span class="op">:</span> </span><span class="r"><span class="annotate short">147 ↛ 148</span><span class="annotate long">line 147 didn't jump to line 148, because the condition on line 147 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="key">raise</span> <span class="nam">CannotEmulateExecutableDHConfigFile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="str">'Cannot emulate dh-exec\'s "=>" feature to rename files for the concrete file'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="nam">config_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="nam">line</span><span class="op">,</span> <span class="nam">build_profile_filter</span> <span class="op">=</span> <span class="nam">_prune_match</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="nam">line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="nam">_BUILD_PROFILE_FILTER</span><span class="op">.</span><span class="nam">search</span><span class="op">(</span><span class="nam">line</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="nam">line</span><span class="op">,</span> <span class="nam">arch_filter</span> <span class="op">=</span> <span class="nam">_prune_match</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="nam">line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="nam">_ARCH_FILTER_START</span><span class="op">.</span><span class="nam">search</span><span class="op">(</span><span class="nam">line</span><span class="op">)</span> <span class="key">or</span> <span class="nam">_ARCH_FILTER_END</span><span class="op">.</span><span class="nam">search</span><span class="op">(</span><span class="nam">line</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="com"># Remove the enclosing []</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="key">lambda</span> <span class="nam">m</span><span class="op">:</span> <span class="nam">m</span><span class="op">.</span><span class="nam">group</span><span class="op">(</span><span class="num">1</span><span class="op">)</span><span class="op">[</span><span class="num">1</span><span class="op">:</span><span class="op">-</span><span class="num">1</span><span class="op">]</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="nam">parts</span> <span class="op">=</span> <span class="nam">tuple</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="nam">substitution</span><span class="op">.</span><span class="nam">substitute</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="nam">w</span><span class="op">,</span> <span class="str">f'{config_file.path} line {line_no} token "{w}"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="key">for</span> <span class="nam">w</span> <span class="key">in</span> <span class="nam">line</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="key">yield</span> <span class="nam">DHConfigFileLine</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="nam">config_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="nam">line_no</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="nam">is_executable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">orig_line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="nam">parts</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="nam">arch_filter</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="nam">build_profile_filter</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"><span class="key">def</span> <span class="nam">dhe_pkgfile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="nam">basename</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="nam">always_fallback_to_packageless_variant</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="nam">bug_950723_prefix_matching</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="com"># TODO: Architecture specific files</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="nam">maybe_at_suffix</span> <span class="op">=</span> <span class="str">"@"</span> <span class="key">if</span> <span class="nam">bug_950723_prefix_matching</span> <span class="key">else</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="nam">possible_names</span> <span class="op">=</span> <span class="op">[</span><span class="str">f"{binary_package.name}{maybe_at_suffix}.{basename}"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="key">if</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">is_main_package</span> <span class="key">or</span> <span class="nam">always_fallback_to_packageless_variant</span><span class="op">:</span> </span><span class="r"><span class="annotate short">190 ↛ 195</span><span class="annotate long">line 190 didn't jump to line 195, because the condition on line 190 was never false</span></span></p> - <p class="run"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="nam">possible_names</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="str">f"{basename}@"</span> <span class="key">if</span> <span class="nam">bug_950723_prefix_matching</span> <span class="key">else</span> <span class="nam">basename</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="key">for</span> <span class="nam">name</span> <span class="key">in</span> <span class="nam">possible_names</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="nam">match</span> <span class="op">=</span> <span class="nam">debian_dir</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="key">if</span> <span class="nam">match</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">match</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="key">return</span> <span class="nam">match</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"><span class="key">def</span> <span class="nam">dhe_pkgdir</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="nam">basename</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="nam">possible_names</span> <span class="op">=</span> <span class="op">[</span><span class="str">f"{binary_package.name}.{basename}"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="key">if</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">is_main_package</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="nam">possible_names</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">basename</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="key">for</span> <span class="nam">name</span> <span class="key">in</span> <span class="nam">possible_names</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="nam">match</span> <span class="op">=</span> <span class="nam">debian_dir</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="key">if</span> <span class="nam">match</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">match</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="key">return</span> <span class="nam">match</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"><span class="key">def</span> <span class="nam">dhe_install_pkg_file_as_ctrl_file_if_present</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="nam">basename</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="nam">control_output_dir</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="nam">mode</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="nam">source</span> <span class="op">=</span> <span class="nam">dhe_pkgfile</span><span class="op">(</span><span class="nam">debian_dir</span><span class="op">,</span> <span class="nam">binary_package</span><span class="op">,</span> <span class="nam">basename</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="key">if</span> <span class="nam">source</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="nam">ensure_dir</span><span class="op">(</span><span class="nam">control_output_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="nam">dhe_install_path</span><span class="op">(</span><span class="nam">source</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">,</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">control_output_dir</span><span class="op">,</span> <span class="nam">basename</span><span class="op">)</span><span class="op">,</span> <span class="nam">mode</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"><span class="key">def</span> <span class="nam">dhe_install_path</span><span class="op">(</span><span class="nam">source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">dest</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">mode</span><span class="op">:</span> <span class="nam">int</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="com"># TODO: "install -p -mXXXX foo bar" silently discards broken</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="com"># symlinks to install the file in place. (#868204)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="nam">print_command</span><span class="op">(</span><span class="str">"install"</span><span class="op">,</span> <span class="str">"-p"</span><span class="op">,</span> <span class="str">f"-m{oct(mode)[2:]}"</span><span class="op">,</span> <span class="nam">source</span><span class="op">,</span> <span class="nam">dest</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="nam">shutil</span><span class="op">.</span><span class="nam">copyfile</span><span class="op">(</span><span class="nam">source</span><span class="op">,</span> <span class="nam">dest</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">chmod</span><span class="op">(</span><span class="nam">dest</span><span class="op">,</span> <span class="nam">mode</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"><span class="nam">_FIND_DH_WITH</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r"--with(?:\s+|=)(\S+)"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"><span class="nam">_DEP_REGEX</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">"^([a-z0-9][-+.a-z0-9]+)"</span><span class="op">,</span> <span class="nam">re</span><span class="op">.</span><span class="nam">ASCII</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"><span class="key">def</span> <span class="nam">parse_drules_for_addons</span><span class="op">(</span><span class="nam">lines</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">sequences</span><span class="op">:</span> <span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="key">for</span> <span class="nam">line</span> <span class="key">in</span> <span class="nam">lines</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">line</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"\tdh "</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="key">for</span> <span class="nam">match</span> <span class="key">in</span> <span class="nam">_FIND_DH_WITH</span><span class="op">.</span><span class="nam">finditer</span><span class="op">(</span><span class="nam">line</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="nam">sequence_def</span> <span class="op">=</span> <span class="nam">match</span><span class="op">.</span><span class="nam">group</span><span class="op">(</span><span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="nam">sequences</span><span class="op">.</span><span class="nam">update</span><span class="op">(</span><span class="nam">sequence_def</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="str">","</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"><span class="key">def</span> <span class="nam">extract_dh_addons_from_control</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="nam">source_paragraph</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="nam">sequences</span><span class="op">:</span> <span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="key">for</span> <span class="nam">f</span> <span class="key">in</span> <span class="op">(</span><span class="str">"Build-Depends"</span><span class="op">,</span> <span class="str">"Build-Depends-Indep"</span><span class="op">,</span> <span class="str">"Build-Depends-Arch"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="nam">field</span> <span class="op">=</span> <span class="nam">source_paragraph</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">f</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">field</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="key">for</span> <span class="nam">dep_clause</span> <span class="key">in</span> <span class="op">(</span><span class="nam">d</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span> <span class="key">for</span> <span class="nam">d</span> <span class="key">in</span> <span class="nam">field</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="str">","</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="nam">match</span> <span class="op">=</span> <span class="nam">_DEP_REGEX</span><span class="op">.</span><span class="nam">match</span><span class="op">(</span><span class="nam">dep_clause</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">match</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="nam">dep</span> <span class="op">=</span> <span class="nam">match</span><span class="op">.</span><span class="nam">group</span><span class="op">(</span><span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">dep</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"dh-sequence-"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="nam">sequences</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">dep</span><span class="op">[</span><span class="num">12</span><span class="op">:</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_deb_packaging_support_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_23db3c975895bd86___init___py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_267b6307937f1878_elf_util_py.html b/coverage-report/d_267b6307937f1878_elf_util_py.html deleted file mode 100644 index 31c29a0..0000000 --- a/coverage-report/d_267b6307937f1878_elf_util_py.html +++ /dev/null @@ -1,307 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/elf_util.py: 76%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/elf_util.py</b>: - <span class="pc_cov">76%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">100 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">83<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">17<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">12<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_23db3c975895bd86_models_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_exceptions_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">io</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">struct</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">List</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">,</span> <span class="nam">Callable</span><span class="op">,</span> <span class="nam">Tuple</span><span class="op">,</span> <span class="nam">Iterable</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">filesystem_scan</span> <span class="key">import</span> <span class="nam">FSPath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="nam">VirtualPath</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="nam">ELF_HEADER_SIZE32</span> <span class="op">=</span> <span class="num">136</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"><span class="nam">ELF_HEADER_SIZE64</span> <span class="op">=</span> <span class="num">232</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"><span class="nam">ELF_MAGIC</span> <span class="op">=</span> <span class="str">b"\x7fELF"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="nam">ELF_VERSION</span> <span class="op">=</span> <span class="num">0x00000001</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"><span class="nam">ELF_ENDIAN_LE</span> <span class="op">=</span> <span class="num">0x01</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"><span class="nam">ELF_ENDIAN_BE</span> <span class="op">=</span> <span class="num">0x02</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"><span class="nam">ELF_TYPE_EXECUTABLE</span> <span class="op">=</span> <span class="num">0x0002</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"><span class="nam">ELF_TYPE_SHARED_OBJECT</span> <span class="op">=</span> <span class="num">0x0003</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"><span class="nam">ELF_LINKING_TYPE_ANY</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"><span class="nam">ELF_LINKING_TYPE_DYNAMIC</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"><span class="nam">ELF_LINKING_TYPE_STATIC</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"><span class="nam">ELF_EI_ELFCLASS32</span> <span class="op">=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"><span class="nam">ELF_EI_ELFCLASS64</span> <span class="op">=</span> <span class="num">2</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"><span class="nam">ELF_PT_DYNAMIC</span> <span class="op">=</span> <span class="num">2</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"><span class="nam">ELF_EI_NIDENT</span> <span class="op">=</span> <span class="num">0x10</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"><span class="com"># ELF header format:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"><span class="com"># typedef struct {</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"><span class="com"># unsigned char e_ident[EI_NIDENT]; # <-- 16 / 0x10 bytes</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"><span class="com"># uint16_t e_type;</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"><span class="com"># uint16_t e_machine;</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"><span class="com"># uint32_t e_version;</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"><span class="com"># ElfN_Addr e_entry;</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"><span class="com"># ElfN_Off e_phoff;</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="com"># ElfN_Off e_shoff;</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"><span class="com"># uint32_t e_flags;</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"><span class="com"># uint16_t e_ehsize;</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"><span class="com"># uint16_t e_phentsize;</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"><span class="com"># uint16_t e_phnum;</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"><span class="com"># uint16_t e_shentsize;</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"><span class="com"># uint16_t e_shnum;</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"><span class="com"># uint16_t e_shstrndx;</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"><span class="com"># } ElfN_Ehdr;</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"><span class="key">class</span> <span class="nam">IncompleteFileError</span><span class="op">(</span><span class="nam">RuntimeError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"><span class="key">def</span> <span class="nam">is_so_or_exec_elf_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="nam">assert_linking_type</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> <span class="op">=</span> <span class="nam">ELF_LINKING_TYPE_ANY</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="nam">is_elf</span><span class="op">,</span> <span class="nam">linking_type</span> <span class="op">=</span> <span class="nam">_read_elf_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="nam">determine_linking_type</span><span class="op">=</span><span class="nam">assert_linking_type</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="key">return</span> <span class="nam">is_elf</span> <span class="key">and</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="nam">assert_linking_type</span> <span class="key">is</span> <span class="nam">ELF_LINKING_TYPE_ANY</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="key">or</span> <span class="nam">assert_linking_type</span> <span class="op">==</span> <span class="nam">linking_type</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"><span class="key">def</span> <span class="nam">_read_elf_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="nam">determine_linking_type</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">bool</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="nam">buffer_size</span> <span class="op">=</span> <span class="num">4096</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="nam">fd_buffer</span> <span class="op">=</span> <span class="nam">bytearray</span><span class="op">(</span><span class="nam">buffer_size</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="nam">linking_type</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="nam">fd</span><span class="op">:</span> <span class="nam">io</span><span class="op">.</span><span class="nam">BufferedReader</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="key">with</span> <span class="nam">path</span><span class="op">.</span><span class="nam">open</span><span class="op">(</span><span class="nam">byte_io</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">buffering</span><span class="op">=</span><span class="nam">io</span><span class="op">.</span><span class="nam">DEFAULT_BUFFER_SIZE</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="nam">len_elf_header_raw</span> <span class="op">=</span> <span class="nam">fd</span><span class="op">.</span><span class="nam">readinto</span><span class="op">(</span><span class="nam">fd_buffer</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="key">not</span> <span class="nam">fd_buffer</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="key">or</span> <span class="nam">len_elf_header_raw</span> <span class="op"><</span> <span class="nam">ELF_HEADER_SIZE32</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="key">or</span> <span class="key">not</span> <span class="nam">fd_buffer</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="nam">ELF_MAGIC</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span><span class="op">,</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="nam">elf_ei_class</span> <span class="op">=</span> <span class="nam">fd_buffer</span><span class="op">[</span><span class="num">4</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="nam">endian_raw</span> <span class="op">=</span> <span class="nam">fd_buffer</span><span class="op">[</span><span class="num">5</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="key">if</span> <span class="nam">endian_raw</span> <span class="op">==</span> <span class="nam">ELF_ENDIAN_LE</span><span class="op">:</span> </span><span class="r"><span class="annotate short">87 ↛ 89</span><span class="annotate long">line 87 didn't jump to line 89, because the condition on line 87 was never false</span></span></p> - <p class="run"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="nam">endian</span> <span class="op">=</span> <span class="str">"<"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="key">elif</span> <span class="nam">endian_raw</span> <span class="op">==</span> <span class="nam">ELF_ENDIAN_BE</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="nam">endian</span> <span class="op">=</span> <span class="str">">"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span><span class="op">,</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="key">if</span> <span class="nam">elf_ei_class</span> <span class="op">==</span> <span class="nam">ELF_EI_ELFCLASS64</span><span class="op">:</span> </span><span class="r"><span class="annotate short">94 ↛ 100</span><span class="annotate long">line 94 didn't jump to line 100, because the condition on line 94 was never false</span></span></p> - <p class="run"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="nam">offset_size</span> <span class="op">=</span> <span class="str">"Q"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="com"># We know it needs to be a 64bit ELF, then the header must be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="com"># large enough for that.</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="key">if</span> <span class="nam">len_elf_header_raw</span> <span class="op"><</span> <span class="nam">ELF_HEADER_SIZE64</span><span class="op">:</span> </span><span class="r"><span class="annotate short">98 ↛ 99</span><span class="annotate long">line 98 didn't jump to line 99, because the condition on line 98 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span><span class="op">,</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="key">elif</span> <span class="nam">elf_ei_class</span> <span class="op">==</span> <span class="nam">ELF_EI_ELFCLASS32</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="nam">offset_size</span> <span class="op">=</span> <span class="str">"L"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span><span class="op">,</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="nam">elf_type</span><span class="op">,</span> <span class="nam">_elf_machine</span><span class="op">,</span> <span class="nam">elf_version</span> <span class="op">=</span> <span class="nam">struct</span><span class="op">.</span><span class="nam">unpack_from</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="str">f"{endian}HHL"</span><span class="op">,</span> <span class="nam">fd_buffer</span><span class="op">,</span> <span class="nam">offset</span><span class="op">=</span><span class="nam">ELF_EI_NIDENT</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="key">if</span> <span class="nam">elf_version</span> <span class="op">!=</span> <span class="nam">ELF_VERSION</span><span class="op">:</span> </span><span class="r"><span class="annotate short">108 ↛ 109</span><span class="annotate long">line 108 didn't jump to line 109, because the condition on line 108 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span><span class="op">,</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="key">if</span> <span class="nam">elf_type</span> <span class="key">not</span> <span class="key">in</span> <span class="op">(</span><span class="nam">ELF_TYPE_EXECUTABLE</span><span class="op">,</span> <span class="nam">ELF_TYPE_SHARED_OBJECT</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">110 ↛ 111</span><span class="annotate long">line 110 didn't jump to line 111, because the condition on line 110 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span><span class="op">,</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="key">if</span> <span class="nam">determine_linking_type</span><span class="op">:</span> </span><span class="r"><span class="annotate short">113 ↛ 76</span><span class="annotate long">line 113 didn't jump to line 76</span></span></p> - <p class="run"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="nam">linking_type</span> <span class="op">=</span> <span class="nam">_determine_elf_linking_type</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="nam">fd</span><span class="op">,</span> <span class="nam">fd_buffer</span><span class="op">,</span> <span class="nam">endian</span><span class="op">,</span> <span class="nam">offset_size</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="key">if</span> <span class="nam">linking_type</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">117 ↛ 118</span><span class="annotate long">line 117 didn't jump to line 118, because the condition on line 117 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span><span class="op">,</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span><span class="op">,</span> <span class="nam">linking_type</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"><span class="key">def</span> <span class="nam">_determine_elf_linking_type</span><span class="op">(</span><span class="nam">fd</span><span class="op">,</span> <span class="nam">fd_buffer</span><span class="op">,</span> <span class="nam">endian</span><span class="op">,</span> <span class="nam">offset_size</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="com"># To check the linking, we look for a DYNAMICALLY program header</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="com"># In other words, we assume static linking by default.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="nam">linking_type</span> <span class="op">=</span> <span class="nam">ELF_LINKING_TYPE_STATIC</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="com"># To do that, we need to read a bit more of the ELF header to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="com"># locate the Program header table.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="com"># Reading - in order at offset 0x18:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="com"># * e_entry (ignored)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="com"># * e_phoff</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="com"># * e_shoff (ignored)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="com"># * e_flags (ignored)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="com"># * e_ehsize (ignored)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="com"># * e_phentsize</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="com"># * e_phnum</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="nam">_</span><span class="op">,</span> <span class="nam">e_phoff</span><span class="op">,</span> <span class="nam">_</span><span class="op">,</span> <span class="nam">_</span><span class="op">,</span> <span class="nam">_</span><span class="op">,</span> <span class="nam">e_phentsize</span><span class="op">,</span> <span class="nam">e_phnum</span> <span class="op">=</span> <span class="nam">struct</span><span class="op">.</span><span class="nam">unpack_from</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="str">f"{endian}{offset_size}{offset_size}{offset_size}LHHH"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="nam">fd_buffer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="nam">offset</span><span class="op">=</span><span class="nam">ELF_EI_NIDENT</span> <span class="op">+</span> <span class="num">8</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="com"># man 5 elf suggests that Program headers can be absent. If so,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="com"># e_phnum will be zero - but we assume the same for e_phentsize.</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="key">if</span> <span class="nam">e_phnum</span> <span class="op">==</span> <span class="num">0</span><span class="op">:</span> </span><span class="r"><span class="annotate short">147 ↛ 148</span><span class="annotate long">line 147 didn't jump to line 148, because the condition on line 147 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="key">return</span> <span class="nam">linking_type</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="com"># Program headers must be at least 4 bytes for this code to do</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="com"># anything sanely. In practise, it must be larger than that</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="com"># as well. Accordingly, at best this is a corrupted ELF file.</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="key">if</span> <span class="nam">e_phentsize</span> <span class="op"><</span> <span class="num">4</span><span class="op">:</span> </span><span class="r"><span class="annotate short">153 ↛ 154</span><span class="annotate long">line 153 didn't jump to line 154, because the condition on line 153 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="nam">fd</span><span class="op">.</span><span class="nam">seek</span><span class="op">(</span><span class="nam">e_phoff</span><span class="op">,</span> <span class="nam">os</span><span class="op">.</span><span class="nam">SEEK_SET</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="nam">unpack_format</span> <span class="op">=</span> <span class="str">f"{endian}L"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="key">for</span> <span class="nam">program_header_raw</span> <span class="key">in</span> <span class="nam">_read_bytes_iteratively</span><span class="op">(</span><span class="nam">fd</span><span class="op">,</span> <span class="nam">e_phentsize</span><span class="op">,</span> <span class="nam">e_phnum</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">159 ↛ 167</span><span class="annotate long">line 159 didn't jump to line 167, because the loop on line 159 didn't complete</span></span></p> - <p class="run"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="nam">p_type</span> <span class="op">=</span> <span class="nam">struct</span><span class="op">.</span><span class="nam">unpack_from</span><span class="op">(</span><span class="nam">unpack_format</span><span class="op">,</span> <span class="nam">program_header_raw</span><span class="op">)</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="key">if</span> <span class="nam">p_type</span> <span class="op">==</span> <span class="nam">ELF_PT_DYNAMIC</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="nam">linking_type</span> <span class="op">=</span> <span class="nam">ELF_LINKING_TYPE_DYNAMIC</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="key">except</span> <span class="nam">IncompleteFileError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="key">return</span> <span class="nam">linking_type</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"><span class="key">def</span> <span class="nam">_read_bytes_iteratively</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="nam">fd</span><span class="op">:</span> <span class="nam">io</span><span class="op">.</span><span class="nam">BufferedReader</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="nam">object_size</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">object_count</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">bytes</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="nam">total_size</span> <span class="op">=</span> <span class="nam">object_size</span> <span class="op">*</span> <span class="nam">object_count</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="nam">bytes_remaining</span> <span class="op">=</span> <span class="nam">total_size</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="com"># FIXME: improve this to read larger chunks and yield them one-by-one</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="nam">byte_buffer</span> <span class="op">=</span> <span class="nam">bytearray</span><span class="op">(</span><span class="nam">object_size</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="key">while</span> <span class="nam">bytes_remaining</span> <span class="op">></span> <span class="num">0</span><span class="op">:</span> </span><span class="r"><span class="annotate short">180 ↛ 187</span><span class="annotate long">line 180 didn't jump to line 187, because the condition on line 180 was never false</span></span></p> - <p class="run"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="nam">n</span> <span class="op">=</span> <span class="nam">fd</span><span class="op">.</span><span class="nam">readinto</span><span class="op">(</span><span class="nam">byte_buffer</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="key">if</span> <span class="nam">n</span> <span class="op">!=</span> <span class="nam">object_size</span><span class="op">:</span> </span><span class="r"><span class="annotate short">182 ↛ 183</span><span class="annotate long">line 182 didn't jump to line 183, because the condition on line 182 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="nam">bytes_remaining</span> <span class="op">-=</span> <span class="nam">n</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="key">yield</span> <span class="nam">byte_buffer</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="key">if</span> <span class="nam">bytes_remaining</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="key">raise</span> <span class="nam">IncompleteFileError</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"><span class="key">def</span> <span class="nam">find_all_elf_files</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="nam">walk_filter</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> <span class="nam">bool</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="nam">with_linking_type</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> <span class="op">=</span> <span class="nam">ELF_LINKING_TYPE_ANY</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">List</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="nam">matches</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="com"># FIXME: Implementation detail that fs_root is always `FSPath` and has `.walk()`</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="key">assert</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">,</span> <span class="nam">FSPath</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="key">for</span> <span class="nam">path</span><span class="op">,</span> <span class="nam">children</span> <span class="key">in</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">walk</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="key">if</span> <span class="nam">walk_filter</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">walk_filter</span><span class="op">(</span><span class="nam">path</span><span class="op">,</span> <span class="nam">children</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_file</span> <span class="key">or</span> <span class="nam">path</span><span class="op">.</span><span class="nam">size</span> <span class="op"><</span> <span class="nam">ELF_HEADER_SIZE32</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">is_so_or_exec_elf_file</span><span class="op">(</span><span class="nam">path</span><span class="op">,</span> <span class="nam">assert_linking_type</span><span class="op">=</span><span class="nam">with_linking_type</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="nam">matches</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="key">return</span> <span class="nam">matches</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_23db3c975895bd86_models_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_exceptions_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_267b6307937f1878_exceptions_py.html b/coverage-report/d_267b6307937f1878_exceptions_py.html deleted file mode 100644 index 7d38b8d..0000000 --- a/coverage-report/d_267b6307937f1878_exceptions_py.html +++ /dev/null @@ -1,189 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/exceptions.py: 92%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/exceptions.py</b>: - <span class="pc_cov">92%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">50 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">45<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">5<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">2<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_elf_util_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_filesystem_scan_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">cast</span><span class="op">,</span> <span class="nam">TYPE_CHECKING</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">if</span> <span class="nam">TYPE_CHECKING</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">impl_types</span> <span class="key">import</span> <span class="nam">DebputyPluginMetadata</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">class</span> <span class="nam">DebputyRuntimeError</span><span class="op">(</span><span class="nam">RuntimeError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="key">def</span> <span class="nam">message</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="key">return</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"str"</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">args</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"><span class="key">class</span> <span class="nam">DebputySubstitutionError</span><span class="op">(</span><span class="nam">DebputyRuntimeError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"><span class="key">class</span> <span class="nam">DebputyManifestVariableRequiresDebianDirError</span><span class="op">(</span><span class="nam">DebputySubstitutionError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"><span class="key">class</span> <span class="nam">DebputyDpkgGensymbolsError</span><span class="op">(</span><span class="nam">DebputyRuntimeError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"><span class="key">class</span> <span class="nam">SymlinkLoopError</span><span class="op">(</span><span class="nam">ValueError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="key">def</span> <span class="nam">message</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="key">return</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"str"</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">args</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"><span class="key">class</span> <span class="nam">PureVirtualPathError</span><span class="op">(</span><span class="nam">TypeError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="key">def</span> <span class="nam">message</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="key">return</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"str"</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">args</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="key">class</span> <span class="nam">TestPathWithNonExistentFSPathError</span><span class="op">(</span><span class="nam">TypeError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="key">def</span> <span class="nam">message</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="key">return</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"str"</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">args</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"><span class="key">class</span> <span class="nam">DebputyFSError</span><span class="op">(</span><span class="nam">DebputyRuntimeError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"><span class="key">class</span> <span class="nam">DebputyFSIsROError</span><span class="op">(</span><span class="nam">DebputyFSError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"><span class="key">class</span> <span class="nam">PluginBaseError</span><span class="op">(</span><span class="nam">DebputyRuntimeError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"><span class="key">class</span> <span class="nam">DebputyPluginRuntimeError</span><span class="op">(</span><span class="nam">PluginBaseError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"><span class="key">class</span> <span class="nam">PluginNotFoundError</span><span class="op">(</span><span class="nam">PluginBaseError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"><span class="key">class</span> <span class="nam">PluginInitializationError</span><span class="op">(</span><span class="nam">PluginBaseError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"><span class="key">class</span> <span class="nam">PluginMetadataError</span><span class="op">(</span><span class="nam">PluginBaseError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"><span class="key">class</span> <span class="nam">PluginConflictError</span><span class="op">(</span><span class="nam">PluginBaseError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="key">def</span> <span class="nam">plugin_a</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="str">"DebputyPluginMetadata"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="key">return</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"DebputyPluginMetadata"</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">args</span><span class="op">[</span><span class="num">1</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="key">def</span> <span class="nam">plugin_b</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="str">"DebputyPluginMetadata"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="key">return</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"DebputyPluginMetadata"</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">args</span><span class="op">[</span><span class="num">2</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"><span class="key">class</span> <span class="nam">PluginAPIViolationError</span><span class="op">(</span><span class="nam">PluginBaseError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"><span class="key">class</span> <span class="nam">UnhandledOrUnexpectedErrorFromPluginError</span><span class="op">(</span><span class="nam">PluginBaseError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"><span class="key">class</span> <span class="nam">DebputyMetadataAccessError</span><span class="op">(</span><span class="nam">DebputyPluginRuntimeError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_elf_util_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_filesystem_scan_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_267b6307937f1878_filesystem_scan_py.html b/coverage-report/d_267b6307937f1878_filesystem_scan_py.html deleted file mode 100644 index 5c580d4..0000000 --- a/coverage-report/d_267b6307937f1878_filesystem_scan_py.html +++ /dev/null @@ -1,2020 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/filesystem_scan.py: 74%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/filesystem_scan.py</b>: - <span class="pc_cov">74%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">1104 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">836<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">268<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">1<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">74<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_exceptions_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_highlevel_manifest_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">atexit</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">contextlib</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">dataclasses</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">import</span> <span class="nam">errno</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">import</span> <span class="nam">io</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">import</span> <span class="nam">operator</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="key">import</span> <span class="nam">stat</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="key">import</span> <span class="nam">subprocess</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"><span class="key">import</span> <span class="nam">tempfile</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"><span class="key">import</span> <span class="nam">time</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="key">from</span> <span class="nam">abc</span> <span class="key">import</span> <span class="nam">ABC</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"><span class="key">from</span> <span class="nam">contextlib</span> <span class="key">import</span> <span class="nam">suppress</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">List</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">Iterable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">Dict</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">Iterator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">Mapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="nam">cast</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="nam">ContextManager</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="nam">TextIO</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="nam">BinaryIO</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="nam">NoReturn</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="nam">Type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="nam">Generic</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"><span class="key">from</span> <span class="nam">weakref</span> <span class="key">import</span> <span class="nam">ref</span><span class="op">,</span> <span class="nam">ReferenceType</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">exceptions</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="nam">PureVirtualPathError</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="nam">DebputyFSIsROError</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="nam">DebputyMetadataAccessError</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="nam">TestPathWithNonExistentFSPathError</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">SymlinkLoopError</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">intermediate_manifest</span> <span class="key">import</span> <span class="nam">PathType</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">base_types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">ROOT_DEFINITION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="nam">StaticFileSystemOwner</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="nam">StaticFileSystemGroup</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">spec</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="nam">PathDef</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="nam">PathMetadataReference</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="nam">PMT</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">types</span> <span class="key">import</span> <span class="nam">VP</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="nam">generated_content_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">_error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="nam">escape_shell</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="nam">assume_not_none</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="nam">_normalize_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"><span class="nam">BY_BASENAME</span> <span class="op">=</span> <span class="nam">operator</span><span class="op">.</span><span class="nam">attrgetter</span><span class="op">(</span><span class="str">"name"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"><span class="key">class</span> <span class="nam">AlwaysEmptyReadOnlyMetadataReference</span><span class="op">(</span><span class="nam">PathMetadataReference</span><span class="op">[</span><span class="nam">PMT</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"_metadata_type"</span><span class="op">,</span> <span class="str">"_owning_plugin"</span><span class="op">,</span> <span class="str">"_current_plugin"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="nam">owning_plugin</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="nam">current_plugin</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="nam">metadata_type</span><span class="op">:</span> <span class="nam">Type</span><span class="op">[</span><span class="nam">PMT</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_owning_plugin</span> <span class="op">=</span> <span class="nam">owning_plugin</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_current_plugin</span> <span class="op">=</span> <span class="nam">current_plugin</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_metadata_type</span> <span class="op">=</span> <span class="nam">metadata_type</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_present</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="key">def</span> <span class="nam">can_read</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_owning_plugin</span> <span class="op">==</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_current_plugin</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="key">def</span> <span class="nam">can_write</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="key">def</span> <span class="nam">value</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">PMT</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">can_read</span><span class="op">:</span> </span><span class="r"><span class="annotate short">92 ↛ 94</span><span class="annotate long">line 92 didn't jump to line 94, because the condition on line 92 was never false</span></span></p> - <p class="run"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="key">raise</span> <span class="nam">DebputyMetadataAccessError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="str">f"Cannot read the metadata {self._metadata_type.__name__} owned by"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="str">f" {self._owning_plugin} as the metadata has not been made"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="str">f" readable to the plugin {self._current_plugin}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="op">@</span><span class="nam">value</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="key">def</span> <span class="nam">value</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">new_value</span><span class="op">:</span> <span class="nam">PMT</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_is_owner</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="key">raise</span> <span class="nam">DebputyFSIsROError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="str">f"Cannot set the metadata {self._metadata_type.__name__} as the path is read-only"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="key">raise</span> <span class="nam">DebputyMetadataAccessError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="str">f"Cannot set the metadata {self._metadata_type.__name__} owned by"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="str">f" {self._owning_plugin} as the metadata has not been made"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="str">f" read-write to the plugin {self._current_plugin}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="key">def</span> <span class="nam">_is_owner</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_owning_plugin</span> <span class="op">==</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_current_plugin</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"><span class="key">class</span> <span class="nam">PathMetadataValue</span><span class="op">(</span><span class="nam">Generic</span><span class="op">[</span><span class="nam">PMT</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="nam">owning_plugin</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="nam">metadata_type</span><span class="op">:</span> <span class="nam">Type</span><span class="op">[</span><span class="nam">PMT</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="nam">value</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">PMT</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="key">def</span> <span class="nam">can_read_value</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">current_plugin</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">owning_plugin</span> <span class="op">==</span> <span class="nam">current_plugin</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="key">def</span> <span class="nam">can_write_value</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">current_plugin</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">owning_plugin</span> <span class="op">==</span> <span class="nam">current_plugin</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"><span class="key">class</span> <span class="nam">PathMetadataReferenceImplementation</span><span class="op">(</span><span class="nam">PathMetadataReference</span><span class="op">[</span><span class="nam">PMT</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"_owning_path"</span><span class="op">,</span> <span class="str">"_current_plugin"</span><span class="op">,</span> <span class="str">"_path_metadata_value"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="nam">owning_path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="nam">current_plugin</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="nam">path_metadata_value</span><span class="op">:</span> <span class="nam">PathMetadataValue</span><span class="op">[</span><span class="nam">PMT</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_owning_path</span> <span class="op">=</span> <span class="nam">owning_path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_current_plugin</span> <span class="op">=</span> <span class="nam">current_plugin</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_path_metadata_value</span> <span class="op">=</span> <span class="nam">path_metadata_value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_present</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">can_read</span><span class="op">:</span> </span><span class="r"><span class="annotate short">145 ↛ 146</span><span class="annotate long">line 145 didn't jump to line 146, because the condition on line 145 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_path_metadata_value</span><span class="op">.</span><span class="nam">value</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="key">def</span> <span class="nam">can_read</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_path_metadata_value</span><span class="op">.</span><span class="nam">can_read_value</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_current_plugin</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="key">def</span> <span class="nam">can_write</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_path_metadata_value</span><span class="op">.</span><span class="nam">can_write_value</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_current_plugin</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">155 ↛ 156</span><span class="annotate long">line 155 didn't jump to line 156, because the condition on line 155 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="nam">owning_path</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_owning_path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="key">return</span> <span class="nam">owning_path</span><span class="op">.</span><span class="nam">is_read_write</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">owning_path</span><span class="op">.</span><span class="nam">is_detached</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="key">def</span> <span class="nam">value</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">PMT</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">can_read</span><span class="op">:</span> </span><span class="r"><span class="annotate short">162 ↛ 164</span><span class="annotate long">line 162 didn't jump to line 164, because the condition on line 162 was never false</span></span></p> - <p class="run"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_path_metadata_value</span><span class="op">.</span><span class="nam">value</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="key">raise</span> <span class="nam">DebputyMetadataAccessError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="str">f"Cannot read the metadata {self._metadata_type_name} owned by"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="str">f" {self._owning_plugin} as the metadata has not been made"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="str">f" readable to the plugin {self._current_plugin}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="op">@</span><span class="nam">value</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="key">def</span> <span class="nam">value</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">new_value</span><span class="op">:</span> <span class="nam">PMT</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">can_write</span><span class="op">:</span> </span><span class="r"><span class="annotate short">172 ↛ 173</span><span class="annotate long">line 172 didn't jump to line 173, because the condition on line 172 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="str">"set"</span> <span class="key">if</span> <span class="nam">new_value</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">else</span> <span class="str">"delete"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="key">raise</span> <span class="nam">DebputyMetadataAccessError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="str">f"Cannot {m} the metadata {self._metadata_type_name} owned by"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="str">f" {self._owning_plugin} as the metadata has not been made"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="str">f" read-write to the plugin {self._current_plugin}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="nam">owning_path</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_owning_path</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">owning_path</span><span class="op">.</span><span class="nam">is_read_write</span><span class="op">:</span> </span><span class="r"><span class="annotate short">180 ↛ 181</span><span class="annotate long">line 180 didn't jump to line 181, because the condition on line 180 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="key">raise</span> <span class="nam">DebputyFSIsROError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="str">f"Cannot set the metadata {self._metadata_type_name} as the path is read-only"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="key">if</span> <span class="nam">owning_path</span><span class="op">.</span><span class="nam">is_detached</span><span class="op">:</span> </span><span class="r"><span class="annotate short">184 ↛ 185</span><span class="annotate long">line 184 didn't jump to line 185, because the condition on line 184 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TypeError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="str">f"Cannot set the metadata {self._metadata_type_name} as the path is detached"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_path_metadata_value</span><span class="op">.</span><span class="nam">value</span> <span class="op">=</span> <span class="nam">new_value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="key">def</span> <span class="nam">_is_owner</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_owning_plugin</span> <span class="op">==</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_current_plugin</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="key">def</span> <span class="nam">_owning_plugin</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_path_metadata_value</span><span class="op">.</span><span class="nam">owning_plugin</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="key">def</span> <span class="nam">_metadata_type_name</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_path_metadata_value</span><span class="op">.</span><span class="nam">metadata_type</span><span class="op">.</span><span class="nam">__name__</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"><span class="key">def</span> <span class="nam">_cp_a</span><span class="op">(</span><span class="nam">source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">dest</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="nam">cmd</span> <span class="op">=</span> <span class="op">[</span><span class="str">"cp"</span><span class="op">,</span> <span class="str">"-a"</span><span class="op">,</span> <span class="nam">source</span><span class="op">,</span> <span class="nam">dest</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_call</span><span class="op">(</span><span class="nam">cmd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="key">except</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">CalledProcessError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="nam">full_command</span> <span class="op">=</span> <span class="nam">escape_shell</span><span class="op">(</span><span class="op">*</span><span class="nam">cmd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="str">f"The attempt to make an internal copy of {escape_shell(source)} failed. Please review the output of cp"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="str">f" above to understand what went wrong. The full command was: {full_command}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"><span class="key">def</span> <span class="nam">_split_path</span><span class="op">(</span><span class="nam">path</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">bool</span><span class="op">,</span> <span class="nam">bool</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="nam">must_be_dir</span> <span class="op">=</span> <span class="key">True</span> <span class="key">if</span> <span class="nam">path</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span> <span class="key">else</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="nam">absolute</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="nam">absolute</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="nam">path</span> <span class="op">=</span> <span class="str">"."</span> <span class="op">+</span> <span class="nam">path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="nam">path_parts</span> <span class="op">=</span> <span class="nam">path</span><span class="op">.</span><span class="nam">rstrip</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="key">if</span> <span class="nam">must_be_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="nam">path_parts</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">"."</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="key">return</span> <span class="nam">absolute</span><span class="op">,</span> <span class="nam">must_be_dir</span><span class="op">,</span> <span class="nam">path_parts</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"><span class="key">def</span> <span class="nam">_root</span><span class="op">(</span><span class="nam">path</span><span class="op">:</span> <span class="nam">VP</span><span class="op">)</span> <span class="op">-></span> <span class="nam">VP</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="nam">current</span> <span class="op">=</span> <span class="nam">path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="key">while</span> <span class="key">True</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="nam">parent</span> <span class="op">=</span> <span class="nam">current</span><span class="op">.</span><span class="nam">parent_dir</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="key">if</span> <span class="nam">parent</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="key">return</span> <span class="nam">current</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="nam">current</span> <span class="op">=</span> <span class="nam">parent</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"><span class="key">def</span> <span class="nam">_check_fs_path_is_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="nam">fs_path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="nam">unlink_on_error</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"FSPath"</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="nam">had_issue</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="com"># FIXME: Check mode, and use the Virtual Path to cache the result as a side-effect</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="nam">st</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">lstat</span><span class="op">(</span><span class="nam">fs_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="key">except</span> <span class="nam">FileNotFoundError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="nam">had_issue</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">stat</span><span class="op">.</span><span class="nam">S_ISREG</span><span class="op">(</span><span class="nam">st</span><span class="op">.</span><span class="nam">st_mode</span><span class="op">)</span> <span class="key">or</span> <span class="nam">st</span><span class="op">.</span><span class="nam">st_nlink</span> <span class="op">></span> <span class="num">1</span><span class="op">:</span> </span><span class="r"><span class="annotate short">247 ↛ 248</span><span class="annotate long">line 247 didn't jump to line 248, because the condition on line 247 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="nam">had_issue</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">had_issue</span><span class="op">:</span> </span><span class="r"><span class="annotate short">249 ↛ 252</span><span class="annotate long">line 249 didn't jump to line 252, because the condition on line 249 was never false</span></span></p> - <p class="run"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="key">if</span> <span class="nam">unlink_on_error</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="key">with</span> <span class="nam">suppress</span><span class="op">(</span><span class="nam">FileNotFoundError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">unlink</span><span class="op">(</span><span class="nam">fs_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TypeError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="str">"The provided FS backing file was deleted, replaced with a non-file entry or it was hard"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="str">" linked to another file. The entry has been disconnected."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"><span class="key">class</span> <span class="nam">CurrentPluginContextManager</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"_plugin_names"</span><span class="op">,</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">initial_plugin_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_names</span> <span class="op">=</span> <span class="op">[</span><span class="nam">initial_plugin_name</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="key">def</span> <span class="nam">current_plugin_name</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_names</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="op">@</span><span class="nam">contextlib</span><span class="op">.</span><span class="nam">contextmanager</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="key">def</span> <span class="nam">change_plugin_context</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">new_plugin_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_names</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">new_plugin_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="key">yield</span> <span class="nam">new_plugin_name</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_names</span><span class="op">.</span><span class="nam">pop</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"><span class="key">class</span> <span class="nam">VirtualPathBase</span><span class="op">(</span><span class="nam">VirtualPath</span><span class="op">,</span> <span class="nam">ABC</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="key">def</span> <span class="nam">_orphan_safe_path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="key">def</span> <span class="nam">_rw_check</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_read_write</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="key">raise</span> <span class="nam">DebputyFSIsROError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="str">f'Attempt to write to "{self._orphan_safe_path()}" failed:'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="str">" Debputy Virtual File system is R/O."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="key">def</span> <span class="nam">lookup</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">path</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"VirtualPathBase"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> <span class="nam">match</span><span class="op">,</span> <span class="nam">missing</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">attempt_lookup</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="key">if</span> <span class="nam">missing</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="key">return</span> <span class="nam">match</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="key">def</span> <span class="nam">attempt_lookup</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">path</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="str">"VirtualPathBase"</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_detached</span><span class="op">:</span> </span><span class="r"><span class="annotate short">298 ↛ 299</span><span class="annotate long">line 298 didn't jump to line 299, because the condition on line 298 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="str">f'Cannot perform lookup via "{self._orphan_safe_path()}": The path is detached'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="nam">absolute</span><span class="op">,</span> <span class="nam">must_be_dir</span><span class="op">,</span> <span class="nam">path_parts</span> <span class="op">=</span> <span class="nam">_split_path</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="nam">current</span> <span class="op">=</span> <span class="nam">_root</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="key">if</span> <span class="nam">absolute</span> <span class="key">else</span> <span class="nam">self</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> <span class="nam">path_parts</span><span class="op">.</span><span class="nam">reverse</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="nam">link_expansions</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> <span class="key">while</span> <span class="nam">path_parts</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="nam">dir_part</span> <span class="op">=</span> <span class="nam">path_parts</span><span class="op">.</span><span class="nam">pop</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="key">if</span> <span class="nam">dir_part</span> <span class="op">==</span> <span class="str">"."</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="key">if</span> <span class="nam">dir_part</span> <span class="op">==</span> <span class="str">".."</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="nam">p</span> <span class="op">=</span> <span class="nam">current</span><span class="op">.</span><span class="nam">parent_dir</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="key">if</span> <span class="nam">p</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">312 ↛ 313</span><span class="annotate long">line 312 didn't jump to line 313, because the condition on line 312 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">f'The path "{path}" escapes the root dir'</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="nam">current</span> <span class="op">=</span> <span class="nam">p</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="nam">current</span> <span class="op">=</span> <span class="nam">current</span><span class="op">[</span><span class="nam">dir_part</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="key">except</span> <span class="nam">KeyError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="nam">path_parts</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">dir_part</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="nam">path_parts</span><span class="op">.</span><span class="nam">reverse</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="key">if</span> <span class="nam">must_be_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="nam">path_parts</span><span class="op">.</span><span class="nam">pop</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> <span class="key">return</span> <span class="nam">current</span><span class="op">,</span> <span class="nam">path_parts</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> <span class="key">if</span> <span class="nam">current</span><span class="op">.</span><span class="nam">is_symlink</span> <span class="key">and</span> <span class="nam">path_parts</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> <span class="key">if</span> <span class="nam">current</span><span class="op">.</span><span class="nam">path</span> <span class="key">in</span> <span class="nam">link_expansions</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> <span class="com"># This is our loop detection for now. It might have some false positives where you</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> <span class="com"># could safely resolve the same symlink twice. However, given that this use-case is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> <span class="com"># basically non-existent in practice for packaging, we just stop here for now.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> <span class="key">raise</span> <span class="nam">SymlinkLoopError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> <span class="str">f'The path "{path}" traversed the symlink "{current.path}" multiple'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> <span class="str">" times. Currently, traversing the same symlink twice is considered"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> <span class="str">" a loop by `debputy` even if the path would eventually resolve."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> <span class="str">" Consider filing a feature request if you have a benign case that"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> <span class="str">" triggers this error."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> <span class="nam">link_expansions</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">current</span><span class="op">.</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> <span class="nam">link_target</span> <span class="op">=</span> <span class="nam">current</span><span class="op">.</span><span class="nam">readlink</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> <span class="nam">link_absolute</span><span class="op">,</span> <span class="nam">_</span><span class="op">,</span> <span class="nam">link_path_parts</span> <span class="op">=</span> <span class="nam">_split_path</span><span class="op">(</span><span class="nam">link_target</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"> <span class="key">if</span> <span class="nam">link_absolute</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> <span class="nam">current</span> <span class="op">=</span> <span class="nam">_root</span><span class="op">(</span><span class="nam">current</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"> <span class="nam">current</span> <span class="op">=</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">current</span><span class="op">.</span><span class="nam">parent_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"> <span class="nam">link_path_parts</span><span class="op">.</span><span class="nam">reverse</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> <span class="nam">path_parts</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">link_path_parts</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"> <span class="key">return</span> <span class="nam">current</span><span class="op">,</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"> <span class="key">def</span> <span class="nam">mkdirs</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">path</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="str">"VirtualPath"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"> <span class="nam">current</span><span class="op">:</span> <span class="nam">VirtualPath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"> <span class="nam">current</span><span class="op">,</span> <span class="nam">missing_parts</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">attempt_lookup</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"> <span class="str">f"{path}/"</span> <span class="key">if</span> <span class="key">not</span> <span class="nam">path</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span> <span class="key">else</span> <span class="nam">path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">current</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"><span class="annotate short">352 ↛ 353</span><span class="annotate long">line 352 didn't jump to line 353, because the condition on line 352 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"> <span class="str">f'mkdirs of "{path}" failed: This would require {current.path} to not exist OR be'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"> <span class="str">" a directory. However, that path exist AND is a not directory."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"> <span class="key">for</span> <span class="nam">missing_part</span> <span class="key">in</span> <span class="nam">missing_parts</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"> <span class="key">assert</span> <span class="nam">missing_part</span> <span class="key">not</span> <span class="key">in</span> <span class="op">(</span><span class="str">"."</span><span class="op">,</span> <span class="str">".."</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"> <span class="nam">current</span> <span class="op">=</span> <span class="nam">current</span><span class="op">.</span><span class="nam">mkdir</span><span class="op">(</span><span class="nam">missing_part</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"> <span class="key">return</span> <span class="nam">current</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"> <span class="key">def</span> <span class="nam">prune_if_empty_dir</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"> <span class="str">"""Remove this and all (now) empty parent directories</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"><span class="str"> Same as: `rmdir --ignore-fail-on-non-empty --parents`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"><span class="str"> This operation may cause the path (and any of its parent directories) to become "detached"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"><span class="str"> and therefore unsafe to use in further operations.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_rw_check</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"><span class="annotate short">372 ↛ 373</span><span class="annotate long">line 372 didn't jump to line 373, because the condition on line 372 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TypeError</span><span class="op">(</span><span class="str">f"{self._orphan_safe_path()} is not a directory"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"> <span class="key">if</span> <span class="nam">any</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">iterdir</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"> <span class="nam">parent_dir</span> <span class="op">=</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">parent_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"> <span class="com"># Recursive does not matter; we already know the directory is empty.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">unlink</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"> <span class="com"># Note: The root dir must never be deleted. This works because when delegating it to the root</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"> <span class="com"># directory, its implementation of this method is a no-op. If this is later rewritten to an</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"> <span class="com"># inline loop (rather than recursion), be sure to preserve this feature.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"> <span class="nam">parent_dir</span><span class="op">.</span><span class="nam">prune_if_empty_dir</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t385" href="#t385">385</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t386" href="#t386">386</a></span><span class="t"> <span class="key">def</span> <span class="nam">_current_plugin</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t387" href="#t387">387</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_detached</span><span class="op">:</span> </span><span class="r"><span class="annotate short">387 ↛ 388</span><span class="annotate long">line 387 didn't jump to line 388, because the condition on line 387 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t388" href="#t388">388</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TypeError</span><span class="op">(</span><span class="str">"Cannot resolve the current plugin; path is detached"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t389" href="#t389">389</a></span><span class="t"> <span class="nam">current</span> <span class="op">=</span> <span class="nam">self</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t390" href="#t390">390</a></span><span class="t"> <span class="key">while</span> <span class="key">True</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t391" href="#t391">391</a></span><span class="t"> <span class="nam">next_parent</span> <span class="op">=</span> <span class="nam">current</span><span class="op">.</span><span class="nam">parent_dir</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t392" href="#t392">392</a></span><span class="t"> <span class="key">if</span> <span class="nam">next_parent</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t393" href="#t393">393</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t394" href="#t394">394</a></span><span class="t"> <span class="nam">current</span> <span class="op">=</span> <span class="nam">next_parent</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t395" href="#t395">395</a></span><span class="t"> <span class="key">assert</span> <span class="nam">current</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t396" href="#t396">396</a></span><span class="t"> <span class="key">return</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"FSRootDir"</span><span class="op">,</span> <span class="nam">current</span><span class="op">)</span><span class="op">.</span><span class="nam">_current_plugin</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t397" href="#t397">397</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t398" href="#t398">398</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t399" href="#t399">399</a></span><span class="t"><span class="key">class</span> <span class="nam">FSPath</span><span class="op">(</span><span class="nam">VirtualPathBase</span><span class="op">,</span> <span class="nam">ABC</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t400" href="#t400">400</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t401" href="#t401">401</a></span><span class="t"> <span class="str">"_basename"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t402" href="#t402">402</a></span><span class="t"> <span class="str">"_parent_dir"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t403" href="#t403">403</a></span><span class="t"> <span class="str">"_children"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t404" href="#t404">404</a></span><span class="t"> <span class="str">"_path_cache"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t405" href="#t405">405</a></span><span class="t"> <span class="str">"_parent_path_cache"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t406" href="#t406">406</a></span><span class="t"> <span class="str">"_last_known_parent_path"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t407" href="#t407">407</a></span><span class="t"> <span class="str">"_mode"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t408" href="#t408">408</a></span><span class="t"> <span class="str">"_owner"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t409" href="#t409">409</a></span><span class="t"> <span class="str">"_group"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t410" href="#t410">410</a></span><span class="t"> <span class="str">"_mtime"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t411" href="#t411">411</a></span><span class="t"> <span class="str">"_stat_cache"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t412" href="#t412">412</a></span><span class="t"> <span class="str">"_metadata"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t413" href="#t413">413</a></span><span class="t"> <span class="str">"__weakref__"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t414" href="#t414">414</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t415" href="#t415">415</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t416" href="#t416">416</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t417" href="#t417">417</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t418" href="#t418">418</a></span><span class="t"> <span class="nam">basename</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t419" href="#t419">419</a></span><span class="t"> <span class="nam">parent</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"FSPath"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t420" href="#t420">420</a></span><span class="t"> <span class="nam">children</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="str">"FSPath"</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t421" href="#t421">421</a></span><span class="t"> <span class="nam">initial_mode</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t422" href="#t422">422</a></span><span class="t"> <span class="nam">mtime</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">float</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t423" href="#t423">423</a></span><span class="t"> <span class="nam">stat_cache</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">os</span><span class="op">.</span><span class="nam">stat_result</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t424" href="#t424">424</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t425" href="#t425">425</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_basename</span> <span class="op">=</span> <span class="nam">basename</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t426" href="#t426">426</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_path_cache</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t427" href="#t427">427</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent_path_cache</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t428" href="#t428">428</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_children</span> <span class="op">=</span> <span class="nam">children</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t429" href="#t429">429</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_last_known_parent_path</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t430" href="#t430">430</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_mode</span> <span class="op">=</span> <span class="nam">initial_mode</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t431" href="#t431">431</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_mtime</span> <span class="op">=</span> <span class="nam">mtime</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t432" href="#t432">432</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_stat_cache</span> <span class="op">=</span> <span class="nam">stat_cache</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t433" href="#t433">433</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_metadata</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Type</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> <span class="nam">PathMetadataValue</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t434" href="#t434">434</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_owner</span> <span class="op">=</span> <span class="nam">ROOT_DEFINITION</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t435" href="#t435">435</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_group</span> <span class="op">=</span> <span class="nam">ROOT_DEFINITION</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t436" href="#t436">436</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t437" href="#t437">437</a></span><span class="t"> <span class="com"># The self._parent_dir = None is to create `_parent_dir` because the parent_dir setter calls</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t438" href="#t438">438</a></span><span class="t"> <span class="com"># is_orphaned, which assumes self._parent_dir is an attribute.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t439" href="#t439">439</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent_dir</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ReferenceType</span><span class="op">[</span><span class="str">"FSPath"</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t440" href="#t440">440</a></span><span class="t"> <span class="key">if</span> <span class="nam">parent</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t441" href="#t441">441</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">parent_dir</span> <span class="op">=</span> <span class="nam">parent</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t442" href="#t442">442</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t443" href="#t443">443</a></span><span class="t"> <span class="key">def</span> <span class="nam">__repr__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t444" href="#t444">444</a></span><span class="t"> <span class="key">return</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t445" href="#t445">445</a></span><span class="t"> <span class="str">f"{self.__class__.__name__}({self._orphan_safe_path()!r},"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t446" href="#t446">446</a></span><span class="t"> <span class="str">f" is_file={self.is_file},"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t447" href="#t447">447</a></span><span class="t"> <span class="str">f" is_dir={self.is_dir},"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t448" href="#t448">448</a></span><span class="t"> <span class="str">f" is_symlink={self.is_symlink},"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t449" href="#t449">449</a></span><span class="t"> <span class="str">f" has_fs_path={self.has_fs_path},"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t450" href="#t450">450</a></span><span class="t"> <span class="str">f" children_len={len(self._children) if self._children else 0})"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t451" href="#t451">451</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t452" href="#t452">452</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t453" href="#t453">453</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t454" href="#t454">454</a></span><span class="t"> <span class="key">def</span> <span class="nam">name</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t455" href="#t455">455</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_basename</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t456" href="#t456">456</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t457" href="#t457">457</a></span><span class="t"> <span class="op">@</span><span class="nam">name</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t458" href="#t458">458</a></span><span class="t"> <span class="key">def</span> <span class="nam">name</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">new_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t459" href="#t459">459</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_rw_check</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t460" href="#t460">460</a></span><span class="t"> <span class="key">if</span> <span class="nam">new_name</span> <span class="op">==</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_basename</span><span class="op">:</span> </span><span class="r"><span class="annotate short">460 ↛ 461</span><span class="annotate long">line 460 didn't jump to line 461, because the condition on line 460 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t461" href="#t461">461</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t462" href="#t462">462</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_detached</span><span class="op">:</span> </span><span class="r"><span class="annotate short">462 ↛ 463</span><span class="annotate long">line 462 didn't jump to line 463, because the condition on line 462 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t463" href="#t463">463</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_basename</span> <span class="op">=</span> <span class="nam">new_name</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t464" href="#t464">464</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t465" href="#t465">465</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_rw_check</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t466" href="#t466">466</a></span><span class="t"> <span class="nam">parent</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">parent_dir</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t467" href="#t467">467</a></span><span class="t"> <span class="com"># This little parent_dir dance ensures the parent dir detects the rename properly</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t468" href="#t468">468</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">parent_dir</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t469" href="#t469">469</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_basename</span> <span class="op">=</span> <span class="nam">new_name</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t470" href="#t470">470</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">parent_dir</span> <span class="op">=</span> <span class="nam">parent</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t471" href="#t471">471</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t472" href="#t472">472</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t473" href="#t473">473</a></span><span class="t"> <span class="key">def</span> <span class="nam">iterdir</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="str">"FSPath"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t474" href="#t474">474</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_children</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t475" href="#t475">475</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_children</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t476" href="#t476">476</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t477" href="#t477">477</a></span><span class="t"> <span class="key">def</span> <span class="nam">all_paths</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="str">"FSPath"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t478" href="#t478">478</a></span><span class="t"> <span class="key">yield</span> <span class="nam">self</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t479" href="#t479">479</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t480" href="#t480">480</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t481" href="#t481">481</a></span><span class="t"> <span class="nam">by_basename</span> <span class="op">=</span> <span class="nam">BY_BASENAME</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t482" href="#t482">482</a></span><span class="t"> <span class="nam">stack</span> <span class="op">=</span> <span class="nam">sorted</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">iterdir</span><span class="op">,</span> <span class="nam">key</span><span class="op">=</span><span class="nam">by_basename</span><span class="op">,</span> <span class="nam">reverse</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t483" href="#t483">483</a></span><span class="t"> <span class="key">while</span> <span class="nam">stack</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t484" href="#t484">484</a></span><span class="t"> <span class="nam">current</span> <span class="op">=</span> <span class="nam">stack</span><span class="op">.</span><span class="nam">pop</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t485" href="#t485">485</a></span><span class="t"> <span class="key">yield</span> <span class="nam">current</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t486" href="#t486">486</a></span><span class="t"> <span class="key">if</span> <span class="nam">current</span><span class="op">.</span><span class="nam">is_dir</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">current</span><span class="op">.</span><span class="nam">is_detached</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t487" href="#t487">487</a></span><span class="t"> <span class="nam">stack</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">sorted</span><span class="op">(</span><span class="nam">current</span><span class="op">.</span><span class="nam">iterdir</span><span class="op">,</span> <span class="nam">key</span><span class="op">=</span><span class="nam">by_basename</span><span class="op">,</span> <span class="nam">reverse</span><span class="op">=</span><span class="key">True</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t488" href="#t488">488</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t489" href="#t489">489</a></span><span class="t"> <span class="key">def</span> <span class="nam">walk</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="str">"FSPath"</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="str">"FSPath"</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t490" href="#t490">490</a></span><span class="t"> <span class="com"># FIXME: can this be more "os.walk"-like without making it harder to implement?</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t491" href="#t491">491</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"><span class="annotate short">491 ↛ 492</span><span class="annotate long">line 491 didn't jump to line 492, because the condition on line 491 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t492" href="#t492">492</a></span><span class="t"> <span class="key">yield</span> <span class="nam">self</span><span class="op">,</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t493" href="#t493">493</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t494" href="#t494">494</a></span><span class="t"> <span class="nam">by_basename</span> <span class="op">=</span> <span class="nam">BY_BASENAME</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t495" href="#t495">495</a></span><span class="t"> <span class="nam">stack</span> <span class="op">=</span> <span class="op">[</span><span class="nam">self</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t496" href="#t496">496</a></span><span class="t"> <span class="key">while</span> <span class="nam">stack</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t497" href="#t497">497</a></span><span class="t"> <span class="nam">current</span> <span class="op">=</span> <span class="nam">stack</span><span class="op">.</span><span class="nam">pop</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t498" href="#t498">498</a></span><span class="t"> <span class="nam">children</span> <span class="op">=</span> <span class="nam">sorted</span><span class="op">(</span><span class="nam">current</span><span class="op">.</span><span class="nam">iterdir</span><span class="op">,</span> <span class="nam">key</span><span class="op">=</span><span class="nam">by_basename</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t499" href="#t499">499</a></span><span class="t"> <span class="key">assert</span> <span class="key">not</span> <span class="nam">children</span> <span class="key">or</span> <span class="nam">current</span><span class="op">.</span><span class="nam">is_dir</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t500" href="#t500">500</a></span><span class="t"> <span class="key">yield</span> <span class="nam">current</span><span class="op">,</span> <span class="nam">children</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t501" href="#t501">501</a></span><span class="t"> <span class="com"># Removing the directory counts as discarding the children.</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t502" href="#t502">502</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">current</span><span class="op">.</span><span class="nam">is_detached</span><span class="op">:</span> </span><span class="r"><span class="annotate short">502 ↛ 496</span><span class="annotate long">line 502 didn't jump to line 496, because the condition on line 502 was never false</span></span></p> - <p class="run"><span class="n"><a id="t503" href="#t503">503</a></span><span class="t"> <span class="nam">stack</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">reversed</span><span class="op">(</span><span class="nam">children</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t504" href="#t504">504</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t505" href="#t505">505</a></span><span class="t"> <span class="key">def</span> <span class="nam">_orphan_safe_path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t506" href="#t506">506</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_detached</span> <span class="key">or</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_last_known_parent_path</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">506 ↛ 508</span><span class="annotate long">line 506 didn't jump to line 508, because the condition on line 506 was never false</span></span></p> - <p class="run"><span class="n"><a id="t507" href="#t507">507</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t508" href="#t508">508</a></span><span class="t"> <span class="key">return</span> <span class="str">f"<orphaned>/{self.name}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t509" href="#t509">509</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t510" href="#t510">510</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t511" href="#t511">511</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_detached</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t512" href="#t512">512</a></span><span class="t"> <span class="nam">parent</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent_dir</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t513" href="#t513">513</a></span><span class="t"> <span class="key">if</span> <span class="nam">parent</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t514" href="#t514">514</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t515" href="#t515">515</a></span><span class="t"> <span class="nam">resolved_parent</span> <span class="op">=</span> <span class="nam">parent</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t516" href="#t516">516</a></span><span class="t"> <span class="key">if</span> <span class="nam">resolved_parent</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">516 ↛ 517</span><span class="annotate long">line 516 didn't jump to line 517, because the condition on line 516 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t517" href="#t517">517</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t518" href="#t518">518</a></span><span class="t"> <span class="key">return</span> <span class="nam">resolved_parent</span><span class="op">.</span><span class="nam">is_detached</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t519" href="#t519">519</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t520" href="#t520">520</a></span><span class="t"> <span class="com"># The __getitem__ behaves like __getitem__ from Dict but __iter__ would ideally work like a Sequence.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t521" href="#t521">521</a></span><span class="t"> <span class="com"># However, that does not feel compatible, so lets force people to use .children instead for the Sequence</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t522" href="#t522">522</a></span><span class="t"> <span class="com"># behaviour to avoid surprises for now.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t523" href="#t523">523</a></span><span class="t"> <span class="com"># (Maybe it is a non-issue, but it is easier to add the API later than to remove it once we have committed</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t524" href="#t524">524</a></span><span class="t"> <span class="com"># to using it)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t525" href="#t525">525</a></span><span class="t"> <span class="nam">__iter__</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t526" href="#t526">526</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t527" href="#t527">527</a></span><span class="t"> <span class="key">def</span> <span class="nam">__getitem__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">key</span><span class="op">)</span> <span class="op">-></span> <span class="str">"FSPath"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t528" href="#t528">528</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_children</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t529" href="#t529">529</a></span><span class="t"> <span class="key">raise</span> <span class="nam">KeyError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t530" href="#t530">530</a></span><span class="t"> <span class="str">f"{key} (note: {self._orphan_safe_path()!r} has no children)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t531" href="#t531">531</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t532" href="#t532">532</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">key</span><span class="op">,</span> <span class="nam">FSPath</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">532 ↛ 533</span><span class="annotate long">line 532 didn't jump to line 533, because the condition on line 532 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t533" href="#t533">533</a></span><span class="t"> <span class="nam">key</span> <span class="op">=</span> <span class="nam">key</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t534" href="#t534">534</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_children</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t535" href="#t535">535</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t536" href="#t536">536</a></span><span class="t"> <span class="key">def</span> <span class="nam">__delitem__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">key</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t537" href="#t537">537</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_rw_check</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t538" href="#t538">538</a></span><span class="t"> <span class="nam">children</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_children</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t539" href="#t539">539</a></span><span class="t"> <span class="key">if</span> <span class="nam">children</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">539 ↛ 540</span><span class="annotate long">line 539 didn't jump to line 540, because the condition on line 539 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t540" href="#t540">540</a></span><span class="t"> <span class="key">raise</span> <span class="nam">KeyError</span><span class="op">(</span><span class="nam">key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t541" href="#t541">541</a></span><span class="t"> <span class="key">del</span> <span class="nam">children</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t542" href="#t542">542</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t543" href="#t543">543</a></span><span class="t"> <span class="key">def</span> <span class="nam">get</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">key</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="str">"Optional[FSPath]"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t544" href="#t544">544</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t545" href="#t545">545</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t546" href="#t546">546</a></span><span class="t"> <span class="key">except</span> <span class="nam">KeyError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t547" href="#t547">547</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t548" href="#t548">548</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t549" href="#t549">549</a></span><span class="t"> <span class="key">def</span> <span class="nam">__contains__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">item</span><span class="op">:</span> <span class="nam">object</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t550" href="#t550">550</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">item</span><span class="op">,</span> <span class="nam">VirtualPath</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">550 ↛ 551</span><span class="annotate long">line 550 didn't jump to line 551, because the condition on line 550 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t551" href="#t551">551</a></span><span class="t"> <span class="key">return</span> <span class="nam">item</span><span class="op">.</span><span class="nam">parent_dir</span> <span class="key">is</span> <span class="nam">self</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t552" href="#t552">552</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">item</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">552 ↛ 553</span><span class="annotate long">line 552 didn't jump to line 553, because the condition on line 552 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t553" href="#t553">553</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t554" href="#t554">554</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">item</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t555" href="#t555">555</a></span><span class="t"> <span class="key">return</span> <span class="nam">m</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t556" href="#t556">556</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t557" href="#t557">557</a></span><span class="t"> <span class="key">def</span> <span class="nam">_add_child</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">child</span><span class="op">:</span> <span class="str">"FSPath"</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t558" href="#t558">558</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_rw_check</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t559" href="#t559">559</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"><span class="annotate short">559 ↛ 560</span><span class="annotate long">line 559 didn't jump to line 560, because the condition on line 559 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t560" href="#t560">560</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TypeError</span><span class="op">(</span><span class="str">f"{self._orphan_safe_path()!r} is not a directory"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t561" href="#t561">561</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_children</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t562" href="#t562">562</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_children</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t563" href="#t563">563</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t564" href="#t564">564</a></span><span class="t"> <span class="nam">conflict_child</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">child</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t565" href="#t565">565</a></span><span class="t"> <span class="key">if</span> <span class="nam">conflict_child</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">565 ↛ 566</span><span class="annotate long">line 565 didn't jump to line 566, because the condition on line 565 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t566" href="#t566">566</a></span><span class="t"> <span class="nam">conflict_child</span><span class="op">.</span><span class="nam">unlink</span><span class="op">(</span><span class="nam">recursive</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t567" href="#t567">567</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_children</span><span class="op">[</span><span class="nam">child</span><span class="op">.</span><span class="nam">name</span><span class="op">]</span> <span class="op">=</span> <span class="nam">child</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t568" href="#t568">568</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t569" href="#t569">569</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t570" href="#t570">570</a></span><span class="t"> <span class="key">def</span> <span class="nam">tar_path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t571" href="#t571">571</a></span><span class="t"> <span class="nam">path</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t572" href="#t572">572</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t573" href="#t573">573</a></span><span class="t"> <span class="key">return</span> <span class="nam">path</span> <span class="op">+</span> <span class="str">"/"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t574" href="#t574">574</a></span><span class="t"> <span class="key">return</span> <span class="nam">path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t575" href="#t575">575</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t576" href="#t576">576</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t577" href="#t577">577</a></span><span class="t"> <span class="key">def</span> <span class="nam">path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t578" href="#t578">578</a></span><span class="t"> <span class="nam">parent_path</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">parent_dir_path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t579" href="#t579">579</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t580" href="#t580">580</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent_path_cache</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t581" href="#t581">581</a></span><span class="t"> <span class="key">and</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent_path_cache</span> <span class="op">==</span> <span class="nam">parent_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t582" href="#t582">582</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t583" href="#t583">583</a></span><span class="t"> <span class="key">return</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_path_cache</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t584" href="#t584">584</a></span><span class="t"> <span class="key">if</span> <span class="nam">parent_path</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">584 ↛ 585</span><span class="annotate long">line 584 didn't jump to line 585, because the condition on line 584 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t585" href="#t585">585</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ReferenceError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t586" href="#t586">586</a></span><span class="t"> <span class="str">f"The path {self.name} is detached! {self.__class__.__name__}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t587" href="#t587">587</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t588" href="#t588">588</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent_path_cache</span> <span class="op">=</span> <span class="nam">parent_path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t589" href="#t589">589</a></span><span class="t"> <span class="nam">ret</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">parent_path</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t590" href="#t590">590</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_path_cache</span> <span class="op">=</span> <span class="nam">ret</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t591" href="#t591">591</a></span><span class="t"> <span class="key">return</span> <span class="nam">ret</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t592" href="#t592">592</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t593" href="#t593">593</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t594" href="#t594">594</a></span><span class="t"> <span class="key">def</span> <span class="nam">parent_dir</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"FSPath"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t595" href="#t595">595</a></span><span class="t"> <span class="nam">p_ref</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent_dir</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t596" href="#t596">596</a></span><span class="t"> <span class="nam">p</span> <span class="op">=</span> <span class="nam">p_ref</span><span class="op">(</span><span class="op">)</span> <span class="key">if</span> <span class="nam">p_ref</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">else</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t597" href="#t597">597</a></span><span class="t"> <span class="key">if</span> <span class="nam">p</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">597 ↛ 598</span><span class="annotate long">line 597 didn't jump to line 598, because the condition on line 597 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t598" href="#t598">598</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ReferenceError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t599" href="#t599">599</a></span><span class="t"> <span class="str">f"The path {self.name} is detached! {self.__class__.__name__}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t600" href="#t600">600</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t601" href="#t601">601</a></span><span class="t"> <span class="key">return</span> <span class="nam">p</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t602" href="#t602">602</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t603" href="#t603">603</a></span><span class="t"> <span class="op">@</span><span class="nam">parent_dir</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t604" href="#t604">604</a></span><span class="t"> <span class="key">def</span> <span class="nam">parent_dir</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">new_parent</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"FSPath"</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t605" href="#t605">605</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_rw_check</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t606" href="#t606">606</a></span><span class="t"> <span class="key">if</span> <span class="nam">new_parent</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t607" href="#t607">607</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">new_parent</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"><span class="annotate short">607 ↛ 608</span><span class="annotate long">line 607 didn't jump to line 608, because the condition on line 607 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t608" href="#t608">608</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t609" href="#t609">609</a></span><span class="t"> <span class="str">f"The parent {new_parent._orphan_safe_path()} must be a directory"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t610" href="#t610">610</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t611" href="#t611">611</a></span><span class="t"> <span class="nam">new_parent</span><span class="op">.</span><span class="nam">_rw_check</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t612" href="#t612">612</a></span><span class="t"> <span class="nam">old_parent</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t613" href="#t613">613</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_last_known_parent_path</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t614" href="#t614">614</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_detached</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t615" href="#t615">615</a></span><span class="t"> <span class="nam">old_parent</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">parent_dir</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t616" href="#t616">616</a></span><span class="t"> <span class="nam">old_parent_children</span> <span class="op">=</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">old_parent</span><span class="op">)</span><span class="op">.</span><span class="nam">_children</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t617" href="#t617">617</a></span><span class="t"> <span class="key">del</span> <span class="nam">old_parent_children</span><span class="op">[</span><span class="nam">self</span><span class="op">.</span><span class="nam">name</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t618" href="#t618">618</a></span><span class="t"> <span class="key">if</span> <span class="nam">new_parent</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t619" href="#t619">619</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent_dir</span> <span class="op">=</span> <span class="nam">ref</span><span class="op">(</span><span class="nam">new_parent</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t620" href="#t620">620</a></span><span class="t"> <span class="nam">new_parent</span><span class="op">.</span><span class="nam">_add_child</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t621" href="#t621">621</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t622" href="#t622">622</a></span><span class="t"> <span class="key">if</span> <span class="nam">old_parent</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">old_parent</span><span class="op">.</span><span class="nam">is_detached</span><span class="op">:</span> </span><span class="r"><span class="annotate short">622 ↛ 624</span><span class="annotate long">line 622 didn't jump to line 624, because the condition on line 622 was never false</span></span></p> - <p class="run"><span class="n"><a id="t623" href="#t623">623</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_last_known_parent_path</span> <span class="op">=</span> <span class="nam">old_parent</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t624" href="#t624">624</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent_dir</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t625" href="#t625">625</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent_path_cache</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t626" href="#t626">626</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t627" href="#t627">627</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t628" href="#t628">628</a></span><span class="t"> <span class="key">def</span> <span class="nam">parent_dir_path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t629" href="#t629">629</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_detached</span><span class="op">:</span> </span><span class="r"><span class="annotate short">629 ↛ 630</span><span class="annotate long">line 629 didn't jump to line 630, because the condition on line 629 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t630" href="#t630">630</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_last_known_parent_path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t631" href="#t631">631</a></span><span class="t"> <span class="key">return</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">parent_dir</span><span class="op">)</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t632" href="#t632">632</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t633" href="#t633">633</a></span><span class="t"> <span class="key">def</span> <span class="nam">chown</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t634" href="#t634">634</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t635" href="#t635">635</a></span><span class="t"> <span class="nam">owner</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">StaticFileSystemOwner</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t636" href="#t636">636</a></span><span class="t"> <span class="nam">group</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">StaticFileSystemGroup</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t637" href="#t637">637</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t638" href="#t638">638</a></span><span class="t"> <span class="str">"""Change the owner/group of this path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t639" href="#t639">639</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t640" href="#t640">640</a></span><span class="t"><span class="str"> :param owner: The desired owner definition for this path. If None, then no change of owner is performed.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t641" href="#t641">641</a></span><span class="t"><span class="str"> :param group: The desired group definition for this path. If None, then no change of group is performed.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t642" href="#t642">642</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t643" href="#t643">643</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_rw_check</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t644" href="#t644">644</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t645" href="#t645">645</a></span><span class="t"> <span class="key">if</span> <span class="nam">owner</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t646" href="#t646">646</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_owner</span> <span class="op">=</span> <span class="nam">owner</span><span class="op">.</span><span class="nam">ownership_definition</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t647" href="#t647">647</a></span><span class="t"> <span class="key">if</span> <span class="nam">group</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t648" href="#t648">648</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_group</span> <span class="op">=</span> <span class="nam">group</span><span class="op">.</span><span class="nam">ownership_definition</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t649" href="#t649">649</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t650" href="#t650">650</a></span><span class="t"> <span class="key">def</span> <span class="nam">stat</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">os</span><span class="op">.</span><span class="nam">stat_result</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t651" href="#t651">651</a></span><span class="t"> <span class="nam">st</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_stat_cache</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t652" href="#t652">652</a></span><span class="t"> <span class="key">if</span> <span class="nam">st</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t653" href="#t653">653</a></span><span class="t"> <span class="nam">st</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_uncached_stat</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t654" href="#t654">654</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_stat_cache</span> <span class="op">=</span> <span class="nam">st</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t655" href="#t655">655</a></span><span class="t"> <span class="key">return</span> <span class="nam">st</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t656" href="#t656">656</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t657" href="#t657">657</a></span><span class="t"> <span class="key">def</span> <span class="nam">_uncached_stat</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">os</span><span class="op">.</span><span class="nam">stat_result</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t658" href="#t658">658</a></span><span class="t"> <span class="key">return</span> <span class="nam">os</span><span class="op">.</span><span class="nam">lstat</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t659" href="#t659">659</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t660" href="#t660">660</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t661" href="#t661">661</a></span><span class="t"> <span class="key">def</span> <span class="nam">mode</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t662" href="#t662">662</a></span><span class="t"> <span class="nam">current_mode</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_mode</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t663" href="#t663">663</a></span><span class="t"> <span class="key">if</span> <span class="nam">current_mode</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">663 ↛ 664</span><span class="annotate long">line 663 didn't jump to line 664, because the condition on line 663 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t664" href="#t664">664</a></span><span class="t"> <span class="nam">current_mode</span> <span class="op">=</span> <span class="nam">stat</span><span class="op">.</span><span class="nam">S_IMODE</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">stat</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">st_mode</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t665" href="#t665">665</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_mode</span> <span class="op">=</span> <span class="nam">current_mode</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t666" href="#t666">666</a></span><span class="t"> <span class="key">return</span> <span class="nam">current_mode</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t667" href="#t667">667</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t668" href="#t668">668</a></span><span class="t"> <span class="op">@</span><span class="nam">mode</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t669" href="#t669">669</a></span><span class="t"> <span class="key">def</span> <span class="nam">mode</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">new_mode</span><span class="op">:</span> <span class="nam">int</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t670" href="#t670">670</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_rw_check</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t671" href="#t671">671</a></span><span class="t"> <span class="nam">min_bit</span> <span class="op">=</span> <span class="num">0o500</span> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_dir</span> <span class="key">else</span> <span class="num">0o400</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t672" href="#t672">672</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span><span class="nam">new_mode</span> <span class="op">&</span> <span class="nam">min_bit</span><span class="op">)</span> <span class="op">!=</span> <span class="nam">min_bit</span><span class="op">:</span> </span><span class="r"><span class="annotate short">672 ↛ 673</span><span class="annotate long">line 672 didn't jump to line 673, because the condition on line 672 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t673" href="#t673">673</a></span><span class="t"> <span class="nam">omode</span> <span class="op">=</span> <span class="nam">oct</span><span class="op">(</span><span class="nam">new_mode</span><span class="op">)</span><span class="op">[</span><span class="num">2</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t674" href="#t674">674</a></span><span class="t"> <span class="nam">omin</span> <span class="op">=</span> <span class="nam">oct</span><span class="op">(</span><span class="nam">min_bit</span><span class="op">)</span><span class="op">[</span><span class="num">2</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t675" href="#t675">675</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t676" href="#t676">676</a></span><span class="t"> <span class="str">f'Attempt to set mode of path "{self._orphan_safe_path()}" to {omode} rejected;'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t677" href="#t677">677</a></span><span class="t"> <span class="str">f" Minimum requirements are {omin} (read-bit and, for dirs, exec bit for user)."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t678" href="#t678">678</a></span><span class="t"> <span class="str">" There are no paths that do not need these requirements met and they can cause"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t679" href="#t679">679</a></span><span class="t"> <span class="str">" problems during build or on the final system."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t680" href="#t680">680</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t681" href="#t681">681</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_mode</span> <span class="op">=</span> <span class="nam">new_mode</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t682" href="#t682">682</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t683" href="#t683">683</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t684" href="#t684">684</a></span><span class="t"> <span class="key">def</span> <span class="nam">mtime</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">float</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t685" href="#t685">685</a></span><span class="t"> <span class="nam">mtime</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_mtime</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t686" href="#t686">686</a></span><span class="t"> <span class="key">if</span> <span class="nam">mtime</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t687" href="#t687">687</a></span><span class="t"> <span class="nam">mtime</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">stat</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">st_mtime</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t688" href="#t688">688</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_mtime</span> <span class="op">=</span> <span class="nam">mtime</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t689" href="#t689">689</a></span><span class="t"> <span class="key">return</span> <span class="nam">mtime</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t690" href="#t690">690</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t691" href="#t691">691</a></span><span class="t"> <span class="op">@</span><span class="nam">mtime</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t692" href="#t692">692</a></span><span class="t"> <span class="key">def</span> <span class="nam">mtime</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">new_mtime</span><span class="op">:</span> <span class="nam">float</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t693" href="#t693">693</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_rw_check</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t694" href="#t694">694</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_mtime</span> <span class="op">=</span> <span class="nam">new_mtime</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t695" href="#t695">695</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t696" href="#t696">696</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t697" href="#t697">697</a></span><span class="t"> <span class="key">def</span> <span class="nam">tar_owner_info</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">int</span><span class="op">,</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">int</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t698" href="#t698">698</a></span><span class="t"> <span class="nam">owner</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_owner</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t699" href="#t699">699</a></span><span class="t"> <span class="nam">group</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_group</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t700" href="#t700">700</a></span><span class="t"> <span class="key">return</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t701" href="#t701">701</a></span><span class="t"> <span class="nam">owner</span><span class="op">.</span><span class="nam">entity_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t702" href="#t702">702</a></span><span class="t"> <span class="nam">owner</span><span class="op">.</span><span class="nam">entity_id</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t703" href="#t703">703</a></span><span class="t"> <span class="nam">group</span><span class="op">.</span><span class="nam">entity_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t704" href="#t704">704</a></span><span class="t"> <span class="nam">group</span><span class="op">.</span><span class="nam">entity_id</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t705" href="#t705">705</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t706" href="#t706">706</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t707" href="#t707">707</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t708" href="#t708">708</a></span><span class="t"> <span class="key">def</span> <span class="nam">_can_replace_inline</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t709" href="#t709">709</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t710" href="#t710">710</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t711" href="#t711">711</a></span><span class="t"> <span class="op">@</span><span class="nam">contextlib</span><span class="op">.</span><span class="nam">contextmanager</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t712" href="#t712">712</a></span><span class="t"> <span class="key">def</span> <span class="nam">add_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t713" href="#t713">713</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t714" href="#t714">714</a></span><span class="t"> <span class="nam">name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t715" href="#t715">715</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t716" href="#t716">716</a></span><span class="t"> <span class="nam">unlink_if_exists</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t717" href="#t717">717</a></span><span class="t"> <span class="nam">use_fs_path_mode</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t718" href="#t718">718</a></span><span class="t"> <span class="nam">mode</span><span class="op">:</span> <span class="nam">int</span> <span class="op">=</span> <span class="num">0o0644</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t719" href="#t719">719</a></span><span class="t"> <span class="nam">mtime</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">float</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t720" href="#t720">720</a></span><span class="t"> <span class="com"># Special-case parameters that are not exposed in the API</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t721" href="#t721">721</a></span><span class="t"> <span class="nam">fs_basename_matters</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t722" href="#t722">722</a></span><span class="t"> <span class="nam">subdir_key</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t723" href="#t723">723</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="str">"FSPath"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t724" href="#t724">724</a></span><span class="t"> <span class="key">if</span> <span class="str">"/"</span> <span class="key">in</span> <span class="nam">name</span> <span class="key">or</span> <span class="nam">name</span> <span class="key">in</span> <span class="op">{</span><span class="str">"."</span><span class="op">,</span> <span class="str">".."</span><span class="op">}</span><span class="op">:</span> </span><span class="r"><span class="annotate short">724 ↛ 725</span><span class="annotate long">line 724 didn't jump to line 725, because the condition on line 724 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t725" href="#t725">725</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">f'Invalid file name: "{name}"'</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t726" href="#t726">726</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"><span class="annotate short">726 ↛ 727</span><span class="annotate long">line 726 didn't jump to line 727, because the condition on line 726 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t727" href="#t727">727</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TypeError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t728" href="#t728">728</a></span><span class="t"> <span class="str">f"Cannot create {self._orphan_safe_path()}/{name}:"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t729" href="#t729">729</a></span><span class="t"> <span class="str">f" {self._orphan_safe_path()} is not a directory"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t730" href="#t730">730</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t731" href="#t731">731</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_rw_check</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t732" href="#t732">732</a></span><span class="t"> <span class="nam">existing</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t733" href="#t733">733</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">733 ↛ 734</span><span class="annotate long">line 733 didn't jump to line 734, because the condition on line 733 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t734" href="#t734">734</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">unlink_if_exists</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t735" href="#t735">735</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t736" href="#t736">736</a></span><span class="t"> <span class="str">f'The path "{self._orphan_safe_path()}" already contains a file called "{name}"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t737" href="#t737">737</a></span><span class="t"> <span class="str">f" and exist_ok was False"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t738" href="#t738">738</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t739" href="#t739">739</a></span><span class="t"> <span class="nam">existing</span><span class="op">.</span><span class="nam">unlink</span><span class="op">(</span><span class="nam">recursive</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t740" href="#t740">740</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t741" href="#t741">741</a></span><span class="t"> <span class="key">if</span> <span class="nam">fs_basename_matters</span> <span class="key">and</span> <span class="nam">subdir_key</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">741 ↛ 742</span><span class="annotate long">line 741 didn't jump to line 742, because the condition on line 741 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t742" href="#t742">742</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t743" href="#t743">743</a></span><span class="t"> <span class="str">"When fs_basename_matters is True, a subdir_key must be provided"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t744" href="#t744">744</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t745" href="#t745">745</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t746" href="#t746">746</a></span><span class="t"> <span class="nam">directory</span> <span class="op">=</span> <span class="nam">generated_content_dir</span><span class="op">(</span><span class="nam">subdir_key</span><span class="op">=</span><span class="nam">subdir_key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t747" href="#t747">747</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t748" href="#t748">748</a></span><span class="t"> <span class="key">if</span> <span class="nam">fs_basename_matters</span><span class="op">:</span> </span><span class="r"><span class="annotate short">748 ↛ 749</span><span class="annotate long">line 748 didn't jump to line 749, because the condition on line 748 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t749" href="#t749">749</a></span><span class="t"> <span class="nam">fs_path</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">directory</span><span class="op">,</span> <span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t750" href="#t750">750</a></span><span class="t"> <span class="key">with</span> <span class="nam">open</span><span class="op">(</span><span class="nam">fs_path</span><span class="op">,</span> <span class="str">"xb"</span><span class="op">)</span> <span class="key">as</span> <span class="nam">_</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t751" href="#t751">751</a></span><span class="t"> <span class="com"># Ensure that the fs_path exists</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t752" href="#t752">752</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t753" href="#t753">753</a></span><span class="t"> <span class="nam">child</span> <span class="op">=</span> <span class="nam">FSBackedFilePath</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t754" href="#t754">754</a></span><span class="t"> <span class="nam">name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t755" href="#t755">755</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t756" href="#t756">756</a></span><span class="t"> <span class="nam">fs_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t757" href="#t757">757</a></span><span class="t"> <span class="nam">replaceable_inline</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t758" href="#t758">758</a></span><span class="t"> <span class="nam">mtime</span><span class="op">=</span><span class="nam">mtime</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t759" href="#t759">759</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t760" href="#t760">760</a></span><span class="t"> <span class="key">yield</span> <span class="nam">child</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t761" href="#t761">761</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t762" href="#t762">762</a></span><span class="t"> <span class="key">with</span> <span class="nam">tempfile</span><span class="op">.</span><span class="nam">NamedTemporaryFile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t763" href="#t763">763</a></span><span class="t"> <span class="nam">dir</span><span class="op">=</span><span class="nam">directory</span><span class="op">,</span> <span class="nam">suffix</span><span class="op">=</span><span class="str">f"__{name}"</span><span class="op">,</span> <span class="nam">delete</span><span class="op">=</span><span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t764" href="#t764">764</a></span><span class="t"> <span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t765" href="#t765">765</a></span><span class="t"> <span class="nam">fs_path</span> <span class="op">=</span> <span class="nam">fd</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t766" href="#t766">766</a></span><span class="t"> <span class="nam">child</span> <span class="op">=</span> <span class="nam">FSBackedFilePath</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t767" href="#t767">767</a></span><span class="t"> <span class="nam">name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t768" href="#t768">768</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t769" href="#t769">769</a></span><span class="t"> <span class="nam">fs_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t770" href="#t770">770</a></span><span class="t"> <span class="nam">replaceable_inline</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t771" href="#t771">771</a></span><span class="t"> <span class="nam">mtime</span><span class="op">=</span><span class="nam">mtime</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t772" href="#t772">772</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t773" href="#t773">773</a></span><span class="t"> <span class="nam">fd</span><span class="op">.</span><span class="nam">close</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t774" href="#t774">774</a></span><span class="t"> <span class="key">yield</span> <span class="nam">child</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t775" href="#t775">775</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t776" href="#t776">776</a></span><span class="t"> <span class="key">if</span> <span class="nam">use_fs_path_mode</span><span class="op">:</span> </span><span class="r"><span class="annotate short">776 ↛ 778</span><span class="annotate long">line 776 didn't jump to line 778, because the condition on line 776 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t777" href="#t777">777</a></span><span class="t"> <span class="com"># Ensure the caller can see the current mode</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t778" href="#t778">778</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">chmod</span><span class="op">(</span><span class="nam">fs_path</span><span class="op">,</span> <span class="nam">mode</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t779" href="#t779">779</a></span><span class="t"> <span class="nam">_check_fs_path_is_file</span><span class="op">(</span><span class="nam">fs_path</span><span class="op">,</span> <span class="nam">unlink_on_error</span><span class="op">=</span><span class="nam">child</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t780" href="#t780">780</a></span><span class="t"> <span class="nam">child</span><span class="op">.</span><span class="nam">_reset_caches</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t781" href="#t781">781</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">use_fs_path_mode</span><span class="op">:</span> </span><span class="r"><span class="annotate short">781 ↛ exit</span><span class="annotate long">line 781 didn't return from function 'add_file', because the condition on line 781 was never false</span></span></p> - <p class="run"><span class="n"><a id="t782" href="#t782">782</a></span><span class="t"> <span class="nam">child</span><span class="op">.</span><span class="nam">mode</span> <span class="op">=</span> <span class="nam">mode</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t783" href="#t783">783</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t784" href="#t784">784</a></span><span class="t"> <span class="key">def</span> <span class="nam">insert_file_from_fs_path</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t785" href="#t785">785</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t786" href="#t786">786</a></span><span class="t"> <span class="nam">name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t787" href="#t787">787</a></span><span class="t"> <span class="nam">fs_path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t788" href="#t788">788</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t789" href="#t789">789</a></span><span class="t"> <span class="nam">exist_ok</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t790" href="#t790">790</a></span><span class="t"> <span class="nam">use_fs_path_mode</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t791" href="#t791">791</a></span><span class="t"> <span class="nam">mode</span><span class="op">:</span> <span class="nam">int</span> <span class="op">=</span> <span class="num">0o0644</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t792" href="#t792">792</a></span><span class="t"> <span class="nam">require_copy_on_write</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t793" href="#t793">793</a></span><span class="t"> <span class="nam">follow_symlinks</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t794" href="#t794">794</a></span><span class="t"> <span class="nam">reference_path</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t795" href="#t795">795</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"FSPath"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t796" href="#t796">796</a></span><span class="t"> <span class="key">if</span> <span class="str">"/"</span> <span class="key">in</span> <span class="nam">name</span> <span class="key">or</span> <span class="nam">name</span> <span class="key">in</span> <span class="op">{</span><span class="str">"."</span><span class="op">,</span> <span class="str">".."</span><span class="op">}</span><span class="op">:</span> </span><span class="r"><span class="annotate short">796 ↛ 797</span><span class="annotate long">line 796 didn't jump to line 797, because the condition on line 796 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t797" href="#t797">797</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">f'Invalid file name: "{name}"'</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t798" href="#t798">798</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"><span class="annotate short">798 ↛ 799</span><span class="annotate long">line 798 didn't jump to line 799, because the condition on line 798 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t799" href="#t799">799</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TypeError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t800" href="#t800">800</a></span><span class="t"> <span class="str">f"Cannot create {self._orphan_safe_path()}/{name}:"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t801" href="#t801">801</a></span><span class="t"> <span class="str">f" {self._orphan_safe_path()} is not a directory"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t802" href="#t802">802</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t803" href="#t803">803</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_rw_check</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t804" href="#t804">804</a></span><span class="t"> <span class="key">if</span> <span class="nam">name</span> <span class="key">in</span> <span class="nam">self</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">exist_ok</span><span class="op">:</span> </span><span class="r"><span class="annotate short">804 ↛ 805</span><span class="annotate long">line 804 didn't jump to line 805, because the condition on line 804 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t805" href="#t805">805</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t806" href="#t806">806</a></span><span class="t"> <span class="str">f'The path "{self._orphan_safe_path()}" already contains a file called "{name}"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t807" href="#t807">807</a></span><span class="t"> <span class="str">f" and exist_ok was False"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t808" href="#t808">808</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t809" href="#t809">809</a></span><span class="t"> <span class="nam">new_fs_path</span> <span class="op">=</span> <span class="nam">fs_path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t810" href="#t810">810</a></span><span class="t"> <span class="key">if</span> <span class="nam">follow_symlinks</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t811" href="#t811">811</a></span><span class="t"> <span class="key">if</span> <span class="nam">reference_path</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">811 ↛ 812</span><span class="annotate long">line 811 didn't jump to line 812, because the condition on line 811 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t812" href="#t812">812</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t813" href="#t813">813</a></span><span class="t"> <span class="str">"The reference_path cannot be used with follow_symlinks"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t814" href="#t814">814</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t815" href="#t815">815</a></span><span class="t"> <span class="nam">new_fs_path</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">realpath</span><span class="op">(</span><span class="nam">new_fs_path</span><span class="op">,</span> <span class="nam">strict</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t816" href="#t816">816</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t817" href="#t817">817</a></span><span class="t"> <span class="nam">fmode</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span> <span class="op">=</span> <span class="nam">mode</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t818" href="#t818">818</a></span><span class="t"> <span class="key">if</span> <span class="nam">use_fs_path_mode</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t819" href="#t819">819</a></span><span class="t"> <span class="nam">fmode</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t820" href="#t820">820</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t821" href="#t821">821</a></span><span class="t"> <span class="nam">st</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t822" href="#t822">822</a></span><span class="t"> <span class="key">if</span> <span class="nam">reference_path</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t823" href="#t823">823</a></span><span class="t"> <span class="nam">st</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">lstat</span><span class="op">(</span><span class="nam">new_fs_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t824" href="#t824">824</a></span><span class="t"> <span class="key">if</span> <span class="nam">stat</span><span class="op">.</span><span class="nam">S_ISDIR</span><span class="op">(</span><span class="nam">st</span><span class="op">.</span><span class="nam">st_mode</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">824 ↛ 825</span><span class="annotate long">line 824 didn't jump to line 825, because the condition on line 824 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t825" href="#t825">825</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t826" href="#t826">826</a></span><span class="t"> <span class="str">f'The provided path "{fs_path}" is a directory. However, this'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t827" href="#t827">827</a></span><span class="t"> <span class="str">" method does not support directories"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t828" href="#t828">828</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t829" href="#t829">829</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t830" href="#t830">830</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">stat</span><span class="op">.</span><span class="nam">S_ISREG</span><span class="op">(</span><span class="nam">st</span><span class="op">.</span><span class="nam">st_mode</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">830 ↛ 831</span><span class="annotate long">line 830 didn't jump to line 831, because the condition on line 830 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t831" href="#t831">831</a></span><span class="t"> <span class="key">if</span> <span class="nam">follow_symlinks</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t832" href="#t832">832</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t833" href="#t833">833</a></span><span class="t"> <span class="str">f"The resolved fs_path ({new_fs_path}) was not a file."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t834" href="#t834">834</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t835" href="#t835">835</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">f"The provided fs_path ({fs_path}) was not a file."</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t836" href="#t836">836</a></span><span class="t"> <span class="key">return</span> <span class="nam">FSBackedFilePath</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t837" href="#t837">837</a></span><span class="t"> <span class="nam">name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t838" href="#t838">838</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t839" href="#t839">839</a></span><span class="t"> <span class="nam">new_fs_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t840" href="#t840">840</a></span><span class="t"> <span class="nam">initial_mode</span><span class="op">=</span><span class="nam">fmode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t841" href="#t841">841</a></span><span class="t"> <span class="nam">stat_cache</span><span class="op">=</span><span class="nam">st</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t842" href="#t842">842</a></span><span class="t"> <span class="nam">replaceable_inline</span><span class="op">=</span><span class="key">not</span> <span class="nam">require_copy_on_write</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t843" href="#t843">843</a></span><span class="t"> <span class="nam">reference_path</span><span class="op">=</span><span class="nam">reference_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t844" href="#t844">844</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t845" href="#t845">845</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t846" href="#t846">846</a></span><span class="t"> <span class="key">def</span> <span class="nam">add_symlink</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t847" href="#t847">847</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t848" href="#t848">848</a></span><span class="t"> <span class="nam">link_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t849" href="#t849">849</a></span><span class="t"> <span class="nam">link_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t850" href="#t850">850</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t851" href="#t851">851</a></span><span class="t"> <span class="nam">reference_path</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t852" href="#t852">852</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"FSPath"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t853" href="#t853">853</a></span><span class="t"> <span class="key">if</span> <span class="str">"/"</span> <span class="key">in</span> <span class="nam">link_name</span> <span class="key">or</span> <span class="nam">link_name</span> <span class="key">in</span> <span class="op">{</span><span class="str">"."</span><span class="op">,</span> <span class="str">".."</span><span class="op">}</span><span class="op">:</span> </span><span class="r"><span class="annotate short">853 ↛ 854</span><span class="annotate long">line 853 didn't jump to line 854, because the condition on line 853 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t854" href="#t854">854</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t855" href="#t855">855</a></span><span class="t"> <span class="str">f'Invalid file name: "{link_name}" (it must be a valid basename)'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t856" href="#t856">856</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t857" href="#t857">857</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"><span class="annotate short">857 ↛ 858</span><span class="annotate long">line 857 didn't jump to line 858, because the condition on line 857 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t858" href="#t858">858</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TypeError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t859" href="#t859">859</a></span><span class="t"> <span class="str">f"Cannot create {self._orphan_safe_path()}/{link_name}:"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t860" href="#t860">860</a></span><span class="t"> <span class="str">f" {self._orphan_safe_path()} is not a directory"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t861" href="#t861">861</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t862" href="#t862">862</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_rw_check</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t863" href="#t863">863</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t864" href="#t864">864</a></span><span class="t"> <span class="nam">existing</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">link_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t865" href="#t865">865</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing</span><span class="op">:</span> </span><span class="r"><span class="annotate short">865 ↛ 867</span><span class="annotate long">line 865 didn't jump to line 867, because the condition on line 865 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t866" href="#t866">866</a></span><span class="t"> <span class="com"># Emulate ln -sf with attempts a non-recursive unlink first.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t867" href="#t867">867</a></span><span class="t"> <span class="nam">existing</span><span class="op">.</span><span class="nam">unlink</span><span class="op">(</span><span class="nam">recursive</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t868" href="#t868">868</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t869" href="#t869">869</a></span><span class="t"> <span class="key">return</span> <span class="nam">SymlinkVirtualPath</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t870" href="#t870">870</a></span><span class="t"> <span class="nam">link_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t871" href="#t871">871</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t872" href="#t872">872</a></span><span class="t"> <span class="nam">link_target</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t873" href="#t873">873</a></span><span class="t"> <span class="nam">reference_path</span><span class="op">=</span><span class="nam">reference_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t874" href="#t874">874</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t875" href="#t875">875</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t876" href="#t876">876</a></span><span class="t"> <span class="key">def</span> <span class="nam">mkdir</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t877" href="#t877">877</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t878" href="#t878">878</a></span><span class="t"> <span class="nam">name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t879" href="#t879">879</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t880" href="#t880">880</a></span><span class="t"> <span class="nam">reference_path</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t881" href="#t881">881</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"FSPath"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t882" href="#t882">882</a></span><span class="t"> <span class="key">if</span> <span class="str">"/"</span> <span class="key">in</span> <span class="nam">name</span> <span class="key">or</span> <span class="nam">name</span> <span class="key">in</span> <span class="op">{</span><span class="str">"."</span><span class="op">,</span> <span class="str">".."</span><span class="op">}</span><span class="op">:</span> </span><span class="r"><span class="annotate short">882 ↛ 883</span><span class="annotate long">line 882 didn't jump to line 883, because the condition on line 882 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t883" href="#t883">883</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t884" href="#t884">884</a></span><span class="t"> <span class="str">f'Invalid file name: "{name}" (it must be a valid basename)'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t885" href="#t885">885</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t886" href="#t886">886</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"><span class="annotate short">886 ↛ 887</span><span class="annotate long">line 886 didn't jump to line 887, because the condition on line 886 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t887" href="#t887">887</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TypeError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t888" href="#t888">888</a></span><span class="t"> <span class="str">f"Cannot create {self._orphan_safe_path()}/{name}:"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t889" href="#t889">889</a></span><span class="t"> <span class="str">f" {self._orphan_safe_path()} is not a directory"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t890" href="#t890">890</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t891" href="#t891">891</a></span><span class="t"> <span class="key">if</span> <span class="nam">reference_path</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">reference_path</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"><span class="annotate short">891 ↛ 892</span><span class="annotate long">line 891 didn't jump to line 892, because the condition on line 891 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t892" href="#t892">892</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t893" href="#t893">893</a></span><span class="t"> <span class="str">f'The provided fs_path "{reference_path.fs_path}" exist but it is not a directory!'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t894" href="#t894">894</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t895" href="#t895">895</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_rw_check</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t896" href="#t896">896</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t897" href="#t897">897</a></span><span class="t"> <span class="nam">existing</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t898" href="#t898">898</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing</span><span class="op">:</span> </span><span class="r"><span class="annotate short">898 ↛ 899</span><span class="annotate long">line 898 didn't jump to line 899, because the condition on line 898 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t899" href="#t899">899</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">f"Path {existing.path} already exist"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t900" href="#t900">900</a></span><span class="t"> <span class="key">return</span> <span class="nam">VirtualDirectoryFSPath</span><span class="op">(</span><span class="nam">name</span><span class="op">,</span> <span class="nam">self</span><span class="op">,</span> <span class="nam">reference_path</span><span class="op">=</span><span class="nam">reference_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t901" href="#t901">901</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t902" href="#t902">902</a></span><span class="t"> <span class="key">def</span> <span class="nam">mkdirs</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">path</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="str">"FSPath"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t903" href="#t903">903</a></span><span class="t"> <span class="key">return</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"FSPath"</span><span class="op">,</span> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">mkdirs</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t904" href="#t904">904</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t905" href="#t905">905</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t906" href="#t906">906</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_read_write</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t907" href="#t907">907</a></span><span class="t"> <span class="str">"""When true, the file system entry may be mutated</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t908" href="#t908">908</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t909" href="#t909">909</a></span><span class="t"><span class="str"> :return: Whether file system mutations are permitted.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t910" href="#t910">910</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t911" href="#t911">911</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_detached</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t912" href="#t912">912</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t913" href="#t913">913</a></span><span class="t"> <span class="key">return</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">parent_dir</span><span class="op">)</span><span class="op">.</span><span class="nam">is_read_write</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t914" href="#t914">914</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t915" href="#t915">915</a></span><span class="t"> <span class="key">def</span> <span class="nam">unlink</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">recursive</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t916" href="#t916">916</a></span><span class="t"> <span class="str">"""Unlink a file or a directory</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t917" href="#t917">917</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t918" href="#t918">918</a></span><span class="t"><span class="str"> This operation will detach the path from the file system (causing "is_detached" to return True).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t919" href="#t919">919</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t920" href="#t920">920</a></span><span class="t"><span class="str"> Note that the root directory cannot be deleted.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t921" href="#t921">921</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t922" href="#t922">922</a></span><span class="t"><span class="str"> :param recursive: If True, then non-empty directories will be unlinked as well removing everything inside them</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t923" href="#t923">923</a></span><span class="t"><span class="str"> as well. When False, an error is raised if the path is a non-empty directory</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t924" href="#t924">924</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t925" href="#t925">925</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_detached</span><span class="op">:</span> </span><span class="r"><span class="annotate short">925 ↛ 926</span><span class="annotate long">line 925 didn't jump to line 926, because the condition on line 925 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t926" href="#t926">926</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t927" href="#t927">927</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">recursive</span> <span class="key">and</span> <span class="nam">any</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">iterdir</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">927 ↛ 928</span><span class="annotate long">line 927 didn't jump to line 928, because the condition on line 927 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t928" href="#t928">928</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t929" href="#t929">929</a></span><span class="t"> <span class="str">f'Refusing to unlink "{self.path}": The directory was not empty and recursive was False'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t930" href="#t930">930</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t931" href="#t931">931</a></span><span class="t"> <span class="com"># The .parent_dir setter does a _rw_check() for us.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t932" href="#t932">932</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">parent_dir</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t933" href="#t933">933</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t934" href="#t934">934</a></span><span class="t"> <span class="key">def</span> <span class="nam">_reset_caches</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t935" href="#t935">935</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_mtime</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t936" href="#t936">936</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_stat_cache</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t937" href="#t937">937</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t938" href="#t938">938</a></span><span class="t"> <span class="key">def</span> <span class="nam">metadata</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t939" href="#t939">939</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t940" href="#t940">940</a></span><span class="t"> <span class="nam">metadata_type</span><span class="op">:</span> <span class="nam">Type</span><span class="op">[</span><span class="nam">PMT</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t941" href="#t941">941</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t942" href="#t942">942</a></span><span class="t"> <span class="nam">owning_plugin</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t943" href="#t943">943</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">PathMetadataReference</span><span class="op">[</span><span class="nam">PMT</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t944" href="#t944">944</a></span><span class="t"> <span class="nam">current_plugin</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_current_plugin</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t945" href="#t945">945</a></span><span class="t"> <span class="key">if</span> <span class="nam">owning_plugin</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">945 ↛ 947</span><span class="annotate long">line 945 didn't jump to line 947, because the condition on line 945 was never false</span></span></p> - <p class="run"><span class="n"><a id="t946" href="#t946">946</a></span><span class="t"> <span class="nam">owning_plugin</span> <span class="op">=</span> <span class="nam">current_plugin</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t947" href="#t947">947</a></span><span class="t"> <span class="nam">metadata_key</span> <span class="op">=</span> <span class="op">(</span><span class="nam">owning_plugin</span><span class="op">,</span> <span class="nam">metadata_type</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t948" href="#t948">948</a></span><span class="t"> <span class="nam">metadata_value</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_metadata</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">metadata_key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t949" href="#t949">949</a></span><span class="t"> <span class="key">if</span> <span class="nam">metadata_value</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t950" href="#t950">950</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_detached</span><span class="op">:</span> </span><span class="r"><span class="annotate short">950 ↛ 951</span><span class="annotate long">line 950 didn't jump to line 951, because the condition on line 950 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t951" href="#t951">951</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TypeError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t952" href="#t952">952</a></span><span class="t"> <span class="str">f"Cannot access the metadata {metadata_type.__name__}: The path is detached."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t953" href="#t953">953</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t954" href="#t954">954</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_read_write</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t955" href="#t955">955</a></span><span class="t"> <span class="key">return</span> <span class="nam">AlwaysEmptyReadOnlyMetadataReference</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t956" href="#t956">956</a></span><span class="t"> <span class="nam">owning_plugin</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t957" href="#t957">957</a></span><span class="t"> <span class="nam">current_plugin</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t958" href="#t958">958</a></span><span class="t"> <span class="nam">metadata_type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t959" href="#t959">959</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t960" href="#t960">960</a></span><span class="t"> <span class="nam">metadata_value</span> <span class="op">=</span> <span class="nam">PathMetadataValue</span><span class="op">(</span><span class="nam">owning_plugin</span><span class="op">,</span> <span class="nam">metadata_type</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t961" href="#t961">961</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_metadata</span><span class="op">[</span><span class="nam">metadata_key</span><span class="op">]</span> <span class="op">=</span> <span class="nam">metadata_value</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t962" href="#t962">962</a></span><span class="t"> <span class="key">return</span> <span class="nam">PathMetadataReferenceImplementation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t963" href="#t963">963</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t964" href="#t964">964</a></span><span class="t"> <span class="nam">current_plugin</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t965" href="#t965">965</a></span><span class="t"> <span class="nam">metadata_value</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t966" href="#t966">966</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t967" href="#t967">967</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t968" href="#t968">968</a></span><span class="t"> <span class="op">@</span><span class="nam">contextlib</span><span class="op">.</span><span class="nam">contextmanager</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t969" href="#t969">969</a></span><span class="t"> <span class="key">def</span> <span class="nam">replace_fs_path_content</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t970" href="#t970">970</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t971" href="#t971">971</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t972" href="#t972">972</a></span><span class="t"> <span class="nam">use_fs_path_mode</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t973" href="#t973">973</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t974" href="#t974">974</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_file</span><span class="op">:</span> </span><span class="r"><span class="annotate short">974 ↛ 975</span><span class="annotate long">line 974 didn't jump to line 975, because the condition on line 974 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t975" href="#t975">975</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TypeError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t976" href="#t976">976</a></span><span class="t"> <span class="str">f'Cannot replace contents of "{self._orphan_safe_path()}" as it is not a file'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t977" href="#t977">977</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t978" href="#t978">978</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_rw_check</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t979" href="#t979">979</a></span><span class="t"> <span class="nam">fs_path</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">fs_path</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t980" href="#t980">980</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_can_replace_inline</span><span class="op">:</span> </span><span class="r"><span class="annotate short">980 ↛ 992</span><span class="annotate long">line 980 didn't jump to line 992, because the condition on line 980 was never false</span></span></p> - <p class="run"><span class="n"><a id="t981" href="#t981">981</a></span><span class="t"> <span class="nam">fs_path</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">fs_path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t982" href="#t982">982</a></span><span class="t"> <span class="nam">directory</span> <span class="op">=</span> <span class="nam">generated_content_dir</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t983" href="#t983">983</a></span><span class="t"> <span class="key">with</span> <span class="nam">tempfile</span><span class="op">.</span><span class="nam">NamedTemporaryFile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t984" href="#t984">984</a></span><span class="t"> <span class="nam">dir</span><span class="op">=</span><span class="nam">directory</span><span class="op">,</span> <span class="nam">suffix</span><span class="op">=</span><span class="str">f"__{self.name}"</span><span class="op">,</span> <span class="nam">delete</span><span class="op">=</span><span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t985" href="#t985">985</a></span><span class="t"> <span class="op">)</span> <span class="key">as</span> <span class="nam">new_path_fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t986" href="#t986">986</a></span><span class="t"> <span class="nam">new_path_fd</span><span class="op">.</span><span class="nam">close</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t987" href="#t987">987</a></span><span class="t"> <span class="nam">_cp_a</span><span class="op">(</span><span class="nam">fs_path</span><span class="op">,</span> <span class="nam">new_path_fd</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t988" href="#t988">988</a></span><span class="t"> <span class="nam">fs_path</span> <span class="op">=</span> <span class="nam">new_path_fd</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t989" href="#t989">989</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_replaced_path</span><span class="op">(</span><span class="nam">fs_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t990" href="#t990">990</a></span><span class="t"> <span class="key">assert</span> <span class="nam">self</span><span class="op">.</span><span class="nam">fs_path</span> <span class="op">==</span> <span class="nam">fs_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t991" href="#t991">991</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t992" href="#t992">992</a></span><span class="t"> <span class="nam">current_mtime</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_mtime</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t993" href="#t993">993</a></span><span class="t"> <span class="key">if</span> <span class="nam">current_mtime</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t994" href="#t994">994</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">utime</span><span class="op">(</span><span class="nam">fs_path</span><span class="op">,</span> <span class="op">(</span><span class="nam">current_mtime</span><span class="op">,</span> <span class="nam">current_mtime</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t995" href="#t995">995</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t996" href="#t996">996</a></span><span class="t"> <span class="nam">current_mode</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">mode</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t997" href="#t997">997</a></span><span class="t"> <span class="key">yield</span> <span class="nam">fs_path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t998" href="#t998">998</a></span><span class="t"> <span class="nam">_check_fs_path_is_file</span><span class="op">(</span><span class="nam">fs_path</span><span class="op">,</span> <span class="nam">unlink_on_error</span><span class="op">=</span><span class="nam">self</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t999" href="#t999">999</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">use_fs_path_mode</span><span class="op">:</span> </span><span class="r"><span class="annotate short">999 ↛ 1001</span><span class="annotate long">line 999 didn't jump to line 1001, because the condition on line 999 was never false</span></span></p> - <p class="run"><span class="n"><a id="t1000" href="#t1000">1000</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">chmod</span><span class="op">(</span><span class="nam">fs_path</span><span class="op">,</span> <span class="nam">current_mode</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1001" href="#t1001">1001</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_reset_caches</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1002" href="#t1002">1002</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1003" href="#t1003">1003</a></span><span class="t"> <span class="key">def</span> <span class="nam">_replaced_path</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">new_fs_path</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1004" href="#t1004">1004</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1005" href="#t1005">1005</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1006" href="#t1006">1006</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1007" href="#t1007">1007</a></span><span class="t"><span class="key">class</span> <span class="nam">VirtualFSPathBase</span><span class="op">(</span><span class="nam">FSPath</span><span class="op">,</span> <span class="nam">ABC</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1008" href="#t1008">1008</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1009" href="#t1009">1009</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1010" href="#t1010">1010</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1011" href="#t1011">1011</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1012" href="#t1012">1012</a></span><span class="t"> <span class="nam">basename</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1013" href="#t1013">1013</a></span><span class="t"> <span class="nam">parent</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"FSPath"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1014" href="#t1014">1014</a></span><span class="t"> <span class="nam">children</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="str">"FSPath"</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1015" href="#t1015">1015</a></span><span class="t"> <span class="nam">initial_mode</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1016" href="#t1016">1016</a></span><span class="t"> <span class="nam">mtime</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">float</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1017" href="#t1017">1017</a></span><span class="t"> <span class="nam">stat_cache</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">os</span><span class="op">.</span><span class="nam">stat_result</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1018" href="#t1018">1018</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1019" href="#t1019">1019</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1020" href="#t1020">1020</a></span><span class="t"> <span class="nam">basename</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1021" href="#t1021">1021</a></span><span class="t"> <span class="nam">parent</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1022" href="#t1022">1022</a></span><span class="t"> <span class="nam">children</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1023" href="#t1023">1023</a></span><span class="t"> <span class="nam">initial_mode</span><span class="op">=</span><span class="nam">initial_mode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1024" href="#t1024">1024</a></span><span class="t"> <span class="nam">mtime</span><span class="op">=</span><span class="nam">mtime</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1025" href="#t1025">1025</a></span><span class="t"> <span class="nam">stat_cache</span><span class="op">=</span><span class="nam">stat_cache</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1026" href="#t1026">1026</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1027" href="#t1027">1027</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1028" href="#t1028">1028</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1029" href="#t1029">1029</a></span><span class="t"> <span class="key">def</span> <span class="nam">mtime</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">float</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1030" href="#t1030">1030</a></span><span class="t"> <span class="nam">mtime</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_mtime</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1031" href="#t1031">1031</a></span><span class="t"> <span class="key">if</span> <span class="nam">mtime</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1032" href="#t1032">1032</a></span><span class="t"> <span class="nam">mtime</span> <span class="op">=</span> <span class="nam">time</span><span class="op">.</span><span class="nam">time</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1033" href="#t1033">1033</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_mtime</span> <span class="op">=</span> <span class="nam">mtime</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1034" href="#t1034">1034</a></span><span class="t"> <span class="key">return</span> <span class="nam">mtime</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1035" href="#t1035">1035</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1036" href="#t1036">1036</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1037" href="#t1037">1037</a></span><span class="t"> <span class="key">def</span> <span class="nam">has_fs_path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1038" href="#t1038">1038</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1039" href="#t1039">1039</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1040" href="#t1040">1040</a></span><span class="t"> <span class="key">def</span> <span class="nam">stat</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">os</span><span class="op">.</span><span class="nam">stat_result</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1041" href="#t1041">1041</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">has_fs_path</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1042" href="#t1042">1042</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PureVirtualPathError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1043" href="#t1043">1043</a></span><span class="t"> <span class="str">"stat() is only applicable to paths backed by the file system. The path"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1044" href="#t1044">1044</a></span><span class="t"> <span class="str">f" {self._orphan_safe_path()!r} is purely virtual"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1045" href="#t1045">1045</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1046" href="#t1046">1046</a></span><span class="t"> <span class="key">return</span> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">stat</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1047" href="#t1047">1047</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1048" href="#t1048">1048</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1049" href="#t1049">1049</a></span><span class="t"> <span class="key">def</span> <span class="nam">fs_path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1050" href="#t1050">1050</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">has_fs_path</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1051" href="#t1051">1051</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PureVirtualPathError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1052" href="#t1052">1052</a></span><span class="t"> <span class="str">"fs_path is only applicable to paths backed by the file system. The path"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1053" href="#t1053">1053</a></span><span class="t"> <span class="str">f" {self._orphan_safe_path()!r} is purely virtual"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1054" href="#t1054">1054</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1055" href="#t1055">1055</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">fs_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1056" href="#t1056">1056</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1057" href="#t1057">1057</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1058" href="#t1058">1058</a></span><span class="t"><span class="key">class</span> <span class="nam">FSRootDir</span><span class="op">(</span><span class="nam">FSPath</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1059" href="#t1059">1059</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"_fs_path"</span><span class="op">,</span> <span class="str">"_fs_read_write"</span><span class="op">,</span> <span class="str">"_plugin_context"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1060" href="#t1060">1060</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1061" href="#t1061">1061</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">fs_path</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1062" href="#t1062">1062</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_fs_path</span> <span class="op">=</span> <span class="nam">fs_path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1063" href="#t1063">1063</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_fs_read_write</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1064" href="#t1064">1064</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1065" href="#t1065">1065</a></span><span class="t"> <span class="str">"."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1066" href="#t1066">1066</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1067" href="#t1067">1067</a></span><span class="t"> <span class="nam">children</span><span class="op">=</span><span class="op">{</span><span class="op">}</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1068" href="#t1068">1068</a></span><span class="t"> <span class="nam">initial_mode</span><span class="op">=</span><span class="num">0o755</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1069" href="#t1069">1069</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1070" href="#t1070">1070</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_context</span> <span class="op">=</span> <span class="nam">CurrentPluginContextManager</span><span class="op">(</span><span class="str">"debputy"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1071" href="#t1071">1071</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1072" href="#t1072">1072</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1073" href="#t1073">1073</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_detached</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1074" href="#t1074">1074</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1075" href="#t1075">1075</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1076" href="#t1076">1076</a></span><span class="t"> <span class="key">def</span> <span class="nam">_orphan_safe_path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1077" href="#t1077">1077</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1078" href="#t1078">1078</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1079" href="#t1079">1079</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1080" href="#t1080">1080</a></span><span class="t"> <span class="key">def</span> <span class="nam">path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1081" href="#t1081">1081</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1082" href="#t1082">1082</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1083" href="#t1083">1083</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1084" href="#t1084">1084</a></span><span class="t"> <span class="key">def</span> <span class="nam">parent_dir</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"FSPath"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1085" href="#t1085">1085</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1086" href="#t1086">1086</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1087" href="#t1087">1087</a></span><span class="t"> <span class="op">@</span><span class="nam">parent_dir</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1088" href="#t1088">1088</a></span><span class="t"> <span class="key">def</span> <span class="nam">parent_dir</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">new_parent</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">FSPath</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1089" href="#t1089">1089</a></span><span class="t"> <span class="key">if</span> <span class="nam">new_parent</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1090" href="#t1090">1090</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"The root directory cannot become a non-root directory"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1091" href="#t1091">1091</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1092" href="#t1092">1092</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1093" href="#t1093">1093</a></span><span class="t"> <span class="key">def</span> <span class="nam">parent_dir_path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1094" href="#t1094">1094</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1095" href="#t1095">1095</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1096" href="#t1096">1096</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1097" href="#t1097">1097</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_dir</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1098" href="#t1098">1098</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1099" href="#t1099">1099</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1100" href="#t1100">1100</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1101" href="#t1101">1101</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_file</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1102" href="#t1102">1102</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1103" href="#t1103">1103</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1104" href="#t1104">1104</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1105" href="#t1105">1105</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_symlink</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1106" href="#t1106">1106</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1107" href="#t1107">1107</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1108" href="#t1108">1108</a></span><span class="t"> <span class="key">def</span> <span class="nam">readlink</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1109" href="#t1109">1109</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TypeError</span><span class="op">(</span><span class="str">f'"{self._orphan_safe_path()!r}" is a directory; not a symlink'</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1110" href="#t1110">1110</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1111" href="#t1111">1111</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1112" href="#t1112">1112</a></span><span class="t"> <span class="key">def</span> <span class="nam">has_fs_path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1113" href="#t1113">1113</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_fs_path</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1114" href="#t1114">1114</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1115" href="#t1115">1115</a></span><span class="t"> <span class="key">def</span> <span class="nam">stat</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">os</span><span class="op">.</span><span class="nam">stat_result</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1116" href="#t1116">1116</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">has_fs_path</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1117" href="#t1117">1117</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PureVirtualPathError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1118" href="#t1118">1118</a></span><span class="t"> <span class="str">"stat() is only applicable to paths backed by the file system. The path"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1119" href="#t1119">1119</a></span><span class="t"> <span class="str">f" {self._orphan_safe_path()!r} is purely virtual"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1120" href="#t1120">1120</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1121" href="#t1121">1121</a></span><span class="t"> <span class="key">return</span> <span class="nam">os</span><span class="op">.</span><span class="nam">stat</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1122" href="#t1122">1122</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1123" href="#t1123">1123</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1124" href="#t1124">1124</a></span><span class="t"> <span class="key">def</span> <span class="nam">fs_path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1125" href="#t1125">1125</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">has_fs_path</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1125 ↛ 1126</span><span class="annotate long">line 1125 didn't jump to line 1126, because the condition on line 1125 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1126" href="#t1126">1126</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PureVirtualPathError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1127" href="#t1127">1127</a></span><span class="t"> <span class="str">"fs_path is only applicable to paths backed by the file system. The path"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1128" href="#t1128">1128</a></span><span class="t"> <span class="str">f" {self._orphan_safe_path()!r} is purely virtual"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1129" href="#t1129">1129</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1130" href="#t1130">1130</a></span><span class="t"> <span class="key">return</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_fs_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1131" href="#t1131">1131</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1132" href="#t1132">1132</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1133" href="#t1133">1133</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_read_write</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1134" href="#t1134">1134</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_fs_read_write</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1135" href="#t1135">1135</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1136" href="#t1136">1136</a></span><span class="t"> <span class="op">@</span><span class="nam">is_read_write</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1137" href="#t1137">1137</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_read_write</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">new_value</span><span class="op">:</span> <span class="nam">bool</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1138" href="#t1138">1138</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_fs_read_write</span> <span class="op">=</span> <span class="nam">new_value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1139" href="#t1139">1139</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1140" href="#t1140">1140</a></span><span class="t"> <span class="key">def</span> <span class="nam">prune_if_empty_dir</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1141" href="#t1141">1141</a></span><span class="t"> <span class="com"># No-op for the root directory. There is never a case where you want to delete this directory</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1142" href="#t1142">1142</a></span><span class="t"> <span class="com"># (and even if you could, debputy will need it for technical reasons, so the root dir stays)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1143" href="#t1143">1143</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1144" href="#t1144">1144</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1145" href="#t1145">1145</a></span><span class="t"> <span class="key">def</span> <span class="nam">unlink</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">recursive</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1146" href="#t1146">1146</a></span><span class="t"> <span class="com"># There is never a case where you want to delete this directory (and even if you could,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1147" href="#t1147">1147</a></span><span class="t"> <span class="com"># debputy will need it for technical reasons, so the root dir stays)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1148" href="#t1148">1148</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TypeError</span><span class="op">(</span><span class="str">"Cannot delete the root directory"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1149" href="#t1149">1149</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1150" href="#t1150">1150</a></span><span class="t"> <span class="key">def</span> <span class="nam">_current_plugin</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1151" href="#t1151">1151</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_context</span><span class="op">.</span><span class="nam">current_plugin_name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1152" href="#t1152">1152</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1153" href="#t1153">1153</a></span><span class="t"> <span class="op">@</span><span class="nam">contextlib</span><span class="op">.</span><span class="nam">contextmanager</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1154" href="#t1154">1154</a></span><span class="t"> <span class="key">def</span> <span class="nam">change_plugin_context</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">new_plugin</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1155" href="#t1155">1155</a></span><span class="t"> <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_context</span><span class="op">.</span><span class="nam">change_plugin_context</span><span class="op">(</span><span class="nam">new_plugin</span><span class="op">)</span> <span class="key">as</span> <span class="nam">r</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1156" href="#t1156">1156</a></span><span class="t"> <span class="key">yield</span> <span class="nam">r</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1157" href="#t1157">1157</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1158" href="#t1158">1158</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1159" href="#t1159">1159</a></span><span class="t"><span class="key">class</span> <span class="nam">VirtualPathWithReference</span><span class="op">(</span><span class="nam">VirtualFSPathBase</span><span class="op">,</span> <span class="nam">ABC</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1160" href="#t1160">1160</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"_reference_path"</span><span class="op">,</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1161" href="#t1161">1161</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1162" href="#t1162">1162</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1163" href="#t1163">1163</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1164" href="#t1164">1164</a></span><span class="t"> <span class="nam">basename</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1165" href="#t1165">1165</a></span><span class="t"> <span class="nam">parent</span><span class="op">:</span> <span class="nam">FSPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1166" href="#t1166">1166</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1167" href="#t1167">1167</a></span><span class="t"> <span class="nam">default_mode</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1168" href="#t1168">1168</a></span><span class="t"> <span class="nam">reference_path</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1169" href="#t1169">1169</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1170" href="#t1170">1170</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1171" href="#t1171">1171</a></span><span class="t"> <span class="nam">basename</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1172" href="#t1172">1172</a></span><span class="t"> <span class="nam">parent</span><span class="op">=</span><span class="nam">parent</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1173" href="#t1173">1173</a></span><span class="t"> <span class="nam">initial_mode</span><span class="op">=</span><span class="nam">reference_path</span><span class="op">.</span><span class="nam">mode</span> <span class="key">if</span> <span class="nam">reference_path</span> <span class="key">else</span> <span class="nam">default_mode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1174" href="#t1174">1174</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1175" href="#t1175">1175</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_reference_path</span> <span class="op">=</span> <span class="nam">reference_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1176" href="#t1176">1176</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1177" href="#t1177">1177</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1178" href="#t1178">1178</a></span><span class="t"> <span class="key">def</span> <span class="nam">has_fs_path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1179" href="#t1179">1179</a></span><span class="t"> <span class="nam">ref_path</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_reference_path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1180" href="#t1180">1180</a></span><span class="t"> <span class="key">return</span> <span class="nam">ref_path</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">ref_path</span><span class="op">.</span><span class="nam">has_fs_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1181" href="#t1181">1181</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1182" href="#t1182">1182</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1183" href="#t1183">1183</a></span><span class="t"> <span class="key">def</span> <span class="nam">mtime</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">float</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1184" href="#t1184">1184</a></span><span class="t"> <span class="nam">mtime</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_mtime</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1185" href="#t1185">1185</a></span><span class="t"> <span class="key">if</span> <span class="nam">mtime</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1185 ↛ 1192</span><span class="annotate long">line 1185 didn't jump to line 1192, because the condition on line 1185 was never false</span></span></p> - <p class="run"><span class="n"><a id="t1186" href="#t1186">1186</a></span><span class="t"> <span class="nam">ref_path</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_reference_path</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1187" href="#t1187">1187</a></span><span class="t"> <span class="key">if</span> <span class="nam">ref_path</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1187 ↛ 1190</span><span class="annotate long">line 1187 didn't jump to line 1190, because the condition on line 1187 was never false</span></span></p> - <p class="run"><span class="n"><a id="t1188" href="#t1188">1188</a></span><span class="t"> <span class="nam">mtime</span> <span class="op">=</span> <span class="nam">ref_path</span><span class="op">.</span><span class="nam">mtime</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1189" href="#t1189">1189</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1190" href="#t1190">1190</a></span><span class="t"> <span class="nam">mtime</span> <span class="op">=</span> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">mtime</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1191" href="#t1191">1191</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_mtime</span> <span class="op">=</span> <span class="nam">mtime</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1192" href="#t1192">1192</a></span><span class="t"> <span class="key">return</span> <span class="nam">mtime</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1193" href="#t1193">1193</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1194" href="#t1194">1194</a></span><span class="t"> <span class="op">@</span><span class="nam">mtime</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1195" href="#t1195">1195</a></span><span class="t"> <span class="key">def</span> <span class="nam">mtime</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">new_mtime</span><span class="op">:</span> <span class="nam">float</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1196" href="#t1196">1196</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_rw_check</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1197" href="#t1197">1197</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_mtime</span> <span class="op">=</span> <span class="nam">new_mtime</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1198" href="#t1198">1198</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1199" href="#t1199">1199</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1200" href="#t1200">1200</a></span><span class="t"> <span class="key">def</span> <span class="nam">fs_path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1201" href="#t1201">1201</a></span><span class="t"> <span class="nam">ref_path</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_reference_path</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1202" href="#t1202">1202</a></span><span class="t"> <span class="key">if</span> <span class="nam">ref_path</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="op">(</span> </span><span class="r"><span class="annotate short">1202 ↛ 1206</span><span class="annotate long">line 1202 didn't jump to line 1206, because the condition on line 1202 was never false</span></span></p> - <p class="pln"><span class="n"><a id="t1203" href="#t1203">1203</a></span><span class="t"> <span class="key">not</span> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">has_fs_path</span> <span class="key">or</span> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">fs_path</span> <span class="op">==</span> <span class="nam">ref_path</span><span class="op">.</span><span class="nam">fs_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1204" href="#t1204">1204</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1205" href="#t1205">1205</a></span><span class="t"> <span class="key">return</span> <span class="nam">ref_path</span><span class="op">.</span><span class="nam">fs_path</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1206" href="#t1206">1206</a></span><span class="t"> <span class="key">return</span> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">fs_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1207" href="#t1207">1207</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1208" href="#t1208">1208</a></span><span class="t"> <span class="key">def</span> <span class="nam">stat</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">os</span><span class="op">.</span><span class="nam">stat_result</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1209" href="#t1209">1209</a></span><span class="t"> <span class="nam">ref_path</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_reference_path</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1210" href="#t1210">1210</a></span><span class="t"> <span class="key">if</span> <span class="nam">ref_path</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1211" href="#t1211">1211</a></span><span class="t"> <span class="key">not</span> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">has_fs_path</span> <span class="key">or</span> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">fs_path</span> <span class="op">==</span> <span class="nam">ref_path</span><span class="op">.</span><span class="nam">fs_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1212" href="#t1212">1212</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1213" href="#t1213">1213</a></span><span class="t"> <span class="key">return</span> <span class="nam">ref_path</span><span class="op">.</span><span class="nam">stat</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1214" href="#t1214">1214</a></span><span class="t"> <span class="key">return</span> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">stat</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1215" href="#t1215">1215</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1216" href="#t1216">1216</a></span><span class="t"> <span class="key">def</span> <span class="nam">open</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1217" href="#t1217">1217</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1218" href="#t1218">1218</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1219" href="#t1219">1219</a></span><span class="t"> <span class="nam">byte_io</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1220" href="#t1220">1220</a></span><span class="t"> <span class="nam">buffering</span><span class="op">:</span> <span class="nam">int</span> <span class="op">=</span> <span class="op">-</span><span class="num">1</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1221" href="#t1221">1221</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Union</span><span class="op">[</span><span class="nam">TextIO</span><span class="op">,</span> <span class="nam">BinaryIO</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1222" href="#t1222">1222</a></span><span class="t"> <span class="nam">reference_path</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_reference_path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1223" href="#t1223">1223</a></span><span class="t"> <span class="key">if</span> <span class="nam">reference_path</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">reference_path</span><span class="op">.</span><span class="nam">fs_path</span> <span class="op">==</span> <span class="nam">self</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1224" href="#t1224">1224</a></span><span class="t"> <span class="key">return</span> <span class="nam">reference_path</span><span class="op">.</span><span class="nam">open</span><span class="op">(</span><span class="nam">byte_io</span><span class="op">=</span><span class="nam">byte_io</span><span class="op">,</span> <span class="nam">buffering</span><span class="op">=</span><span class="nam">buffering</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1225" href="#t1225">1225</a></span><span class="t"> <span class="key">return</span> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">open</span><span class="op">(</span><span class="nam">byte_io</span><span class="op">=</span><span class="nam">byte_io</span><span class="op">,</span> <span class="nam">buffering</span><span class="op">=</span><span class="nam">buffering</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1226" href="#t1226">1226</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1227" href="#t1227">1227</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1228" href="#t1228">1228</a></span><span class="t"><span class="key">class</span> <span class="nam">VirtualDirectoryFSPath</span><span class="op">(</span><span class="nam">VirtualPathWithReference</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1229" href="#t1229">1229</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"_reference_path"</span><span class="op">,</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1230" href="#t1230">1230</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1231" href="#t1231">1231</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1232" href="#t1232">1232</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1233" href="#t1233">1233</a></span><span class="t"> <span class="nam">basename</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1234" href="#t1234">1234</a></span><span class="t"> <span class="nam">parent</span><span class="op">:</span> <span class="nam">FSPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1235" href="#t1235">1235</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1236" href="#t1236">1236</a></span><span class="t"> <span class="nam">reference_path</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1237" href="#t1237">1237</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1238" href="#t1238">1238</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1239" href="#t1239">1239</a></span><span class="t"> <span class="nam">basename</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1240" href="#t1240">1240</a></span><span class="t"> <span class="nam">parent</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1241" href="#t1241">1241</a></span><span class="t"> <span class="nam">reference_path</span><span class="op">=</span><span class="nam">reference_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1242" href="#t1242">1242</a></span><span class="t"> <span class="nam">default_mode</span><span class="op">=</span><span class="num">0o755</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1243" href="#t1243">1243</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1244" href="#t1244">1244</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_reference_path</span> <span class="op">=</span> <span class="nam">reference_path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1245" href="#t1245">1245</a></span><span class="t"> <span class="key">assert</span> <span class="nam">reference_path</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">reference_path</span><span class="op">.</span><span class="nam">is_dir</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1246" href="#t1246">1246</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1247" href="#t1247">1247</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1248" href="#t1248">1248</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_dir</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1249" href="#t1249">1249</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1250" href="#t1250">1250</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1251" href="#t1251">1251</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1252" href="#t1252">1252</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_file</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1253" href="#t1253">1253</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1254" href="#t1254">1254</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1255" href="#t1255">1255</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1256" href="#t1256">1256</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_symlink</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1257" href="#t1257">1257</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1258" href="#t1258">1258</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1259" href="#t1259">1259</a></span><span class="t"> <span class="key">def</span> <span class="nam">readlink</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1260" href="#t1260">1260</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TypeError</span><span class="op">(</span><span class="str">f'"{self._orphan_safe_path()!r}" is a directory; not a symlink'</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1261" href="#t1261">1261</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1262" href="#t1262">1262</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1263" href="#t1263">1263</a></span><span class="t"><span class="key">class</span> <span class="nam">SymlinkVirtualPath</span><span class="op">(</span><span class="nam">VirtualPathWithReference</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1264" href="#t1264">1264</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"_link_target"</span><span class="op">,</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1265" href="#t1265">1265</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1266" href="#t1266">1266</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1267" href="#t1267">1267</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1268" href="#t1268">1268</a></span><span class="t"> <span class="nam">basename</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1269" href="#t1269">1269</a></span><span class="t"> <span class="nam">parent_dir</span><span class="op">:</span> <span class="nam">FSPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1270" href="#t1270">1270</a></span><span class="t"> <span class="nam">link_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1271" href="#t1271">1271</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1272" href="#t1272">1272</a></span><span class="t"> <span class="nam">reference_path</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1273" href="#t1273">1273</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1274" href="#t1274">1274</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1275" href="#t1275">1275</a></span><span class="t"> <span class="nam">basename</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1276" href="#t1276">1276</a></span><span class="t"> <span class="nam">parent</span><span class="op">=</span><span class="nam">parent_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1277" href="#t1277">1277</a></span><span class="t"> <span class="nam">default_mode</span><span class="op">=</span><span class="nam">_SYMLINK_MODE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1278" href="#t1278">1278</a></span><span class="t"> <span class="nam">reference_path</span><span class="op">=</span><span class="nam">reference_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1279" href="#t1279">1279</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1280" href="#t1280">1280</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_link_target</span> <span class="op">=</span> <span class="nam">link_target</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1281" href="#t1281">1281</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1282" href="#t1282">1282</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1283" href="#t1283">1283</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_dir</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1284" href="#t1284">1284</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1285" href="#t1285">1285</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1286" href="#t1286">1286</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1287" href="#t1287">1287</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_file</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1288" href="#t1288">1288</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1289" href="#t1289">1289</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1290" href="#t1290">1290</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1291" href="#t1291">1291</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_symlink</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1292" href="#t1292">1292</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1293" href="#t1293">1293</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1294" href="#t1294">1294</a></span><span class="t"> <span class="key">def</span> <span class="nam">readlink</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1295" href="#t1295">1295</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_link_target</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1296" href="#t1296">1296</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1297" href="#t1297">1297</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1298" href="#t1298">1298</a></span><span class="t"><span class="key">class</span> <span class="nam">FSBackedFilePath</span><span class="op">(</span><span class="nam">VirtualPathWithReference</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1299" href="#t1299">1299</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"_fs_path"</span><span class="op">,</span> <span class="str">"_replaceable_inline"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1300" href="#t1300">1300</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1301" href="#t1301">1301</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1302" href="#t1302">1302</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1303" href="#t1303">1303</a></span><span class="t"> <span class="nam">basename</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1304" href="#t1304">1304</a></span><span class="t"> <span class="nam">parent_dir</span><span class="op">:</span> <span class="nam">FSPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1305" href="#t1305">1305</a></span><span class="t"> <span class="nam">fs_path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1306" href="#t1306">1306</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1307" href="#t1307">1307</a></span><span class="t"> <span class="nam">replaceable_inline</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1308" href="#t1308">1308</a></span><span class="t"> <span class="nam">initial_mode</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1309" href="#t1309">1309</a></span><span class="t"> <span class="nam">mtime</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">float</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1310" href="#t1310">1310</a></span><span class="t"> <span class="nam">stat_cache</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">os</span><span class="op">.</span><span class="nam">stat_result</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1311" href="#t1311">1311</a></span><span class="t"> <span class="nam">reference_path</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1312" href="#t1312">1312</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1313" href="#t1313">1313</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1314" href="#t1314">1314</a></span><span class="t"> <span class="nam">basename</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1315" href="#t1315">1315</a></span><span class="t"> <span class="nam">parent_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1316" href="#t1316">1316</a></span><span class="t"> <span class="nam">default_mode</span><span class="op">=</span><span class="num">0o644</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1317" href="#t1317">1317</a></span><span class="t"> <span class="nam">reference_path</span><span class="op">=</span><span class="nam">reference_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1318" href="#t1318">1318</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1319" href="#t1319">1319</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_fs_path</span> <span class="op">=</span> <span class="nam">fs_path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1320" href="#t1320">1320</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_replaceable_inline</span> <span class="op">=</span> <span class="nam">replaceable_inline</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1321" href="#t1321">1321</a></span><span class="t"> <span class="key">if</span> <span class="nam">initial_mode</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1322" href="#t1322">1322</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">mode</span> <span class="op">=</span> <span class="nam">initial_mode</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1323" href="#t1323">1323</a></span><span class="t"> <span class="key">if</span> <span class="nam">mtime</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1324" href="#t1324">1324</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_mtime</span> <span class="op">=</span> <span class="nam">mtime</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1325" href="#t1325">1325</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_stat_cache</span> <span class="op">=</span> <span class="nam">stat_cache</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1326" href="#t1326">1326</a></span><span class="t"> <span class="key">assert</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1327" href="#t1327">1327</a></span><span class="t"> <span class="key">not</span> <span class="nam">replaceable_inline</span> <span class="key">or</span> <span class="str">"debputy/scratch-dir/"</span> <span class="key">in</span> <span class="nam">fs_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1328" href="#t1328">1328</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> <span class="str">f"{fs_path} should not be inline-replaceable -- {self.path}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1329" href="#t1329">1329</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1330" href="#t1330">1330</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1331" href="#t1331">1331</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_dir</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1332" href="#t1332">1332</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1333" href="#t1333">1333</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1334" href="#t1334">1334</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1335" href="#t1335">1335</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_file</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1336" href="#t1336">1336</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1337" href="#t1337">1337</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1338" href="#t1338">1338</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1339" href="#t1339">1339</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_symlink</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1340" href="#t1340">1340</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1341" href="#t1341">1341</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1342" href="#t1342">1342</a></span><span class="t"> <span class="key">def</span> <span class="nam">readlink</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1343" href="#t1343">1343</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TypeError</span><span class="op">(</span><span class="str">f'"{self._orphan_safe_path()!r}" is a file; not a symlink'</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1344" href="#t1344">1344</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1345" href="#t1345">1345</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1346" href="#t1346">1346</a></span><span class="t"> <span class="key">def</span> <span class="nam">has_fs_path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1347" href="#t1347">1347</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1348" href="#t1348">1348</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1349" href="#t1349">1349</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1350" href="#t1350">1350</a></span><span class="t"> <span class="key">def</span> <span class="nam">fs_path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1351" href="#t1351">1351</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_fs_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1352" href="#t1352">1352</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1353" href="#t1353">1353</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1354" href="#t1354">1354</a></span><span class="t"> <span class="key">def</span> <span class="nam">_can_replace_inline</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1355" href="#t1355">1355</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_replaceable_inline</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1356" href="#t1356">1356</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1357" href="#t1357">1357</a></span><span class="t"> <span class="key">def</span> <span class="nam">_replaced_path</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">new_fs_path</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1358" href="#t1358">1358</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_fs_path</span> <span class="op">=</span> <span class="nam">new_fs_path</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1359" href="#t1359">1359</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_reference_path</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1360" href="#t1360">1360</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_replaceable_inline</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1361" href="#t1361">1361</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1362" href="#t1362">1362</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1363" href="#t1363">1363</a></span><span class="t"><span class="nam">_SYMLINK_MODE</span> <span class="op">=</span> <span class="num">0o777</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1364" href="#t1364">1364</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1365" href="#t1365">1365</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1366" href="#t1366">1366</a></span><span class="t"><span class="key">class</span> <span class="nam">VirtualTestPath</span><span class="op">(</span><span class="nam">FSPath</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1367" href="#t1367">1367</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1368" href="#t1368">1368</a></span><span class="t"> <span class="str">"_path_type"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1369" href="#t1369">1369</a></span><span class="t"> <span class="str">"_has_fs_path"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1370" href="#t1370">1370</a></span><span class="t"> <span class="str">"_fs_path"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1371" href="#t1371">1371</a></span><span class="t"> <span class="str">"_link_target"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1372" href="#t1372">1372</a></span><span class="t"> <span class="str">"_content"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1373" href="#t1373">1373</a></span><span class="t"> <span class="str">"_materialized_content"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1374" href="#t1374">1374</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1375" href="#t1375">1375</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1376" href="#t1376">1376</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1377" href="#t1377">1377</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1378" href="#t1378">1378</a></span><span class="t"> <span class="nam">basename</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1379" href="#t1379">1379</a></span><span class="t"> <span class="nam">parent_dir</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">FSPath</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1380" href="#t1380">1380</a></span><span class="t"> <span class="nam">mode</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1381" href="#t1381">1381</a></span><span class="t"> <span class="nam">mtime</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">float</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1382" href="#t1382">1382</a></span><span class="t"> <span class="nam">is_dir</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1383" href="#t1383">1383</a></span><span class="t"> <span class="nam">has_fs_path</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1384" href="#t1384">1384</a></span><span class="t"> <span class="nam">fs_path</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1385" href="#t1385">1385</a></span><span class="t"> <span class="nam">link_target</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1386" href="#t1386">1386</a></span><span class="t"> <span class="nam">content</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1387" href="#t1387">1387</a></span><span class="t"> <span class="nam">materialized_content</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1388" href="#t1388">1388</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1389" href="#t1389">1389</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1390" href="#t1390">1390</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_path_type</span> <span class="op">=</span> <span class="nam">PathType</span><span class="op">.</span><span class="nam">DIRECTORY</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1391" href="#t1391">1391</a></span><span class="t"> <span class="key">elif</span> <span class="nam">link_target</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1392" href="#t1392">1392</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_path_type</span> <span class="op">=</span> <span class="nam">PathType</span><span class="op">.</span><span class="nam">SYMLINK</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1393" href="#t1393">1393</a></span><span class="t"> <span class="key">if</span> <span class="nam">mode</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">mode</span> <span class="op">!=</span> <span class="nam">_SYMLINK_MODE</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1393 ↛ 1394</span><span class="annotate long">line 1393 didn't jump to line 1394, because the condition on line 1393 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1394" href="#t1394">1394</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1395" href="#t1395">1395</a></span><span class="t"> <span class="str">f'Please do not assign a mode to symlinks. Triggered for "{basename}".'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1396" href="#t1396">1396</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1397" href="#t1397">1397</a></span><span class="t"> <span class="key">assert</span> <span class="nam">mode</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">mode</span> <span class="op">==</span> <span class="nam">_SYMLINK_MODE</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1398" href="#t1398">1398</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1399" href="#t1399">1399</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_path_type</span> <span class="op">=</span> <span class="nam">PathType</span><span class="op">.</span><span class="nam">FILE</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1400" href="#t1400">1400</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1401" href="#t1401">1401</a></span><span class="t"> <span class="key">if</span> <span class="nam">mode</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1402" href="#t1402">1402</a></span><span class="t"> <span class="nam">initial_mode</span> <span class="op">=</span> <span class="nam">mode</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1403" href="#t1403">1403</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1404" href="#t1404">1404</a></span><span class="t"> <span class="nam">initial_mode</span> <span class="op">=</span> <span class="num">0o755</span> <span class="key">if</span> <span class="nam">is_dir</span> <span class="key">else</span> <span class="num">0o644</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1405" href="#t1405">1405</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1406" href="#t1406">1406</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_link_target</span> <span class="op">=</span> <span class="nam">link_target</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1407" href="#t1407">1407</a></span><span class="t"> <span class="key">if</span> <span class="nam">has_fs_path</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1408" href="#t1408">1408</a></span><span class="t"> <span class="nam">has_fs_path</span> <span class="op">=</span> <span class="nam">bool</span><span class="op">(</span><span class="nam">fs_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1409" href="#t1409">1409</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_has_fs_path</span> <span class="op">=</span> <span class="nam">has_fs_path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1410" href="#t1410">1410</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_fs_path</span> <span class="op">=</span> <span class="nam">fs_path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1411" href="#t1411">1411</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_materialized_content</span> <span class="op">=</span> <span class="nam">materialized_content</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1412" href="#t1412">1412</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1413" href="#t1413">1413</a></span><span class="t"> <span class="nam">basename</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1414" href="#t1414">1414</a></span><span class="t"> <span class="nam">parent</span><span class="op">=</span><span class="nam">parent_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1415" href="#t1415">1415</a></span><span class="t"> <span class="nam">initial_mode</span><span class="op">=</span><span class="nam">initial_mode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1416" href="#t1416">1416</a></span><span class="t"> <span class="nam">mtime</span><span class="op">=</span><span class="nam">mtime</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1417" href="#t1417">1417</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1418" href="#t1418">1418</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_content</span> <span class="op">=</span> <span class="nam">content</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1419" href="#t1419">1419</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1420" href="#t1420">1420</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1421" href="#t1421">1421</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_dir</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1422" href="#t1422">1422</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_path_type</span> <span class="op">==</span> <span class="nam">PathType</span><span class="op">.</span><span class="nam">DIRECTORY</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1423" href="#t1423">1423</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1424" href="#t1424">1424</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1425" href="#t1425">1425</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_file</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1426" href="#t1426">1426</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_path_type</span> <span class="op">==</span> <span class="nam">PathType</span><span class="op">.</span><span class="nam">FILE</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1427" href="#t1427">1427</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1428" href="#t1428">1428</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1429" href="#t1429">1429</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_symlink</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1430" href="#t1430">1430</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_path_type</span> <span class="op">==</span> <span class="nam">PathType</span><span class="op">.</span><span class="nam">SYMLINK</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1431" href="#t1431">1431</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1432" href="#t1432">1432</a></span><span class="t"> <span class="key">def</span> <span class="nam">readlink</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1433" href="#t1433">1433</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_symlink</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1433 ↛ 1434</span><span class="annotate long">line 1433 didn't jump to line 1434, because the condition on line 1433 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1434" href="#t1434">1434</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TypeError</span><span class="op">(</span><span class="str">f"readlink is only valid for symlinks ({self.path!r})"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1435" href="#t1435">1435</a></span><span class="t"> <span class="nam">link_target</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_link_target</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1436" href="#t1436">1436</a></span><span class="t"> <span class="key">assert</span> <span class="nam">link_target</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1437" href="#t1437">1437</a></span><span class="t"> <span class="key">return</span> <span class="nam">link_target</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1438" href="#t1438">1438</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1439" href="#t1439">1439</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1440" href="#t1440">1440</a></span><span class="t"> <span class="key">def</span> <span class="nam">mtime</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">float</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1441" href="#t1441">1441</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_mtime</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1442" href="#t1442">1442</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_mtime</span> <span class="op">=</span> <span class="nam">time</span><span class="op">.</span><span class="nam">time</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1443" href="#t1443">1443</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_mtime</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1444" href="#t1444">1444</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1445" href="#t1445">1445</a></span><span class="t"> <span class="op">@</span><span class="nam">mtime</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1446" href="#t1446">1446</a></span><span class="t"> <span class="key">def</span> <span class="nam">mtime</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">new_mtime</span><span class="op">:</span> <span class="nam">float</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1447" href="#t1447">1447</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_rw_check</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1448" href="#t1448">1448</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_mtime</span> <span class="op">=</span> <span class="nam">new_mtime</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1449" href="#t1449">1449</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1450" href="#t1450">1450</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1451" href="#t1451">1451</a></span><span class="t"> <span class="key">def</span> <span class="nam">has_fs_path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1452" href="#t1452">1452</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_has_fs_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1453" href="#t1453">1453</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1454" href="#t1454">1454</a></span><span class="t"> <span class="key">def</span> <span class="nam">stat</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">os</span><span class="op">.</span><span class="nam">stat_result</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1455" href="#t1455">1455</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">has_fs_path</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1455 ↛ 1470</span><span class="annotate long">line 1455 didn't jump to line 1470, because the condition on line 1455 was never false</span></span></p> - <p class="run"><span class="n"><a id="t1456" href="#t1456">1456</a></span><span class="t"> <span class="nam">path</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">fs_path</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1457" href="#t1457">1457</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1457 ↛ 1458</span><span class="annotate long">line 1457 didn't jump to line 1458, because the condition on line 1457 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1458" href="#t1458">1458</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PureVirtualPathError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1459" href="#t1459">1459</a></span><span class="t"> <span class="str">f"The test wants a real stat of {self._orphan_safe_path()!r}, which this mock path"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1460" href="#t1460">1460</a></span><span class="t"> <span class="str">" cannot provide!"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1461" href="#t1461">1461</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1462" href="#t1462">1462</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1463" href="#t1463">1463</a></span><span class="t"> <span class="key">return</span> <span class="nam">os</span><span class="op">.</span><span class="nam">stat</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1464" href="#t1464">1464</a></span><span class="t"> <span class="key">except</span> <span class="nam">FileNotFoundError</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1465" href="#t1465">1465</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PureVirtualPathError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1466" href="#t1466">1466</a></span><span class="t"> <span class="str">f"The test wants a real stat of {self._orphan_safe_path()!r}, which this mock path"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1467" href="#t1467">1467</a></span><span class="t"> <span class="str">" cannot provide! (An fs_path was provided, but it did not exist)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1468" href="#t1468">1468</a></span><span class="t"> <span class="op">)</span> <span class="key">from</span> <span class="nam">e</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1469" href="#t1469">1469</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1470" href="#t1470">1470</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PureVirtualPathError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1471" href="#t1471">1471</a></span><span class="t"> <span class="str">"stat() is only applicable to paths backed by the file system. The path"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1472" href="#t1472">1472</a></span><span class="t"> <span class="str">f" {self._orphan_safe_path()!r} is purely virtual"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1473" href="#t1473">1473</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1474" href="#t1474">1474</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1475" href="#t1475">1475</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1476" href="#t1476">1476</a></span><span class="t"> <span class="key">def</span> <span class="nam">size</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1477" href="#t1477">1477</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_content</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1477 ↛ 1478</span><span class="annotate long">line 1477 didn't jump to line 1478, because the condition on line 1477 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1478" href="#t1478">1478</a></span><span class="t"> <span class="key">return</span> <span class="nam">len</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_content</span><span class="op">.</span><span class="nam">encode</span><span class="op">(</span><span class="str">"utf-8"</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1479" href="#t1479">1479</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">has_fs_path</span> <span class="key">or</span> <span class="nam">self</span><span class="op">.</span><span class="nam">fs_path</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1480" href="#t1480">1480</a></span><span class="t"> <span class="key">return</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1481" href="#t1481">1481</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">stat</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">st_size</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1482" href="#t1482">1482</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1483" href="#t1483">1483</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1484" href="#t1484">1484</a></span><span class="t"> <span class="key">def</span> <span class="nam">fs_path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1485" href="#t1485">1485</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">has_fs_path</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1486" href="#t1486">1486</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_fs_path</span> <span class="key">is</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_materialized_content</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1487" href="#t1487">1487</a></span><span class="t"> <span class="key">with</span> <span class="nam">tempfile</span><span class="op">.</span><span class="nam">NamedTemporaryFile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1488" href="#t1488">1488</a></span><span class="t"> <span class="nam">mode</span><span class="op">=</span><span class="str">"w+t"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1489" href="#t1489">1489</a></span><span class="t"> <span class="nam">encoding</span><span class="op">=</span><span class="str">"utf-8"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1490" href="#t1490">1490</a></span><span class="t"> <span class="nam">suffix</span><span class="op">=</span><span class="str">f"__{self.name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1491" href="#t1491">1491</a></span><span class="t"> <span class="nam">delete</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1492" href="#t1492">1492</a></span><span class="t"> <span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1493" href="#t1493">1493</a></span><span class="t"> <span class="nam">filepath</span> <span class="op">=</span> <span class="nam">fd</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1494" href="#t1494">1494</a></span><span class="t"> <span class="nam">fd</span><span class="op">.</span><span class="nam">write</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_materialized_content</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1495" href="#t1495">1495</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_fs_path</span> <span class="op">=</span> <span class="nam">filepath</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1496" href="#t1496">1496</a></span><span class="t"> <span class="nam">atexit</span><span class="op">.</span><span class="nam">register</span><span class="op">(</span><span class="key">lambda</span><span class="op">:</span> <span class="nam">os</span><span class="op">.</span><span class="nam">unlink</span><span class="op">(</span><span class="nam">filepath</span><span class="op">)</span><span class="op">)</span> </span><span class="r"><span class="annotate short">1496 ↛ exit</span><span class="annotate long">line 1496 didn't run the lambda on line 1496</span></span></p> - <p class="pln"><span class="n"><a id="t1497" href="#t1497">1497</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1498" href="#t1498">1498</a></span><span class="t"> <span class="nam">path</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_fs_path</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1499" href="#t1499">1499</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1499 ↛ 1500</span><span class="annotate long">line 1499 didn't jump to line 1500, because the condition on line 1499 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1500" href="#t1500">1500</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PureVirtualPathError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1501" href="#t1501">1501</a></span><span class="t"> <span class="str">f"The test wants a real file system entry of {self._orphan_safe_path()!r}, which this "</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1502" href="#t1502">1502</a></span><span class="t"> <span class="str">" mock path cannot provide!"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1503" href="#t1503">1503</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1504" href="#t1504">1504</a></span><span class="t"> <span class="key">return</span> <span class="nam">path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1505" href="#t1505">1505</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PureVirtualPathError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1506" href="#t1506">1506</a></span><span class="t"> <span class="str">"fs_path is only applicable to paths backed by the file system. The path"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1507" href="#t1507">1507</a></span><span class="t"> <span class="str">f" {self._orphan_safe_path()!r} is purely virtual"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1508" href="#t1508">1508</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1509" href="#t1509">1509</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1510" href="#t1510">1510</a></span><span class="t"> <span class="key">def</span> <span class="nam">replace_fs_path_content</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1511" href="#t1511">1511</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1512" href="#t1512">1512</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1513" href="#t1513">1513</a></span><span class="t"> <span class="nam">use_fs_path_mode</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1514" href="#t1514">1514</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">ContextManager</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1515" href="#t1515">1515</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_content</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1515 ↛ 1516</span><span class="annotate long">line 1515 didn't jump to line 1516, because the condition on line 1515 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1516" href="#t1516">1516</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TypeError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1517" href="#t1517">1517</a></span><span class="t"> <span class="str">f"The `replace_fs_path_content()` method was called on {self.path}. Said path was"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1518" href="#t1518">1518</a></span><span class="t"> <span class="str">" created with `content` but for this method to work, the path should have been"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1519" href="#t1519">1519</a></span><span class="t"> <span class="str">" created with `materialized_content`"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1520" href="#t1520">1520</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1521" href="#t1521">1521</a></span><span class="t"> <span class="key">return</span> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">replace_fs_path_content</span><span class="op">(</span><span class="nam">use_fs_path_mode</span><span class="op">=</span><span class="nam">use_fs_path_mode</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1522" href="#t1522">1522</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1523" href="#t1523">1523</a></span><span class="t"> <span class="key">def</span> <span class="nam">open</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1524" href="#t1524">1524</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1525" href="#t1525">1525</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1526" href="#t1526">1526</a></span><span class="t"> <span class="nam">byte_io</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1527" href="#t1527">1527</a></span><span class="t"> <span class="nam">buffering</span><span class="op">:</span> <span class="nam">int</span> <span class="op">=</span> <span class="op">-</span><span class="num">1</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1528" href="#t1528">1528</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Union</span><span class="op">[</span><span class="nam">TextIO</span><span class="op">,</span> <span class="nam">BinaryIO</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1529" href="#t1529">1529</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_content</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1530" href="#t1530">1530</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1531" href="#t1531">1531</a></span><span class="t"> <span class="key">return</span> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">open</span><span class="op">(</span><span class="nam">byte_io</span><span class="op">=</span><span class="nam">byte_io</span><span class="op">,</span> <span class="nam">buffering</span><span class="op">=</span><span class="nam">buffering</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1532" href="#t1532">1532</a></span><span class="t"> <span class="key">except</span> <span class="nam">FileNotFoundError</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1533" href="#t1533">1533</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TestPathWithNonExistentFSPathError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1534" href="#t1534">1534</a></span><span class="t"> <span class="str">"The test path {self.path} had an fs_path {self._fs_path}, which does not"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1535" href="#t1535">1535</a></span><span class="t"> <span class="str">" exist. This exception can only occur in the testsuite. Either have the"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1536" href="#t1536">1536</a></span><span class="t"> <span class="str">" test provide content for the path (`virtual_path_def(..., content=...) or,"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1537" href="#t1537">1537</a></span><span class="t"> <span class="str">" if that is too painful in general, have the code accept this error as a "</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1538" href="#t1538">1538</a></span><span class="t"> <span class="str">" test only-case and provide a default."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1539" href="#t1539">1539</a></span><span class="t"> <span class="op">)</span> <span class="key">from</span> <span class="nam">e</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1540" href="#t1540">1540</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1541" href="#t1541">1541</a></span><span class="t"> <span class="key">if</span> <span class="nam">byte_io</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1542" href="#t1542">1542</a></span><span class="t"> <span class="key">return</span> <span class="nam">io</span><span class="op">.</span><span class="nam">BytesIO</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_content</span><span class="op">.</span><span class="nam">encode</span><span class="op">(</span><span class="str">"utf-8"</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1543" href="#t1543">1543</a></span><span class="t"> <span class="key">return</span> <span class="nam">io</span><span class="op">.</span><span class="nam">StringIO</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_content</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1544" href="#t1544">1544</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1545" href="#t1545">1545</a></span><span class="t"> <span class="key">def</span> <span class="nam">_replaced_path</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">new_fs_path</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1546" href="#t1546">1546</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_fs_path</span> <span class="op">=</span> <span class="nam">new_fs_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1547" href="#t1547">1547</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1548" href="#t1548">1548</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1549" href="#t1549">1549</a></span><span class="t"><span class="key">class</span> <span class="nam">FSROOverlay</span><span class="op">(</span><span class="nam">VirtualPathBase</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1550" href="#t1550">1550</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1551" href="#t1551">1551</a></span><span class="t"> <span class="str">"_path"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1552" href="#t1552">1552</a></span><span class="t"> <span class="str">"_fs_path"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1553" href="#t1553">1553</a></span><span class="t"> <span class="str">"_parent"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1554" href="#t1554">1554</a></span><span class="t"> <span class="str">"_stat_cache"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1555" href="#t1555">1555</a></span><span class="t"> <span class="str">"_readlink_cache"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1556" href="#t1556">1556</a></span><span class="t"> <span class="str">"_children"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1557" href="#t1557">1557</a></span><span class="t"> <span class="str">"_stat_failed_cache"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1558" href="#t1558">1558</a></span><span class="t"> <span class="str">"__weakref__"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1559" href="#t1559">1559</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1560" href="#t1560">1560</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1561" href="#t1561">1561</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1562" href="#t1562">1562</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1563" href="#t1563">1563</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1564" href="#t1564">1564</a></span><span class="t"> <span class="nam">fs_path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1565" href="#t1565">1565</a></span><span class="t"> <span class="nam">parent</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"FSROOverlay"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1566" href="#t1566">1566</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1567" href="#t1567">1567</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_path</span><span class="op">:</span> <span class="nam">str</span> <span class="op">=</span> <span class="nam">path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1568" href="#t1568">1568</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_fs_path</span><span class="op">:</span> <span class="nam">str</span> <span class="op">=</span> <span class="nam">_normalize_path</span><span class="op">(</span><span class="nam">fs_path</span><span class="op">,</span> <span class="nam">with_prefix</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1569" href="#t1569">1569</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ReferenceType</span><span class="op">[</span><span class="nam">FSROOverlay</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1570" href="#t1570">1570</a></span><span class="t"> <span class="nam">ref</span><span class="op">(</span><span class="nam">parent</span><span class="op">)</span> <span class="key">if</span> <span class="nam">parent</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">else</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1571" href="#t1571">1571</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1572" href="#t1572">1572</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_stat_cache</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">os</span><span class="op">.</span><span class="nam">stat_result</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1573" href="#t1573">1573</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_readlink_cache</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1574" href="#t1574">1574</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_stat_failed_cache</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1575" href="#t1575">1575</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_children</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">FSROOverlay</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1576" href="#t1576">1576</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1577" href="#t1577">1577</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1578" href="#t1578">1578</a></span><span class="t"> <span class="key">def</span> <span class="nam">create_root_dir</span><span class="op">(</span><span class="nam">cls</span><span class="op">,</span> <span class="nam">path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">fs_path</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="str">"FSROOverlay"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1579" href="#t1579">1579</a></span><span class="t"> <span class="key">return</span> <span class="nam">FSROOverlay</span><span class="op">(</span><span class="nam">path</span><span class="op">,</span> <span class="nam">fs_path</span><span class="op">,</span> <span class="key">None</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1580" href="#t1580">1580</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1581" href="#t1581">1581</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1582" href="#t1582">1582</a></span><span class="t"> <span class="key">def</span> <span class="nam">name</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1583" href="#t1583">1583</a></span><span class="t"> <span class="key">return</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">basename</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1584" href="#t1584">1584</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1585" href="#t1585">1585</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1586" href="#t1586">1586</a></span><span class="t"> <span class="key">def</span> <span class="nam">iterdir</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="str">"FSROOverlay"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1587" href="#t1587">1587</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1588" href="#t1588">1588</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1589" href="#t1589">1589</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_children</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1590" href="#t1590">1590</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_ensure_children_are_resolved</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1591" href="#t1591">1591</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_children</span><span class="op">)</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1592" href="#t1592">1592</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1593" href="#t1593">1593</a></span><span class="t"> <span class="key">def</span> <span class="nam">lookup</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">path</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"FSROOverlay"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1594" href="#t1594">1594</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1595" href="#t1595">1595</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1596" href="#t1596">1596</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_children</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1597" href="#t1597">1597</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_ensure_children_are_resolved</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1598" href="#t1598">1598</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1599" href="#t1599">1599</a></span><span class="t"> <span class="nam">absolute</span><span class="op">,</span> <span class="nam">_</span><span class="op">,</span> <span class="nam">path_parts</span> <span class="op">=</span> <span class="nam">_split_path</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1600" href="#t1600">1600</a></span><span class="t"> <span class="nam">current</span> <span class="op">=</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"FSROOverlay"</span><span class="op">,</span> <span class="nam">_root</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">)</span> <span class="key">if</span> <span class="nam">absolute</span> <span class="key">else</span> <span class="nam">self</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1601" href="#t1601">1601</a></span><span class="t"> <span class="key">for</span> <span class="nam">no</span><span class="op">,</span> <span class="nam">dir_part</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">path_parts</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1602" href="#t1602">1602</a></span><span class="t"> <span class="key">if</span> <span class="nam">dir_part</span> <span class="op">==</span> <span class="str">"."</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1603" href="#t1603">1603</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1604" href="#t1604">1604</a></span><span class="t"> <span class="key">if</span> <span class="nam">dir_part</span> <span class="op">==</span> <span class="str">".."</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1605" href="#t1605">1605</a></span><span class="t"> <span class="nam">p</span> <span class="op">=</span> <span class="nam">current</span><span class="op">.</span><span class="nam">parent_dir</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1606" href="#t1606">1606</a></span><span class="t"> <span class="key">if</span> <span class="nam">current</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1607" href="#t1607">1607</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">f'The path "{path}" escapes the root dir'</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1608" href="#t1608">1608</a></span><span class="t"> <span class="nam">current</span> <span class="op">=</span> <span class="nam">p</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1609" href="#t1609">1609</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1610" href="#t1610">1610</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1611" href="#t1611">1611</a></span><span class="t"> <span class="nam">current</span> <span class="op">=</span> <span class="nam">current</span><span class="op">[</span><span class="nam">dir_part</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1612" href="#t1612">1612</a></span><span class="t"> <span class="key">except</span> <span class="nam">KeyError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1613" href="#t1613">1613</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1614" href="#t1614">1614</a></span><span class="t"> <span class="key">return</span> <span class="nam">current</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1615" href="#t1615">1615</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1616" href="#t1616">1616</a></span><span class="t"> <span class="key">def</span> <span class="nam">all_paths</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="str">"FSROOverlay"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1617" href="#t1617">1617</a></span><span class="t"> <span class="key">yield</span> <span class="nam">self</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1618" href="#t1618">1618</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1619" href="#t1619">1619</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1620" href="#t1620">1620</a></span><span class="t"> <span class="nam">stack</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">iterdir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1621" href="#t1621">1621</a></span><span class="t"> <span class="nam">stack</span><span class="op">.</span><span class="nam">reverse</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1622" href="#t1622">1622</a></span><span class="t"> <span class="key">while</span> <span class="nam">stack</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1623" href="#t1623">1623</a></span><span class="t"> <span class="nam">current</span> <span class="op">=</span> <span class="nam">stack</span><span class="op">.</span><span class="nam">pop</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1624" href="#t1624">1624</a></span><span class="t"> <span class="key">yield</span> <span class="nam">current</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1625" href="#t1625">1625</a></span><span class="t"> <span class="key">if</span> <span class="nam">current</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1626" href="#t1626">1626</a></span><span class="t"> <span class="key">if</span> <span class="nam">current</span><span class="op">.</span><span class="nam">_children</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1627" href="#t1627">1627</a></span><span class="t"> <span class="nam">current</span><span class="op">.</span><span class="nam">_ensure_children_are_resolved</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1628" href="#t1628">1628</a></span><span class="t"> <span class="nam">stack</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">reversed</span><span class="op">(</span><span class="nam">current</span><span class="op">.</span><span class="nam">_children</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1629" href="#t1629">1629</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1630" href="#t1630">1630</a></span><span class="t"> <span class="key">def</span> <span class="nam">_ensure_children_are_resolved</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1631" href="#t1631">1631</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_dir</span> <span class="key">or</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_children</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1632" href="#t1632">1632</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1633" href="#t1633">1633</a></span><span class="t"> <span class="nam">dir_path</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1634" href="#t1634">1634</a></span><span class="t"> <span class="nam">dir_fs_path</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">fs_path</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1635" href="#t1635">1635</a></span><span class="t"> <span class="nam">children</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1636" href="#t1636">1636</a></span><span class="t"> <span class="key">for</span> <span class="nam">name</span> <span class="key">in</span> <span class="nam">sorted</span><span class="op">(</span><span class="nam">os</span><span class="op">.</span><span class="nam">listdir</span><span class="op">(</span><span class="nam">dir_fs_path</span><span class="op">)</span><span class="op">,</span> <span class="nam">key</span><span class="op">=</span><span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">basename</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1637" href="#t1637">1637</a></span><span class="t"> <span class="nam">child_path</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">dir_path</span><span class="op">,</span> <span class="nam">name</span><span class="op">)</span> <span class="key">if</span> <span class="nam">dir_path</span> <span class="op">!=</span> <span class="str">"."</span> <span class="key">else</span> <span class="nam">name</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1638" href="#t1638">1638</a></span><span class="t"> <span class="nam">child_fs_path</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1639" href="#t1639">1639</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">dir_fs_path</span><span class="op">,</span> <span class="nam">name</span><span class="op">)</span> <span class="key">if</span> <span class="nam">dir_fs_path</span> <span class="op">!=</span> <span class="str">"."</span> <span class="key">else</span> <span class="nam">name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1640" href="#t1640">1640</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1641" href="#t1641">1641</a></span><span class="t"> <span class="nam">children</span><span class="op">[</span><span class="nam">name</span><span class="op">]</span> <span class="op">=</span> <span class="nam">FSROOverlay</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1642" href="#t1642">1642</a></span><span class="t"> <span class="nam">child_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1643" href="#t1643">1643</a></span><span class="t"> <span class="nam">child_fs_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1644" href="#t1644">1644</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1645" href="#t1645">1645</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1646" href="#t1646">1646</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_children</span> <span class="op">=</span> <span class="nam">children</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1647" href="#t1647">1647</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1648" href="#t1648">1648</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1649" href="#t1649">1649</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_detached</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1650" href="#t1650">1650</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1651" href="#t1651">1651</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1652" href="#t1652">1652</a></span><span class="t"> <span class="key">def</span> <span class="nam">__getitem__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">key</span><span class="op">)</span> <span class="op">-></span> <span class="str">"VirtualPath"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1653" href="#t1653">1653</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1654" href="#t1654">1654</a></span><span class="t"> <span class="key">raise</span> <span class="nam">KeyError</span><span class="op">(</span><span class="nam">key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1655" href="#t1655">1655</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_children</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1656" href="#t1656">1656</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_ensure_children_are_resolved</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1657" href="#t1657">1657</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">key</span><span class="op">,</span> <span class="nam">FSPath</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1658" href="#t1658">1658</a></span><span class="t"> <span class="nam">key</span> <span class="op">=</span> <span class="nam">key</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1659" href="#t1659">1659</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_children</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1660" href="#t1660">1660</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1661" href="#t1661">1661</a></span><span class="t"> <span class="key">def</span> <span class="nam">__delitem__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">key</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1662" href="#t1662">1662</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_error_ro_fs</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1663" href="#t1663">1663</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1664" href="#t1664">1664</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1665" href="#t1665">1665</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_read_write</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1666" href="#t1666">1666</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1667" href="#t1667">1667</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1668" href="#t1668">1668</a></span><span class="t"> <span class="key">def</span> <span class="nam">_rw_check</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1669" href="#t1669">1669</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_error_ro_fs</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1670" href="#t1670">1670</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1671" href="#t1671">1671</a></span><span class="t"> <span class="key">def</span> <span class="nam">_error_ro_fs</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">NoReturn</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1672" href="#t1672">1672</a></span><span class="t"> <span class="key">raise</span> <span class="nam">DebputyFSIsROError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1673" href="#t1673">1673</a></span><span class="t"> <span class="str">f'Attempt to write to "{self.path}" failed:'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1674" href="#t1674">1674</a></span><span class="t"> <span class="str">" Debputy Virtual File system is R/O."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1675" href="#t1675">1675</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1676" href="#t1676">1676</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1677" href="#t1677">1677</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1678" href="#t1678">1678</a></span><span class="t"> <span class="key">def</span> <span class="nam">path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1679" href="#t1679">1679</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1680" href="#t1680">1680</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1681" href="#t1681">1681</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1682" href="#t1682">1682</a></span><span class="t"> <span class="key">def</span> <span class="nam">parent_dir</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"FSROOverlay"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1683" href="#t1683">1683</a></span><span class="t"> <span class="nam">parent</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1684" href="#t1684">1684</a></span><span class="t"> <span class="key">if</span> <span class="nam">parent</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1685" href="#t1685">1685</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1686" href="#t1686">1686</a></span><span class="t"> <span class="nam">resolved</span> <span class="op">=</span> <span class="nam">parent</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1687" href="#t1687">1687</a></span><span class="t"> <span class="key">if</span> <span class="nam">resolved</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1688" href="#t1688">1688</a></span><span class="t"> <span class="key">raise</span> <span class="nam">RuntimeError</span><span class="op">(</span><span class="str">"Parent was garbage collected!"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1689" href="#t1689">1689</a></span><span class="t"> <span class="key">return</span> <span class="nam">resolved</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1690" href="#t1690">1690</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1691" href="#t1691">1691</a></span><span class="t"> <span class="key">def</span> <span class="nam">stat</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">os</span><span class="op">.</span><span class="nam">stat_result</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1692" href="#t1692">1692</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_stat_failed_cache</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1693" href="#t1693">1693</a></span><span class="t"> <span class="key">raise</span> <span class="nam">FileNotFoundError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1694" href="#t1694">1694</a></span><span class="t"> <span class="nam">errno</span><span class="op">.</span><span class="nam">ENOENT</span><span class="op">,</span> <span class="nam">os</span><span class="op">.</span><span class="nam">strerror</span><span class="op">(</span><span class="nam">errno</span><span class="op">.</span><span class="nam">ENOENT</span><span class="op">)</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">fs_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1695" href="#t1695">1695</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1696" href="#t1696">1696</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1697" href="#t1697">1697</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_stat_cache</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1698" href="#t1698">1698</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1699" href="#t1699">1699</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_stat_cache</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">lstat</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1700" href="#t1700">1700</a></span><span class="t"> <span class="key">except</span> <span class="nam">FileNotFoundError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1701" href="#t1701">1701</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_stat_failed_cache</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1702" href="#t1702">1702</a></span><span class="t"> <span class="key">raise</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1703" href="#t1703">1703</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_stat_cache</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1704" href="#t1704">1704</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1705" href="#t1705">1705</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1706" href="#t1706">1706</a></span><span class="t"> <span class="key">def</span> <span class="nam">mode</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1707" href="#t1707">1707</a></span><span class="t"> <span class="key">return</span> <span class="nam">stat</span><span class="op">.</span><span class="nam">S_IMODE</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">stat</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">st_mode</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1708" href="#t1708">1708</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1709" href="#t1709">1709</a></span><span class="t"> <span class="op">@</span><span class="nam">mode</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1710" href="#t1710">1710</a></span><span class="t"> <span class="key">def</span> <span class="nam">mode</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">_unused</span><span class="op">:</span> <span class="nam">int</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1711" href="#t1711">1711</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_error_ro_fs</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1712" href="#t1712">1712</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1713" href="#t1713">1713</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1714" href="#t1714">1714</a></span><span class="t"> <span class="key">def</span> <span class="nam">mtime</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">float</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1715" href="#t1715">1715</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">stat</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">st_mtime</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1716" href="#t1716">1716</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1717" href="#t1717">1717</a></span><span class="t"> <span class="op">@</span><span class="nam">mtime</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1718" href="#t1718">1718</a></span><span class="t"> <span class="key">def</span> <span class="nam">mtime</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">new_mtime</span><span class="op">:</span> <span class="nam">float</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1719" href="#t1719">1719</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_error_ro_fs</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1720" href="#t1720">1720</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1721" href="#t1721">1721</a></span><span class="t"> <span class="key">def</span> <span class="nam">readlink</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1722" href="#t1722">1722</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_symlink</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1723" href="#t1723">1723</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TypeError</span><span class="op">(</span><span class="str">f"readlink is only valid for symlinks ({self.path!r})"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1724" href="#t1724">1724</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_readlink_cache</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1725" href="#t1725">1725</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_readlink_cache</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">readlink</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1726" href="#t1726">1726</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_readlink_cache</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1727" href="#t1727">1727</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1728" href="#t1728">1728</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1729" href="#t1729">1729</a></span><span class="t"> <span class="key">def</span> <span class="nam">fs_path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1730" href="#t1730">1730</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_fs_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1731" href="#t1731">1731</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1732" href="#t1732">1732</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1733" href="#t1733">1733</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_dir</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1734" href="#t1734">1734</a></span><span class="t"> <span class="com"># The root path can have a non-existent fs_path (such as d/tmp not always existing)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1735" href="#t1735">1735</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1736" href="#t1736">1736</a></span><span class="t"> <span class="key">return</span> <span class="nam">stat</span><span class="op">.</span><span class="nam">S_ISDIR</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">stat</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">st_mode</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1737" href="#t1737">1737</a></span><span class="t"> <span class="key">except</span> <span class="nam">FileNotFoundError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1738" href="#t1738">1738</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1739" href="#t1739">1739</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1740" href="#t1740">1740</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1741" href="#t1741">1741</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_file</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1742" href="#t1742">1742</a></span><span class="t"> <span class="com"># The root path can have a non-existent fs_path (such as d/tmp not always existing)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1743" href="#t1743">1743</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1744" href="#t1744">1744</a></span><span class="t"> <span class="key">return</span> <span class="nam">stat</span><span class="op">.</span><span class="nam">S_ISREG</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">stat</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">st_mode</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1745" href="#t1745">1745</a></span><span class="t"> <span class="key">except</span> <span class="nam">FileNotFoundError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1746" href="#t1746">1746</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1747" href="#t1747">1747</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1748" href="#t1748">1748</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1749" href="#t1749">1749</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_symlink</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1750" href="#t1750">1750</a></span><span class="t"> <span class="com"># The root path can have a non-existent fs_path (such as d/tmp not always existing)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1751" href="#t1751">1751</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1752" href="#t1752">1752</a></span><span class="t"> <span class="key">return</span> <span class="nam">stat</span><span class="op">.</span><span class="nam">S_ISLNK</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">stat</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">st_mode</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1753" href="#t1753">1753</a></span><span class="t"> <span class="key">except</span> <span class="nam">FileNotFoundError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1754" href="#t1754">1754</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1755" href="#t1755">1755</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1756" href="#t1756">1756</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1757" href="#t1757">1757</a></span><span class="t"> <span class="key">def</span> <span class="nam">has_fs_path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1758" href="#t1758">1758</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1759" href="#t1759">1759</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1760" href="#t1760">1760</a></span><span class="t"> <span class="key">def</span> <span class="nam">open</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1761" href="#t1761">1761</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1762" href="#t1762">1762</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1763" href="#t1763">1763</a></span><span class="t"> <span class="nam">byte_io</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1764" href="#t1764">1764</a></span><span class="t"> <span class="nam">buffering</span><span class="op">:</span> <span class="nam">int</span> <span class="op">=</span> <span class="op">-</span><span class="num">1</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1765" href="#t1765">1765</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Union</span><span class="op">[</span><span class="nam">TextIO</span><span class="op">,</span> <span class="nam">BinaryIO</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1766" href="#t1766">1766</a></span><span class="t"> <span class="com"># Allow symlinks for open here, because we can let the OS resolve the symlink reliably in this</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1767" href="#t1767">1767</a></span><span class="t"> <span class="com"># case.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1768" href="#t1768">1768</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_file</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_symlink</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1769" href="#t1769">1769</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TypeError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1770" href="#t1770">1770</a></span><span class="t"> <span class="str">f"Cannot open {self.path} for reading: It is not a file nor a symlink"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1771" href="#t1771">1771</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1772" href="#t1772">1772</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1773" href="#t1773">1773</a></span><span class="t"> <span class="key">if</span> <span class="nam">byte_io</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1774" href="#t1774">1774</a></span><span class="t"> <span class="key">return</span> <span class="nam">open</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">,</span> <span class="str">"rb"</span><span class="op">,</span> <span class="nam">buffering</span><span class="op">=</span><span class="nam">buffering</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1775" href="#t1775">1775</a></span><span class="t"> <span class="key">return</span> <span class="nam">open</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">,</span> <span class="str">"rt"</span><span class="op">,</span> <span class="nam">encoding</span><span class="op">=</span><span class="str">"utf-8"</span><span class="op">,</span> <span class="nam">buffering</span><span class="op">=</span><span class="nam">buffering</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1776" href="#t1776">1776</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1777" href="#t1777">1777</a></span><span class="t"> <span class="key">def</span> <span class="nam">chown</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1778" href="#t1778">1778</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1779" href="#t1779">1779</a></span><span class="t"> <span class="nam">owner</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">StaticFileSystemOwner</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1780" href="#t1780">1780</a></span><span class="t"> <span class="nam">group</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">StaticFileSystemGroup</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1781" href="#t1781">1781</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1782" href="#t1782">1782</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_error_ro_fs</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1783" href="#t1783">1783</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1784" href="#t1784">1784</a></span><span class="t"> <span class="key">def</span> <span class="nam">mkdir</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">name</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="str">"VirtualPath"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1785" href="#t1785">1785</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_error_ro_fs</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1786" href="#t1786">1786</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1787" href="#t1787">1787</a></span><span class="t"> <span class="key">def</span> <span class="nam">add_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1788" href="#t1788">1788</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1789" href="#t1789">1789</a></span><span class="t"> <span class="nam">name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1790" href="#t1790">1790</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1791" href="#t1791">1791</a></span><span class="t"> <span class="nam">unlink_if_exists</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1792" href="#t1792">1792</a></span><span class="t"> <span class="nam">use_fs_path_mode</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1793" href="#t1793">1793</a></span><span class="t"> <span class="nam">mode</span><span class="op">:</span> <span class="nam">int</span> <span class="op">=</span> <span class="num">0o0644</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1794" href="#t1794">1794</a></span><span class="t"> <span class="nam">mtime</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">float</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1795" href="#t1795">1795</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">ContextManager</span><span class="op">[</span><span class="str">"VirtualPath"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1796" href="#t1796">1796</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_error_ro_fs</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1797" href="#t1797">1797</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1798" href="#t1798">1798</a></span><span class="t"> <span class="key">def</span> <span class="nam">add_symlink</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">link_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">link_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="str">"VirtualPath"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1799" href="#t1799">1799</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_error_ro_fs</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1800" href="#t1800">1800</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1801" href="#t1801">1801</a></span><span class="t"> <span class="key">def</span> <span class="nam">unlink</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">recursive</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1802" href="#t1802">1802</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_error_ro_fs</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1803" href="#t1803">1803</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1804" href="#t1804">1804</a></span><span class="t"> <span class="key">def</span> <span class="nam">metadata</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1805" href="#t1805">1805</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1806" href="#t1806">1806</a></span><span class="t"> <span class="nam">metadata_type</span><span class="op">:</span> <span class="nam">Type</span><span class="op">[</span><span class="nam">PMT</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1807" href="#t1807">1807</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1808" href="#t1808">1808</a></span><span class="t"> <span class="nam">owning_plugin</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1809" href="#t1809">1809</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">PathMetadataReference</span><span class="op">[</span><span class="nam">PMT</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1810" href="#t1810">1810</a></span><span class="t"> <span class="nam">current_plugin</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_current_plugin</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1811" href="#t1811">1811</a></span><span class="t"> <span class="key">if</span> <span class="nam">owning_plugin</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1812" href="#t1812">1812</a></span><span class="t"> <span class="nam">owning_plugin</span> <span class="op">=</span> <span class="nam">current_plugin</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1813" href="#t1813">1813</a></span><span class="t"> <span class="key">return</span> <span class="nam">AlwaysEmptyReadOnlyMetadataReference</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1814" href="#t1814">1814</a></span><span class="t"> <span class="nam">owning_plugin</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1815" href="#t1815">1815</a></span><span class="t"> <span class="nam">current_plugin</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1816" href="#t1816">1816</a></span><span class="t"> <span class="nam">metadata_type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1817" href="#t1817">1817</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1818" href="#t1818">1818</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1819" href="#t1819">1819</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1820" href="#t1820">1820</a></span><span class="t"><span class="key">class</span> <span class="nam">FSROOverlayRootDir</span><span class="op">(</span><span class="nam">FSROOverlay</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1821" href="#t1821">1821</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"_plugin_context"</span><span class="op">,</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1822" href="#t1822">1822</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1823" href="#t1823">1823</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">fs_path</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1824" href="#t1824">1824</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="nam">path</span><span class="op">,</span> <span class="nam">fs_path</span><span class="op">,</span> <span class="key">None</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1825" href="#t1825">1825</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_context</span> <span class="op">=</span> <span class="nam">CurrentPluginContextManager</span><span class="op">(</span><span class="str">"debputy"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1826" href="#t1826">1826</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1827" href="#t1827">1827</a></span><span class="t"> <span class="key">def</span> <span class="nam">_current_plugin</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1828" href="#t1828">1828</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_context</span><span class="op">.</span><span class="nam">current_plugin_name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1829" href="#t1829">1829</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1830" href="#t1830">1830</a></span><span class="t"> <span class="op">@</span><span class="nam">contextlib</span><span class="op">.</span><span class="nam">contextmanager</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1831" href="#t1831">1831</a></span><span class="t"> <span class="key">def</span> <span class="nam">change_plugin_context</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">new_plugin</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1832" href="#t1832">1832</a></span><span class="t"> <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_context</span><span class="op">.</span><span class="nam">change_plugin_context</span><span class="op">(</span><span class="nam">new_plugin</span><span class="op">)</span> <span class="key">as</span> <span class="nam">r</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1833" href="#t1833">1833</a></span><span class="t"> <span class="key">yield</span> <span class="nam">r</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1834" href="#t1834">1834</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1835" href="#t1835">1835</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1836" href="#t1836">1836</a></span><span class="t"><span class="key">def</span> <span class="nam">as_path_def</span><span class="op">(</span><span class="nam">pd</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">PathDef</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="nam">PathDef</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1837" href="#t1837">1837</a></span><span class="t"> <span class="key">return</span> <span class="nam">PathDef</span><span class="op">(</span><span class="nam">pd</span><span class="op">)</span> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">pd</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span> <span class="key">else</span> <span class="nam">pd</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1838" href="#t1838">1838</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1839" href="#t1839">1839</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1840" href="#t1840">1840</a></span><span class="t"><span class="key">def</span> <span class="nam">as_path_defs</span><span class="op">(</span><span class="nam">paths</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">PathDef</span><span class="op">]</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">PathDef</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1841" href="#t1841">1841</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="op">(</span><span class="nam">as_path_def</span><span class="op">(</span><span class="nam">p</span><span class="op">)</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">paths</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1842" href="#t1842">1842</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1843" href="#t1843">1843</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1844" href="#t1844">1844</a></span><span class="t"><span class="key">def</span> <span class="nam">build_virtual_fs</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1845" href="#t1845">1845</a></span><span class="t"> <span class="nam">paths</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">PathDef</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1846" href="#t1846">1846</a></span><span class="t"> <span class="nam">read_write_fs</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1847" href="#t1847">1847</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="str">"FSPath"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1848" href="#t1848">1848</a></span><span class="t"> <span class="nam">root_dir</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">FSRootDir</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1849" href="#t1849">1849</a></span><span class="t"> <span class="nam">directories</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">FSPath</span><span class="op">]</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1850" href="#t1850">1850</a></span><span class="t"> <span class="nam">non_directories</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1851" href="#t1851">1851</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1852" href="#t1852">1852</a></span><span class="t"> <span class="key">def</span> <span class="nam">_ensure_parent_dirs</span><span class="op">(</span><span class="nam">p</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1853" href="#t1853">1853</a></span><span class="t"> <span class="nam">current</span> <span class="op">=</span> <span class="nam">p</span><span class="op">.</span><span class="nam">rstrip</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1854" href="#t1854">1854</a></span><span class="t"> <span class="nam">missing_dirs</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1855" href="#t1855">1855</a></span><span class="t"> <span class="key">while</span> <span class="key">True</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1856" href="#t1856">1856</a></span><span class="t"> <span class="nam">current</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">dirname</span><span class="op">(</span><span class="nam">current</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1857" href="#t1857">1857</a></span><span class="t"> <span class="key">if</span> <span class="nam">current</span> <span class="key">in</span> <span class="nam">directories</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1858" href="#t1858">1858</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1859" href="#t1859">1859</a></span><span class="t"> <span class="key">if</span> <span class="nam">current</span> <span class="key">in</span> <span class="nam">non_directories</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1859 ↛ 1860</span><span class="annotate long">line 1859 didn't jump to line 1860, because the condition on line 1859 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1860" href="#t1860">1860</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1861" href="#t1861">1861</a></span><span class="t"> <span class="str">f'Conflicting definition for "{current}". The path "{p}" wants it as a directory,'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1862" href="#t1862">1862</a></span><span class="t"> <span class="str">' but it is defined as a non-directory. (Ensure dirs end with "/")'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1863" href="#t1863">1863</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1864" href="#t1864">1864</a></span><span class="t"> <span class="nam">missing_dirs</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">current</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1865" href="#t1865">1865</a></span><span class="t"> <span class="key">for</span> <span class="nam">dir_path</span> <span class="key">in</span> <span class="nam">reversed</span><span class="op">(</span><span class="nam">missing_dirs</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1866" href="#t1866">1866</a></span><span class="t"> <span class="nam">parent_dir</span> <span class="op">=</span> <span class="nam">directories</span><span class="op">[</span><span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">dirname</span><span class="op">(</span><span class="nam">dir_path</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1867" href="#t1867">1867</a></span><span class="t"> <span class="nam">d</span> <span class="op">=</span> <span class="nam">VirtualTestPath</span><span class="op">(</span><span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">basename</span><span class="op">(</span><span class="nam">dir_path</span><span class="op">)</span><span class="op">,</span> <span class="nam">parent_dir</span><span class="op">,</span> <span class="nam">is_dir</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1868" href="#t1868">1868</a></span><span class="t"> <span class="nam">directories</span><span class="op">[</span><span class="nam">dir_path</span><span class="op">]</span> <span class="op">=</span> <span class="nam">d</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1869" href="#t1869">1869</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1870" href="#t1870">1870</a></span><span class="t"> <span class="key">for</span> <span class="nam">path_def</span> <span class="key">in</span> <span class="nam">as_path_defs</span><span class="op">(</span><span class="nam">paths</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1871" href="#t1871">1871</a></span><span class="t"> <span class="nam">path</span> <span class="op">=</span> <span class="nam">path_def</span><span class="op">.</span><span class="nam">path_name</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1872" href="#t1872">1872</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span> <span class="key">in</span> <span class="nam">directories</span> <span class="key">or</span> <span class="nam">path</span> <span class="key">in</span> <span class="nam">non_directories</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1872 ↛ 1873</span><span class="annotate long">line 1872 didn't jump to line 1873, because the condition on line 1872 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1873" href="#t1873">1873</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1874" href="#t1874">1874</a></span><span class="t"> <span class="str">f'Duplicate definition of "{path}". Can be false positive if input is not in'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1875" href="#t1875">1875</a></span><span class="t"> <span class="str">' "correct order" (ensure directories occur before their children)'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1876" href="#t1876">1876</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1877" href="#t1877">1877</a></span><span class="t"> <span class="key">if</span> <span class="nam">root_dir</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1878" href="#t1878">1878</a></span><span class="t"> <span class="nam">root_fs_path</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1879" href="#t1879">1879</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span> <span class="key">in</span> <span class="op">(</span><span class="str">"."</span><span class="op">,</span> <span class="str">"./"</span><span class="op">,</span> <span class="str">"/"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1880" href="#t1880">1880</a></span><span class="t"> <span class="nam">root_fs_path</span> <span class="op">=</span> <span class="nam">path_def</span><span class="op">.</span><span class="nam">fs_path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1881" href="#t1881">1881</a></span><span class="t"> <span class="nam">root_dir</span> <span class="op">=</span> <span class="nam">FSRootDir</span><span class="op">(</span><span class="nam">fs_path</span><span class="op">=</span><span class="nam">root_fs_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1882" href="#t1882">1882</a></span><span class="t"> <span class="nam">directories</span><span class="op">[</span><span class="str">"."</span><span class="op">]</span> <span class="op">=</span> <span class="nam">root_dir</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1883" href="#t1883">1883</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1884" href="#t1884">1884</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span> <span class="key">not</span> <span class="key">in</span> <span class="op">(</span><span class="str">"."</span><span class="op">,</span> <span class="str">"./"</span><span class="op">,</span> <span class="str">"/"</span><span class="op">)</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">path</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"./"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1885" href="#t1885">1885</a></span><span class="t"> <span class="nam">path</span> <span class="op">=</span> <span class="str">"./"</span> <span class="op">+</span> <span class="nam">path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1886" href="#t1886">1886</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span> <span class="key">not</span> <span class="key">in</span> <span class="op">(</span><span class="str">"."</span><span class="op">,</span> <span class="str">"./"</span><span class="op">,</span> <span class="str">"/"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1887" href="#t1887">1887</a></span><span class="t"> <span class="nam">_ensure_parent_dirs</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1888" href="#t1888">1888</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span> <span class="key">in</span> <span class="op">(</span><span class="str">"."</span><span class="op">,</span> <span class="str">"./"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1889" href="#t1889">1889</a></span><span class="t"> <span class="key">assert</span> <span class="str">"."</span> <span class="key">in</span> <span class="nam">directories</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1890" href="#t1890">1890</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1891" href="#t1891">1891</a></span><span class="t"> <span class="nam">is_dir</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1892" href="#t1892">1892</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1893" href="#t1893">1893</a></span><span class="t"> <span class="nam">path</span> <span class="op">=</span> <span class="nam">path</span><span class="op">[</span><span class="op">:</span><span class="op">-</span><span class="num">1</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1894" href="#t1894">1894</a></span><span class="t"> <span class="nam">is_dir</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1895" href="#t1895">1895</a></span><span class="t"> <span class="nam">directory</span> <span class="op">=</span> <span class="nam">directories</span><span class="op">[</span><span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">dirname</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1896" href="#t1896">1896</a></span><span class="t"> <span class="key">assert</span> <span class="key">not</span> <span class="nam">is_dir</span> <span class="key">or</span> <span class="key">not</span> <span class="nam">bool</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1897" href="#t1897">1897</a></span><span class="t"> <span class="nam">path_def</span><span class="op">.</span><span class="nam">link_target</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1898" href="#t1898">1898</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> <span class="str">f"is_dir={is_dir} vs. link_target={path_def.link_target}"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1899" href="#t1899">1899</a></span><span class="t"> <span class="nam">fs_path</span> <span class="op">=</span> <span class="nam">VirtualTestPath</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1900" href="#t1900">1900</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">basename</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1901" href="#t1901">1901</a></span><span class="t"> <span class="nam">directory</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1902" href="#t1902">1902</a></span><span class="t"> <span class="nam">is_dir</span><span class="op">=</span><span class="nam">is_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1903" href="#t1903">1903</a></span><span class="t"> <span class="nam">mode</span><span class="op">=</span><span class="nam">path_def</span><span class="op">.</span><span class="nam">mode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1904" href="#t1904">1904</a></span><span class="t"> <span class="nam">mtime</span><span class="op">=</span><span class="nam">path_def</span><span class="op">.</span><span class="nam">mtime</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1905" href="#t1905">1905</a></span><span class="t"> <span class="nam">has_fs_path</span><span class="op">=</span><span class="nam">path_def</span><span class="op">.</span><span class="nam">has_fs_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1906" href="#t1906">1906</a></span><span class="t"> <span class="nam">fs_path</span><span class="op">=</span><span class="nam">path_def</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1907" href="#t1907">1907</a></span><span class="t"> <span class="nam">link_target</span><span class="op">=</span><span class="nam">path_def</span><span class="op">.</span><span class="nam">link_target</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1908" href="#t1908">1908</a></span><span class="t"> <span class="nam">content</span><span class="op">=</span><span class="nam">path_def</span><span class="op">.</span><span class="nam">content</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1909" href="#t1909">1909</a></span><span class="t"> <span class="nam">materialized_content</span><span class="op">=</span><span class="nam">path_def</span><span class="op">.</span><span class="nam">materialized_content</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1910" href="#t1910">1910</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1911" href="#t1911">1911</a></span><span class="t"> <span class="key">assert</span> <span class="key">not</span> <span class="nam">fs_path</span><span class="op">.</span><span class="nam">is_detached</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1912" href="#t1912">1912</a></span><span class="t"> <span class="key">if</span> <span class="nam">fs_path</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1913" href="#t1913">1913</a></span><span class="t"> <span class="nam">directories</span><span class="op">[</span><span class="nam">fs_path</span><span class="op">.</span><span class="nam">path</span><span class="op">]</span> <span class="op">=</span> <span class="nam">fs_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1914" href="#t1914">1914</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1915" href="#t1915">1915</a></span><span class="t"> <span class="nam">non_directories</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">fs_path</span><span class="op">.</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1916" href="#t1916">1916</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1917" href="#t1917">1917</a></span><span class="t"> <span class="key">if</span> <span class="nam">root_dir</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1918" href="#t1918">1918</a></span><span class="t"> <span class="nam">root_dir</span> <span class="op">=</span> <span class="nam">FSRootDir</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1919" href="#t1919">1919</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1920" href="#t1920">1920</a></span><span class="t"> <span class="nam">root_dir</span><span class="op">.</span><span class="nam">is_read_write</span> <span class="op">=</span> <span class="nam">read_write_fs</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1921" href="#t1921">1921</a></span><span class="t"> <span class="key">return</span> <span class="nam">root_dir</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_exceptions_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_highlevel_manifest_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_267b6307937f1878_highlevel_manifest_parser_py.html b/coverage-report/d_267b6307937f1878_highlevel_manifest_parser_py.html deleted file mode 100644 index 54d2244..0000000 --- a/coverage-report/d_267b6307937f1878_highlevel_manifest_parser_py.html +++ /dev/null @@ -1,637 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/highlevel_manifest_parser.py: 68%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/highlevel_manifest_parser.py</b>: - <span class="pc_cov">68%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">253 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">182<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">71<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">2<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">13<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_highlevel_manifest_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_installations_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">collections</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">contextlib</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> <span class="nam">Dict</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="nam">Callable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">List</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">Mapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">IO</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">Iterator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">cast</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"><span class="key">from</span> <span class="nam">debian</span><span class="op">.</span><span class="nam">debian_support</span> <span class="key">import</span> <span class="nam">DpkgArchTable</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">highlevel_manifest</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">HighLevelManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">PackageTransformationDefinition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">MutableYAMLManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">maintscript_snippet</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="nam">MaintscriptSnippet</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="nam">STD_CONTROL_SCRIPTS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="nam">MaintscriptSnippetContainer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">packages</span> <span class="key">import</span> <span class="nam">BinaryPackage</span><span class="op">,</span> <span class="nam">SourcePackage</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">path_matcher</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="nam">MatchRuleType</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="nam">ExactFileSystemPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="nam">MatchRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">substitution</span> <span class="key">import</span> <span class="nam">Substitution</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="nam">_normalize_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="nam">escape_shell</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">assume_not_none</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">_warn</span><span class="op">,</span> <span class="nam">_info</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">_deb_options_profiles</span> <span class="key">import</span> <span class="nam">DebBuildOptionsAndProfiles</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">architecture_support</span> <span class="key">import</span> <span class="nam">DpkgArchitectureBuildProcessValuesTable</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">filesystem_scan</span> <span class="key">import</span> <span class="nam">FSROOverlay</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">installations</span> <span class="key">import</span> <span class="nam">InstallRule</span><span class="op">,</span> <span class="nam">PPFInstallRule</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">exceptions</span> <span class="key">import</span> <span class="nam">ManifestParseException</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">parser_data</span> <span class="key">import</span> <span class="nam">ParserContextData</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">AttributePath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">packager_provided_files</span> <span class="key">import</span> <span class="nam">detect_all_packager_provided_files</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="nam">VirtualPath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">impl_types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="nam">TP</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="nam">TTP</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="nam">DispatchingTableParser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="nam">OPARSER_MANIFEST_ROOT</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">PackageContextData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">feature_set</span> <span class="key">import</span> <span class="nam">PluginProvidedFeatureSet</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">yaml</span> <span class="key">import</span> <span class="nam">YAMLError</span><span class="op">,</span> <span class="nam">MANIFEST_YAML</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"><span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="key">from</span> <span class="nam">Levenshtein</span> <span class="key">import</span> <span class="nam">distance</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"><span class="key">except</span> <span class="nam">ImportError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="key">def</span> <span class="nam">_detect_possible_typo</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="nam">_d</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="nam">_key</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="nam">_attribute_parent_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="nam">required</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="key">if</span> <span class="nam">required</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="str">"Install python3-levenshtein to have debputy try to detect typos in the manifest."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"><span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="key">def</span> <span class="nam">_detect_possible_typo</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="nam">d</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="nam">key</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="nam">_attribute_parent_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="nam">_required</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="nam">k_len</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="key">for</span> <span class="nam">actual_key</span> <span class="key">in</span> <span class="nam">d</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="key">if</span> <span class="nam">abs</span><span class="op">(</span><span class="nam">k_len</span> <span class="op">-</span> <span class="nam">len</span><span class="op">(</span><span class="nam">actual_key</span><span class="op">)</span><span class="op">)</span> <span class="op">></span> <span class="num">2</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="nam">d</span> <span class="op">=</span> <span class="nam">distance</span><span class="op">(</span><span class="nam">key</span><span class="op">,</span> <span class="nam">actual_key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="key">if</span> <span class="nam">d</span> <span class="op">></span> <span class="num">2</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="nam">path</span> <span class="op">=</span> <span class="nam">_attribute_parent_path</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="nam">ref</span> <span class="op">=</span> <span class="str">f'at "{path}"'</span> <span class="key">if</span> <span class="nam">path</span> <span class="key">else</span> <span class="str">"at the manifest root level"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="str">f'Possible typo: The key "{actual_key}" should probably have been "{key}" {ref}'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"><span class="key">def</span> <span class="nam">_per_package_subst_variables</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="nam">p</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="nam">name</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="key">return</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="str">"PACKAGE"</span><span class="op">:</span> <span class="nam">name</span> <span class="key">if</span> <span class="nam">name</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">else</span> <span class="nam">p</span><span class="op">.</span><span class="nam">name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"><span class="key">class</span> <span class="nam">HighLevelManifestParser</span><span class="op">(</span><span class="nam">ParserContextData</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="nam">manifest_path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="nam">source_package</span><span class="op">:</span> <span class="nam">SourcePackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="nam">binary_packages</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="nam">substitution</span><span class="op">:</span> <span class="nam">Substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="nam">dpkg_architecture_variables</span><span class="op">:</span> <span class="nam">DpkgArchitectureBuildProcessValuesTable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="nam">dpkg_arch_query_table</span><span class="op">:</span> <span class="nam">DpkgArchTable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="nam">build_env</span><span class="op">:</span> <span class="nam">DebBuildOptionsAndProfiles</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="nam">plugin_provided_feature_set</span><span class="op">:</span> <span class="nam">PluginProvidedFeatureSet</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="com"># Available for testing purposes only</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">VirtualPath</span><span class="op">]</span> <span class="op">=</span> <span class="str">"./debian"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">manifest_path</span> <span class="op">=</span> <span class="nam">manifest_path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_source_package</span> <span class="op">=</span> <span class="nam">source_package</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_binary_packages</span> <span class="op">=</span> <span class="nam">binary_packages</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_mutable_yaml_manifest</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">MutableYAMLManifest</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="com"># In source context, some variables are known to be unresolvable. Record this, so</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="com"># we can give better error messages.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_substitution</span> <span class="op">=</span> <span class="nam">substitution</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_dpkg_architecture_variables</span> <span class="op">=</span> <span class="nam">dpkg_architecture_variables</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_dpkg_arch_query_table</span> <span class="op">=</span> <span class="nam">dpkg_arch_query_table</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_build_env</span> <span class="op">=</span> <span class="nam">build_env</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_state_stack</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">PackageTransformationDefinition</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_provided_feature_set</span> <span class="op">=</span> <span class="nam">plugin_provided_feature_set</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_declared_variables</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">debian_dir</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">137 ↛ 138</span><span class="annotate long">line 137 didn't jump to line 138, because the condition on line 137 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="nam">debian_dir</span> <span class="op">=</span> <span class="nam">FSROOverlay</span><span class="op">.</span><span class="nam">create_root_dir</span><span class="op">(</span><span class="str">"debian"</span><span class="op">,</span> <span class="nam">debian_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_debian_dir</span> <span class="op">=</span> <span class="nam">debian_dir</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="com"># Delayed initialized; we rely on this delay to parse the variables.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_all_package_states</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_install_rules</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">InstallRule</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_ownership_caches_loaded</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_used</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="key">def</span> <span class="nam">_ensure_package_states_is_initialized</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_all_package_states</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="nam">substitution</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_substitution</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="nam">binary_packages</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_binary_packages</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="key">assert</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_all_package_states</span> <span class="key">is</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_all_package_states</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="nam">n</span><span class="op">:</span> <span class="nam">PackageTransformationDefinition</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">=</span><span class="nam">p</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="nam">substitution</span><span class="op">=</span><span class="nam">substitution</span><span class="op">.</span><span class="nam">with_extra_substitutions</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="op">**</span><span class="nam">_per_package_subst_variables</span><span class="op">(</span><span class="nam">p</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="nam">is_auto_generated_package</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="nam">maintscript_snippets</span><span class="op">=</span><span class="nam">collections</span><span class="op">.</span><span class="nam">defaultdict</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="nam">MaintscriptSnippetContainer</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="key">for</span> <span class="nam">n</span><span class="op">,</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">binary_packages</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="key">for</span> <span class="nam">n</span><span class="op">,</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">binary_packages</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="nam">dbgsym_name</span> <span class="op">=</span> <span class="str">f"{n}-dbgsym"</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="key">if</span> <span class="nam">dbgsym_name</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_all_package_states</span><span class="op">:</span> </span><span class="r"><span class="annotate short">171 ↛ 172</span><span class="annotate long">line 171 didn't jump to line 172, because the condition on line 171 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_all_package_states</span><span class="op">[</span><span class="nam">dbgsym_name</span><span class="op">]</span> <span class="op">=</span> <span class="nam">PackageTransformationDefinition</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">=</span><span class="nam">p</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="nam">substitution</span><span class="op">=</span><span class="nam">substitution</span><span class="op">.</span><span class="nam">with_extra_substitutions</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="op">**</span><span class="nam">_per_package_subst_variables</span><span class="op">(</span><span class="nam">p</span><span class="op">,</span> <span class="nam">name</span><span class="op">=</span><span class="nam">dbgsym_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="nam">is_auto_generated_package</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="nam">maintscript_snippets</span><span class="op">=</span><span class="nam">collections</span><span class="op">.</span><span class="nam">defaultdict</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="nam">MaintscriptSnippetContainer</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="key">def</span> <span class="nam">binary_packages</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_binary_packages</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="key">def</span> <span class="nam">_package_states</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">PackageTransformationDefinition</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="key">assert</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_all_package_states</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_all_package_states</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="key">def</span> <span class="nam">dpkg_architecture_variables</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">DpkgArchitectureBuildProcessValuesTable</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_dpkg_architecture_variables</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="key">def</span> <span class="nam">dpkg_arch_query_table</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">DpkgArchTable</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_dpkg_arch_query_table</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="key">def</span> <span class="nam">build_env</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">DebBuildOptionsAndProfiles</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_build_env</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="key">def</span> <span class="nam">build_manifest</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">HighLevelManifest</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_used</span><span class="op">:</span> </span><span class="r"><span class="annotate short">206 ↛ 207</span><span class="annotate long">line 206 didn't jump to line 207, because the condition on line 206 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TypeError</span><span class="op">(</span><span class="str">"build_manifest can only be called once!"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_used</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_ensure_package_states_is_initialized</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="key">for</span> <span class="nam">var</span><span class="op">,</span> <span class="nam">attribute_path</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_declared_variables</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">substitution</span><span class="op">.</span><span class="nam">is_used</span><span class="op">(</span><span class="nam">var</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="str">f'The variable "{var}" is unused. Either use it or remove it.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="str">f" The variable was declared at {attribute_path.path}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">YAMLManifestParser</span><span class="op">)</span> <span class="key">and</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_mutable_yaml_manifest</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_mutable_yaml_manifest</span> <span class="op">=</span> <span class="nam">MutableYAMLManifest</span><span class="op">.</span><span class="nam">empty_manifest</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="nam">all_packager_provided_files</span> <span class="op">=</span> <span class="nam">detect_all_packager_provided_files</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_provided_feature_set</span><span class="op">.</span><span class="nam">packager_provided_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_debian_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">binary_packages</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="key">for</span> <span class="nam">package</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_states</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">binary_package_context</span><span class="op">(</span><span class="nam">package</span><span class="op">)</span> <span class="key">as</span> <span class="nam">context</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">context</span><span class="op">.</span><span class="nam">is_auto_generated_package</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="nam">ppf_result</span> <span class="op">=</span> <span class="nam">all_packager_provided_files</span><span class="op">[</span><span class="nam">package</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="key">if</span> <span class="nam">ppf_result</span><span class="op">.</span><span class="nam">auto_installable</span><span class="op">:</span> </span><span class="r"><span class="annotate short">228 ↛ 229</span><span class="annotate long">line 228 didn't jump to line 229, because the condition on line 228 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="nam">context</span><span class="op">.</span><span class="nam">install_rules</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="nam">PPFInstallRule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="nam">context</span><span class="op">.</span><span class="nam">binary_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="nam">context</span><span class="op">.</span><span class="nam">substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="nam">ppf_result</span><span class="op">.</span><span class="nam">auto_installable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="nam">context</span><span class="op">.</span><span class="nam">reserved_packager_provided_files</span><span class="op">.</span><span class="nam">update</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="nam">ppf_result</span><span class="op">.</span><span class="nam">reserved_only</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_transform_dpkg_maintscript_helpers_to_snippets</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="key">return</span> <span class="nam">HighLevelManifest</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">manifest_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_mutable_yaml_manifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_install_rules</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_source_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">binary_packages</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_states</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_dpkg_architecture_variables</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_dpkg_arch_query_table</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_build_env</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_provided_feature_set</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_debian_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="op">@</span><span class="nam">contextlib</span><span class="op">.</span><span class="nam">contextmanager</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="key">def</span> <span class="nam">binary_package_context</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> <span class="nam">package_name</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">PackageTransformationDefinition</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="key">if</span> <span class="nam">package_name</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_states</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="str">f'The package "{package_name}" is not present in the debian/control file (could not find'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="str">f' "Package: {package_name}" in a binary stanza) nor is it a -dbgsym package for one'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="str">" for a package in debian/control."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="nam">package_state</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_states</span><span class="op">[</span><span class="nam">package_name</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_state_stack</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">package_state</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="nam">ps_len</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_package_state_stack</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="key">yield</span> <span class="nam">package_state</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="key">if</span> <span class="nam">ps_len</span> <span class="op">!=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_package_state_stack</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">270 ↛ 271</span><span class="annotate long">line 270 didn't jump to line 271, because the condition on line 270 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="key">raise</span> <span class="nam">RuntimeError</span><span class="op">(</span><span class="str">"Internal error: Unbalanced stack manipulation detected"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_state_stack</span><span class="op">.</span><span class="nam">pop</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="key">def</span> <span class="nam">dispatch_parser_table_for</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">rule_type</span><span class="op">:</span> <span class="nam">TTP</span><span class="op">)</span> <span class="op">-></span> <span class="nam">DispatchingTableParser</span><span class="op">[</span><span class="nam">TP</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="nam">t</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_provided_feature_set</span><span class="op">.</span><span class="nam">manifest_parser_generator</span><span class="op">.</span><span class="nam">dispatch_parser_table_for</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="nam">rule_type</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="key">if</span> <span class="nam">t</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="key">raise</span> <span class="nam">AssertionError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="str">f"Internal error: No dispatching parser for {rule_type.__name__}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="key">return</span> <span class="nam">t</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="key">def</span> <span class="nam">substitution</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Substitution</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_state_stack</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_state_stack</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span><span class="op">.</span><span class="nam">substitution</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_substitution</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="key">def</span> <span class="nam">add_extra_substitution_variables</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> <span class="op">**</span><span class="nam">extra_substitutions</span><span class="op">:</span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">AttributePath</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Substitution</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_state_stack</span> <span class="key">or</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_all_package_states</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">294 ↛ 299</span><span class="annotate long">line 294 didn't jump to line 299, because the condition on line 294 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="com"># For one, it would not "bubble up" correctly when added to the lowest stack.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> <span class="com"># And if it is not added to the lowest stack, then you get errors about it being</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="com"># unknown as soon as you leave the stack (which is weird for the user when</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="com"># the variable is something known, sometimes not)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="key">raise</span> <span class="nam">RuntimeError</span><span class="op">(</span><span class="str">"Cannot use add_extra_substitution from this state"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="key">for</span> <span class="nam">key</span><span class="op">,</span> <span class="op">(</span><span class="nam">_</span><span class="op">,</span> <span class="nam">path</span><span class="op">)</span> <span class="key">in</span> <span class="nam">extra_substitutions</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_declared_variables</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> <span class="op">=</span> <span class="nam">path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_substitution</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_substitution</span><span class="op">.</span><span class="nam">with_extra_substitutions</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="op">**</span><span class="op">{</span><span class="nam">k</span><span class="op">:</span> <span class="nam">v</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="key">for</span> <span class="nam">k</span><span class="op">,</span> <span class="nam">v</span> <span class="key">in</span> <span class="nam">extra_substitutions</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_substitution</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="key">def</span> <span class="nam">current_binary_package_state</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">PackageTransformationDefinition</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_state_stack</span><span class="op">:</span> </span><span class="r"><span class="annotate short">309 ↛ 310</span><span class="annotate long">line 309 didn't jump to line 310, because the condition on line 309 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="key">raise</span> <span class="nam">RuntimeError</span><span class="op">(</span><span class="str">"Invalid state: Not in a binary package context"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_state_stack</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_in_binary_package_state</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="key">return</span> <span class="nam">bool</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_package_state_stack</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="key">def</span> <span class="nam">_transform_dpkg_maintscript_helpers_to_snippets</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="nam">package_state</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">current_binary_package_state</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="key">for</span> <span class="nam">dmh</span> <span class="key">in</span> <span class="nam">package_state</span><span class="op">.</span><span class="nam">dpkg_maintscript_helper_snippets</span><span class="op">:</span> </span><span class="r"><span class="annotate short">319 ↛ 320</span><span class="annotate long">line 319 didn't jump to line 320, because the loop on line 319 never started</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="nam">snippet</span> <span class="op">=</span> <span class="nam">MaintscriptSnippet</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">=</span><span class="nam">dmh</span><span class="op">.</span><span class="nam">definition_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="nam">snippet</span><span class="op">=</span><span class="str">f'dpkg-maintscript-helper {escape_shell(*dmh.cmdline)} -- "$@"\n'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> <span class="key">for</span> <span class="nam">script</span> <span class="key">in</span> <span class="nam">STD_CONTROL_SCRIPTS</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> <span class="nam">package_state</span><span class="op">.</span><span class="nam">maintscript_snippets</span><span class="op">[</span><span class="nam">script</span><span class="op">]</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">snippet</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> <span class="key">def</span> <span class="nam">normalize_path</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> <span class="nam">allow_root_dir_match</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">ExactFileSystemPath</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> <span class="nam">normalized</span> <span class="op">=</span> <span class="nam">_normalize_path</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> <span class="key">except</span> <span class="nam">ValueError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> <span class="str">f'The path "{path}" provided in {definition_source.path} should be relative to the root of the'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"> <span class="str">' package and not use any ".." or "." segments.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"> <span class="key">if</span> <span class="nam">normalized</span> <span class="op">==</span> <span class="str">"."</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">allow_root_dir_match</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"> <span class="str">"Manifests must not change the root directory of the deb file. Please correct"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> <span class="str">f' "{definition_source.path}" (path: "{path}) in {self.manifest_path}'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"> <span class="key">return</span> <span class="nam">ExactFileSystemPath</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">substitution</span><span class="op">.</span><span class="nam">substitute</span><span class="op">(</span><span class="nam">normalized</span><span class="op">,</span> <span class="nam">definition_source</span><span class="op">.</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"> <span class="key">def</span> <span class="nam">parse_path_or_glob</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"> <span class="nam">path_or_glob</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">MatchRule</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"> <span class="nam">match_rule</span> <span class="op">=</span> <span class="nam">MatchRule</span><span class="op">.</span><span class="nam">from_path_or_glob</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"> <span class="nam">path_or_glob</span><span class="op">,</span> <span class="nam">definition_source</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> <span class="nam">substitution</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">substitution</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"> <span class="com"># NB: "." and "/" will be translated to MATCH_ANYTHING by MatchRule.from_path_or_glob,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"> <span class="com"># so there is no need to check for an exact match on "." like in normalize_path.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"> <span class="key">if</span> <span class="nam">match_rule</span><span class="op">.</span><span class="nam">rule_type</span> <span class="op">==</span> <span class="nam">MatchRuleType</span><span class="op">.</span><span class="nam">MATCH_ANYTHING</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"> <span class="str">f'The chosen match rule "{path_or_glob}" matches everything (including the deb root directory).'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"> <span class="str">f' Please correct "{definition_source.path}" (path: "{path_or_glob}) in {self.manifest_path} to'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"> <span class="str">f' something that matches "less" than everything.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"> <span class="key">return</span> <span class="nam">match_rule</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"> <span class="key">def</span> <span class="nam">parse_manifest</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">HighLevelManifest</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"><span class="key">class</span> <span class="nam">YAMLManifestParser</span><span class="op">(</span><span class="nam">HighLevelManifestParser</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"> <span class="key">def</span> <span class="nam">_optional_key</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"> <span class="nam">d</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"> <span class="nam">key</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"> <span class="nam">attribute_parent_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"> <span class="nam">expected_type</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"> <span class="nam">default_value</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"> <span class="nam">v</span> <span class="op">=</span> <span class="nam">d</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"> <span class="key">if</span> <span class="nam">v</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"> <span class="nam">_detect_possible_typo</span><span class="op">(</span><span class="nam">d</span><span class="op">,</span> <span class="nam">key</span><span class="op">,</span> <span class="nam">attribute_parent_path</span><span class="op">,</span> <span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"> <span class="key">return</span> <span class="nam">default_value</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t385" href="#t385">385</a></span><span class="t"> <span class="key">if</span> <span class="nam">expected_type</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t386" href="#t386">386</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_ensure_value_is_type</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t387" href="#t387">387</a></span><span class="t"> <span class="nam">v</span><span class="op">,</span> <span class="nam">expected_type</span><span class="op">,</span> <span class="nam">key</span><span class="op">,</span> <span class="nam">attribute_parent_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t388" href="#t388">388</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t389" href="#t389">389</a></span><span class="t"> <span class="key">return</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t390" href="#t390">390</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t391" href="#t391">391</a></span><span class="t"> <span class="key">def</span> <span class="nam">_required_key</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t392" href="#t392">392</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t393" href="#t393">393</a></span><span class="t"> <span class="nam">d</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t394" href="#t394">394</a></span><span class="t"> <span class="nam">key</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t395" href="#t395">395</a></span><span class="t"> <span class="nam">attribute_parent_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t396" href="#t396">396</a></span><span class="t"> <span class="nam">expected_type</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t397" href="#t397">397</a></span><span class="t"> <span class="nam">extra</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="op">]</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t398" href="#t398">398</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t399" href="#t399">399</a></span><span class="t"> <span class="nam">v</span> <span class="op">=</span> <span class="nam">d</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t400" href="#t400">400</a></span><span class="t"> <span class="key">if</span> <span class="nam">v</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t401" href="#t401">401</a></span><span class="t"> <span class="nam">_detect_possible_typo</span><span class="op">(</span><span class="nam">d</span><span class="op">,</span> <span class="nam">key</span><span class="op">,</span> <span class="nam">attribute_parent_path</span><span class="op">,</span> <span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t402" href="#t402">402</a></span><span class="t"> <span class="key">if</span> <span class="nam">extra</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t403" href="#t403">403</a></span><span class="t"> <span class="nam">msg</span> <span class="op">=</span> <span class="nam">extra</span> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">extra</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span> <span class="key">else</span> <span class="nam">extra</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t404" href="#t404">404</a></span><span class="t"> <span class="nam">extra_info</span> <span class="op">=</span> <span class="str">" "</span> <span class="op">+</span> <span class="nam">msg</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t405" href="#t405">405</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t406" href="#t406">406</a></span><span class="t"> <span class="nam">extra_info</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t407" href="#t407">407</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t408" href="#t408">408</a></span><span class="t"> <span class="str">f'Missing required key {key} at {attribute_parent_path.path} in manifest "{self.manifest_path}.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t409" href="#t409">409</a></span><span class="t"> <span class="str">f"{extra_info}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t410" href="#t410">410</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t411" href="#t411">411</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t412" href="#t412">412</a></span><span class="t"> <span class="key">if</span> <span class="nam">expected_type</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t413" href="#t413">413</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_ensure_value_is_type</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t414" href="#t414">414</a></span><span class="t"> <span class="nam">v</span><span class="op">,</span> <span class="nam">expected_type</span><span class="op">,</span> <span class="nam">key</span><span class="op">,</span> <span class="nam">attribute_parent_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t415" href="#t415">415</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t416" href="#t416">416</a></span><span class="t"> <span class="key">return</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t417" href="#t417">417</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t418" href="#t418">418</a></span><span class="t"> <span class="key">def</span> <span class="nam">_ensure_value_is_type</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t419" href="#t419">419</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t420" href="#t420">420</a></span><span class="t"> <span class="nam">v</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t421" href="#t421">421</a></span><span class="t"> <span class="nam">t</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t422" href="#t422">422</a></span><span class="t"> <span class="nam">key</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">int</span><span class="op">,</span> <span class="nam">AttributePath</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t423" href="#t423">423</a></span><span class="t"> <span class="nam">attribute_parent_path</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">AttributePath</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t424" href="#t424">424</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t425" href="#t425">425</a></span><span class="t"> <span class="key">if</span> <span class="nam">v</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t426" href="#t426">426</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t427" href="#t427">427</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">t</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t428" href="#t428">428</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">t</span><span class="op">,</span> <span class="nam">tuple</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t429" href="#t429">429</a></span><span class="t"> <span class="nam">t_msg</span> <span class="op">=</span> <span class="str">"one of: "</span> <span class="op">+</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">x</span><span class="op">.</span><span class="nam">__name__</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">t</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t430" href="#t430">430</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t431" href="#t431">431</a></span><span class="t"> <span class="nam">t_msg</span> <span class="op">=</span> <span class="str">f"a {t.__name__}"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t432" href="#t432">432</a></span><span class="t"> <span class="nam">key_path</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t433" href="#t433">433</a></span><span class="t"> <span class="nam">key</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t434" href="#t434">434</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">key</span><span class="op">,</span> <span class="nam">AttributePath</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t435" href="#t435">435</a></span><span class="t"> <span class="key">else</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">attribute_parent_path</span><span class="op">)</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t436" href="#t436">436</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t437" href="#t437">437</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t438" href="#t438">438</a></span><span class="t"> <span class="str">f'The key {key_path} must be {t_msg} in manifest "{self.manifest_path}"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t439" href="#t439">439</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t440" href="#t440">440</a></span><span class="t"> <span class="key">return</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t441" href="#t441">441</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t442" href="#t442">442</a></span><span class="t"> <span class="key">def</span> <span class="nam">from_yaml_dict</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">yaml_data</span><span class="op">:</span> <span class="nam">object</span><span class="op">)</span> <span class="op">-></span> <span class="str">"HighLevelManifest"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t443" href="#t443">443</a></span><span class="t"> <span class="nam">attribute_path</span> <span class="op">=</span> <span class="nam">AttributePath</span><span class="op">.</span><span class="nam">root_path</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t444" href="#t444">444</a></span><span class="t"> <span class="nam">parser_generator</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_provided_feature_set</span><span class="op">.</span><span class="nam">manifest_parser_generator</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t445" href="#t445">445</a></span><span class="t"> <span class="nam">dispatchable_object_parsers</span> <span class="op">=</span> <span class="nam">parser_generator</span><span class="op">.</span><span class="nam">dispatchable_object_parsers</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t446" href="#t446">446</a></span><span class="t"> <span class="nam">manifest_root_parser</span> <span class="op">=</span> <span class="nam">dispatchable_object_parsers</span><span class="op">[</span><span class="nam">OPARSER_MANIFEST_ROOT</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t447" href="#t447">447</a></span><span class="t"> <span class="nam">parsed_data</span> <span class="op">=</span> <span class="nam">cast</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t448" href="#t448">448</a></span><span class="t"> <span class="str">"ManifestRootRule"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t449" href="#t449">449</a></span><span class="t"> <span class="nam">manifest_root_parser</span><span class="op">.</span><span class="nam">parse_input</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t450" href="#t450">450</a></span><span class="t"> <span class="nam">yaml_data</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t451" href="#t451">451</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t452" href="#t452">452</a></span><span class="t"> <span class="nam">parser_context</span><span class="op">=</span><span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t453" href="#t453">453</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t454" href="#t454">454</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t455" href="#t455">455</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t456" href="#t456">456</a></span><span class="t"> <span class="nam">packages_dict</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">PackageContextData</span><span class="op">[</span><span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="nam">cast</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t457" href="#t457">457</a></span><span class="t"> <span class="str">"Mapping[str, PackageContextData[Mapping[str, Any]]]"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t458" href="#t458">458</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"packages"</span><span class="op">,</span> <span class="op">{</span><span class="op">}</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t459" href="#t459">459</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t460" href="#t460">460</a></span><span class="t"> <span class="nam">install_rules</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"installations"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t461" href="#t461">461</a></span><span class="t"> <span class="key">if</span> <span class="nam">install_rules</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t462" href="#t462">462</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_install_rules</span> <span class="op">=</span> <span class="nam">install_rules</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t463" href="#t463">463</a></span><span class="t"> <span class="nam">packages_parent_path</span> <span class="op">=</span> <span class="nam">attribute_path</span><span class="op">[</span><span class="str">"packages"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t464" href="#t464">464</a></span><span class="t"> <span class="key">for</span> <span class="nam">package_name_raw</span><span class="op">,</span> <span class="nam">pcd</span> <span class="key">in</span> <span class="nam">packages_dict</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t465" href="#t465">465</a></span><span class="t"> <span class="nam">definition_source</span> <span class="op">=</span> <span class="nam">packages_parent_path</span><span class="op">[</span><span class="nam">package_name_raw</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t466" href="#t466">466</a></span><span class="t"> <span class="nam">package_name</span> <span class="op">=</span> <span class="nam">pcd</span><span class="op">.</span><span class="nam">resolved_package_name</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t467" href="#t467">467</a></span><span class="t"> <span class="nam">parsed</span> <span class="op">=</span> <span class="nam">pcd</span><span class="op">.</span><span class="nam">value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t468" href="#t468">468</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t469" href="#t469">469</a></span><span class="t"> <span class="nam">package_state</span><span class="op">:</span> <span class="nam">PackageTransformationDefinition</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t470" href="#t470">470</a></span><span class="t"> <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">binary_package_context</span><span class="op">(</span><span class="nam">package_name</span><span class="op">)</span> <span class="key">as</span> <span class="nam">package_state</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t471" href="#t471">471</a></span><span class="t"> <span class="key">if</span> <span class="nam">package_state</span><span class="op">.</span><span class="nam">is_auto_generated_package</span><span class="op">:</span> </span><span class="r"><span class="annotate short">471 ↛ 473</span><span class="annotate long">line 471 didn't jump to line 473, because the condition on line 471 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t472" href="#t472">472</a></span><span class="t"> <span class="com"># Maybe lift (part) of this restriction.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t473" href="#t473">473</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t474" href="#t474">474</a></span><span class="t"> <span class="str">f'Cannot define rules for package "{package_name}" (at {definition_source.path}). It is an'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t475" href="#t475">475</a></span><span class="t"> <span class="str">" auto-generated package."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t476" href="#t476">476</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t477" href="#t477">477</a></span><span class="t"> <span class="nam">binary_version</span> <span class="op">=</span> <span class="nam">parsed</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"binary-version"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t478" href="#t478">478</a></span><span class="t"> <span class="key">if</span> <span class="nam">binary_version</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t479" href="#t479">479</a></span><span class="t"> <span class="nam">package_state</span><span class="op">.</span><span class="nam">binary_version</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t480" href="#t480">480</a></span><span class="t"> <span class="nam">package_state</span><span class="op">.</span><span class="nam">substitution</span><span class="op">.</span><span class="nam">substitute</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t481" href="#t481">481</a></span><span class="t"> <span class="nam">binary_version</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t482" href="#t482">482</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">[</span><span class="str">"binary-version"</span><span class="op">]</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t483" href="#t483">483</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t484" href="#t484">484</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t485" href="#t485">485</a></span><span class="t"> <span class="nam">search_dirs</span> <span class="op">=</span> <span class="nam">parsed</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"installation_search_dirs"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t486" href="#t486">486</a></span><span class="t"> <span class="key">if</span> <span class="nam">search_dirs</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">486 ↛ 487</span><span class="annotate long">line 486 didn't jump to line 487, because the condition on line 486 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t487" href="#t487">487</a></span><span class="t"> <span class="nam">package_state</span><span class="op">.</span><span class="nam">search_dirs</span> <span class="op">=</span> <span class="nam">search_dirs</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t488" href="#t488">488</a></span><span class="t"> <span class="nam">transformations</span> <span class="op">=</span> <span class="nam">parsed</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"transformations"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t489" href="#t489">489</a></span><span class="t"> <span class="nam">conffile_management</span> <span class="op">=</span> <span class="nam">parsed</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"conffile_management"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t490" href="#t490">490</a></span><span class="t"> <span class="nam">service_rules</span> <span class="op">=</span> <span class="nam">parsed</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"services"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t491" href="#t491">491</a></span><span class="t"> <span class="key">if</span> <span class="nam">transformations</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t492" href="#t492">492</a></span><span class="t"> <span class="nam">package_state</span><span class="op">.</span><span class="nam">transformations</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">transformations</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t493" href="#t493">493</a></span><span class="t"> <span class="key">if</span> <span class="nam">conffile_management</span><span class="op">:</span> </span><span class="r"><span class="annotate short">493 ↛ 494</span><span class="annotate long">line 493 didn't jump to line 494, because the condition on line 493 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t494" href="#t494">494</a></span><span class="t"> <span class="nam">package_state</span><span class="op">.</span><span class="nam">dpkg_maintscript_helper_snippets</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t495" href="#t495">495</a></span><span class="t"> <span class="nam">conffile_management</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t496" href="#t496">496</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t497" href="#t497">497</a></span><span class="t"> <span class="key">if</span> <span class="nam">service_rules</span><span class="op">:</span> </span><span class="r"><span class="annotate short">497 ↛ 498</span><span class="annotate long">line 497 didn't jump to line 498, because the condition on line 497 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t498" href="#t498">498</a></span><span class="t"> <span class="nam">package_state</span><span class="op">.</span><span class="nam">requested_service_rules</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">service_rules</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t499" href="#t499">499</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t500" href="#t500">500</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">build_manifest</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t501" href="#t501">501</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t502" href="#t502">502</a></span><span class="t"> <span class="key">def</span> <span class="nam">_parse_manifest</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">fd</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">IO</span><span class="op">[</span><span class="nam">bytes</span><span class="op">]</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="nam">HighLevelManifest</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t503" href="#t503">503</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t504" href="#t504">504</a></span><span class="t"> <span class="nam">data</span> <span class="op">=</span> <span class="nam">MANIFEST_YAML</span><span class="op">.</span><span class="nam">load</span><span class="op">(</span><span class="nam">fd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t505" href="#t505">505</a></span><span class="t"> <span class="key">except</span> <span class="nam">YAMLError</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t506" href="#t506">506</a></span><span class="t"> <span class="nam">msg</span> <span class="op">=</span> <span class="nam">str</span><span class="op">(</span><span class="nam">e</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t507" href="#t507">507</a></span><span class="t"> <span class="nam">lines</span> <span class="op">=</span> <span class="nam">msg</span><span class="op">.</span><span class="nam">splitlines</span><span class="op">(</span><span class="nam">keepends</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t508" href="#t508">508</a></span><span class="t"> <span class="nam">i</span> <span class="op">=</span> <span class="op">-</span><span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t509" href="#t509">509</a></span><span class="t"> <span class="key">for</span> <span class="nam">i</span><span class="op">,</span> <span class="nam">line</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">lines</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t510" href="#t510">510</a></span><span class="t"> <span class="com"># Avoid an irrelevant "how do configure the YAML parser" message, which the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t511" href="#t511">511</a></span><span class="t"> <span class="com"># user cannot use.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t512" href="#t512">512</a></span><span class="t"> <span class="key">if</span> <span class="nam">line</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"To suppress this check"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t513" href="#t513">513</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t514" href="#t514">514</a></span><span class="t"> <span class="key">if</span> <span class="nam">i</span> <span class="op">></span> <span class="op">-</span><span class="num">1</span> <span class="key">and</span> <span class="nam">len</span><span class="op">(</span><span class="nam">lines</span><span class="op">)</span> <span class="op">></span> <span class="nam">i</span> <span class="op">+</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t515" href="#t515">515</a></span><span class="t"> <span class="nam">lines</span> <span class="op">=</span> <span class="nam">lines</span><span class="op">[</span><span class="op">:</span><span class="nam">i</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t516" href="#t516">516</a></span><span class="t"> <span class="nam">msg</span> <span class="op">=</span> <span class="str">""</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">lines</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t517" href="#t517">517</a></span><span class="t"> <span class="nam">msg</span> <span class="op">=</span> <span class="nam">msg</span><span class="op">.</span><span class="nam">rstrip</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t518" href="#t518">518</a></span><span class="t"> <span class="nam">msg</span> <span class="op">+=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t519" href="#t519">519</a></span><span class="t"> <span class="str">f"\n\nYou can use `yamllint -d relaxed {escape_shell(self.manifest_path)}` to validate"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t520" href="#t520">520</a></span><span class="t"> <span class="str">" the YAML syntax. The yamllint tool also supports style rules for YAML documents"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t521" href="#t521">521</a></span><span class="t"> <span class="str">" (such as indentation rules) in case that is of interest."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t522" href="#t522">522</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t523" href="#t523">523</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t524" href="#t524">524</a></span><span class="t"> <span class="str">f"Could not parse {self.manifest_path} as a YAML document: {msg}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t525" href="#t525">525</a></span><span class="t"> <span class="op">)</span> <span class="key">from</span> <span class="nam">e</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t526" href="#t526">526</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_mutable_yaml_manifest</span> <span class="op">=</span> <span class="nam">MutableYAMLManifest</span><span class="op">(</span><span class="nam">data</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t527" href="#t527">527</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">from_yaml_dict</span><span class="op">(</span><span class="nam">data</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t528" href="#t528">528</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t529" href="#t529">529</a></span><span class="t"> <span class="key">def</span> <span class="nam">parse_manifest</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t530" href="#t530">530</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t531" href="#t531">531</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t532" href="#t532">532</a></span><span class="t"> <span class="nam">fd</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">IO</span><span class="op">[</span><span class="nam">bytes</span><span class="op">]</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t533" href="#t533">533</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">HighLevelManifest</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t534" href="#t534">534</a></span><span class="t"> <span class="key">if</span> <span class="nam">fd</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">534 ↛ 535</span><span class="annotate long">line 534 didn't jump to line 535, because the condition on line 534 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t535" href="#t535">535</a></span><span class="t"> <span class="key">with</span> <span class="nam">open</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">manifest_path</span><span class="op">,</span> <span class="str">"rb"</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t536" href="#t536">536</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parse_manifest</span><span class="op">(</span><span class="nam">fd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t537" href="#t537">537</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t538" href="#t538">538</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parse_manifest</span><span class="op">(</span><span class="nam">fd</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_highlevel_manifest_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_installations_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_267b6307937f1878_highlevel_manifest_py.html b/coverage-report/d_267b6307937f1878_highlevel_manifest_py.html deleted file mode 100644 index ec64758..0000000 --- a/coverage-report/d_267b6307937f1878_highlevel_manifest_py.html +++ /dev/null @@ -1,1706 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/highlevel_manifest.py: 67%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/highlevel_manifest.py</b>: - <span class="pc_cov">67%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">801 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">564<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">237<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">3<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">52<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_filesystem_scan_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_highlevel_manifest_parser_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">dataclasses</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">functools</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">import</span> <span class="nam">textwrap</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">from</span> <span class="nam">contextlib</span> <span class="key">import</span> <span class="nam">suppress</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">from</span> <span class="nam">dataclasses</span> <span class="key">import</span> <span class="nam">dataclass</span><span class="op">,</span> <span class="nam">field</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">List</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">Dict</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">Iterable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">Mapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">TypeVar</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">Generic</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">cast</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">Set</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">Sequence</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">FrozenSet</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"><span class="key">from</span> <span class="nam">debian</span><span class="op">.</span><span class="nam">debian_support</span> <span class="key">import</span> <span class="nam">DpkgArchTable</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">_deb_options_profiles</span> <span class="key">import</span> <span class="nam">DebBuildOptionsAndProfiles</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">_manifest_constants</span> <span class="key">import</span> <span class="op">*</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">architecture_support</span> <span class="key">import</span> <span class="nam">DpkgArchitectureBuildProcessValuesTable</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">builtin_manifest_rules</span> <span class="key">import</span> <span class="nam">builtin_mode_normalization_rules</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">debhelper_emulation</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="nam">dhe_dbgsym_root_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="nam">assert_no_dbgsym_migration</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="nam">read_dbgsym_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">exceptions</span> <span class="key">import</span> <span class="nam">DebputySubstitutionError</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">filesystem_scan</span> <span class="key">import</span> <span class="nam">FSPath</span><span class="op">,</span> <span class="nam">FSRootDir</span><span class="op">,</span> <span class="nam">FSROOverlay</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">installations</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="nam">InstallRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="nam">SourcePathMatcher</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">PathAlreadyInstalledOrDiscardedError</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="nam">NoMatchForInstallPatternError</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="nam">InstallRuleContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">BinaryPackageInstallRuleContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">InstallSearchDirContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="nam">SearchDir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">intermediate_manifest</span> <span class="key">import</span> <span class="nam">TarMember</span><span class="op">,</span> <span class="nam">PathType</span><span class="op">,</span> <span class="nam">IntermediateManifest</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">maintscript_snippet</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="nam">DpkgMaintscriptHelperCommand</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="nam">MaintscriptSnippetContainer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">manifest_conditions</span> <span class="key">import</span> <span class="nam">ConditionContext</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">base_types</span> <span class="key">import</span> <span class="nam">FileSystemMatchRule</span><span class="op">,</span> <span class="nam">FileSystemExactMatchRule</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">AttributePath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">packager_provided_files</span> <span class="key">import</span> <span class="nam">PackagerProvidedFile</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">packages</span> <span class="key">import</span> <span class="nam">BinaryPackage</span><span class="op">,</span> <span class="nam">SourcePackage</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">feature_set</span> <span class="key">import</span> <span class="nam">PluginProvidedFeatureSet</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">impl</span> <span class="key">import</span> <span class="nam">BinaryCtrlAccessorProviderCreator</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">impl_types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="nam">PackageProcessingContextProvider</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="nam">PackageDataTable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">spec</span> <span class="key">import</span> <span class="nam">FlushableSubstvars</span><span class="op">,</span> <span class="nam">VirtualPath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">debputy</span><span class="op">.</span><span class="nam">binary_package_rules</span> <span class="key">import</span> <span class="nam">ServiceRule</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">substitution</span> <span class="key">import</span> <span class="nam">Substitution</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">transformation_rules</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="nam">TransformationRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="nam">ModeNormalizationTransformationRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="nam">NormalizeShebangLineTransformation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="nam">_error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="nam">_warn</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="nam">debian_policy_normalize_symlink_target</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="nam">generated_content_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="nam">_info</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">yaml</span> <span class="key">import</span> <span class="nam">MANIFEST_YAML</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">yaml</span><span class="op">.</span><span class="nam">compat</span> <span class="key">import</span> <span class="nam">CommentedMap</span><span class="op">,</span> <span class="nam">CommentedSeq</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"><span class="op">@</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"><span class="key">class</span> <span class="nam">DbgsymInfo</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="nam">dbgsym_fs_root</span><span class="op">:</span> <span class="nam">FSPath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="nam">dbgsym_ids</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"><span class="op">@</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"><span class="key">class</span> <span class="nam">BinaryPackageData</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="nam">source_package</span><span class="op">:</span> <span class="nam">SourcePackage</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">:</span> <span class="nam">BinaryPackage</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="nam">binary_staging_root_dir</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="nam">control_output_dir</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">FSPath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="nam">substvars</span><span class="op">:</span> <span class="nam">FlushableSubstvars</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="nam">package_metadata_context</span><span class="op">:</span> <span class="nam">PackageProcessingContextProvider</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="nam">ctrl_creator</span><span class="op">:</span> <span class="nam">BinaryCtrlAccessorProviderCreator</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="nam">dbgsym_info</span><span class="op">:</span> <span class="nam">DbgsymInfo</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"><span class="op">@</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"><span class="key">class</span> <span class="nam">PackageTransformationDefinition</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">:</span> <span class="nam">BinaryPackage</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="nam">substitution</span><span class="op">:</span> <span class="nam">Substitution</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="nam">is_auto_generated_package</span><span class="op">:</span> <span class="nam">bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="nam">binary_version</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="nam">search_dirs</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">FileSystemExactMatchRule</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="nam">dpkg_maintscript_helper_snippets</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">DpkgMaintscriptHelperCommand</span><span class="op">]</span> <span class="op">=</span> <span class="nam">field</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="nam">default_factory</span><span class="op">=</span><span class="nam">list</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="nam">maintscript_snippets</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">MaintscriptSnippetContainer</span><span class="op">]</span> <span class="op">=</span> <span class="nam">field</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="nam">default_factory</span><span class="op">=</span><span class="nam">dict</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="nam">transformations</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">TransformationRule</span><span class="op">]</span> <span class="op">=</span> <span class="nam">field</span><span class="op">(</span><span class="nam">default_factory</span><span class="op">=</span><span class="nam">list</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="nam">reserved_packager_provided_files</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">PackagerProvidedFile</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="nam">field</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="nam">default_factory</span><span class="op">=</span><span class="nam">dict</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="nam">install_rules</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">InstallRule</span><span class="op">]</span> <span class="op">=</span> <span class="nam">field</span><span class="op">(</span><span class="nam">default_factory</span><span class="op">=</span><span class="nam">list</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="nam">requested_service_rules</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">ServiceRule</span><span class="op">]</span> <span class="op">=</span> <span class="nam">field</span><span class="op">(</span><span class="nam">default_factory</span><span class="op">=</span><span class="nam">list</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"><span class="key">def</span> <span class="nam">_path_to_tar_member</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">FSPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="nam">clamp_mtime_to</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">TarMember</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="nam">mtime</span> <span class="op">=</span> <span class="nam">float</span><span class="op">(</span><span class="nam">clamp_mtime_to</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="nam">owner</span><span class="op">,</span> <span class="nam">uid</span><span class="op">,</span> <span class="nam">group</span><span class="op">,</span> <span class="nam">gid</span> <span class="op">=</span> <span class="nam">path</span><span class="op">.</span><span class="nam">tar_owner_info</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="nam">mode</span> <span class="op">=</span> <span class="nam">path</span><span class="op">.</span><span class="nam">mode</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span><span class="op">.</span><span class="nam">has_fs_path</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="nam">mtime</span> <span class="op">=</span> <span class="nam">min</span><span class="op">(</span><span class="nam">mtime</span><span class="op">,</span> <span class="nam">path</span><span class="op">.</span><span class="nam">mtime</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="nam">path_type</span> <span class="op">=</span> <span class="nam">PathType</span><span class="op">.</span><span class="nam">DIRECTORY</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="key">elif</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_file</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="com"># TODO: someday we will need to deal with hardlinks and it might appear here.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="nam">path_type</span> <span class="op">=</span> <span class="nam">PathType</span><span class="op">.</span><span class="nam">FILE</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="key">elif</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_symlink</span><span class="op">:</span> </span><span class="r"><span class="annotate short">137 ↛ 157</span><span class="annotate long">line 137 didn't jump to line 157, because the condition on line 137 was never false</span></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="com"># Special-case that we resolve immediately (since we need to normalize the target anyway)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="nam">link_target</span> <span class="op">=</span> <span class="nam">debian_policy_normalize_symlink_target</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="nam">path</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="nam">path</span><span class="op">.</span><span class="nam">readlink</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="key">return</span> <span class="nam">TarMember</span><span class="op">.</span><span class="nam">virtual_path</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="nam">path</span><span class="op">.</span><span class="nam">tar_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="nam">PathType</span><span class="op">.</span><span class="nam">SYMLINK</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="nam">mtime</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="nam">link_target</span><span class="op">=</span><span class="nam">link_target</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="com"># Force mode to be 0777 as that is the mode we see in the data.tar. In theory, tar lets you set</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="com"># it to whatever. However, for reproducibility, we have to be well-behaved - and that is 0777.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="nam">mode</span><span class="op">=</span><span class="num">0o0777</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="nam">owner</span><span class="op">=</span><span class="nam">owner</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="nam">uid</span><span class="op">=</span><span class="nam">uid</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="nam">group</span><span class="op">=</span><span class="nam">group</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="nam">gid</span><span class="op">=</span><span class="nam">gid</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="key">assert</span> <span class="key">not</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_symlink</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="key">raise</span> <span class="nam">AssertionError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="str">f"Unsupported file type: {path.path} - not a file, dir nor a symlink!"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">path</span><span class="op">.</span><span class="nam">has_fs_path</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="key">assert</span> <span class="key">not</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_file</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="key">return</span> <span class="nam">TarMember</span><span class="op">.</span><span class="nam">virtual_path</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="nam">path</span><span class="op">.</span><span class="nam">tar_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="nam">path_type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="nam">mtime</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="nam">mode</span><span class="op">=</span><span class="nam">mode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="nam">owner</span><span class="op">=</span><span class="nam">owner</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="nam">uid</span><span class="op">=</span><span class="nam">uid</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="nam">group</span><span class="op">=</span><span class="nam">group</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="nam">gid</span><span class="op">=</span><span class="nam">gid</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="nam">may_steal_fs_path</span> <span class="op">=</span> <span class="nam">path</span><span class="op">.</span><span class="nam">_can_replace_inline</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="key">return</span> <span class="nam">TarMember</span><span class="op">.</span><span class="nam">from_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="nam">path</span><span class="op">.</span><span class="nam">tar_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="nam">path</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="nam">mode</span><span class="op">=</span><span class="nam">mode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="nam">uid</span><span class="op">=</span><span class="nam">uid</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="nam">owner</span><span class="op">=</span><span class="nam">owner</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="nam">gid</span><span class="op">=</span><span class="nam">gid</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="nam">group</span><span class="op">=</span><span class="nam">group</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="nam">path_type</span><span class="op">=</span><span class="nam">path_type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="nam">path_mtime</span><span class="op">=</span><span class="nam">mtime</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="nam">clamp_mtime_to</span><span class="op">=</span><span class="nam">clamp_mtime_to</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="nam">may_steal_fs_path</span><span class="op">=</span><span class="nam">may_steal_fs_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"><span class="key">def</span> <span class="nam">_generate_intermediate_manifest</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">FSPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="nam">clamp_mtime_to</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">TarMember</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="nam">symlinks</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="key">for</span> <span class="nam">path</span> <span class="key">in</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">all_paths</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="nam">tar_member</span> <span class="op">=</span> <span class="nam">_path_to_tar_member</span><span class="op">(</span><span class="nam">path</span><span class="op">,</span> <span class="nam">clamp_mtime_to</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="key">if</span> <span class="nam">tar_member</span><span class="op">.</span><span class="nam">path_type</span> <span class="op">==</span> <span class="nam">PathType</span><span class="op">.</span><span class="nam">SYMLINK</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="nam">symlinks</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">tar_member</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="key">yield</span> <span class="nam">tar_member</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">symlinks</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"><span class="nam">ST</span> <span class="op">=</span> <span class="nam">TypeVar</span><span class="op">(</span><span class="str">"ST"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"><span class="nam">T</span> <span class="op">=</span> <span class="nam">TypeVar</span><span class="op">(</span><span class="str">"T"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"><span class="key">class</span> <span class="nam">AbstractYAMLSubStore</span><span class="op">(</span><span class="nam">Generic</span><span class="op">[</span><span class="nam">ST</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="nam">parent_store</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="nam">parent_key</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">int</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="nam">store</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ST</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="key">if</span> <span class="nam">parent_store</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">parent_key</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="nam">from_parent_store</span> <span class="op">=</span> <span class="nam">parent_store</span><span class="op">[</span><span class="nam">parent_key</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="key">except</span> <span class="op">(</span><span class="nam">KeyError</span><span class="op">,</span> <span class="nam">IndexError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="nam">from_parent_store</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"><span class="annotate short">220 ↛ 225</span><span class="annotate long">line 220 didn't jump to line 225</span></span></p> - <p class="pln"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="nam">store</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="key">and</span> <span class="nam">from_parent_store</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="key">and</span> <span class="nam">store</span> <span class="key">is</span> <span class="key">not</span> <span class="nam">parent_store</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="str">"Store is provided but is not the one already in the parent store"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="key">if</span> <span class="nam">store</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">228 ↛ 230</span><span class="annotate long">line 228 didn't jump to line 230, because the condition on line 228 was never false</span></span></p> - <p class="run"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="nam">store</span> <span class="op">=</span> <span class="nam">from_parent_store</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent_store</span> <span class="op">=</span> <span class="nam">parent_store</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent_key</span> <span class="op">=</span> <span class="nam">parent_key</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_is_detached</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="nam">parent_key</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">parent_store</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">parent_key</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">parent_store</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="key">assert</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_is_detached</span> <span class="key">or</span> <span class="nam">store</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="key">if</span> <span class="nam">store</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="nam">store</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_create_new_instance</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_store</span><span class="op">:</span> <span class="nam">ST</span> <span class="op">=</span> <span class="nam">store</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="key">def</span> <span class="nam">_create_new_instance</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">ST</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="key">def</span> <span class="nam">create_definition_if_missing</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_is_detached</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">create_definition</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="key">def</span> <span class="nam">create_definition</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_is_detached</span><span class="op">:</span> </span><span class="r"><span class="annotate short">248 ↛ 249</span><span class="annotate long">line 248 didn't jump to line 249, because the condition on line 248 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="key">raise</span> <span class="nam">RuntimeError</span><span class="op">(</span><span class="str">"Definition is already present"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="nam">parent_store</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent_store</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="key">if</span> <span class="nam">parent_store</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">251 ↛ 252</span><span class="annotate long">line 251 didn't jump to line 252, because the condition on line 251 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="key">raise</span> <span class="nam">RuntimeError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="str">f"Definition is not attached to any parent!? ({self.__class__.__name__})"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">parent_store</span><span class="op">,</span> <span class="nam">list</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="key">assert</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent_key</span> <span class="key">is</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent_key</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">parent_store</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent_store</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_store</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="nam">parent_store</span><span class="op">[</span><span class="nam">self</span><span class="op">.</span><span class="nam">_parent_key</span><span class="op">]</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_store</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_is_detached</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="key">def</span> <span class="nam">remove_definition</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_ensure_attached</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="key">del</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent_store</span><span class="op">[</span><span class="nam">self</span><span class="op">.</span><span class="nam">_parent_key</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_parent_store</span><span class="op">,</span> <span class="nam">list</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent_key</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_is_detached</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="key">def</span> <span class="nam">_ensure_attached</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_is_detached</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="key">raise</span> <span class="nam">RuntimeError</span><span class="op">(</span><span class="str">"The definition has been removed!"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"><span class="key">class</span> <span class="nam">AbstractYAMLListSubStore</span><span class="op">(</span><span class="nam">Generic</span><span class="op">[</span><span class="nam">T</span><span class="op">]</span><span class="op">,</span> <span class="nam">AbstractYAMLSubStore</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">T</span><span class="op">]</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="key">def</span> <span class="nam">_create_new_instance</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">List</span><span class="op">[</span><span class="nam">T</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="key">return</span> <span class="nam">CommentedSeq</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"><span class="key">class</span> <span class="nam">AbstractYAMLDictSubStore</span><span class="op">(</span><span class="nam">Generic</span><span class="op">[</span><span class="nam">T</span><span class="op">]</span><span class="op">,</span> <span class="nam">AbstractYAMLSubStore</span><span class="op">[</span><span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">T</span><span class="op">]</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="key">def</span> <span class="nam">_create_new_instance</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">T</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="key">return</span> <span class="nam">CommentedMap</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"><span class="key">class</span> <span class="nam">MutableCondition</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="key">def</span> <span class="nam">arch_matches</span><span class="op">(</span><span class="nam">cls</span><span class="op">,</span> <span class="nam">arch_filter</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">CommentedMap</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="key">return</span> <span class="nam">CommentedMap</span><span class="op">(</span><span class="op">{</span><span class="nam">MK_CONDITION_ARCH_MATCHES</span><span class="op">:</span> <span class="nam">arch_filter</span><span class="op">}</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="key">def</span> <span class="nam">build_profiles_matches</span><span class="op">(</span><span class="nam">cls</span><span class="op">,</span> <span class="nam">build_profiles_matches</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">CommentedMap</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> <span class="key">return</span> <span class="nam">CommentedMap</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="op">{</span><span class="nam">MK_CONDITION_BUILD_PROFILES_MATCHES</span><span class="op">:</span> <span class="nam">build_profiles_matches</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"><span class="key">class</span> <span class="nam">MutableYAMLSymlink</span><span class="op">(</span><span class="nam">AbstractYAMLDictSubStore</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="key">def</span> <span class="nam">new_symlink</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> <span class="nam">link_path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">link_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">condition</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"MutableYAMLSymlink"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="nam">inner</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="nam">MK_TRANSFORMATIONS_CREATE_SYMLINK_LINK_PATH</span><span class="op">:</span> <span class="nam">link_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> <span class="nam">MK_TRANSFORMATIONS_CREATE_SYMLINK_LINK_TARGET</span><span class="op">:</span> <span class="nam">link_target</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> <span class="nam">content</span> <span class="op">=</span> <span class="op">{</span><span class="nam">MK_TRANSFORMATIONS_CREATE_SYMLINK</span><span class="op">:</span> <span class="nam">inner</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="key">if</span> <span class="nam">condition</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">307 ↛ 308</span><span class="annotate long">line 307 didn't jump to line 308, because the condition on line 307 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="nam">inner</span><span class="op">[</span><span class="str">"when"</span><span class="op">]</span> <span class="op">=</span> <span class="nam">condition</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="key">return</span> <span class="nam">cls</span><span class="op">(</span><span class="key">None</span><span class="op">,</span> <span class="key">None</span><span class="op">,</span> <span class="nam">store</span><span class="op">=</span><span class="nam">CommentedMap</span><span class="op">(</span><span class="nam">content</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="key">def</span> <span class="nam">symlink_path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_store</span><span class="op">[</span><span class="nam">MK_TRANSFORMATIONS_CREATE_SYMLINK</span><span class="op">]</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="nam">MK_TRANSFORMATIONS_CREATE_SYMLINK_LINK_PATH</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="op">@</span><span class="nam">symlink_path</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="key">def</span> <span class="nam">symlink_path</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">path</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_store</span><span class="op">[</span><span class="nam">MK_TRANSFORMATIONS_CREATE_SYMLINK</span><span class="op">]</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="nam">MK_TRANSFORMATIONS_CREATE_SYMLINK_LINK_PATH</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="op">]</span> <span class="op">=</span> <span class="nam">path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> <span class="key">def</span> <span class="nam">symlink_target</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_store</span><span class="op">[</span><span class="nam">MK_TRANSFORMATIONS_CREATE_SYMLINK</span><span class="op">]</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> <span class="nam">MK_TRANSFORMATIONS_CREATE_SYMLINK_LINK_TARGET</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> <span class="op">@</span><span class="nam">symlink_target</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> <span class="key">def</span> <span class="nam">symlink_target</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">target</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_store</span><span class="op">[</span><span class="nam">MK_TRANSFORMATIONS_CREATE_SYMLINK</span><span class="op">]</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> <span class="nam">MK_TRANSFORMATIONS_CREATE_SYMLINK_LINK_TARGET</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> <span class="op">]</span> <span class="op">=</span> <span class="nam">target</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"><span class="key">class</span> <span class="nam">MutableYAMLConffileManagementItem</span><span class="op">(</span><span class="nam">AbstractYAMLDictSubStore</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> <span class="key">def</span> <span class="nam">rm_conffile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> <span class="nam">conffile</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"> <span class="nam">prior_to_version</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"> <span class="nam">owning_package</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"MutableYAMLConffileManagementItem"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> <span class="nam">r</span> <span class="op">=</span> <span class="nam">cls</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"> <span class="nam">store</span><span class="op">=</span><span class="nam">CommentedMap</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"> <span class="nam">MK_CONFFILE_MANAGEMENT_REMOVE</span><span class="op">:</span> <span class="nam">CommentedMap</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"> <span class="op">{</span><span class="nam">MK_CONFFILE_MANAGEMENT_REMOVE_PATH</span><span class="op">:</span> <span class="nam">conffile</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">prior_to_version</span> <span class="op">=</span> <span class="nam">prior_to_version</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">owning_package</span> <span class="op">=</span> <span class="nam">owning_package</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"> <span class="key">return</span> <span class="nam">r</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"> <span class="key">def</span> <span class="nam">mv_conffile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"> <span class="nam">old_conffile</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"> <span class="nam">new_conffile</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"> <span class="nam">prior_to_version</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"> <span class="nam">owning_package</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"MutableYAMLConffileManagementItem"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"> <span class="nam">r</span> <span class="op">=</span> <span class="nam">cls</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"> <span class="nam">store</span><span class="op">=</span><span class="nam">CommentedMap</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"> <span class="nam">MK_CONFFILE_MANAGEMENT_RENAME</span><span class="op">:</span> <span class="nam">CommentedMap</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"> <span class="nam">MK_CONFFILE_MANAGEMENT_RENAME_SOURCE</span><span class="op">:</span> <span class="nam">old_conffile</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"> <span class="nam">MK_CONFFILE_MANAGEMENT_RENAME_TARGET</span><span class="op">:</span> <span class="nam">new_conffile</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">prior_to_version</span> <span class="op">=</span> <span class="nam">prior_to_version</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">owning_package</span> <span class="op">=</span> <span class="nam">owning_package</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"> <span class="key">return</span> <span class="nam">r</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t385" href="#t385">385</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t386" href="#t386">386</a></span><span class="t"> <span class="key">def</span> <span class="nam">_container</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t387" href="#t387">387</a></span><span class="t"> <span class="key">assert</span> <span class="nam">len</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_store</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t388" href="#t388">388</a></span><span class="t"> <span class="key">return</span> <span class="nam">next</span><span class="op">(</span><span class="nam">iter</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_store</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t389" href="#t389">389</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t390" href="#t390">390</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t391" href="#t391">391</a></span><span class="t"> <span class="key">def</span> <span class="nam">command</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t392" href="#t392">392</a></span><span class="t"> <span class="key">assert</span> <span class="nam">len</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_store</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t393" href="#t393">393</a></span><span class="t"> <span class="key">return</span> <span class="nam">next</span><span class="op">(</span><span class="nam">iter</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_store</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t394" href="#t394">394</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t395" href="#t395">395</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t396" href="#t396">396</a></span><span class="t"> <span class="key">def</span> <span class="nam">obsolete_conffile</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t397" href="#t397">397</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">command</span> <span class="op">==</span> <span class="nam">MK_CONFFILE_MANAGEMENT_REMOVE</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t398" href="#t398">398</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_container</span><span class="op">[</span><span class="nam">MK_CONFFILE_MANAGEMENT_REMOVE_PATH</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t399" href="#t399">399</a></span><span class="t"> <span class="key">assert</span> <span class="nam">self</span><span class="op">.</span><span class="nam">command</span> <span class="op">==</span> <span class="nam">MK_CONFFILE_MANAGEMENT_RENAME</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t400" href="#t400">400</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_container</span><span class="op">[</span><span class="nam">MK_CONFFILE_MANAGEMENT_RENAME_SOURCE</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t401" href="#t401">401</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t402" href="#t402">402</a></span><span class="t"> <span class="op">@</span><span class="nam">obsolete_conffile</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t403" href="#t403">403</a></span><span class="t"> <span class="key">def</span> <span class="nam">obsolete_conffile</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">value</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t404" href="#t404">404</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">command</span> <span class="op">==</span> <span class="nam">MK_CONFFILE_MANAGEMENT_REMOVE</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t405" href="#t405">405</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_container</span><span class="op">[</span><span class="nam">MK_CONFFILE_MANAGEMENT_REMOVE_PATH</span><span class="op">]</span> <span class="op">=</span> <span class="nam">value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t406" href="#t406">406</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t407" href="#t407">407</a></span><span class="t"> <span class="key">assert</span> <span class="nam">self</span><span class="op">.</span><span class="nam">command</span> <span class="op">==</span> <span class="nam">MK_CONFFILE_MANAGEMENT_RENAME</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t408" href="#t408">408</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_container</span><span class="op">[</span><span class="nam">MK_CONFFILE_MANAGEMENT_RENAME_SOURCE</span><span class="op">]</span> <span class="op">=</span> <span class="nam">value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t409" href="#t409">409</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t410" href="#t410">410</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t411" href="#t411">411</a></span><span class="t"> <span class="key">def</span> <span class="nam">new_conffile</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t412" href="#t412">412</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">command</span> <span class="op">!=</span> <span class="nam">MK_CONFFILE_MANAGEMENT_RENAME</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t413" href="#t413">413</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TypeError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t414" href="#t414">414</a></span><span class="t"> <span class="str">f"The new_conffile attribute is only applicable to command {MK_CONFFILE_MANAGEMENT_RENAME}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t415" href="#t415">415</a></span><span class="t"> <span class="str">f" This is a {self.command}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t416" href="#t416">416</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t417" href="#t417">417</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_container</span><span class="op">[</span><span class="nam">MK_CONFFILE_MANAGEMENT_RENAME_TARGET</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t418" href="#t418">418</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t419" href="#t419">419</a></span><span class="t"> <span class="op">@</span><span class="nam">new_conffile</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t420" href="#t420">420</a></span><span class="t"> <span class="key">def</span> <span class="nam">new_conffile</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">value</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t421" href="#t421">421</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">command</span> <span class="op">!=</span> <span class="nam">MK_CONFFILE_MANAGEMENT_RENAME</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t422" href="#t422">422</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TypeError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t423" href="#t423">423</a></span><span class="t"> <span class="str">f"The new_conffile attribute is only applicable to command {MK_CONFFILE_MANAGEMENT_RENAME}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t424" href="#t424">424</a></span><span class="t"> <span class="str">f" This is a {self.command}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t425" href="#t425">425</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t426" href="#t426">426</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_container</span><span class="op">[</span><span class="nam">MK_CONFFILE_MANAGEMENT_RENAME_TARGET</span><span class="op">]</span> <span class="op">=</span> <span class="nam">value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t427" href="#t427">427</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t428" href="#t428">428</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t429" href="#t429">429</a></span><span class="t"> <span class="key">def</span> <span class="nam">prior_to_version</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t430" href="#t430">430</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_container</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">MK_CONFFILE_MANAGEMENT_X_PRIOR_TO_VERSION</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t431" href="#t431">431</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t432" href="#t432">432</a></span><span class="t"> <span class="op">@</span><span class="nam">prior_to_version</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t433" href="#t433">433</a></span><span class="t"> <span class="key">def</span> <span class="nam">prior_to_version</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">value</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t434" href="#t434">434</a></span><span class="t"> <span class="key">if</span> <span class="nam">value</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t435" href="#t435">435</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t436" href="#t436">436</a></span><span class="t"> <span class="key">del</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_container</span><span class="op">[</span><span class="nam">MK_CONFFILE_MANAGEMENT_X_PRIOR_TO_VERSION</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t437" href="#t437">437</a></span><span class="t"> <span class="key">except</span> <span class="nam">KeyError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t438" href="#t438">438</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t439" href="#t439">439</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t440" href="#t440">440</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_container</span><span class="op">[</span><span class="nam">MK_CONFFILE_MANAGEMENT_X_PRIOR_TO_VERSION</span><span class="op">]</span> <span class="op">=</span> <span class="nam">value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t441" href="#t441">441</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t442" href="#t442">442</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t443" href="#t443">443</a></span><span class="t"> <span class="key">def</span> <span class="nam">owning_package</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t444" href="#t444">444</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_container</span><span class="op">[</span><span class="nam">MK_CONFFILE_MANAGEMENT_X_PRIOR_TO_VERSION</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t445" href="#t445">445</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t446" href="#t446">446</a></span><span class="t"> <span class="op">@</span><span class="nam">owning_package</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t447" href="#t447">447</a></span><span class="t"> <span class="key">def</span> <span class="nam">owning_package</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">value</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t448" href="#t448">448</a></span><span class="t"> <span class="key">if</span> <span class="nam">value</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t449" href="#t449">449</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t450" href="#t450">450</a></span><span class="t"> <span class="key">del</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_container</span><span class="op">[</span><span class="nam">MK_CONFFILE_MANAGEMENT_X_OWNING_PACKAGE</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t451" href="#t451">451</a></span><span class="t"> <span class="key">except</span> <span class="nam">KeyError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t452" href="#t452">452</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t453" href="#t453">453</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t454" href="#t454">454</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_container</span><span class="op">[</span><span class="nam">MK_CONFFILE_MANAGEMENT_X_OWNING_PACKAGE</span><span class="op">]</span> <span class="op">=</span> <span class="nam">value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t455" href="#t455">455</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t456" href="#t456">456</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t457" href="#t457">457</a></span><span class="t"><span class="key">class</span> <span class="nam">MutableYAMLPackageDefinition</span><span class="op">(</span><span class="nam">AbstractYAMLDictSubStore</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t458" href="#t458">458</a></span><span class="t"> <span class="key">def</span> <span class="nam">_list_store</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t459" href="#t459">459</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> <span class="nam">key</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">create_if_absent</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t460" href="#t460">460</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t461" href="#t461">461</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_is_detached</span> <span class="key">or</span> <span class="nam">key</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_store</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t462" href="#t462">462</a></span><span class="t"> <span class="key">if</span> <span class="nam">create_if_absent</span><span class="op">:</span> </span><span class="r"><span class="annotate short">462 ↛ 463</span><span class="annotate long">line 462 didn't jump to line 463, because the condition on line 462 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t463" href="#t463">463</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t464" href="#t464">464</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">create_definition_if_missing</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t465" href="#t465">465</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_store</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t466" href="#t466">466</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_store</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t467" href="#t467">467</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t468" href="#t468">468</a></span><span class="t"> <span class="key">def</span> <span class="nam">_insert_item</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">key</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">item</span><span class="op">:</span> <span class="nam">AbstractYAMLDictSubStore</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t469" href="#t469">469</a></span><span class="t"> <span class="nam">parent_store</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_list_store</span><span class="op">(</span><span class="nam">key</span><span class="op">,</span> <span class="nam">create_if_absent</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t470" href="#t470">470</a></span><span class="t"> <span class="key">assert</span> <span class="nam">parent_store</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t471" href="#t471">471</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">item</span><span class="op">.</span><span class="nam">_is_detached</span> <span class="key">or</span> <span class="op">(</span> </span><span class="r"><span class="annotate short">471 ↛ 474</span><span class="annotate long">line 471 didn't jump to line 474, because the condition on line 471 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t472" href="#t472">472</a></span><span class="t"> <span class="nam">item</span><span class="op">.</span><span class="nam">_parent_store</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">item</span><span class="op">.</span><span class="nam">_parent_store</span> <span class="key">is</span> <span class="key">not</span> <span class="nam">parent_store</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t473" href="#t473">473</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t474" href="#t474">474</a></span><span class="t"> <span class="key">raise</span> <span class="nam">RuntimeError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t475" href="#t475">475</a></span><span class="t"> <span class="str">"Item is already attached or associated with a different container"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t476" href="#t476">476</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t477" href="#t477">477</a></span><span class="t"> <span class="nam">item</span><span class="op">.</span><span class="nam">_parent_store</span> <span class="op">=</span> <span class="nam">parent_store</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t478" href="#t478">478</a></span><span class="t"> <span class="nam">item</span><span class="op">.</span><span class="nam">create_definition</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t479" href="#t479">479</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t480" href="#t480">480</a></span><span class="t"> <span class="key">def</span> <span class="nam">add_symlink</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">symlink</span><span class="op">:</span> <span class="nam">MutableYAMLSymlink</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t481" href="#t481">481</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_insert_item</span><span class="op">(</span><span class="nam">MK_TRANSFORMATIONS</span><span class="op">,</span> <span class="nam">symlink</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t482" href="#t482">482</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t483" href="#t483">483</a></span><span class="t"> <span class="key">def</span> <span class="nam">symlinks</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">MutableYAMLSymlink</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t484" href="#t484">484</a></span><span class="t"> <span class="nam">store</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_list_store</span><span class="op">(</span><span class="nam">MK_TRANSFORMATIONS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t485" href="#t485">485</a></span><span class="t"> <span class="key">if</span> <span class="nam">store</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">485 ↛ 486</span><span class="annotate long">line 485 didn't jump to line 486, because the condition on line 485 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t486" href="#t486">486</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t487" href="#t487">487</a></span><span class="t"> <span class="key">for</span> <span class="nam">i</span> <span class="key">in</span> <span class="nam">range</span><span class="op">(</span><span class="nam">len</span><span class="op">(</span><span class="nam">store</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">487 ↛ 488</span><span class="annotate long">line 487 didn't jump to line 488, because the loop on line 487 never started</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t488" href="#t488">488</a></span><span class="t"> <span class="nam">d</span> <span class="op">=</span> <span class="nam">store</span><span class="op">[</span><span class="nam">i</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t489" href="#t489">489</a></span><span class="t"> <span class="key">if</span> <span class="nam">d</span> <span class="key">and</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">d</span><span class="op">,</span> <span class="nam">dict</span><span class="op">)</span> <span class="key">and</span> <span class="nam">len</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span> <span class="key">and</span> <span class="str">"symlink"</span> <span class="key">in</span> <span class="nam">d</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t490" href="#t490">490</a></span><span class="t"> <span class="key">yield</span> <span class="nam">MutableYAMLSymlink</span><span class="op">(</span><span class="nam">store</span><span class="op">,</span> <span class="nam">i</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t491" href="#t491">491</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t492" href="#t492">492</a></span><span class="t"> <span class="key">def</span> <span class="nam">conffile_management_items</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">MutableYAMLConffileManagementItem</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t493" href="#t493">493</a></span><span class="t"> <span class="nam">store</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_list_store</span><span class="op">(</span><span class="nam">MK_CONFFILE_MANAGEMENT</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t494" href="#t494">494</a></span><span class="t"> <span class="key">if</span> <span class="nam">store</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">494 ↛ 495</span><span class="annotate long">line 494 didn't jump to line 495, because the condition on line 494 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t495" href="#t495">495</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t496" href="#t496">496</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t497" href="#t497">497</a></span><span class="t"> <span class="nam">MutableYAMLConffileManagementItem</span><span class="op">(</span><span class="nam">store</span><span class="op">,</span> <span class="nam">i</span><span class="op">)</span> <span class="key">for</span> <span class="nam">i</span> <span class="key">in</span> <span class="nam">range</span><span class="op">(</span><span class="nam">len</span><span class="op">(</span><span class="nam">store</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t498" href="#t498">498</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t499" href="#t499">499</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t500" href="#t500">500</a></span><span class="t"> <span class="key">def</span> <span class="nam">add_conffile_management</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t501" href="#t501">501</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> <span class="nam">conffile_management_item</span><span class="op">:</span> <span class="nam">MutableYAMLConffileManagementItem</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t502" href="#t502">502</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t503" href="#t503">503</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_insert_item</span><span class="op">(</span><span class="nam">MK_CONFFILE_MANAGEMENT</span><span class="op">,</span> <span class="nam">conffile_management_item</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t504" href="#t504">504</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t505" href="#t505">505</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t506" href="#t506">506</a></span><span class="t"><span class="key">class</span> <span class="nam">AbstractMutableYAMLInstallRule</span><span class="op">(</span><span class="nam">AbstractYAMLDictSubStore</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t507" href="#t507">507</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t508" href="#t508">508</a></span><span class="t"> <span class="key">def</span> <span class="nam">_container</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t509" href="#t509">509</a></span><span class="t"> <span class="key">assert</span> <span class="nam">len</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_store</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t510" href="#t510">510</a></span><span class="t"> <span class="key">return</span> <span class="nam">next</span><span class="op">(</span><span class="nam">iter</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_store</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t511" href="#t511">511</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t512" href="#t512">512</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t513" href="#t513">513</a></span><span class="t"> <span class="key">def</span> <span class="nam">into</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t514" href="#t514">514</a></span><span class="t"> <span class="nam">v</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_container</span><span class="op">[</span><span class="nam">MK_INSTALLATIONS_INSTALL_INTO</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t515" href="#t515">515</a></span><span class="t"> <span class="key">if</span> <span class="nam">v</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t516" href="#t516">516</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t517" href="#t517">517</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t518" href="#t518">518</a></span><span class="t"> <span class="key">return</span> <span class="op">[</span><span class="nam">v</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t519" href="#t519">519</a></span><span class="t"> <span class="key">return</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t520" href="#t520">520</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t521" href="#t521">521</a></span><span class="t"> <span class="op">@</span><span class="nam">into</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t522" href="#t522">522</a></span><span class="t"> <span class="key">def</span> <span class="nam">into</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">new_value</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t523" href="#t523">523</a></span><span class="t"> <span class="key">if</span> <span class="nam">new_value</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">523 ↛ 527</span><span class="annotate long">line 523 didn't jump to line 527, because the condition on line 523 was never false</span></span></p> - <p class="run"><span class="n"><a id="t524" href="#t524">524</a></span><span class="t"> <span class="key">with</span> <span class="nam">suppress</span><span class="op">(</span><span class="nam">KeyError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t525" href="#t525">525</a></span><span class="t"> <span class="key">del</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_container</span><span class="op">[</span><span class="nam">MK_INSTALLATIONS_INSTALL_INTO</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t526" href="#t526">526</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t527" href="#t527">527</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">new_value</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t528" href="#t528">528</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_container</span><span class="op">[</span><span class="nam">MK_INSTALLATIONS_INSTALL_INTO</span><span class="op">]</span> <span class="op">=</span> <span class="nam">new_value</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t529" href="#t529">529</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t530" href="#t530">530</a></span><span class="t"> <span class="nam">new_list</span> <span class="op">=</span> <span class="nam">CommentedSeq</span><span class="op">(</span><span class="nam">new_value</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t531" href="#t531">531</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_container</span><span class="op">[</span><span class="nam">MK_INSTALLATIONS_INSTALL_INTO</span><span class="op">]</span> <span class="op">=</span> <span class="nam">new_list</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t532" href="#t532">532</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t533" href="#t533">533</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t534" href="#t534">534</a></span><span class="t"> <span class="key">def</span> <span class="nam">when</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t535" href="#t535">535</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_container</span><span class="op">[</span><span class="nam">MK_CONDITION_WHEN</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t536" href="#t536">536</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t537" href="#t537">537</a></span><span class="t"> <span class="op">@</span><span class="nam">when</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t538" href="#t538">538</a></span><span class="t"> <span class="key">def</span> <span class="nam">when</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">new_value</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t539" href="#t539">539</a></span><span class="t"> <span class="key">if</span> <span class="nam">new_value</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">539 ↛ 540</span><span class="annotate long">line 539 didn't jump to line 540, because the condition on line 539 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t540" href="#t540">540</a></span><span class="t"> <span class="key">with</span> <span class="nam">suppress</span><span class="op">(</span><span class="nam">KeyError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t541" href="#t541">541</a></span><span class="t"> <span class="key">del</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_container</span><span class="op">[</span><span class="nam">MK_CONDITION_WHEN</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t542" href="#t542">542</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t543" href="#t543">543</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">new_value</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">543 ↛ 544</span><span class="annotate long">line 543 didn't jump to line 544, because the condition on line 543 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t544" href="#t544">544</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_container</span><span class="op">[</span><span class="nam">MK_CONDITION_WHEN</span><span class="op">]</span> <span class="op">=</span> <span class="nam">new_value</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t545" href="#t545">545</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t546" href="#t546">546</a></span><span class="t"> <span class="nam">new_map</span> <span class="op">=</span> <span class="nam">CommentedMap</span><span class="op">(</span><span class="nam">new_value</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t547" href="#t547">547</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_container</span><span class="op">[</span><span class="nam">MK_CONDITION_WHEN</span><span class="op">]</span> <span class="op">=</span> <span class="nam">new_map</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t548" href="#t548">548</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t549" href="#t549">549</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t550" href="#t550">550</a></span><span class="t"> <span class="key">def</span> <span class="nam">install_dest</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t551" href="#t551">551</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t552" href="#t552">552</a></span><span class="t"> <span class="nam">sources</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t553" href="#t553">553</a></span><span class="t"> <span class="nam">into</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t554" href="#t554">554</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t555" href="#t555">555</a></span><span class="t"> <span class="nam">dest_dir</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t556" href="#t556">556</a></span><span class="t"> <span class="nam">when</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t557" href="#t557">557</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"MutableYAMLInstallRuleInstall"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t558" href="#t558">558</a></span><span class="t"> <span class="nam">k</span> <span class="op">=</span> <span class="nam">MK_INSTALLATIONS_INSTALL_SOURCES</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t559" href="#t559">559</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">sources</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t560" href="#t560">560</a></span><span class="t"> <span class="nam">k</span> <span class="op">=</span> <span class="nam">MK_INSTALLATIONS_INSTALL_SOURCE</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t561" href="#t561">561</a></span><span class="t"> <span class="nam">r</span> <span class="op">=</span> <span class="nam">MutableYAMLInstallRuleInstall</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t562" href="#t562">562</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t563" href="#t563">563</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t564" href="#t564">564</a></span><span class="t"> <span class="nam">store</span><span class="op">=</span><span class="nam">CommentedMap</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t565" href="#t565">565</a></span><span class="t"> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t566" href="#t566">566</a></span><span class="t"> <span class="nam">MK_INSTALLATIONS_INSTALL</span><span class="op">:</span> <span class="nam">CommentedMap</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t567" href="#t567">567</a></span><span class="t"> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t568" href="#t568">568</a></span><span class="t"> <span class="nam">k</span><span class="op">:</span> <span class="nam">sources</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t569" href="#t569">569</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t570" href="#t570">570</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t571" href="#t571">571</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t572" href="#t572">572</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t573" href="#t573">573</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t574" href="#t574">574</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">dest_dir</span> <span class="op">=</span> <span class="nam">dest_dir</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t575" href="#t575">575</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">into</span> <span class="op">=</span> <span class="nam">into</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t576" href="#t576">576</a></span><span class="t"> <span class="key">if</span> <span class="nam">when</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t577" href="#t577">577</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">when</span> <span class="op">=</span> <span class="nam">when</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t578" href="#t578">578</a></span><span class="t"> <span class="key">return</span> <span class="nam">r</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t579" href="#t579">579</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t580" href="#t580">580</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t581" href="#t581">581</a></span><span class="t"> <span class="key">def</span> <span class="nam">multi_dest_install</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t582" href="#t582">582</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t583" href="#t583">583</a></span><span class="t"> <span class="nam">sources</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t584" href="#t584">584</a></span><span class="t"> <span class="nam">dest_dirs</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t585" href="#t585">585</a></span><span class="t"> <span class="nam">into</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t586" href="#t586">586</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t587" href="#t587">587</a></span><span class="t"> <span class="nam">when</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t588" href="#t588">588</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"MutableYAMLInstallRuleInstall"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t589" href="#t589">589</a></span><span class="t"> <span class="nam">k</span> <span class="op">=</span> <span class="nam">MK_INSTALLATIONS_INSTALL_SOURCES</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t590" href="#t590">590</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">sources</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">590 ↛ 592</span><span class="annotate long">line 590 didn't jump to line 592, because the condition on line 590 was never false</span></span></p> - <p class="run"><span class="n"><a id="t591" href="#t591">591</a></span><span class="t"> <span class="nam">k</span> <span class="op">=</span> <span class="nam">MK_INSTALLATIONS_INSTALL_SOURCE</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t592" href="#t592">592</a></span><span class="t"> <span class="nam">r</span> <span class="op">=</span> <span class="nam">MutableYAMLInstallRuleInstall</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t593" href="#t593">593</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t594" href="#t594">594</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t595" href="#t595">595</a></span><span class="t"> <span class="nam">store</span><span class="op">=</span><span class="nam">CommentedMap</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t596" href="#t596">596</a></span><span class="t"> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t597" href="#t597">597</a></span><span class="t"> <span class="nam">MK_INSTALLATIONS_MULTI_DEST_INSTALL</span><span class="op">:</span> <span class="nam">CommentedMap</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t598" href="#t598">598</a></span><span class="t"> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t599" href="#t599">599</a></span><span class="t"> <span class="nam">k</span><span class="op">:</span> <span class="nam">sources</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t600" href="#t600">600</a></span><span class="t"> <span class="str">"dest-dirs"</span><span class="op">:</span> <span class="nam">dest_dirs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t601" href="#t601">601</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t602" href="#t602">602</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t603" href="#t603">603</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t604" href="#t604">604</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t605" href="#t605">605</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t606" href="#t606">606</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">into</span> <span class="op">=</span> <span class="nam">into</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t607" href="#t607">607</a></span><span class="t"> <span class="key">if</span> <span class="nam">when</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">607 ↛ 608</span><span class="annotate long">line 607 didn't jump to line 608, because the condition on line 607 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t608" href="#t608">608</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">when</span> <span class="op">=</span> <span class="nam">when</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t609" href="#t609">609</a></span><span class="t"> <span class="key">return</span> <span class="nam">r</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t610" href="#t610">610</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t611" href="#t611">611</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t612" href="#t612">612</a></span><span class="t"> <span class="key">def</span> <span class="nam">install_as</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t613" href="#t613">613</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t614" href="#t614">614</a></span><span class="t"> <span class="nam">source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t615" href="#t615">615</a></span><span class="t"> <span class="nam">install_as</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t616" href="#t616">616</a></span><span class="t"> <span class="nam">into</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t617" href="#t617">617</a></span><span class="t"> <span class="nam">when</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t618" href="#t618">618</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"MutableYAMLInstallRuleInstall"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t619" href="#t619">619</a></span><span class="t"> <span class="nam">r</span> <span class="op">=</span> <span class="nam">MutableYAMLInstallRuleInstall</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t620" href="#t620">620</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t621" href="#t621">621</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t622" href="#t622">622</a></span><span class="t"> <span class="nam">store</span><span class="op">=</span><span class="nam">CommentedMap</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t623" href="#t623">623</a></span><span class="t"> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t624" href="#t624">624</a></span><span class="t"> <span class="nam">MK_INSTALLATIONS_INSTALL</span><span class="op">:</span> <span class="nam">CommentedMap</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t625" href="#t625">625</a></span><span class="t"> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t626" href="#t626">626</a></span><span class="t"> <span class="nam">MK_INSTALLATIONS_INSTALL_SOURCE</span><span class="op">:</span> <span class="nam">source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t627" href="#t627">627</a></span><span class="t"> <span class="nam">MK_INSTALLATIONS_INSTALL_AS</span><span class="op">:</span> <span class="nam">install_as</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t628" href="#t628">628</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t629" href="#t629">629</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t630" href="#t630">630</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t631" href="#t631">631</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t632" href="#t632">632</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t633" href="#t633">633</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">into</span> <span class="op">=</span> <span class="nam">into</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t634" href="#t634">634</a></span><span class="t"> <span class="key">if</span> <span class="nam">when</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">634 ↛ 635</span><span class="annotate long">line 634 didn't jump to line 635, because the condition on line 634 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t635" href="#t635">635</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">when</span> <span class="op">=</span> <span class="nam">when</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t636" href="#t636">636</a></span><span class="t"> <span class="key">return</span> <span class="nam">r</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t637" href="#t637">637</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t638" href="#t638">638</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t639" href="#t639">639</a></span><span class="t"> <span class="key">def</span> <span class="nam">install_doc_as</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t640" href="#t640">640</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t641" href="#t641">641</a></span><span class="t"> <span class="nam">source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t642" href="#t642">642</a></span><span class="t"> <span class="nam">install_as</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t643" href="#t643">643</a></span><span class="t"> <span class="nam">into</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t644" href="#t644">644</a></span><span class="t"> <span class="nam">when</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t645" href="#t645">645</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"MutableYAMLInstallRuleInstall"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t646" href="#t646">646</a></span><span class="t"> <span class="nam">r</span> <span class="op">=</span> <span class="nam">MutableYAMLInstallRuleInstall</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t647" href="#t647">647</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t648" href="#t648">648</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t649" href="#t649">649</a></span><span class="t"> <span class="nam">store</span><span class="op">=</span><span class="nam">CommentedMap</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t650" href="#t650">650</a></span><span class="t"> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t651" href="#t651">651</a></span><span class="t"> <span class="nam">MK_INSTALLATIONS_INSTALL_DOCS</span><span class="op">:</span> <span class="nam">CommentedMap</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t652" href="#t652">652</a></span><span class="t"> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t653" href="#t653">653</a></span><span class="t"> <span class="nam">MK_INSTALLATIONS_INSTALL_SOURCE</span><span class="op">:</span> <span class="nam">source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t654" href="#t654">654</a></span><span class="t"> <span class="nam">MK_INSTALLATIONS_INSTALL_AS</span><span class="op">:</span> <span class="nam">install_as</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t655" href="#t655">655</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t656" href="#t656">656</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t657" href="#t657">657</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t658" href="#t658">658</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t659" href="#t659">659</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t660" href="#t660">660</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">into</span> <span class="op">=</span> <span class="nam">into</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t661" href="#t661">661</a></span><span class="t"> <span class="key">if</span> <span class="nam">when</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t662" href="#t662">662</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">when</span> <span class="op">=</span> <span class="nam">when</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t663" href="#t663">663</a></span><span class="t"> <span class="key">return</span> <span class="nam">r</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t664" href="#t664">664</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t665" href="#t665">665</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t666" href="#t666">666</a></span><span class="t"> <span class="key">def</span> <span class="nam">install_docs</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t667" href="#t667">667</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t668" href="#t668">668</a></span><span class="t"> <span class="nam">sources</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t669" href="#t669">669</a></span><span class="t"> <span class="nam">into</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t670" href="#t670">670</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t671" href="#t671">671</a></span><span class="t"> <span class="nam">dest_dir</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t672" href="#t672">672</a></span><span class="t"> <span class="nam">when</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t673" href="#t673">673</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"MutableYAMLInstallRuleInstall"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t674" href="#t674">674</a></span><span class="t"> <span class="nam">k</span> <span class="op">=</span> <span class="nam">MK_INSTALLATIONS_INSTALL_SOURCES</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t675" href="#t675">675</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">sources</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t676" href="#t676">676</a></span><span class="t"> <span class="nam">k</span> <span class="op">=</span> <span class="nam">MK_INSTALLATIONS_INSTALL_SOURCE</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t677" href="#t677">677</a></span><span class="t"> <span class="nam">r</span> <span class="op">=</span> <span class="nam">MutableYAMLInstallRuleInstall</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t678" href="#t678">678</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t679" href="#t679">679</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t680" href="#t680">680</a></span><span class="t"> <span class="nam">store</span><span class="op">=</span><span class="nam">CommentedMap</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t681" href="#t681">681</a></span><span class="t"> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t682" href="#t682">682</a></span><span class="t"> <span class="nam">MK_INSTALLATIONS_INSTALL_DOCS</span><span class="op">:</span> <span class="nam">CommentedMap</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t683" href="#t683">683</a></span><span class="t"> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t684" href="#t684">684</a></span><span class="t"> <span class="nam">k</span><span class="op">:</span> <span class="nam">sources</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t685" href="#t685">685</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t686" href="#t686">686</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t687" href="#t687">687</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t688" href="#t688">688</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t689" href="#t689">689</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t690" href="#t690">690</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">into</span> <span class="op">=</span> <span class="nam">into</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t691" href="#t691">691</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">dest_dir</span> <span class="op">=</span> <span class="nam">dest_dir</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t692" href="#t692">692</a></span><span class="t"> <span class="key">if</span> <span class="nam">when</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t693" href="#t693">693</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">when</span> <span class="op">=</span> <span class="nam">when</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t694" href="#t694">694</a></span><span class="t"> <span class="key">return</span> <span class="nam">r</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t695" href="#t695">695</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t696" href="#t696">696</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t697" href="#t697">697</a></span><span class="t"> <span class="key">def</span> <span class="nam">install_examples</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t698" href="#t698">698</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t699" href="#t699">699</a></span><span class="t"> <span class="nam">sources</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t700" href="#t700">700</a></span><span class="t"> <span class="nam">into</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t701" href="#t701">701</a></span><span class="t"> <span class="nam">when</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t702" href="#t702">702</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"MutableYAMLInstallRuleInstallExamples"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t703" href="#t703">703</a></span><span class="t"> <span class="nam">k</span> <span class="op">=</span> <span class="nam">MK_INSTALLATIONS_INSTALL_SOURCES</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t704" href="#t704">704</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">sources</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t705" href="#t705">705</a></span><span class="t"> <span class="nam">k</span> <span class="op">=</span> <span class="nam">MK_INSTALLATIONS_INSTALL_SOURCE</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t706" href="#t706">706</a></span><span class="t"> <span class="nam">r</span> <span class="op">=</span> <span class="nam">MutableYAMLInstallRuleInstallExamples</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t707" href="#t707">707</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t708" href="#t708">708</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t709" href="#t709">709</a></span><span class="t"> <span class="nam">store</span><span class="op">=</span><span class="nam">CommentedMap</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t710" href="#t710">710</a></span><span class="t"> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t711" href="#t711">711</a></span><span class="t"> <span class="nam">MK_INSTALLATIONS_INSTALL_EXAMPLES</span><span class="op">:</span> <span class="nam">CommentedMap</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t712" href="#t712">712</a></span><span class="t"> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t713" href="#t713">713</a></span><span class="t"> <span class="nam">k</span><span class="op">:</span> <span class="nam">sources</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t714" href="#t714">714</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t715" href="#t715">715</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t716" href="#t716">716</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t717" href="#t717">717</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t718" href="#t718">718</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t719" href="#t719">719</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">into</span> <span class="op">=</span> <span class="nam">into</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t720" href="#t720">720</a></span><span class="t"> <span class="key">if</span> <span class="nam">when</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">720 ↛ 721</span><span class="annotate long">line 720 didn't jump to line 721, because the condition on line 720 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t721" href="#t721">721</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">when</span> <span class="op">=</span> <span class="nam">when</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t722" href="#t722">722</a></span><span class="t"> <span class="key">return</span> <span class="nam">r</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t723" href="#t723">723</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t724" href="#t724">724</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t725" href="#t725">725</a></span><span class="t"> <span class="key">def</span> <span class="nam">install_man</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t726" href="#t726">726</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t727" href="#t727">727</a></span><span class="t"> <span class="nam">sources</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t728" href="#t728">728</a></span><span class="t"> <span class="nam">into</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t729" href="#t729">729</a></span><span class="t"> <span class="nam">language</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t730" href="#t730">730</a></span><span class="t"> <span class="nam">when</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t731" href="#t731">731</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"MutableYAMLInstallRuleMan"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t732" href="#t732">732</a></span><span class="t"> <span class="nam">k</span> <span class="op">=</span> <span class="nam">MK_INSTALLATIONS_INSTALL_SOURCES</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t733" href="#t733">733</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">sources</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">733 ↛ 734</span><span class="annotate long">line 733 didn't jump to line 734, because the condition on line 733 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t734" href="#t734">734</a></span><span class="t"> <span class="nam">k</span> <span class="op">=</span> <span class="nam">MK_INSTALLATIONS_INSTALL_SOURCE</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t735" href="#t735">735</a></span><span class="t"> <span class="nam">r</span> <span class="op">=</span> <span class="nam">MutableYAMLInstallRuleMan</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t736" href="#t736">736</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t737" href="#t737">737</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t738" href="#t738">738</a></span><span class="t"> <span class="nam">store</span><span class="op">=</span><span class="nam">CommentedMap</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t739" href="#t739">739</a></span><span class="t"> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t740" href="#t740">740</a></span><span class="t"> <span class="nam">MK_INSTALLATIONS_INSTALL_MAN</span><span class="op">:</span> <span class="nam">CommentedMap</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t741" href="#t741">741</a></span><span class="t"> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t742" href="#t742">742</a></span><span class="t"> <span class="nam">k</span><span class="op">:</span> <span class="nam">sources</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t743" href="#t743">743</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t744" href="#t744">744</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t745" href="#t745">745</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t746" href="#t746">746</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t747" href="#t747">747</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t748" href="#t748">748</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">language</span> <span class="op">=</span> <span class="nam">language</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t749" href="#t749">749</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">into</span> <span class="op">=</span> <span class="nam">into</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t750" href="#t750">750</a></span><span class="t"> <span class="key">if</span> <span class="nam">when</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">750 ↛ 751</span><span class="annotate long">line 750 didn't jump to line 751, because the condition on line 750 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t751" href="#t751">751</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">when</span> <span class="op">=</span> <span class="nam">when</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t752" href="#t752">752</a></span><span class="t"> <span class="key">return</span> <span class="nam">r</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t753" href="#t753">753</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t754" href="#t754">754</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t755" href="#t755">755</a></span><span class="t"> <span class="key">def</span> <span class="nam">discard</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t756" href="#t756">756</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t757" href="#t757">757</a></span><span class="t"> <span class="nam">sources</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t758" href="#t758">758</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"MutableYAMLInstallRuleDiscard"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t759" href="#t759">759</a></span><span class="t"> <span class="key">return</span> <span class="nam">MutableYAMLInstallRuleDiscard</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t760" href="#t760">760</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t761" href="#t761">761</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t762" href="#t762">762</a></span><span class="t"> <span class="nam">store</span><span class="op">=</span><span class="nam">CommentedMap</span><span class="op">(</span><span class="op">{</span><span class="nam">MK_INSTALLATIONS_DISCARD</span><span class="op">:</span> <span class="nam">sources</span><span class="op">}</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t763" href="#t763">763</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t764" href="#t764">764</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t765" href="#t765">765</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t766" href="#t766">766</a></span><span class="t"><span class="key">class</span> <span class="nam">MutableYAMLInstallRuleInstallExamples</span><span class="op">(</span><span class="nam">AbstractMutableYAMLInstallRule</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t767" href="#t767">767</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t768" href="#t768">768</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t769" href="#t769">769</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t770" href="#t770">770</a></span><span class="t"><span class="key">class</span> <span class="nam">MutableYAMLInstallRuleMan</span><span class="op">(</span><span class="nam">AbstractMutableYAMLInstallRule</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t771" href="#t771">771</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t772" href="#t772">772</a></span><span class="t"> <span class="key">def</span> <span class="nam">language</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t773" href="#t773">773</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_container</span><span class="op">[</span><span class="nam">MK_INSTALLATIONS_INSTALL_MAN_LANGUAGE</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t774" href="#t774">774</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t775" href="#t775">775</a></span><span class="t"> <span class="op">@</span><span class="nam">language</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t776" href="#t776">776</a></span><span class="t"> <span class="key">def</span> <span class="nam">language</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">new_value</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t777" href="#t777">777</a></span><span class="t"> <span class="key">if</span> <span class="nam">new_value</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t778" href="#t778">778</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_container</span><span class="op">[</span><span class="nam">MK_INSTALLATIONS_INSTALL_MAN_LANGUAGE</span><span class="op">]</span> <span class="op">=</span> <span class="nam">new_value</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t779" href="#t779">779</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t780" href="#t780">780</a></span><span class="t"> <span class="key">with</span> <span class="nam">suppress</span><span class="op">(</span><span class="nam">KeyError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t781" href="#t781">781</a></span><span class="t"> <span class="key">del</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_container</span><span class="op">[</span><span class="nam">MK_INSTALLATIONS_INSTALL_MAN_LANGUAGE</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t782" href="#t782">782</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t783" href="#t783">783</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t784" href="#t784">784</a></span><span class="t"><span class="key">class</span> <span class="nam">MutableYAMLInstallRuleDiscard</span><span class="op">(</span><span class="nam">AbstractMutableYAMLInstallRule</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t785" href="#t785">785</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t786" href="#t786">786</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t787" href="#t787">787</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t788" href="#t788">788</a></span><span class="t"><span class="key">class</span> <span class="nam">MutableYAMLInstallRuleInstall</span><span class="op">(</span><span class="nam">AbstractMutableYAMLInstallRule</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t789" href="#t789">789</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t790" href="#t790">790</a></span><span class="t"> <span class="key">def</span> <span class="nam">sources</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t791" href="#t791">791</a></span><span class="t"> <span class="nam">v</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_container</span><span class="op">[</span><span class="nam">MK_INSTALLATIONS_INSTALL_SOURCES</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t792" href="#t792">792</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t793" href="#t793">793</a></span><span class="t"> <span class="key">return</span> <span class="op">[</span><span class="nam">v</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t794" href="#t794">794</a></span><span class="t"> <span class="key">return</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t795" href="#t795">795</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t796" href="#t796">796</a></span><span class="t"> <span class="op">@</span><span class="nam">sources</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t797" href="#t797">797</a></span><span class="t"> <span class="key">def</span> <span class="nam">sources</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">new_value</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t798" href="#t798">798</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">new_value</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t799" href="#t799">799</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_container</span><span class="op">[</span><span class="nam">MK_INSTALLATIONS_INSTALL_SOURCES</span><span class="op">]</span> <span class="op">=</span> <span class="nam">new_value</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t800" href="#t800">800</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t801" href="#t801">801</a></span><span class="t"> <span class="nam">new_list</span> <span class="op">=</span> <span class="nam">CommentedSeq</span><span class="op">(</span><span class="nam">new_value</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t802" href="#t802">802</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_container</span><span class="op">[</span><span class="nam">MK_INSTALLATIONS_INSTALL_SOURCES</span><span class="op">]</span> <span class="op">=</span> <span class="nam">new_list</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t803" href="#t803">803</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t804" href="#t804">804</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t805" href="#t805">805</a></span><span class="t"> <span class="key">def</span> <span class="nam">dest_dir</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t806" href="#t806">806</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_container</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">MK_INSTALLATIONS_INSTALL_DEST_DIR</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t807" href="#t807">807</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t808" href="#t808">808</a></span><span class="t"> <span class="op">@</span><span class="nam">dest_dir</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t809" href="#t809">809</a></span><span class="t"> <span class="key">def</span> <span class="nam">dest_dir</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">new_value</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t810" href="#t810">810</a></span><span class="t"> <span class="key">if</span> <span class="nam">new_value</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">self</span><span class="op">.</span><span class="nam">dest_as</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">810 ↛ 811</span><span class="annotate long">line 810 didn't jump to line 811, because the condition on line 810 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t811" href="#t811">811</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t812" href="#t812">812</a></span><span class="t"> <span class="str">f'Cannot both have a "{MK_INSTALLATIONS_INSTALL_DEST_DIR}" and'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t813" href="#t813">813</a></span><span class="t"> <span class="str">f' "{MK_INSTALLATIONS_INSTALL_AS}"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t814" href="#t814">814</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t815" href="#t815">815</a></span><span class="t"> <span class="key">if</span> <span class="nam">new_value</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t816" href="#t816">816</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_container</span><span class="op">[</span><span class="nam">MK_INSTALLATIONS_INSTALL_DEST_DIR</span><span class="op">]</span> <span class="op">=</span> <span class="nam">new_value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t817" href="#t817">817</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t818" href="#t818">818</a></span><span class="t"> <span class="key">with</span> <span class="nam">suppress</span><span class="op">(</span><span class="nam">KeyError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t819" href="#t819">819</a></span><span class="t"> <span class="key">del</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_container</span><span class="op">[</span><span class="nam">MK_INSTALLATIONS_INSTALL_DEST_DIR</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t820" href="#t820">820</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t821" href="#t821">821</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t822" href="#t822">822</a></span><span class="t"> <span class="key">def</span> <span class="nam">dest_as</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t823" href="#t823">823</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_container</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">MK_INSTALLATIONS_INSTALL_AS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t824" href="#t824">824</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t825" href="#t825">825</a></span><span class="t"> <span class="op">@</span><span class="nam">dest_as</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t826" href="#t826">826</a></span><span class="t"> <span class="key">def</span> <span class="nam">dest_as</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">new_value</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t827" href="#t827">827</a></span><span class="t"> <span class="key">if</span> <span class="nam">new_value</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t828" href="#t828">828</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">dest_dir</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t829" href="#t829">829</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t830" href="#t830">830</a></span><span class="t"> <span class="str">f'Cannot both have a "{MK_INSTALLATIONS_INSTALL_DEST_DIR}" and'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t831" href="#t831">831</a></span><span class="t"> <span class="str">f' "{MK_INSTALLATIONS_INSTALL_AS}"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t832" href="#t832">832</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t833" href="#t833">833</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t834" href="#t834">834</a></span><span class="t"> <span class="nam">sources</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_container</span><span class="op">[</span><span class="nam">MK_INSTALLATIONS_INSTALL_SOURCES</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t835" href="#t835">835</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">sources</span><span class="op">,</span> <span class="nam">list</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t836" href="#t836">836</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">sources</span><span class="op">)</span> <span class="op">!=</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t837" href="#t837">837</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t838" href="#t838">838</a></span><span class="t"> <span class="str">f'Cannot have "{MK_INSTALLATIONS_INSTALL_AS}" when'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t839" href="#t839">839</a></span><span class="t"> <span class="str">f' "{MK_INSTALLATIONS_INSTALL_SOURCES}" is not exactly one item'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t840" href="#t840">840</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t841" href="#t841">841</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">sources</span> <span class="op">=</span> <span class="nam">sources</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t842" href="#t842">842</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_container</span><span class="op">[</span><span class="nam">MK_INSTALLATIONS_INSTALL_AS</span><span class="op">]</span> <span class="op">=</span> <span class="nam">new_value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t843" href="#t843">843</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t844" href="#t844">844</a></span><span class="t"> <span class="key">with</span> <span class="nam">suppress</span><span class="op">(</span><span class="nam">KeyError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t845" href="#t845">845</a></span><span class="t"> <span class="key">del</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_container</span><span class="op">[</span><span class="nam">MK_INSTALLATIONS_INSTALL_AS</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t846" href="#t846">846</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t847" href="#t847">847</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t848" href="#t848">848</a></span><span class="t"><span class="key">class</span> <span class="nam">MutableYAMLInstallationsDefinition</span><span class="op">(</span><span class="nam">AbstractYAMLListSubStore</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t849" href="#t849">849</a></span><span class="t"> <span class="key">def</span> <span class="nam">append</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">install_rule</span><span class="op">:</span> <span class="nam">AbstractMutableYAMLInstallRule</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t850" href="#t850">850</a></span><span class="t"> <span class="nam">parent_store</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_store</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t851" href="#t851">851</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">install_rule</span><span class="op">.</span><span class="nam">_is_detached</span> <span class="key">or</span> <span class="op">(</span> </span><span class="r"><span class="annotate short">851 ↛ 855</span><span class="annotate long">line 851 didn't jump to line 855, because the condition on line 851 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t852" href="#t852">852</a></span><span class="t"> <span class="nam">install_rule</span><span class="op">.</span><span class="nam">_parent_store</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t853" href="#t853">853</a></span><span class="t"> <span class="key">and</span> <span class="nam">install_rule</span><span class="op">.</span><span class="nam">_parent_store</span> <span class="key">is</span> <span class="key">not</span> <span class="nam">parent_store</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t854" href="#t854">854</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t855" href="#t855">855</a></span><span class="t"> <span class="key">raise</span> <span class="nam">RuntimeError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t856" href="#t856">856</a></span><span class="t"> <span class="str">"Item is already attached or associated with a different container"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t857" href="#t857">857</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t858" href="#t858">858</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">create_definition_if_missing</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t859" href="#t859">859</a></span><span class="t"> <span class="nam">install_rule</span><span class="op">.</span><span class="nam">_parent_store</span> <span class="op">=</span> <span class="nam">parent_store</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t860" href="#t860">860</a></span><span class="t"> <span class="nam">install_rule</span><span class="op">.</span><span class="nam">create_definition</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t861" href="#t861">861</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t862" href="#t862">862</a></span><span class="t"> <span class="key">def</span> <span class="nam">extend</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">install_rules</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">AbstractMutableYAMLInstallRule</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t863" href="#t863">863</a></span><span class="t"> <span class="nam">parent_store</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_store</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t864" href="#t864">864</a></span><span class="t"> <span class="key">for</span> <span class="nam">install_rule</span> <span class="key">in</span> <span class="nam">install_rules</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t865" href="#t865">865</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">install_rule</span><span class="op">.</span><span class="nam">_is_detached</span> <span class="key">or</span> <span class="op">(</span> </span><span class="r"><span class="annotate short">865 ↛ 869</span><span class="annotate long">line 865 didn't jump to line 869, because the condition on line 865 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t866" href="#t866">866</a></span><span class="t"> <span class="nam">install_rule</span><span class="op">.</span><span class="nam">_parent_store</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t867" href="#t867">867</a></span><span class="t"> <span class="key">and</span> <span class="nam">install_rule</span><span class="op">.</span><span class="nam">_parent_store</span> <span class="key">is</span> <span class="key">not</span> <span class="nam">parent_store</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t868" href="#t868">868</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t869" href="#t869">869</a></span><span class="t"> <span class="key">raise</span> <span class="nam">RuntimeError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t870" href="#t870">870</a></span><span class="t"> <span class="str">"Item is already attached or associated with a different container"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t871" href="#t871">871</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t872" href="#t872">872</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">create_definition_if_missing</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t873" href="#t873">873</a></span><span class="t"> <span class="nam">install_rule</span><span class="op">.</span><span class="nam">_parent_store</span> <span class="op">=</span> <span class="nam">parent_store</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t874" href="#t874">874</a></span><span class="t"> <span class="nam">install_rule</span><span class="op">.</span><span class="nam">create_definition</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t875" href="#t875">875</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t876" href="#t876">876</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t877" href="#t877">877</a></span><span class="t"><span class="key">class</span> <span class="nam">MutableYAMLManifestVariables</span><span class="op">(</span><span class="nam">AbstractYAMLDictSubStore</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t878" href="#t878">878</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t879" href="#t879">879</a></span><span class="t"> <span class="key">def</span> <span class="nam">variables</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t880" href="#t880">880</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_store</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t881" href="#t881">881</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t882" href="#t882">882</a></span><span class="t"> <span class="key">def</span> <span class="nam">__setitem__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">key</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">value</span><span class="op">:</span> <span class="nam">Any</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t883" href="#t883">883</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_store</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> <span class="op">=</span> <span class="nam">value</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t884" href="#t884">884</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">create_definition_if_missing</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t885" href="#t885">885</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t886" href="#t886">886</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t887" href="#t887">887</a></span><span class="t"><span class="key">class</span> <span class="nam">MutableYAMLManifestDefinitions</span><span class="op">(</span><span class="nam">AbstractYAMLDictSubStore</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t888" href="#t888">888</a></span><span class="t"> <span class="key">def</span> <span class="nam">manifest_variables</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t889" href="#t889">889</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">create_if_absent</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t890" href="#t890">890</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">MutableYAMLManifestVariables</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t891" href="#t891">891</a></span><span class="t"> <span class="nam">d</span> <span class="op">=</span> <span class="nam">MutableYAMLManifestVariables</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_store</span><span class="op">,</span> <span class="nam">MK_MANIFEST_VARIABLES</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t892" href="#t892">892</a></span><span class="t"> <span class="key">if</span> <span class="nam">create_if_absent</span><span class="op">:</span> </span><span class="r"><span class="annotate short">892 ↛ 893</span><span class="annotate long">line 892 didn't jump to line 893, because the condition on line 892 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t893" href="#t893">893</a></span><span class="t"> <span class="nam">d</span><span class="op">.</span><span class="nam">create_definition_if_missing</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t894" href="#t894">894</a></span><span class="t"> <span class="key">return</span> <span class="nam">d</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t895" href="#t895">895</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t896" href="#t896">896</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t897" href="#t897">897</a></span><span class="t"><span class="key">class</span> <span class="nam">MutableYAMLManifest</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t898" href="#t898">898</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">store</span><span class="op">:</span> <span class="nam">Any</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t899" href="#t899">899</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_store</span> <span class="op">=</span> <span class="nam">store</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t900" href="#t900">900</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t901" href="#t901">901</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t902" href="#t902">902</a></span><span class="t"> <span class="key">def</span> <span class="nam">empty_manifest</span><span class="op">(</span><span class="nam">cls</span><span class="op">)</span> <span class="op">-></span> <span class="str">"MutableYAMLManifest"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t903" href="#t903">903</a></span><span class="t"> <span class="key">return</span> <span class="nam">cls</span><span class="op">(</span><span class="nam">CommentedMap</span><span class="op">(</span><span class="op">{</span><span class="nam">MK_MANIFEST_VERSION</span><span class="op">:</span> <span class="nam">DEFAULT_MANIFEST_VERSION</span><span class="op">}</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t904" href="#t904">904</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t905" href="#t905">905</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t906" href="#t906">906</a></span><span class="t"> <span class="key">def</span> <span class="nam">manifest_version</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t907" href="#t907">907</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_store</span><span class="op">[</span><span class="nam">MK_MANIFEST_VERSION</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t908" href="#t908">908</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t909" href="#t909">909</a></span><span class="t"> <span class="op">@</span><span class="nam">manifest_version</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t910" href="#t910">910</a></span><span class="t"> <span class="key">def</span> <span class="nam">manifest_version</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">version</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t911" href="#t911">911</a></span><span class="t"> <span class="key">if</span> <span class="nam">version</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">SUPPORTED_MANIFEST_VERSIONS</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t912" href="#t912">912</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"Unsupported version"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t913" href="#t913">913</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_store</span><span class="op">[</span><span class="nam">MK_MANIFEST_VERSION</span><span class="op">]</span> <span class="op">=</span> <span class="nam">version</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t914" href="#t914">914</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t915" href="#t915">915</a></span><span class="t"> <span class="key">def</span> <span class="nam">installations</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t916" href="#t916">916</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t917" href="#t917">917</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t918" href="#t918">918</a></span><span class="t"> <span class="nam">create_if_absent</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t919" href="#t919">919</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">MutableYAMLInstallationsDefinition</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t920" href="#t920">920</a></span><span class="t"> <span class="nam">d</span> <span class="op">=</span> <span class="nam">MutableYAMLInstallationsDefinition</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_store</span><span class="op">,</span> <span class="nam">MK_INSTALLATIONS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t921" href="#t921">921</a></span><span class="t"> <span class="key">if</span> <span class="nam">create_if_absent</span><span class="op">:</span> </span><span class="r"><span class="annotate short">921 ↛ 922</span><span class="annotate long">line 921 didn't jump to line 922, because the condition on line 921 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t922" href="#t922">922</a></span><span class="t"> <span class="nam">d</span><span class="op">.</span><span class="nam">create_definition_if_missing</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t923" href="#t923">923</a></span><span class="t"> <span class="key">return</span> <span class="nam">d</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t924" href="#t924">924</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t925" href="#t925">925</a></span><span class="t"> <span class="key">def</span> <span class="nam">manifest_definitions</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t926" href="#t926">926</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t927" href="#t927">927</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t928" href="#t928">928</a></span><span class="t"> <span class="nam">create_if_absent</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t929" href="#t929">929</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">MutableYAMLManifestDefinitions</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t930" href="#t930">930</a></span><span class="t"> <span class="nam">d</span> <span class="op">=</span> <span class="nam">MutableYAMLManifestDefinitions</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_store</span><span class="op">,</span> <span class="nam">MK_MANIFEST_DEFINITIONS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t931" href="#t931">931</a></span><span class="t"> <span class="key">if</span> <span class="nam">create_if_absent</span><span class="op">:</span> </span><span class="r"><span class="annotate short">931 ↛ 932</span><span class="annotate long">line 931 didn't jump to line 932, because the condition on line 931 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t932" href="#t932">932</a></span><span class="t"> <span class="nam">d</span><span class="op">.</span><span class="nam">create_definition_if_missing</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t933" href="#t933">933</a></span><span class="t"> <span class="key">return</span> <span class="nam">d</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t934" href="#t934">934</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t935" href="#t935">935</a></span><span class="t"> <span class="key">def</span> <span class="nam">package</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t936" href="#t936">936</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> <span class="nam">name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">create_if_absent</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t937" href="#t937">937</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">MutableYAMLPackageDefinition</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t938" href="#t938">938</a></span><span class="t"> <span class="key">if</span> <span class="nam">MK_PACKAGES</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_store</span><span class="op">:</span> </span><span class="r"><span class="annotate short">938 ↛ 940</span><span class="annotate long">line 938 didn't jump to line 940, because the condition on line 938 was never false</span></span></p> - <p class="run"><span class="n"><a id="t939" href="#t939">939</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_store</span><span class="op">[</span><span class="nam">MK_PACKAGES</span><span class="op">]</span> <span class="op">=</span> <span class="nam">CommentedMap</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t940" href="#t940">940</a></span><span class="t"> <span class="nam">packages_store</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_store</span><span class="op">[</span><span class="nam">MK_PACKAGES</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t941" href="#t941">941</a></span><span class="t"> <span class="nam">package</span> <span class="op">=</span> <span class="nam">packages_store</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t942" href="#t942">942</a></span><span class="t"> <span class="key">if</span> <span class="nam">package</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">942 ↛ 949</span><span class="annotate long">line 942 didn't jump to line 949, because the condition on line 942 was never false</span></span></p> - <p class="par run show_par"><span class="n"><a id="t943" href="#t943">943</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">create_if_absent</span><span class="op">:</span> </span><span class="r"><span class="annotate short">943 ↛ 944</span><span class="annotate long">line 943 didn't jump to line 944, because the condition on line 943 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t944" href="#t944">944</a></span><span class="t"> <span class="key">raise</span> <span class="nam">KeyError</span><span class="op">(</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t945" href="#t945">945</a></span><span class="t"> <span class="key">assert</span> <span class="nam">packages_store</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t946" href="#t946">946</a></span><span class="t"> <span class="nam">d</span> <span class="op">=</span> <span class="nam">MutableYAMLPackageDefinition</span><span class="op">(</span><span class="nam">packages_store</span><span class="op">,</span> <span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t947" href="#t947">947</a></span><span class="t"> <span class="nam">d</span><span class="op">.</span><span class="nam">create_definition</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t948" href="#t948">948</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t949" href="#t949">949</a></span><span class="t"> <span class="nam">d</span> <span class="op">=</span> <span class="nam">MutableYAMLPackageDefinition</span><span class="op">(</span><span class="nam">packages_store</span><span class="op">,</span> <span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t950" href="#t950">950</a></span><span class="t"> <span class="key">return</span> <span class="nam">d</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t951" href="#t951">951</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t952" href="#t952">952</a></span><span class="t"> <span class="key">def</span> <span class="nam">write_to</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">fd</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t953" href="#t953">953</a></span><span class="t"> <span class="nam">MANIFEST_YAML</span><span class="op">.</span><span class="nam">dump</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_store</span><span class="op">,</span> <span class="nam">fd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t954" href="#t954">954</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t955" href="#t955">955</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t956" href="#t956">956</a></span><span class="t"><span class="key">def</span> <span class="nam">_describe_missing_path</span><span class="op">(</span><span class="nam">entry</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t957" href="#t957">957</a></span><span class="t"> <span class="key">if</span> <span class="nam">entry</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t958" href="#t958">958</a></span><span class="t"> <span class="key">return</span> <span class="str">f"{entry.fs_path}/ (empty directory; possible integration point)"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t959" href="#t959">959</a></span><span class="t"> <span class="key">if</span> <span class="nam">entry</span><span class="op">.</span><span class="nam">is_symlink</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t960" href="#t960">960</a></span><span class="t"> <span class="nam">target</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">readlink</span><span class="op">(</span><span class="nam">entry</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t961" href="#t961">961</a></span><span class="t"> <span class="key">return</span> <span class="str">f"{entry.fs_path} (symlink; links to {target})"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t962" href="#t962">962</a></span><span class="t"> <span class="key">if</span> <span class="nam">entry</span><span class="op">.</span><span class="nam">is_file</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t963" href="#t963">963</a></span><span class="t"> <span class="key">return</span> <span class="str">f"{entry.fs_path} (file)"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t964" href="#t964">964</a></span><span class="t"> <span class="key">return</span> <span class="str">f"{entry.fs_path} (other!? Probably not supported by debputy and may need a `remove`)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t965" href="#t965">965</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t966" href="#t966">966</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t967" href="#t967">967</a></span><span class="t"><span class="key">def</span> <span class="nam">_detect_missing_installations</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t968" href="#t968">968</a></span><span class="t"> <span class="nam">path_matcher</span><span class="op">:</span> <span class="nam">SourcePathMatcher</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t969" href="#t969">969</a></span><span class="t"> <span class="nam">search_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t970" href="#t970">970</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t971" href="#t971">971</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">isdir</span><span class="op">(</span><span class="nam">search_dir</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">971 ↛ 973</span><span class="annotate long">line 971 didn't jump to line 973, because the condition on line 971 was never false</span></span></p> - <p class="run"><span class="n"><a id="t972" href="#t972">972</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t973" href="#t973">973</a></span><span class="t"> <span class="nam">missing</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">path_matcher</span><span class="op">.</span><span class="nam">detect_missing</span><span class="op">(</span><span class="nam">search_dir</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t974" href="#t974">974</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">missing</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t975" href="#t975">975</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t976" href="#t976">976</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t977" href="#t977">977</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t978" href="#t978">978</a></span><span class="t"> <span class="str">f"The following paths were present in {search_dir.fs_path}, but not installed (nor explicitly discarded)."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t979" href="#t979">979</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t980" href="#t980">980</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span><span class="str">""</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t981" href="#t981">981</a></span><span class="t"> <span class="key">for</span> <span class="nam">entry</span> <span class="key">in</span> <span class="nam">missing</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t982" href="#t982">982</a></span><span class="t"> <span class="nam">desc</span> <span class="op">=</span> <span class="nam">_describe_missing_path</span><span class="op">(</span><span class="nam">entry</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t983" href="#t983">983</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span><span class="str">f" * {desc}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t984" href="#t984">984</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span><span class="str">""</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t985" href="#t985">985</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t986" href="#t986">986</a></span><span class="t"> <span class="nam">excl</span> <span class="op">=</span> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t987" href="#t987">987</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t988" href="#t988">988</a></span><span class="t"><span class="str"> - discard: "*"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t989" href="#t989">989</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t990" href="#t990">990</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t991" href="#t991">991</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t992" href="#t992">992</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t993" href="#t993">993</a></span><span class="t"> <span class="str">"Please review the list and add either install rules or exclusions to `installations` in"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t994" href="#t994">994</a></span><span class="t"> <span class="str">" debian/debputy.manifest. If you do not need any of these paths, add the following to the"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t995" href="#t995">995</a></span><span class="t"> <span class="str">f" end of your 'installations`:\n\n{excl}\n"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t996" href="#t996">996</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t997" href="#t997">997</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t998" href="#t998">998</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t999" href="#t999">999</a></span><span class="t"><span class="key">def</span> <span class="nam">_list_automatic_discard_rules</span><span class="op">(</span><span class="nam">path_matcher</span><span class="op">:</span> <span class="nam">SourcePathMatcher</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1000" href="#t1000">1000</a></span><span class="t"> <span class="nam">used_discard_rules</span> <span class="op">=</span> <span class="nam">path_matcher</span><span class="op">.</span><span class="nam">used_auto_discard_rules</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1001" href="#t1001">1001</a></span><span class="t"> <span class="com"># Discard rules can match and then be overridden. In that case, they appear</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1002" href="#t1002">1002</a></span><span class="t"> <span class="com"># but have 0 matches.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1003" href="#t1003">1003</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">sum</span><span class="op">(</span><span class="op">(</span><span class="nam">len</span><span class="op">(</span><span class="nam">v</span><span class="op">)</span> <span class="key">for</span> <span class="nam">v</span> <span class="key">in</span> <span class="nam">used_discard_rules</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">,</span> <span class="num">0</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1004" href="#t1004">1004</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1005" href="#t1005">1005</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">"The following automatic discard rules were triggered:"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1006" href="#t1006">1006</a></span><span class="t"> <span class="nam">example_path</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1007" href="#t1007">1007</a></span><span class="t"> <span class="key">for</span> <span class="nam">rule</span> <span class="key">in</span> <span class="nam">sorted</span><span class="op">(</span><span class="nam">used_discard_rules</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1008" href="#t1008">1008</a></span><span class="t"> <span class="key">for</span> <span class="nam">fs_path</span> <span class="key">in</span> <span class="nam">sorted</span><span class="op">(</span><span class="nam">used_discard_rules</span><span class="op">[</span><span class="nam">rule</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1009" href="#t1009">1009</a></span><span class="t"> <span class="key">if</span> <span class="nam">example_path</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1009 ↛ 1011</span><span class="annotate long">line 1009 didn't jump to line 1011, because the condition on line 1009 was never false</span></span></p> - <p class="run"><span class="n"><a id="t1010" href="#t1010">1010</a></span><span class="t"> <span class="nam">example_path</span> <span class="op">=</span> <span class="nam">fs_path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1011" href="#t1011">1011</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f" * {rule} -> {fs_path}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1012" href="#t1012">1012</a></span><span class="t"> <span class="key">assert</span> <span class="nam">example_path</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1013" href="#t1013">1013</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">""</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1014" href="#t1014">1014</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1015" href="#t1015">1015</a></span><span class="t"> <span class="str">"Note that some of these may have been overruled. The overrule detection logic is not"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1016" href="#t1016">1016</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1017" href="#t1017">1017</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">"100% reliable."</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1018" href="#t1018">1018</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">""</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1019" href="#t1019">1019</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1020" href="#t1020">1020</a></span><span class="t"> <span class="str">"You can overrule an automatic discard rule by explicitly listing the path. As an example:"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1021" href="#t1021">1021</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1022" href="#t1022">1022</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">" installations:"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1023" href="#t1023">1023</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">" - install:"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1024" href="#t1024">1024</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f" source: {example_path}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1025" href="#t1025">1025</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1026" href="#t1026">1026</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1027" href="#t1027">1027</a></span><span class="t"><span class="key">def</span> <span class="nam">_install_everything_from_source_dir_if_present</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1028" href="#t1028">1028</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1029" href="#t1029">1029</a></span><span class="t"> <span class="nam">substitution</span><span class="op">:</span> <span class="nam">Substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1030" href="#t1030">1030</a></span><span class="t"> <span class="nam">path_matcher</span><span class="op">:</span> <span class="nam">SourcePathMatcher</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1031" href="#t1031">1031</a></span><span class="t"> <span class="nam">install_rule_context</span><span class="op">:</span> <span class="nam">InstallRuleContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1032" href="#t1032">1032</a></span><span class="t"> <span class="nam">source_condition_context</span><span class="op">:</span> <span class="nam">ConditionContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1033" href="#t1033">1033</a></span><span class="t"> <span class="nam">source_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1034" href="#t1034">1034</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1035" href="#t1035">1035</a></span><span class="t"> <span class="nam">into_dir</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1036" href="#t1036">1036</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1037" href="#t1037">1037</a></span><span class="t"> <span class="nam">attribute_path</span> <span class="op">=</span> <span class="nam">AttributePath</span><span class="op">.</span><span class="nam">builtin_path</span><span class="op">(</span><span class="op">)</span><span class="op">[</span><span class="str">f"installing {source_dir.fs_path}"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1038" href="#t1038">1038</a></span><span class="t"> <span class="nam">pkg_set</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span><span class="op">[</span><span class="nam">dctrl_bin</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1039" href="#t1039">1039</a></span><span class="t"> <span class="nam">install_rule</span> <span class="op">=</span> <span class="nam">InstallRule</span><span class="op">.</span><span class="nam">install_dest</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1040" href="#t1040">1040</a></span><span class="t"> <span class="op">[</span><span class="nam">FileSystemMatchRule</span><span class="op">.</span><span class="nam">from_path_match</span><span class="op">(</span><span class="str">"*"</span><span class="op">,</span> <span class="nam">attribute_path</span><span class="op">,</span> <span class="nam">substitution</span><span class="op">)</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1041" href="#t1041">1041</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1042" href="#t1042">1042</a></span><span class="t"> <span class="nam">pkg_set</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1043" href="#t1043">1043</a></span><span class="t"> <span class="str">f"Built-in; install everything from {source_dir.fs_path} into {dctrl_bin.name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1044" href="#t1044">1044</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1045" href="#t1045">1045</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1046" href="#t1046">1046</a></span><span class="t"> <span class="nam">pkg_search_dir</span><span class="op">:</span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">SearchDir</span><span class="op">]</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1047" href="#t1047">1047</a></span><span class="t"> <span class="nam">SearchDir</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1048" href="#t1048">1048</a></span><span class="t"> <span class="nam">source_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1049" href="#t1049">1049</a></span><span class="t"> <span class="nam">pkg_set</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1050" href="#t1050">1050</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1051" href="#t1051">1051</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1052" href="#t1052">1052</a></span><span class="t"> <span class="nam">replacements</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1053" href="#t1053">1053</a></span><span class="t"> <span class="str">"search_dirs"</span><span class="op">:</span> <span class="nam">pkg_search_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1054" href="#t1054">1054</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1055" href="#t1055">1055</a></span><span class="t"> <span class="key">if</span> <span class="nam">into_dir</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1055 ↛ 1056</span><span class="annotate long">line 1055 didn't jump to line 1056, because the condition on line 1055 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1056" href="#t1056">1056</a></span><span class="t"> <span class="nam">binary_package_contexts</span> <span class="op">=</span> <span class="nam">dict</span><span class="op">(</span><span class="nam">install_rule_context</span><span class="op">.</span><span class="nam">binary_package_contexts</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1057" href="#t1057">1057</a></span><span class="t"> <span class="nam">updated</span> <span class="op">=</span> <span class="nam">binary_package_contexts</span><span class="op">[</span><span class="nam">dctrl_bin</span><span class="op">.</span><span class="nam">name</span><span class="op">]</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">=</span><span class="nam">into_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1058" href="#t1058">1058</a></span><span class="t"> <span class="nam">binary_package_contexts</span><span class="op">[</span><span class="nam">dctrl_bin</span><span class="op">.</span><span class="nam">name</span><span class="op">]</span> <span class="op">=</span> <span class="nam">updated</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1059" href="#t1059">1059</a></span><span class="t"> <span class="nam">replacements</span><span class="op">[</span><span class="str">"binary_package_contexts"</span><span class="op">]</span> <span class="op">=</span> <span class="nam">binary_package_contexts</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1060" href="#t1060">1060</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1061" href="#t1061">1061</a></span><span class="t"> <span class="nam">fake_install_rule_context</span> <span class="op">=</span> <span class="nam">install_rule_context</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="op">**</span><span class="nam">replacements</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1062" href="#t1062">1062</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1063" href="#t1063">1063</a></span><span class="t"> <span class="nam">install_rule</span><span class="op">.</span><span class="nam">perform_install</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1064" href="#t1064">1064</a></span><span class="t"> <span class="nam">path_matcher</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1065" href="#t1065">1065</a></span><span class="t"> <span class="nam">fake_install_rule_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1066" href="#t1066">1066</a></span><span class="t"> <span class="nam">source_condition_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1067" href="#t1067">1067</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1068" href="#t1068">1068</a></span><span class="t"> <span class="key">except</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1069" href="#t1069">1069</a></span><span class="t"> <span class="nam">NoMatchForInstallPatternError</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1070" href="#t1070">1070</a></span><span class="t"> <span class="nam">PathAlreadyInstalledOrDiscardedError</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1071" href="#t1071">1071</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1072" href="#t1072">1072</a></span><span class="t"> <span class="com"># Empty directory or everything excluded by default; ignore the error</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1073" href="#t1073">1073</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1074" href="#t1074">1074</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1075" href="#t1075">1075</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1076" href="#t1076">1076</a></span><span class="t"><span class="key">class</span> <span class="nam">HighLevelManifest</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1077" href="#t1077">1077</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1078" href="#t1078">1078</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1079" href="#t1079">1079</a></span><span class="t"> <span class="nam">manifest_path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1080" href="#t1080">1080</a></span><span class="t"> <span class="nam">mutable_manifest</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">MutableYAMLManifest</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1081" href="#t1081">1081</a></span><span class="t"> <span class="nam">install_rules</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">InstallRule</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1082" href="#t1082">1082</a></span><span class="t"> <span class="nam">source_package</span><span class="op">:</span> <span class="nam">SourcePackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1083" href="#t1083">1083</a></span><span class="t"> <span class="nam">binary_packages</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1084" href="#t1084">1084</a></span><span class="t"> <span class="nam">substitution</span><span class="op">:</span> <span class="nam">Substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1085" href="#t1085">1085</a></span><span class="t"> <span class="nam">package_transformations</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">PackageTransformationDefinition</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1086" href="#t1086">1086</a></span><span class="t"> <span class="nam">dpkg_architecture_variables</span><span class="op">:</span> <span class="nam">DpkgArchitectureBuildProcessValuesTable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1087" href="#t1087">1087</a></span><span class="t"> <span class="nam">dpkg_arch_query_table</span><span class="op">:</span> <span class="nam">DpkgArchTable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1088" href="#t1088">1088</a></span><span class="t"> <span class="nam">build_env</span><span class="op">:</span> <span class="nam">DebBuildOptionsAndProfiles</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1089" href="#t1089">1089</a></span><span class="t"> <span class="nam">plugin_provided_feature_set</span><span class="op">:</span> <span class="nam">PluginProvidedFeatureSet</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1090" href="#t1090">1090</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1091" href="#t1091">1091</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1092" href="#t1092">1092</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">manifest_path</span> <span class="op">=</span> <span class="nam">manifest_path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1093" href="#t1093">1093</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">mutable_manifest</span> <span class="op">=</span> <span class="nam">mutable_manifest</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1094" href="#t1094">1094</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_install_rules</span> <span class="op">=</span> <span class="nam">install_rules</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1095" href="#t1095">1095</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_source_package</span> <span class="op">=</span> <span class="nam">source_package</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1096" href="#t1096">1096</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_binary_packages</span> <span class="op">=</span> <span class="nam">binary_packages</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1097" href="#t1097">1097</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">substitution</span> <span class="op">=</span> <span class="nam">substitution</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1098" href="#t1098">1098</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">package_transformations</span> <span class="op">=</span> <span class="nam">package_transformations</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1099" href="#t1099">1099</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_dpkg_architecture_variables</span> <span class="op">=</span> <span class="nam">dpkg_architecture_variables</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1100" href="#t1100">1100</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_dpkg_arch_query_table</span> <span class="op">=</span> <span class="nam">dpkg_arch_query_table</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1101" href="#t1101">1101</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_build_env</span> <span class="op">=</span> <span class="nam">build_env</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1102" href="#t1102">1102</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_used_for</span><span class="op">:</span> <span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1103" href="#t1103">1103</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_provided_feature_set</span> <span class="op">=</span> <span class="nam">plugin_provided_feature_set</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1104" href="#t1104">1104</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_debian_dir</span> <span class="op">=</span> <span class="nam">debian_dir</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1105" href="#t1105">1105</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1106" href="#t1106">1106</a></span><span class="t"> <span class="key">def</span> <span class="nam">source_version</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">include_binnmu_version</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1107" href="#t1107">1107</a></span><span class="t"> <span class="com"># TODO: There should an easier way to determine the source version; really.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1108" href="#t1108">1108</a></span><span class="t"> <span class="nam">version_var</span> <span class="op">=</span> <span class="str">"{{DEB_VERSION}}"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1109" href="#t1109">1109</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">include_binnmu_version</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1110" href="#t1110">1110</a></span><span class="t"> <span class="nam">version_var</span> <span class="op">=</span> <span class="str">"{{_DEBPUTY_INTERNAL_NON_BINNMU_SOURCE}}"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1111" href="#t1111">1111</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1112" href="#t1112">1112</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">substitution</span><span class="op">.</span><span class="nam">substitute</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1113" href="#t1113">1113</a></span><span class="t"> <span class="nam">version_var</span><span class="op">,</span> <span class="str">"internal (resolve version)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1114" href="#t1114">1114</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1115" href="#t1115">1115</a></span><span class="t"> <span class="key">except</span> <span class="nam">DebputySubstitutionError</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1116" href="#t1116">1116</a></span><span class="t"> <span class="key">raise</span> <span class="nam">AssertionError</span><span class="op">(</span><span class="str">f"Could not resolve {version_var}"</span><span class="op">)</span> <span class="key">from</span> <span class="nam">e</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1117" href="#t1117">1117</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1118" href="#t1118">1118</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1119" href="#t1119">1119</a></span><span class="t"> <span class="key">def</span> <span class="nam">debian_dir</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">VirtualPath</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1120" href="#t1120">1120</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_debian_dir</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1121" href="#t1121">1121</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1122" href="#t1122">1122</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1123" href="#t1123">1123</a></span><span class="t"> <span class="key">def</span> <span class="nam">dpkg_architecture_variables</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">DpkgArchitectureBuildProcessValuesTable</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1124" href="#t1124">1124</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_dpkg_architecture_variables</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1125" href="#t1125">1125</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1126" href="#t1126">1126</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1127" href="#t1127">1127</a></span><span class="t"> <span class="key">def</span> <span class="nam">build_env</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">DebBuildOptionsAndProfiles</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1128" href="#t1128">1128</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_build_env</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1129" href="#t1129">1129</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1130" href="#t1130">1130</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1131" href="#t1131">1131</a></span><span class="t"> <span class="key">def</span> <span class="nam">plugin_provided_feature_set</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">PluginProvidedFeatureSet</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1132" href="#t1132">1132</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_provided_feature_set</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1133" href="#t1133">1133</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1134" href="#t1134">1134</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1135" href="#t1135">1135</a></span><span class="t"> <span class="key">def</span> <span class="nam">active_packages</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1136" href="#t1136">1136</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="op">(</span><span class="nam">p</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_binary_packages</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span> <span class="key">if</span> <span class="nam">p</span><span class="op">.</span><span class="nam">should_be_acted_on</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1137" href="#t1137">1137</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1138" href="#t1138">1138</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1139" href="#t1139">1139</a></span><span class="t"> <span class="key">def</span> <span class="nam">all_packages</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1140" href="#t1140">1140</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_binary_packages</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1141" href="#t1141">1141</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1142" href="#t1142">1142</a></span><span class="t"> <span class="key">def</span> <span class="nam">package_state_for</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">package</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">PackageTransformationDefinition</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1143" href="#t1143">1143</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">package_transformations</span><span class="op">[</span><span class="nam">package</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1144" href="#t1144">1144</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1145" href="#t1145">1145</a></span><span class="t"> <span class="key">def</span> <span class="nam">_detect_doc_main_package_for</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">package</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">)</span> <span class="op">-></span> <span class="nam">BinaryPackage</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1146" href="#t1146">1146</a></span><span class="t"> <span class="nam">name</span> <span class="op">=</span> <span class="nam">package</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1147" href="#t1147">1147</a></span><span class="t"> <span class="com"># If it is not a -doc package, then docs should be installed</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1148" href="#t1148">1148</a></span><span class="t"> <span class="com"># under its own package name.</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1149" href="#t1149">1149</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"-doc"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1149 ↛ 1151</span><span class="annotate long">line 1149 didn't jump to line 1151, because the condition on line 1149 was never false</span></span></p> - <p class="run"><span class="n"><a id="t1150" href="#t1150">1150</a></span><span class="t"> <span class="key">return</span> <span class="nam">package</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1151" href="#t1151">1151</a></span><span class="t"> <span class="nam">name</span> <span class="op">=</span> <span class="nam">name</span><span class="op">[</span><span class="op">:</span><span class="op">-</span><span class="num">4</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1152" href="#t1152">1152</a></span><span class="t"> <span class="nam">main_package</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_binary_packages</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1153" href="#t1153">1153</a></span><span class="t"> <span class="key">if</span> <span class="nam">main_package</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1154" href="#t1154">1154</a></span><span class="t"> <span class="key">return</span> <span class="nam">main_package</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1155" href="#t1155">1155</a></span><span class="t"> <span class="key">if</span> <span class="nam">name</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"lib"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1156" href="#t1156">1156</a></span><span class="t"> <span class="nam">dev_pkg</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_binary_packages</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">f"{name}-dev"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1157" href="#t1157">1157</a></span><span class="t"> <span class="key">if</span> <span class="nam">dev_pkg</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1158" href="#t1158">1158</a></span><span class="t"> <span class="key">return</span> <span class="nam">dev_pkg</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1159" href="#t1159">1159</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1160" href="#t1160">1160</a></span><span class="t"> <span class="com"># If we found no better match; default to the doc package itself.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1161" href="#t1161">1161</a></span><span class="t"> <span class="key">return</span> <span class="nam">package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1162" href="#t1162">1162</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1163" href="#t1163">1163</a></span><span class="t"> <span class="key">def</span> <span class="nam">perform_installations</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1164" href="#t1164">1164</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1165" href="#t1165">1165</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1166" href="#t1166">1166</a></span><span class="t"> <span class="nam">install_request_context</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">InstallSearchDirContext</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1167" href="#t1167">1167</a></span><span class="t"> <span class="nam">enable_manifest_installation_feature</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1168" href="#t1168">1168</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">PackageDataTable</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1169" href="#t1169">1169</a></span><span class="t"> <span class="nam">package_data_dict</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1170" href="#t1170">1170</a></span><span class="t"> <span class="nam">package_data_table</span> <span class="op">=</span> <span class="nam">PackageDataTable</span><span class="op">(</span><span class="nam">package_data_dict</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1171" href="#t1171">1171</a></span><span class="t"> <span class="key">if</span> <span class="nam">install_request_context</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1171 ↛ 1173</span><span class="annotate long">line 1171 didn't jump to line 1173, because the condition on line 1171 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t1172" href="#t1172">1172</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1173" href="#t1173">1173</a></span><span class="t"> <span class="op">@</span><span class="nam">functools</span><span class="op">.</span><span class="nam">lru_cache</span><span class="op">(</span><span class="key">None</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1174" href="#t1174">1174</a></span><span class="t"> <span class="key">def</span> <span class="nam">_as_path</span><span class="op">(</span><span class="nam">fs_path</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">VirtualPath</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1175" href="#t1175">1175</a></span><span class="t"> <span class="key">return</span> <span class="nam">FSROOverlay</span><span class="op">.</span><span class="nam">create_root_dir</span><span class="op">(</span><span class="str">"."</span><span class="op">,</span> <span class="nam">fs_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1176" href="#t1176">1176</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1177" href="#t1177">1177</a></span><span class="t"> <span class="nam">dtmp_dir</span> <span class="op">=</span> <span class="nam">_as_path</span><span class="op">(</span><span class="str">"debian/tmp"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1178" href="#t1178">1178</a></span><span class="t"> <span class="nam">source_root_dir</span> <span class="op">=</span> <span class="nam">_as_path</span><span class="op">(</span><span class="str">"."</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1179" href="#t1179">1179</a></span><span class="t"> <span class="nam">into</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_binary_packages</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1180" href="#t1180">1180</a></span><span class="t"> <span class="nam">default_search_dirs</span> <span class="op">=</span> <span class="op">[</span><span class="nam">dtmp_dir</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1181" href="#t1181">1181</a></span><span class="t"> <span class="nam">per_package_search_dirs</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1182" href="#t1182">1182</a></span><span class="t"> <span class="nam">t</span><span class="op">.</span><span class="nam">binary_package</span><span class="op">:</span> <span class="op">[</span><span class="nam">_as_path</span><span class="op">(</span><span class="nam">f</span><span class="op">.</span><span class="nam">match_rule</span><span class="op">.</span><span class="nam">path</span><span class="op">)</span> <span class="key">for</span> <span class="nam">f</span> <span class="key">in</span> <span class="nam">t</span><span class="op">.</span><span class="nam">search_dirs</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1183" href="#t1183">1183</a></span><span class="t"> <span class="key">for</span> <span class="nam">t</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">package_transformations</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1184" href="#t1184">1184</a></span><span class="t"> <span class="key">if</span> <span class="nam">t</span><span class="op">.</span><span class="nam">search_dirs</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1185" href="#t1185">1185</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1186" href="#t1186">1186</a></span><span class="t"> <span class="nam">search_dirs</span> <span class="op">=</span> <span class="nam">_determine_search_dir_order</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1187" href="#t1187">1187</a></span><span class="t"> <span class="nam">per_package_search_dirs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1188" href="#t1188">1188</a></span><span class="t"> <span class="nam">into</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1189" href="#t1189">1189</a></span><span class="t"> <span class="nam">default_search_dirs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1190" href="#t1190">1190</a></span><span class="t"> <span class="nam">source_root_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1191" href="#t1191">1191</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1192" href="#t1192">1192</a></span><span class="t"> <span class="nam">check_for_uninstalled_dirs</span> <span class="op">=</span> <span class="nam">tuple</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1193" href="#t1193">1193</a></span><span class="t"> <span class="nam">s</span><span class="op">.</span><span class="nam">search_dir</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1194" href="#t1194">1194</a></span><span class="t"> <span class="key">for</span> <span class="nam">s</span> <span class="key">in</span> <span class="nam">search_dirs</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1195" href="#t1195">1195</a></span><span class="t"> <span class="key">if</span> <span class="nam">s</span><span class="op">.</span><span class="nam">search_dir</span><span class="op">.</span><span class="nam">fs_path</span> <span class="op">!=</span> <span class="nam">source_root_dir</span><span class="op">.</span><span class="nam">fs_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1196" href="#t1196">1196</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1197" href="#t1197">1197</a></span><span class="t"> <span class="nam">_present_installation_dirs</span><span class="op">(</span><span class="nam">search_dirs</span><span class="op">,</span> <span class="nam">check_for_uninstalled_dirs</span><span class="op">,</span> <span class="nam">into</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1198" href="#t1198">1198</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1199" href="#t1199">1199</a></span><span class="t"> <span class="nam">dtmp_dir</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1200" href="#t1200">1200</a></span><span class="t"> <span class="nam">search_dirs</span> <span class="op">=</span> <span class="nam">install_request_context</span><span class="op">.</span><span class="nam">search_dirs</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1201" href="#t1201">1201</a></span><span class="t"> <span class="nam">into</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_binary_packages</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1202" href="#t1202">1202</a></span><span class="t"> <span class="nam">seen</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1203" href="#t1203">1203</a></span><span class="t"> <span class="key">for</span> <span class="nam">search_dir</span> <span class="key">in</span> <span class="nam">search_dirs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1204" href="#t1204">1204</a></span><span class="t"> <span class="nam">seen</span><span class="op">.</span><span class="nam">update</span><span class="op">(</span><span class="nam">search_dir</span><span class="op">.</span><span class="nam">applies_to</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1205" href="#t1205">1205</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1206" href="#t1206">1206</a></span><span class="t"> <span class="nam">missing</span> <span class="op">=</span> <span class="nam">into</span> <span class="op">-</span> <span class="nam">seen</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1207" href="#t1207">1207</a></span><span class="t"> <span class="key">if</span> <span class="nam">missing</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1207 ↛ 1208</span><span class="annotate long">line 1207 didn't jump to line 1208, because the condition on line 1207 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1208" href="#t1208">1208</a></span><span class="t"> <span class="nam">names</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">p</span><span class="op">.</span><span class="nam">name</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">missing</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1209" href="#t1209">1209</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1210" href="#t1210">1210</a></span><span class="t"> <span class="str">f"The following package(s) had no search dirs: {names}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1211" href="#t1211">1211</a></span><span class="t"> <span class="str">" (Generally, the source root would be applicable to all packages)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1212" href="#t1212">1212</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1213" href="#t1213">1213</a></span><span class="t"> <span class="nam">extra_names</span> <span class="op">=</span> <span class="nam">seen</span> <span class="op">-</span> <span class="nam">into</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1214" href="#t1214">1214</a></span><span class="t"> <span class="key">if</span> <span class="nam">extra_names</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1214 ↛ 1215</span><span class="annotate long">line 1214 didn't jump to line 1215, because the condition on line 1214 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1215" href="#t1215">1215</a></span><span class="t"> <span class="nam">names</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">p</span><span class="op">.</span><span class="nam">name</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">extra_names</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1216" href="#t1216">1216</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1217" href="#t1217">1217</a></span><span class="t"> <span class="str">f"The install_request_context referenced the following unknown package(s): {names}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1218" href="#t1218">1218</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1219" href="#t1219">1219</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1220" href="#t1220">1220</a></span><span class="t"> <span class="nam">check_for_uninstalled_dirs</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1221" href="#t1221">1221</a></span><span class="t"> <span class="nam">install_request_context</span><span class="op">.</span><span class="nam">check_for_uninstalled_dirs</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1222" href="#t1222">1222</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1223" href="#t1223">1223</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1224" href="#t1224">1224</a></span><span class="t"> <span class="nam">install_rule_context</span> <span class="op">=</span> <span class="nam">InstallRuleContext</span><span class="op">(</span><span class="nam">search_dirs</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1225" href="#t1225">1225</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1226" href="#t1226">1226</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"><span class="annotate short">1226 ↛ 1232</span><span class="annotate long">line 1226 didn't jump to line 1232</span></span></p> - <p class="pln"><span class="n"><a id="t1227" href="#t1227">1227</a></span><span class="t"> <span class="nam">enable_manifest_installation_feature</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1228" href="#t1228">1228</a></span><span class="t"> <span class="key">and</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_install_rules</span> <span class="key">is</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1229" href="#t1229">1229</a></span><span class="t"> <span class="key">and</span> <span class="nam">dtmp_dir</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1230" href="#t1230">1230</a></span><span class="t"> <span class="key">and</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">isdir</span><span class="op">(</span><span class="nam">dtmp_dir</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1231" href="#t1231">1231</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1232" href="#t1232">1232</a></span><span class="t"> <span class="nam">msg</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1233" href="#t1233">1233</a></span><span class="t"> <span class="str">"The build system appears to have provided the output of upstream build system's"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1234" href="#t1234">1234</a></span><span class="t"> <span class="str">" install in debian/tmp. However, these are no provisions for debputy to install"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1235" href="#t1235">1235</a></span><span class="t"> <span class="str">" any of that into any of the debian packages listed in debian/control."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1236" href="#t1236">1236</a></span><span class="t"> <span class="str">" To avoid accidentally creating empty packages, debputy will insist that you "</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1237" href="#t1237">1237</a></span><span class="t"> <span class="str">" explicitly define an empty installation definition if you did not want to "</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1238" href="#t1238">1238</a></span><span class="t"> <span class="str">" install any of those files even though they have been provided."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1239" href="#t1239">1239</a></span><span class="t"> <span class="str">' Example: "installations: []"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1240" href="#t1240">1240</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1241" href="#t1241">1241</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span><span class="nam">msg</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1242" href="#t1242">1242</a></span><span class="t"> <span class="key">elif</span> <span class="op">(</span> </span><span class="r"><span class="annotate short">1242 ↛ 1245</span><span class="annotate long">line 1242 didn't jump to line 1245</span></span></p> - <p class="pln"><span class="n"><a id="t1243" href="#t1243">1243</a></span><span class="t"> <span class="key">not</span> <span class="nam">enable_manifest_installation_feature</span> <span class="key">and</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_install_rules</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1244" href="#t1244">1244</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1245" href="#t1245">1245</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1246" href="#t1246">1246</a></span><span class="t"> <span class="str">f"The `installations` feature cannot be used in {self.manifest_path} with this integration mode."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1247" href="#t1247">1247</a></span><span class="t"> <span class="str">f" Please remove or comment out the `installations` keyword."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1248" href="#t1248">1248</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1249" href="#t1249">1249</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1250" href="#t1250">1250</a></span><span class="t"> <span class="key">for</span> <span class="nam">dctrl_bin</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">all_packages</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1251" href="#t1251">1251</a></span><span class="t"> <span class="nam">package</span> <span class="op">=</span> <span class="nam">dctrl_bin</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1252" href="#t1252">1252</a></span><span class="t"> <span class="nam">doc_main_package</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_detect_doc_main_package_for</span><span class="op">(</span><span class="nam">dctrl_bin</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1253" href="#t1253">1253</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1254" href="#t1254">1254</a></span><span class="t"> <span class="nam">install_rule_context</span><span class="op">[</span><span class="nam">package</span><span class="op">]</span> <span class="op">=</span> <span class="nam">BinaryPackageInstallRuleContext</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1255" href="#t1255">1255</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1256" href="#t1256">1256</a></span><span class="t"> <span class="nam">FSRootDir</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1257" href="#t1257">1257</a></span><span class="t"> <span class="nam">doc_main_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1258" href="#t1258">1258</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1259" href="#t1259">1259</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1260" href="#t1260">1260</a></span><span class="t"> <span class="key">if</span> <span class="nam">enable_manifest_installation_feature</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1260 ↛ 1265</span><span class="annotate long">line 1260 didn't jump to line 1265</span></span></p> - <p class="run"><span class="n"><a id="t1261" href="#t1261">1261</a></span><span class="t"> <span class="nam">discard_rules</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1262" href="#t1262">1262</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">plugin_provided_feature_set</span><span class="op">.</span><span class="nam">auto_discard_rules</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1263" href="#t1263">1263</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1264" href="#t1264">1264</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1265" href="#t1265">1265</a></span><span class="t"> <span class="nam">discard_rules</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1266" href="#t1266">1266</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">plugin_provided_feature_set</span><span class="op">.</span><span class="nam">auto_discard_rules</span><span class="op">[</span><span class="str">"debian-dir"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1267" href="#t1267">1267</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1268" href="#t1268">1268</a></span><span class="t"> <span class="nam">path_matcher</span> <span class="op">=</span> <span class="nam">SourcePathMatcher</span><span class="op">(</span><span class="nam">discard_rules</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1269" href="#t1269">1269</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1270" href="#t1270">1270</a></span><span class="t"> <span class="nam">source_condition_context</span> <span class="op">=</span> <span class="nam">ConditionContext</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1271" href="#t1271">1271</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1272" href="#t1272">1272</a></span><span class="t"> <span class="nam">substitution</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1273" href="#t1273">1273</a></span><span class="t"> <span class="nam">build_env</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">_build_env</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1274" href="#t1274">1274</a></span><span class="t"> <span class="nam">dpkg_architecture_variables</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">_dpkg_architecture_variables</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1275" href="#t1275">1275</a></span><span class="t"> <span class="nam">dpkg_arch_query_table</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">_dpkg_arch_query_table</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1276" href="#t1276">1276</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1277" href="#t1277">1277</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1278" href="#t1278">1278</a></span><span class="t"> <span class="key">for</span> <span class="nam">dctrl_bin</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">active_packages</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1279" href="#t1279">1279</a></span><span class="t"> <span class="nam">package</span> <span class="op">=</span> <span class="nam">dctrl_bin</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1280" href="#t1280">1280</a></span><span class="t"> <span class="key">if</span> <span class="nam">install_request_context</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1280 ↛ 1285</span><span class="annotate long">line 1280 didn't jump to line 1285, because the condition on line 1280 was never false</span></span></p> - <p class="run"><span class="n"><a id="t1281" href="#t1281">1281</a></span><span class="t"> <span class="nam">build_system_staging_dir</span> <span class="op">=</span> <span class="nam">install_request_context</span><span class="op">.</span><span class="nam">debian_pkg_dirs</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1282" href="#t1282">1282</a></span><span class="t"> <span class="nam">package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1283" href="#t1283">1283</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1284" href="#t1284">1284</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1285" href="#t1285">1285</a></span><span class="t"> <span class="nam">build_system_staging_dir_fs_path</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="str">"debian"</span><span class="op">,</span> <span class="nam">package</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1286" href="#t1286">1286</a></span><span class="t"> <span class="key">if</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">isdir</span><span class="op">(</span><span class="nam">build_system_staging_dir_fs_path</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1287" href="#t1287">1287</a></span><span class="t"> <span class="nam">build_system_staging_dir</span> <span class="op">=</span> <span class="nam">FSROOverlay</span><span class="op">.</span><span class="nam">create_root_dir</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1288" href="#t1288">1288</a></span><span class="t"> <span class="str">"."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1289" href="#t1289">1289</a></span><span class="t"> <span class="nam">build_system_staging_dir_fs_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1290" href="#t1290">1290</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1291" href="#t1291">1291</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1292" href="#t1292">1292</a></span><span class="t"> <span class="nam">build_system_staging_dir</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1293" href="#t1293">1293</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1294" href="#t1294">1294</a></span><span class="t"> <span class="key">if</span> <span class="nam">build_system_staging_dir</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1295" href="#t1295">1295</a></span><span class="t"> <span class="nam">_install_everything_from_source_dir_if_present</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1296" href="#t1296">1296</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1297" href="#t1297">1297</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1298" href="#t1298">1298</a></span><span class="t"> <span class="nam">path_matcher</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1299" href="#t1299">1299</a></span><span class="t"> <span class="nam">install_rule_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1300" href="#t1300">1300</a></span><span class="t"> <span class="nam">source_condition_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1301" href="#t1301">1301</a></span><span class="t"> <span class="nam">build_system_staging_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1302" href="#t1302">1302</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1303" href="#t1303">1303</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1304" href="#t1304">1304</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_install_rules</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1305" href="#t1305">1305</a></span><span class="t"> <span class="com"># FIXME: Check that every install rule remains used after transformations have run.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1306" href="#t1306">1306</a></span><span class="t"> <span class="com"># What we want to check is transformations do not exclude everything from an install</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1307" href="#t1307">1307</a></span><span class="t"> <span class="com"># rule. The hard part here is that renaming (etc.) is fine, so we cannot 1:1 string</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1308" href="#t1308">1308</a></span><span class="t"> <span class="com"># match.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1309" href="#t1309">1309</a></span><span class="t"> <span class="key">for</span> <span class="nam">install_rule</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_install_rules</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1310" href="#t1310">1310</a></span><span class="t"> <span class="nam">install_rule</span><span class="op">.</span><span class="nam">perform_install</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1311" href="#t1311">1311</a></span><span class="t"> <span class="nam">path_matcher</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1312" href="#t1312">1312</a></span><span class="t"> <span class="nam">install_rule_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1313" href="#t1313">1313</a></span><span class="t"> <span class="nam">source_condition_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1314" href="#t1314">1314</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1315" href="#t1315">1315</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1316" href="#t1316">1316</a></span><span class="t"> <span class="key">if</span> <span class="nam">enable_manifest_installation_feature</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1316 ↛ 1320</span><span class="annotate long">line 1316 didn't jump to line 1320, because the condition on line 1316 was never false</span></span></p> - <p class="run"><span class="n"><a id="t1317" href="#t1317">1317</a></span><span class="t"> <span class="key">for</span> <span class="nam">search_dir</span> <span class="key">in</span> <span class="nam">check_for_uninstalled_dirs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1318" href="#t1318">1318</a></span><span class="t"> <span class="nam">_detect_missing_installations</span><span class="op">(</span><span class="nam">path_matcher</span><span class="op">,</span> <span class="nam">search_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1319" href="#t1319">1319</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1320" href="#t1320">1320</a></span><span class="t"> <span class="key">for</span> <span class="nam">dctrl_bin</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">all_packages</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1321" href="#t1321">1321</a></span><span class="t"> <span class="nam">package</span> <span class="op">=</span> <span class="nam">dctrl_bin</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1322" href="#t1322">1322</a></span><span class="t"> <span class="nam">binary_install_rule_context</span> <span class="op">=</span> <span class="nam">install_rule_context</span><span class="op">[</span><span class="nam">package</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1323" href="#t1323">1323</a></span><span class="t"> <span class="nam">build_system_pkg_staging_dir</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="str">"debian"</span><span class="op">,</span> <span class="nam">package</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1324" href="#t1324">1324</a></span><span class="t"> <span class="nam">fs_root</span> <span class="op">=</span> <span class="nam">binary_install_rule_context</span><span class="op">.</span><span class="nam">fs_root</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1325" href="#t1325">1325</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1326" href="#t1326">1326</a></span><span class="t"> <span class="nam">context</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">package_transformations</span><span class="op">[</span><span class="nam">package</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1327" href="#t1327">1327</a></span><span class="t"> <span class="key">if</span> <span class="nam">dctrl_bin</span><span class="op">.</span><span class="nam">should_be_acted_on</span> <span class="key">and</span> <span class="nam">enable_manifest_installation_feature</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1327 ↛ 1335</span><span class="annotate long">line 1327 didn't jump to line 1335, because the condition on line 1327 was never false</span></span></p> - <p class="par run show_par"><span class="n"><a id="t1328" href="#t1328">1328</a></span><span class="t"> <span class="key">for</span> <span class="nam">special_install_rule</span> <span class="key">in</span> <span class="nam">context</span><span class="op">.</span><span class="nam">install_rules</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1328 ↛ 1329</span><span class="annotate long">line 1328 didn't jump to line 1329, because the loop on line 1328 never started</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1329" href="#t1329">1329</a></span><span class="t"> <span class="nam">special_install_rule</span><span class="op">.</span><span class="nam">perform_install</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1330" href="#t1330">1330</a></span><span class="t"> <span class="nam">path_matcher</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1331" href="#t1331">1331</a></span><span class="t"> <span class="nam">install_rule_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1332" href="#t1332">1332</a></span><span class="t"> <span class="nam">source_condition_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1333" href="#t1333">1333</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1334" href="#t1334">1334</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1335" href="#t1335">1335</a></span><span class="t"> <span class="key">if</span> <span class="nam">dctrl_bin</span><span class="op">.</span><span class="nam">should_be_acted_on</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1335 ↛ 1347</span><span class="annotate long">line 1335 didn't jump to line 1347, because the condition on line 1335 was never false</span></span></p> - <p class="run"><span class="n"><a id="t1336" href="#t1336">1336</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">apply_fs_transformations</span><span class="op">(</span><span class="nam">package</span><span class="op">,</span> <span class="nam">fs_root</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1337" href="#t1337">1337</a></span><span class="t"> <span class="nam">substvars_file</span> <span class="op">=</span> <span class="str">f"debian/{package}.substvars"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1338" href="#t1338">1338</a></span><span class="t"> <span class="nam">substvars</span> <span class="op">=</span> <span class="nam">FlushableSubstvars</span><span class="op">.</span><span class="nam">load_from_path</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1339" href="#t1339">1339</a></span><span class="t"> <span class="nam">substvars_file</span><span class="op">,</span> <span class="nam">missing_ok</span><span class="op">=</span><span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1340" href="#t1340">1340</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1341" href="#t1341">1341</a></span><span class="t"> <span class="com"># We do not want to touch the substvars file (non-clean rebuild contamination)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1342" href="#t1342">1342</a></span><span class="t"> <span class="nam">substvars</span><span class="op">.</span><span class="nam">substvars_path</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1343" href="#t1343">1343</a></span><span class="t"> <span class="nam">control_output_dir</span> <span class="op">=</span> <span class="nam">generated_content_dir</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1344" href="#t1344">1344</a></span><span class="t"> <span class="nam">package</span><span class="op">=</span><span class="nam">dctrl_bin</span><span class="op">,</span> <span class="nam">subdir_key</span><span class="op">=</span><span class="str">"DEBIAN"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1345" href="#t1345">1345</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1346" href="#t1346">1346</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1347" href="#t1347">1347</a></span><span class="t"> <span class="nam">substvars</span> <span class="op">=</span> <span class="nam">FlushableSubstvars</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1348" href="#t1348">1348</a></span><span class="t"> <span class="nam">control_output_dir</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1349" href="#t1349">1349</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1350" href="#t1350">1350</a></span><span class="t"> <span class="nam">udeb_package</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_binary_packages</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">f"{package}-udeb"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1351" href="#t1351">1351</a></span><span class="t"> <span class="key">if</span> <span class="nam">udeb_package</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">udeb_package</span><span class="op">.</span><span class="nam">is_udeb</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1351 ↛ 1352</span><span class="annotate long">line 1351 didn't jump to line 1352, because the condition on line 1351 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1352" href="#t1352">1352</a></span><span class="t"> <span class="nam">udeb_package</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1353" href="#t1353">1353</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1354" href="#t1354">1354</a></span><span class="t"> <span class="nam">package_metadata_context</span> <span class="op">=</span> <span class="nam">PackageProcessingContextProvider</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1355" href="#t1355">1355</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1356" href="#t1356">1356</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1357" href="#t1357">1357</a></span><span class="t"> <span class="nam">udeb_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1358" href="#t1358">1358</a></span><span class="t"> <span class="nam">package_data_table</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1359" href="#t1359">1359</a></span><span class="t"> <span class="com"># FIXME: source_package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1360" href="#t1360">1360</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1361" href="#t1361">1361</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1362" href="#t1362">1362</a></span><span class="t"> <span class="nam">ctrl_creator</span> <span class="op">=</span> <span class="nam">BinaryCtrlAccessorProviderCreator</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1363" href="#t1363">1363</a></span><span class="t"> <span class="nam">package_metadata_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1364" href="#t1364">1364</a></span><span class="t"> <span class="nam">substvars</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1365" href="#t1365">1365</a></span><span class="t"> <span class="nam">context</span><span class="op">.</span><span class="nam">maintscript_snippets</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1366" href="#t1366">1366</a></span><span class="t"> <span class="nam">context</span><span class="op">.</span><span class="nam">substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1367" href="#t1367">1367</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1368" href="#t1368">1368</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1369" href="#t1369">1369</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">enable_manifest_installation_feature</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1369 ↛ 1370</span><span class="annotate long">line 1369 didn't jump to line 1370, because the condition on line 1369 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1370" href="#t1370">1370</a></span><span class="t"> <span class="nam">assert_no_dbgsym_migration</span><span class="op">(</span><span class="nam">dctrl_bin</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1371" href="#t1371">1371</a></span><span class="t"> <span class="nam">dh_dbgsym_root_fs</span> <span class="op">=</span> <span class="nam">FSROOverlay</span><span class="op">.</span><span class="nam">create_root_dir</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1372" href="#t1372">1372</a></span><span class="t"> <span class="str">""</span><span class="op">,</span> <span class="nam">dhe_dbgsym_root_dir</span><span class="op">(</span><span class="nam">dctrl_bin</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1373" href="#t1373">1373</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1374" href="#t1374">1374</a></span><span class="t"> <span class="nam">dbgsym_root_fs</span> <span class="op">=</span> <span class="nam">FSRootDir</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1375" href="#t1375">1375</a></span><span class="t"> <span class="nam">_install_everything_from_source_dir_if_present</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1376" href="#t1376">1376</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1377" href="#t1377">1377</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1378" href="#t1378">1378</a></span><span class="t"> <span class="nam">path_matcher</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1379" href="#t1379">1379</a></span><span class="t"> <span class="nam">install_rule_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1380" href="#t1380">1380</a></span><span class="t"> <span class="nam">source_condition_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1381" href="#t1381">1381</a></span><span class="t"> <span class="nam">dh_dbgsym_root_fs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1382" href="#t1382">1382</a></span><span class="t"> <span class="nam">into_dir</span><span class="op">=</span><span class="nam">dbgsym_root_fs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1383" href="#t1383">1383</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1384" href="#t1384">1384</a></span><span class="t"> <span class="nam">dbgsym_build_ids</span> <span class="op">=</span> <span class="nam">read_dbgsym_file</span><span class="op">(</span><span class="nam">dctrl_bin</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1385" href="#t1385">1385</a></span><span class="t"> <span class="nam">dbgsym_info</span> <span class="op">=</span> <span class="nam">DbgsymInfo</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1386" href="#t1386">1386</a></span><span class="t"> <span class="nam">dbgsym_root_fs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1387" href="#t1387">1387</a></span><span class="t"> <span class="nam">dbgsym_build_ids</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1388" href="#t1388">1388</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1389" href="#t1389">1389</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1390" href="#t1390">1390</a></span><span class="t"> <span class="nam">dbgsym_info</span> <span class="op">=</span> <span class="nam">DbgsymInfo</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1391" href="#t1391">1391</a></span><span class="t"> <span class="nam">FSRootDir</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1392" href="#t1392">1392</a></span><span class="t"> <span class="op">[</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1393" href="#t1393">1393</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1394" href="#t1394">1394</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1395" href="#t1395">1395</a></span><span class="t"> <span class="nam">package_data_dict</span><span class="op">[</span><span class="nam">package</span><span class="op">]</span> <span class="op">=</span> <span class="nam">BinaryPackageData</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1396" href="#t1396">1396</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_source_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1397" href="#t1397">1397</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1398" href="#t1398">1398</a></span><span class="t"> <span class="nam">build_system_pkg_staging_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1399" href="#t1399">1399</a></span><span class="t"> <span class="nam">control_output_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1400" href="#t1400">1400</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1401" href="#t1401">1401</a></span><span class="t"> <span class="nam">substvars</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1402" href="#t1402">1402</a></span><span class="t"> <span class="nam">package_metadata_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1403" href="#t1403">1403</a></span><span class="t"> <span class="nam">ctrl_creator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1404" href="#t1404">1404</a></span><span class="t"> <span class="nam">dbgsym_info</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1405" href="#t1405">1405</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1406" href="#t1406">1406</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1407" href="#t1407">1407</a></span><span class="t"> <span class="nam">_list_automatic_discard_rules</span><span class="op">(</span><span class="nam">path_matcher</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1408" href="#t1408">1408</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1409" href="#t1409">1409</a></span><span class="t"> <span class="key">return</span> <span class="nam">package_data_table</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1410" href="#t1410">1410</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1411" href="#t1411">1411</a></span><span class="t"> <span class="key">def</span> <span class="nam">condition_context</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1412" href="#t1412">1412</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> <span class="nam">binary_package</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1413" href="#t1413">1413</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">ConditionContext</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1414" href="#t1414">1414</a></span><span class="t"> <span class="key">if</span> <span class="nam">binary_package</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1414 ↛ 1415</span><span class="annotate long">line 1414 didn't jump to line 1415, because the condition on line 1414 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1415" href="#t1415">1415</a></span><span class="t"> <span class="key">return</span> <span class="nam">ConditionContext</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1416" href="#t1416">1416</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1417" href="#t1417">1417</a></span><span class="t"> <span class="nam">substitution</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1418" href="#t1418">1418</a></span><span class="t"> <span class="nam">build_env</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">_build_env</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1419" href="#t1419">1419</a></span><span class="t"> <span class="nam">dpkg_architecture_variables</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">_dpkg_architecture_variables</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1420" href="#t1420">1420</a></span><span class="t"> <span class="nam">dpkg_arch_query_table</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">_dpkg_arch_query_table</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1421" href="#t1421">1421</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1422" href="#t1422">1422</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">binary_package</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1422 ↛ 1423</span><span class="annotate long">line 1422 didn't jump to line 1423, because the condition on line 1422 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1423" href="#t1423">1423</a></span><span class="t"> <span class="nam">binary_package</span> <span class="op">=</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1424" href="#t1424">1424</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1425" href="#t1425">1425</a></span><span class="t"> <span class="nam">package_transformation</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">package_transformations</span><span class="op">[</span><span class="nam">binary_package</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1426" href="#t1426">1426</a></span><span class="t"> <span class="key">return</span> <span class="nam">ConditionContext</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1427" href="#t1427">1427</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">=</span><span class="nam">package_transformation</span><span class="op">.</span><span class="nam">binary_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1428" href="#t1428">1428</a></span><span class="t"> <span class="nam">substitution</span><span class="op">=</span><span class="nam">package_transformation</span><span class="op">.</span><span class="nam">substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1429" href="#t1429">1429</a></span><span class="t"> <span class="nam">build_env</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">_build_env</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1430" href="#t1430">1430</a></span><span class="t"> <span class="nam">dpkg_architecture_variables</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">_dpkg_architecture_variables</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1431" href="#t1431">1431</a></span><span class="t"> <span class="nam">dpkg_arch_query_table</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">_dpkg_arch_query_table</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1432" href="#t1432">1432</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1433" href="#t1433">1433</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1434" href="#t1434">1434</a></span><span class="t"> <span class="key">def</span> <span class="nam">apply_fs_transformations</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1435" href="#t1435">1435</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1436" href="#t1436">1436</a></span><span class="t"> <span class="nam">package</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1437" href="#t1437">1437</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">FSPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1438" href="#t1438">1438</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1439" href="#t1439">1439</a></span><span class="t"> <span class="key">if</span> <span class="nam">package</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_used_for</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1439 ↛ 1440</span><span class="annotate long">line 1439 didn't jump to line 1440, because the condition on line 1439 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1440" href="#t1440">1440</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1441" href="#t1441">1441</a></span><span class="t"> <span class="str">f"data.tar contents for {package} has already been finalized!?"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1442" href="#t1442">1442</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1443" href="#t1443">1443</a></span><span class="t"> <span class="key">if</span> <span class="nam">package</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">package_transformations</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1443 ↛ 1444</span><span class="annotate long">line 1443 didn't jump to line 1444, because the condition on line 1443 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1444" href="#t1444">1444</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1445" href="#t1445">1445</a></span><span class="t"> <span class="str">f'The package "{package}" was not relevant for the manifest!?'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1446" href="#t1446">1446</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1447" href="#t1447">1447</a></span><span class="t"> <span class="nam">package_transformation</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">package_transformations</span><span class="op">[</span><span class="nam">package</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1448" href="#t1448">1448</a></span><span class="t"> <span class="nam">condition_context</span> <span class="op">=</span> <span class="nam">ConditionContext</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1449" href="#t1449">1449</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">=</span><span class="nam">package_transformation</span><span class="op">.</span><span class="nam">binary_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1450" href="#t1450">1450</a></span><span class="t"> <span class="nam">substitution</span><span class="op">=</span><span class="nam">package_transformation</span><span class="op">.</span><span class="nam">substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1451" href="#t1451">1451</a></span><span class="t"> <span class="nam">build_env</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">_build_env</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1452" href="#t1452">1452</a></span><span class="t"> <span class="nam">dpkg_architecture_variables</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">_dpkg_architecture_variables</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1453" href="#t1453">1453</a></span><span class="t"> <span class="nam">dpkg_arch_query_table</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">_dpkg_arch_query_table</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1454" href="#t1454">1454</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1455" href="#t1455">1455</a></span><span class="t"> <span class="nam">norm_rules</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1456" href="#t1456">1456</a></span><span class="t"> <span class="nam">builtin_mode_normalization_rules</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1457" href="#t1457">1457</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_dpkg_architecture_variables</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1458" href="#t1458">1458</a></span><span class="t"> <span class="nam">package_transformation</span><span class="op">.</span><span class="nam">binary_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1459" href="#t1459">1459</a></span><span class="t"> <span class="nam">package_transformation</span><span class="op">.</span><span class="nam">substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1460" href="#t1460">1460</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1461" href="#t1461">1461</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1462" href="#t1462">1462</a></span><span class="t"> <span class="nam">norm_mode_transformation_rule</span> <span class="op">=</span> <span class="nam">ModeNormalizationTransformationRule</span><span class="op">(</span><span class="nam">norm_rules</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1463" href="#t1463">1463</a></span><span class="t"> <span class="nam">norm_mode_transformation_rule</span><span class="op">.</span><span class="nam">transform_file_system</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">,</span> <span class="nam">condition_context</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1464" href="#t1464">1464</a></span><span class="t"> <span class="key">for</span> <span class="nam">transformation</span> <span class="key">in</span> <span class="nam">package_transformation</span><span class="op">.</span><span class="nam">transformations</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1465" href="#t1465">1465</a></span><span class="t"> <span class="nam">transformation</span><span class="op">.</span><span class="nam">transform_file_system</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">,</span> <span class="nam">condition_context</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1466" href="#t1466">1466</a></span><span class="t"> <span class="nam">interpreter_normalization</span> <span class="op">=</span> <span class="nam">NormalizeShebangLineTransformation</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1467" href="#t1467">1467</a></span><span class="t"> <span class="nam">interpreter_normalization</span><span class="op">.</span><span class="nam">transform_file_system</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">,</span> <span class="nam">condition_context</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1468" href="#t1468">1468</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1469" href="#t1469">1469</a></span><span class="t"> <span class="key">def</span> <span class="nam">finalize_data_tar_contents</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1470" href="#t1470">1470</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1471" href="#t1471">1471</a></span><span class="t"> <span class="nam">package</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1472" href="#t1472">1472</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">FSPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1473" href="#t1473">1473</a></span><span class="t"> <span class="nam">clamp_mtime_to</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1474" href="#t1474">1474</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">IntermediateManifest</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1475" href="#t1475">1475</a></span><span class="t"> <span class="key">if</span> <span class="nam">package</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_used_for</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1475 ↛ 1476</span><span class="annotate long">line 1475 didn't jump to line 1476, because the condition on line 1475 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1476" href="#t1476">1476</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1477" href="#t1477">1477</a></span><span class="t"> <span class="str">f"data.tar contents for {package} has already been finalized!?"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1478" href="#t1478">1478</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1479" href="#t1479">1479</a></span><span class="t"> <span class="key">if</span> <span class="nam">package</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">package_transformations</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1479 ↛ 1480</span><span class="annotate long">line 1479 didn't jump to line 1480, because the condition on line 1479 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1480" href="#t1480">1480</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1481" href="#t1481">1481</a></span><span class="t"> <span class="str">f'The package "{package}" was not relevant for the manifest!?'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1482" href="#t1482">1482</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1483" href="#t1483">1483</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_used_for</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">package</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1484" href="#t1484">1484</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1485" href="#t1485">1485</a></span><span class="t"> <span class="com"># At this point, there so be no further mutations to the file system (because the will not</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1486" href="#t1486">1486</a></span><span class="t"> <span class="com"># be present in the intermediate manifest)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1487" href="#t1487">1487</a></span><span class="t"> <span class="nam">cast</span><span class="op">(</span><span class="str">"FSRootDir"</span><span class="op">,</span> <span class="nam">fs_root</span><span class="op">)</span><span class="op">.</span><span class="nam">is_read_write</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1488" href="#t1488">1488</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1489" href="#t1489">1489</a></span><span class="t"> <span class="nam">intermediate_manifest</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1490" href="#t1490">1490</a></span><span class="t"> <span class="nam">_generate_intermediate_manifest</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1491" href="#t1491">1491</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1492" href="#t1492">1492</a></span><span class="t"> <span class="nam">clamp_mtime_to</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1493" href="#t1493">1493</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1494" href="#t1494">1494</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1495" href="#t1495">1495</a></span><span class="t"> <span class="key">return</span> <span class="nam">intermediate_manifest</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1496" href="#t1496">1496</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1497" href="#t1497">1497</a></span><span class="t"> <span class="key">def</span> <span class="nam">apply_to_binary_staging_directory</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1498" href="#t1498">1498</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1499" href="#t1499">1499</a></span><span class="t"> <span class="nam">package</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1500" href="#t1500">1500</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">FSPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1501" href="#t1501">1501</a></span><span class="t"> <span class="nam">clamp_mtime_to</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1502" href="#t1502">1502</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">IntermediateManifest</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1503" href="#t1503">1503</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">apply_fs_transformations</span><span class="op">(</span><span class="nam">package</span><span class="op">,</span> <span class="nam">fs_root</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1504" href="#t1504">1504</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">finalize_data_tar_contents</span><span class="op">(</span><span class="nam">package</span><span class="op">,</span> <span class="nam">fs_root</span><span class="op">,</span> <span class="nam">clamp_mtime_to</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1505" href="#t1505">1505</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1506" href="#t1506">1506</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1507" href="#t1507">1507</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1508" href="#t1508">1508</a></span><span class="t"><span class="key">class</span> <span class="nam">SearchDirOrderState</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1509" href="#t1509">1509</a></span><span class="t"> <span class="nam">search_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1510" href="#t1510">1510</a></span><span class="t"> <span class="nam">applies_to</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">Set</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">,</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="nam">dataclasses</span><span class="op">.</span><span class="nam">field</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1511" href="#t1511">1511</a></span><span class="t"> <span class="nam">default_factory</span><span class="op">=</span><span class="nam">set</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1512" href="#t1512">1512</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1513" href="#t1513">1513</a></span><span class="t"> <span class="nam">after</span><span class="op">:</span> <span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="nam">dataclasses</span><span class="op">.</span><span class="nam">field</span><span class="op">(</span><span class="nam">default_factory</span><span class="op">=</span><span class="nam">set</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1514" href="#t1514">1514</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1515" href="#t1515">1515</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1516" href="#t1516">1516</a></span><span class="t"><span class="key">def</span> <span class="nam">_present_installation_dirs</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1517" href="#t1517">1517</a></span><span class="t"> <span class="nam">search_dirs</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">SearchDir</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1518" href="#t1518">1518</a></span><span class="t"> <span class="nam">checked_missing_dirs</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1519" href="#t1519">1519</a></span><span class="t"> <span class="nam">all_pkgs</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1520" href="#t1520">1520</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1521" href="#t1521">1521</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">"The following directories are considered search dirs (in order):"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1522" href="#t1522">1522</a></span><span class="t"> <span class="nam">max_len</span> <span class="op">=</span> <span class="nam">max</span><span class="op">(</span><span class="op">(</span><span class="nam">len</span><span class="op">(</span><span class="nam">s</span><span class="op">.</span><span class="nam">search_dir</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">)</span> <span class="key">for</span> <span class="nam">s</span> <span class="key">in</span> <span class="nam">search_dirs</span><span class="op">)</span><span class="op">,</span> <span class="nam">default</span><span class="op">=</span><span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1523" href="#t1523">1523</a></span><span class="t"> <span class="key">for</span> <span class="nam">search_dir</span> <span class="key">in</span> <span class="nam">search_dirs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1524" href="#t1524">1524</a></span><span class="t"> <span class="nam">applies_to</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1525" href="#t1525">1525</a></span><span class="t"> <span class="key">if</span> <span class="nam">search_dir</span><span class="op">.</span><span class="nam">applies_to</span> <span class="op"><</span> <span class="nam">all_pkgs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1526" href="#t1526">1526</a></span><span class="t"> <span class="nam">names</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">p</span><span class="op">.</span><span class="nam">name</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">search_dir</span><span class="op">.</span><span class="nam">applies_to</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1527" href="#t1527">1527</a></span><span class="t"> <span class="nam">applies_to</span> <span class="op">=</span> <span class="str">f" [only applicable to: {names}]"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1528" href="#t1528">1528</a></span><span class="t"> <span class="nam">remark</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1529" href="#t1529">1529</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">isdir</span><span class="op">(</span><span class="nam">search_dir</span><span class="op">.</span><span class="nam">search_dir</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1530" href="#t1530">1530</a></span><span class="t"> <span class="nam">remark</span> <span class="op">=</span> <span class="str">" (skipped; absent)"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1531" href="#t1531">1531</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f" * {search_dir.search_dir.fs_path:{max_len}}{applies_to}{remark}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1532" href="#t1532">1532</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1533" href="#t1533">1533</a></span><span class="t"> <span class="key">if</span> <span class="nam">checked_missing_dirs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1534" href="#t1534">1534</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">'The following directories are considered for "not-installed" paths;'</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1535" href="#t1535">1535</a></span><span class="t"> <span class="key">for</span> <span class="nam">d</span> <span class="key">in</span> <span class="nam">checked_missing_dirs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1536" href="#t1536">1536</a></span><span class="t"> <span class="nam">remark</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1537" href="#t1537">1537</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">isdir</span><span class="op">(</span><span class="nam">d</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1538" href="#t1538">1538</a></span><span class="t"> <span class="nam">remark</span> <span class="op">=</span> <span class="str">" (skipped; absent)"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1539" href="#t1539">1539</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f" * {d.fs_path:{max_len}}{remark}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1540" href="#t1540">1540</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1541" href="#t1541">1541</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1542" href="#t1542">1542</a></span><span class="t"><span class="key">def</span> <span class="nam">_determine_search_dir_order</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1543" href="#t1543">1543</a></span><span class="t"> <span class="nam">requested</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1544" href="#t1544">1544</a></span><span class="t"> <span class="nam">all_pkgs</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1545" href="#t1545">1545</a></span><span class="t"> <span class="nam">default_search_dirs</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1546" href="#t1546">1546</a></span><span class="t"> <span class="nam">source_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1547" href="#t1547">1547</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">SearchDir</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1548" href="#t1548">1548</a></span><span class="t"> <span class="nam">search_dir_table</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1549" href="#t1549">1549</a></span><span class="t"> <span class="key">assert</span> <span class="nam">requested</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span> <span class="op"><=</span> <span class="nam">all_pkgs</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1550" href="#t1550">1550</a></span><span class="t"> <span class="key">for</span> <span class="nam">pkg</span> <span class="key">in</span> <span class="nam">all_pkgs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1551" href="#t1551">1551</a></span><span class="t"> <span class="nam">paths</span> <span class="op">=</span> <span class="nam">requested</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">pkg</span><span class="op">,</span> <span class="nam">default_search_dirs</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1552" href="#t1552">1552</a></span><span class="t"> <span class="nam">previous_search_dir</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">SearchDirOrderState</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1553" href="#t1553">1553</a></span><span class="t"> <span class="key">for</span> <span class="nam">path</span> <span class="key">in</span> <span class="nam">paths</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1554" href="#t1554">1554</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1555" href="#t1555">1555</a></span><span class="t"> <span class="nam">search_dir_state</span> <span class="op">=</span> <span class="nam">search_dir_table</span><span class="op">[</span><span class="nam">path</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1556" href="#t1556">1556</a></span><span class="t"> <span class="key">except</span> <span class="nam">KeyError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1557" href="#t1557">1557</a></span><span class="t"> <span class="nam">search_dir_state</span> <span class="op">=</span> <span class="nam">SearchDirOrderState</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1558" href="#t1558">1558</a></span><span class="t"> <span class="nam">search_dir_table</span><span class="op">[</span><span class="nam">path</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">]</span> <span class="op">=</span> <span class="nam">search_dir_state</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1559" href="#t1559">1559</a></span><span class="t"> <span class="nam">search_dir_state</span><span class="op">.</span><span class="nam">applies_to</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">pkg</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1560" href="#t1560">1560</a></span><span class="t"> <span class="key">if</span> <span class="nam">previous_search_dir</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1561" href="#t1561">1561</a></span><span class="t"> <span class="nam">search_dir_state</span><span class="op">.</span><span class="nam">after</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">previous_search_dir</span><span class="op">.</span><span class="nam">search_dir</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1562" href="#t1562">1562</a></span><span class="t"> <span class="nam">previous_search_dir</span> <span class="op">=</span> <span class="nam">search_dir_state</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1563" href="#t1563">1563</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1564" href="#t1564">1564</a></span><span class="t"> <span class="nam">search_dirs_in_order</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1565" href="#t1565">1565</a></span><span class="t"> <span class="nam">released</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1566" href="#t1566">1566</a></span><span class="t"> <span class="nam">remaining</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1567" href="#t1567">1567</a></span><span class="t"> <span class="key">for</span> <span class="nam">search_dir_state</span> <span class="key">in</span> <span class="nam">search_dir_table</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1568" href="#t1568">1568</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="op">(</span><span class="nam">search_dir_state</span><span class="op">.</span><span class="nam">after</span> <span class="op"><=</span> <span class="nam">released</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1569" href="#t1569">1569</a></span><span class="t"> <span class="nam">remaining</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">search_dir_state</span><span class="op">.</span><span class="nam">search_dir</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1570" href="#t1570">1570</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1571" href="#t1571">1571</a></span><span class="t"> <span class="nam">search_dirs_in_order</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">search_dir_state</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1572" href="#t1572">1572</a></span><span class="t"> <span class="nam">released</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">search_dir_state</span><span class="op">.</span><span class="nam">search_dir</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1573" href="#t1573">1573</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1574" href="#t1574">1574</a></span><span class="t"> <span class="key">while</span> <span class="nam">remaining</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1575" href="#t1575">1575</a></span><span class="t"> <span class="nam">current_released</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">released</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1576" href="#t1576">1576</a></span><span class="t"> <span class="key">for</span> <span class="nam">fs_path</span> <span class="key">in</span> <span class="nam">remaining</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1577" href="#t1577">1577</a></span><span class="t"> <span class="nam">search_dir_state</span> <span class="op">=</span> <span class="nam">search_dir_table</span><span class="op">[</span><span class="nam">fs_path</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1578" href="#t1578">1578</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">search_dir_state</span><span class="op">.</span><span class="nam">after</span><span class="op">.</span><span class="nam">issubset</span><span class="op">(</span><span class="nam">released</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1579" href="#t1579">1579</a></span><span class="t"> <span class="nam">remaining</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">search_dir_state</span><span class="op">.</span><span class="nam">search_dir</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1580" href="#t1580">1580</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1581" href="#t1581">1581</a></span><span class="t"> <span class="nam">search_dirs_in_order</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">search_dir_state</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1582" href="#t1582">1582</a></span><span class="t"> <span class="nam">released</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">search_dir_state</span><span class="op">.</span><span class="nam">search_dir</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1583" href="#t1583">1583</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1584" href="#t1584">1584</a></span><span class="t"> <span class="key">if</span> <span class="nam">current_released</span> <span class="op">==</span> <span class="nam">len</span><span class="op">(</span><span class="nam">released</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1585" href="#t1585">1585</a></span><span class="t"> <span class="nam">names</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">remaining</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1586" href="#t1586">1586</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1587" href="#t1587">1587</a></span><span class="t"> <span class="str">f"There is a circular dependency (somewhere) between the search dirs: {names}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1588" href="#t1588">1588</a></span><span class="t"> <span class="str">" Note that the search directories across all packages have to be ordered (and the"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1589" href="#t1589">1589</a></span><span class="t"> <span class="str">" source root should generally be last)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1590" href="#t1590">1590</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1591" href="#t1591">1591</a></span><span class="t"> <span class="nam">remaining</span> <span class="op">-=</span> <span class="nam">released</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1592" href="#t1592">1592</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1593" href="#t1593">1593</a></span><span class="t"> <span class="nam">search_dirs_in_order</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1594" href="#t1594">1594</a></span><span class="t"> <span class="nam">SearchDirOrderState</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1595" href="#t1595">1595</a></span><span class="t"> <span class="nam">source_root</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1596" href="#t1596">1596</a></span><span class="t"> <span class="nam">all_pkgs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1597" href="#t1597">1597</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1598" href="#t1598">1598</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1599" href="#t1599">1599</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1600" href="#t1600">1600</a></span><span class="t"> <span class="key">return</span> <span class="nam">tuple</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1601" href="#t1601">1601</a></span><span class="t"> <span class="com"># Avoid duplicating all_pkgs</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1602" href="#t1602">1602</a></span><span class="t"> <span class="nam">SearchDir</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1603" href="#t1603">1603</a></span><span class="t"> <span class="nam">s</span><span class="op">.</span><span class="nam">search_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1604" href="#t1604">1604</a></span><span class="t"> <span class="nam">frozenset</span><span class="op">(</span><span class="nam">s</span><span class="op">.</span><span class="nam">applies_to</span><span class="op">)</span> <span class="key">if</span> <span class="nam">s</span><span class="op">.</span><span class="nam">applies_to</span> <span class="op">!=</span> <span class="nam">all_pkgs</span> <span class="key">else</span> <span class="nam">all_pkgs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1605" href="#t1605">1605</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1606" href="#t1606">1606</a></span><span class="t"> <span class="key">for</span> <span class="nam">s</span> <span class="key">in</span> <span class="nam">search_dirs_in_order</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1607" href="#t1607">1607</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_filesystem_scan_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_highlevel_manifest_parser_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_267b6307937f1878_installations_py.html b/coverage-report/d_267b6307937f1878_installations_py.html deleted file mode 100644 index 6318f48..0000000 --- a/coverage-report/d_267b6307937f1878_installations_py.html +++ /dev/null @@ -1,1261 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/installations.py: 65%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/installations.py</b>: - <span class="pc_cov">65%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">499 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">342<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">157<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">5<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">36<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_highlevel_manifest_parser_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_intermediate_manifest_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">collections</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">dataclasses</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">import</span> <span class="nam">re</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">from</span> <span class="nam">enum</span> <span class="key">import</span> <span class="nam">IntEnum</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">List</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">Dict</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">FrozenSet</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">Callable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">Iterator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">Set</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">Sequence</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">Iterable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">TYPE_CHECKING</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">cast</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">Mapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">exceptions</span> <span class="key">import</span> <span class="nam">DebputyRuntimeError</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">filesystem_scan</span> <span class="key">import</span> <span class="nam">FSPath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_conditions</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="nam">ConditionContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="nam">ManifestCondition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="nam">_BUILD_DOCS_BDO</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">base_types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="nam">FileSystemMatchRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="nam">FileSystemExactMatchRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="nam">DebputyDispatchableType</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">packages</span> <span class="key">import</span> <span class="nam">BinaryPackage</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">path_matcher</span> <span class="key">import</span> <span class="nam">MatchRule</span><span class="op">,</span> <span class="nam">ExactFileSystemPath</span><span class="op">,</span> <span class="nam">MATCH_ANYTHING</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">substitution</span> <span class="key">import</span> <span class="nam">Substitution</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">_error</span><span class="op">,</span> <span class="nam">_warn</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"><span class="key">if</span> <span class="nam">TYPE_CHECKING</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">packager_provided_files</span> <span class="key">import</span> <span class="nam">PackagerProvidedFile</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="nam">VirtualPath</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">impl_types</span> <span class="key">import</span> <span class="nam">PluginProvidedDiscardRule</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"><span class="nam">_MAN_TH_LINE</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r'^[.]TH\s+\S+\s+"?(\d+[^"\s]*)"?'</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"><span class="nam">_MAN_DT_LINE</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r"^[.]Dt\s+\S+\s+(\d+\S*)"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"><span class="nam">_MAN_SECTION_BASENAME</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r"[.]([1-9]\w*)(?:[.]gz)?$"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"><span class="nam">_MAN_REAL_SECTION</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r"^(\d+)"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"><span class="nam">_MAN_INST_BASENAME</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r"[.][^.]+$"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"><span class="nam">MAN_GUESS_LANG_FROM_PATH</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="str">r"(?:^|/)man/(?:([a-z][a-z](?:_[A-Z][A-Z])?)(?:\.[^/]+)?)?/man[1-9]/"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"><span class="nam">MAN_GUESS_FROM_BASENAME</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r"[.]([a-z][a-z](?:_[A-Z][A-Z])?)[.](?:[1-9]|man)"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"><span class="key">class</span> <span class="nam">InstallRuleError</span><span class="op">(</span><span class="nam">DebputyRuntimeError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"><span class="key">class</span> <span class="nam">PathAlreadyInstalledOrDiscardedError</span><span class="op">(</span><span class="nam">InstallRuleError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="key">def</span> <span class="nam">path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="key">return</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"str"</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">args</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="key">def</span> <span class="nam">into</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="key">return</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"FrozenSet[BinaryPackage]"</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">args</span><span class="op">[</span><span class="num">1</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="key">def</span> <span class="nam">definition_source</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="key">return</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"str"</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">args</span><span class="op">[</span><span class="num">2</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"><span class="key">class</span> <span class="nam">ExactPathMatchTwiceError</span><span class="op">(</span><span class="nam">InstallRuleError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="key">def</span> <span class="nam">path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="key">return</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"str"</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">args</span><span class="op">[</span><span class="num">1</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="key">def</span> <span class="nam">into</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">BinaryPackage</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="key">return</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"BinaryPackage"</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">args</span><span class="op">[</span><span class="num">2</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="key">def</span> <span class="nam">definition_source</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="key">return</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"str"</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">args</span><span class="op">[</span><span class="num">3</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"><span class="key">class</span> <span class="nam">NoMatchForInstallPatternError</span><span class="op">(</span><span class="nam">InstallRuleError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="key">def</span> <span class="nam">pattern</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="key">return</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"str"</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">args</span><span class="op">[</span><span class="num">1</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="key">def</span> <span class="nam">search_dirs</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Sequence</span><span class="op">[</span><span class="str">"SearchDir"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="key">return</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"Sequence[SearchDir]"</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">args</span><span class="op">[</span><span class="num">2</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="key">def</span> <span class="nam">definition_source</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="key">return</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"str"</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">args</span><span class="op">[</span><span class="num">3</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"><span class="key">class</span> <span class="nam">SearchDir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="nam">search_dir</span><span class="op">:</span> <span class="str">"VirtualPath"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="nam">applies_to</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"><span class="key">class</span> <span class="nam">BinaryPackageInstallRuleContext</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">:</span> <span class="nam">BinaryPackage</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">FSPath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="nam">doc_main_package</span><span class="op">:</span> <span class="nam">BinaryPackage</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="key">def</span> <span class="nam">replace</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">**</span><span class="nam">changes</span><span class="op">:</span> <span class="nam">Any</span><span class="op">)</span> <span class="op">-></span> <span class="str">"BinaryPackageInstallRuleContext"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="key">return</span> <span class="nam">dataclasses</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">**</span><span class="nam">changes</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"><span class="key">class</span> <span class="nam">InstallSearchDirContext</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="nam">search_dirs</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">SearchDir</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="nam">check_for_uninstalled_dirs</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="str">"VirtualPath"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="com"># TODO: Support search dirs per-package</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="nam">debian_pkg_dirs</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="str">"VirtualPath"</span><span class="op">]</span> <span class="op">=</span> <span class="nam">dataclasses</span><span class="op">.</span><span class="nam">field</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="nam">default_factory</span><span class="op">=</span><span class="nam">dict</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"><span class="key">class</span> <span class="nam">InstallRuleContext</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="com"># TODO: Search dirs should be per-package</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="nam">search_dirs</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">SearchDir</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="nam">binary_package_contexts</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">BinaryPackageInstallRuleContext</span><span class="op">]</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="nam">dataclasses</span><span class="op">.</span><span class="nam">field</span><span class="op">(</span><span class="nam">default_factory</span><span class="op">=</span><span class="nam">dict</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="key">def</span> <span class="nam">__getitem__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">item</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">BinaryPackageInstallRuleContext</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">binary_package_contexts</span><span class="op">[</span><span class="nam">item</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="key">def</span> <span class="nam">__setitem__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">key</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">value</span><span class="op">:</span> <span class="nam">BinaryPackageInstallRuleContext</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">binary_package_contexts</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> <span class="op">=</span> <span class="nam">value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="key">def</span> <span class="nam">replace</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">**</span><span class="nam">changes</span><span class="op">:</span> <span class="nam">Any</span><span class="op">)</span> <span class="op">-></span> <span class="str">"InstallRuleContext"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="key">return</span> <span class="nam">dataclasses</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">**</span><span class="nam">changes</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"><span class="key">class</span> <span class="nam">PathMatch</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="str">"VirtualPath"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="nam">search_dir</span><span class="op">:</span> <span class="str">"VirtualPath"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="nam">is_exact_match</span><span class="op">:</span> <span class="nam">bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="nam">into</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"><span class="key">class</span> <span class="nam">DiscardState</span><span class="op">(</span><span class="nam">IntEnum</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="nam">UNCHECKED</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="nam">NOT_DISCARDED</span> <span class="op">=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="nam">DISCARDED_BY_PLUGIN_PROVIDED_RULE</span> <span class="op">=</span> <span class="num">2</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="nam">DISCARDED_BY_MANIFEST_RULE</span> <span class="op">=</span> <span class="num">3</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"><span class="key">def</span> <span class="nam">_determine_manpage_section</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="nam">match_rule</span><span class="op">:</span> <span class="nam">PathMatch</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="nam">provided_section</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="nam">section</span> <span class="op">=</span> <span class="nam">str</span><span class="op">(</span><span class="nam">provided_section</span><span class="op">)</span> <span class="key">if</span> <span class="nam">provided_section</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">else</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="key">if</span> <span class="nam">section</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="nam">detected_section</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="key">with</span> <span class="nam">open</span><span class="op">(</span><span class="nam">match_rule</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">,</span> <span class="str">"r"</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="key">for</span> <span class="nam">line</span> <span class="key">in</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">line</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="op">(</span><span class="str">".TH"</span><span class="op">,</span> <span class="str">".Dt"</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="nam">_MAN_DT_LINE</span><span class="op">.</span><span class="nam">match</span><span class="op">(</span><span class="nam">line</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">m</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="nam">_MAN_TH_LINE</span><span class="op">.</span><span class="nam">match</span><span class="op">(</span><span class="nam">line</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">m</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="nam">detected_section</span> <span class="op">=</span> <span class="nam">m</span><span class="op">.</span><span class="nam">group</span><span class="op">(</span><span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="key">if</span> <span class="str">"."</span> <span class="key">in</span> <span class="nam">detected_section</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="str">f"Ignoring detected section {detected_section} in {match_rule.path.fs_path}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="str">f" (detected via {definition_source}): It looks too much like a version"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="nam">detected_section</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="key">if</span> <span class="nam">detected_section</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="nam">_MAN_SECTION_BASENAME</span><span class="op">.</span><span class="nam">search</span><span class="op">(</span><span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">basename</span><span class="op">(</span><span class="nam">match_rule</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">path</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="key">if</span> <span class="nam">m</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="nam">detected_section</span> <span class="op">=</span> <span class="nam">m</span><span class="op">.</span><span class="nam">group</span><span class="op">(</span><span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="nam">section</span> <span class="op">=</span> <span class="nam">detected_section</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="key">return</span> <span class="nam">section</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"><span class="key">def</span> <span class="nam">_determine_manpage_real_section</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="nam">match_rule</span><span class="op">:</span> <span class="nam">PathMatch</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="nam">section</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="nam">real_section</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="key">if</span> <span class="nam">section</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="nam">_MAN_REAL_SECTION</span><span class="op">.</span><span class="nam">match</span><span class="op">(</span><span class="nam">section</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="key">if</span> <span class="nam">m</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="nam">real_section</span> <span class="op">=</span> <span class="nam">int</span><span class="op">(</span><span class="nam">m</span><span class="op">.</span><span class="nam">group</span><span class="op">(</span><span class="num">1</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="key">if</span> <span class="nam">real_section</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">real_section</span> <span class="op"><</span> <span class="num">0</span> <span class="key">or</span> <span class="nam">real_section</span> <span class="op">></span> <span class="num">9</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="key">if</span> <span class="nam">real_section</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="str">f"Computed section for {match_rule.path.fs_path} was {real_section} (section: {section}),"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="str">f" which is not a valid section (must be between 1 and 9 incl.)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="str">f"Could not determine the section for {match_rule.path.fs_path} automatically. The man page"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="str">f" was detected via {definition_source}. Consider using `section: <number>` to"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="str">" explicitly declare the section. Keep in mind that it applies to all man pages for that"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="str">" rule and you may have to split the rule into two for this reason."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="key">return</span> <span class="nam">real_section</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"><span class="key">def</span> <span class="nam">_determine_manpage_language</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="nam">match_rule</span><span class="op">:</span> <span class="nam">PathMatch</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="nam">provided_language</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="key">if</span> <span class="nam">provided_language</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="key">if</span> <span class="nam">provided_language</span> <span class="key">not</span> <span class="key">in</span> <span class="op">(</span><span class="str">"derive-from-basename"</span><span class="op">,</span> <span class="str">"derive-from-path"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="key">return</span> <span class="nam">provided_language</span> <span class="key">if</span> <span class="nam">provided_language</span> <span class="op">!=</span> <span class="str">"C"</span> <span class="key">else</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="key">if</span> <span class="nam">provided_language</span> <span class="op">==</span> <span class="str">"derive-from-basename"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="nam">MAN_GUESS_FROM_BASENAME</span><span class="op">.</span><span class="nam">search</span><span class="op">(</span><span class="nam">match_rule</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="key">if</span> <span class="nam">m</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="key">return</span> <span class="nam">m</span><span class="op">.</span><span class="nam">group</span><span class="op">(</span><span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="com"># Fall-through for derive-from-path case</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="nam">MAN_GUESS_LANG_FROM_PATH</span><span class="op">.</span><span class="nam">search</span><span class="op">(</span><span class="nam">match_rule</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="key">if</span> <span class="nam">m</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="key">return</span> <span class="nam">m</span><span class="op">.</span><span class="nam">group</span><span class="op">(</span><span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"><span class="key">def</span> <span class="nam">_dest_path_for_manpage</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="nam">provided_section</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="nam">provided_language</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="str">"PathMatch"</span><span class="op">]</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="key">def</span> <span class="nam">_manpage_dest_path</span><span class="op">(</span><span class="nam">match_rule</span><span class="op">:</span> <span class="nam">PathMatch</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="nam">inst_basename</span> <span class="op">=</span> <span class="nam">_MAN_INST_BASENAME</span><span class="op">.</span><span class="nam">sub</span><span class="op">(</span><span class="str">""</span><span class="op">,</span> <span class="nam">match_rule</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="nam">section</span> <span class="op">=</span> <span class="nam">_determine_manpage_section</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="nam">match_rule</span><span class="op">,</span> <span class="nam">provided_section</span><span class="op">,</span> <span class="nam">definition_source</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="nam">real_section</span> <span class="op">=</span> <span class="nam">_determine_manpage_real_section</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="nam">match_rule</span><span class="op">,</span> <span class="nam">section</span><span class="op">,</span> <span class="nam">definition_source</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="key">assert</span> <span class="nam">section</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="nam">language</span> <span class="op">=</span> <span class="nam">_determine_manpage_language</span><span class="op">(</span><span class="nam">match_rule</span><span class="op">,</span> <span class="nam">provided_language</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="key">if</span> <span class="nam">language</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="nam">maybe_language</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="nam">maybe_language</span> <span class="op">=</span> <span class="str">f"{language}/"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="nam">lang_suffix</span> <span class="op">=</span> <span class="str">f".{language}"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="key">if</span> <span class="nam">inst_basename</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="nam">lang_suffix</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="nam">inst_basename</span> <span class="op">=</span> <span class="nam">inst_basename</span><span class="op">[</span><span class="op">:</span> <span class="op">-</span><span class="nam">len</span><span class="op">(</span><span class="nam">lang_suffix</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="key">return</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="str">f"usr/share/man/{maybe_language}man{real_section}/{inst_basename}.{section}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="key">return</span> <span class="nam">_manpage_dest_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"><span class="key">class</span> <span class="nam">SourcePathMatcher</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">auto_discard_rules</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="str">"PluginProvidedDiscardRule"</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_already_matched</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="op">]</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_exact_match_request</span><span class="op">:</span> <span class="nam">Set</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_discarded</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">DiscardState</span><span class="op">]</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_auto_discard_rules</span> <span class="op">=</span> <span class="nam">auto_discard_rules</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">used_auto_discard_rules</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="nam">collections</span><span class="op">.</span><span class="nam">defaultdict</span><span class="op">(</span><span class="nam">set</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_reserved</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">path</span><span class="op">:</span> <span class="str">"VirtualPath"</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="nam">fs_path</span> <span class="op">=</span> <span class="nam">path</span><span class="op">.</span><span class="nam">fs_path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="key">if</span> <span class="nam">fs_path</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_already_matched</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="nam">result</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_discarded</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">fs_path</span><span class="op">,</span> <span class="nam">DiscardState</span><span class="op">.</span><span class="nam">UNCHECKED</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="key">if</span> <span class="nam">result</span> <span class="op">==</span> <span class="nam">DiscardState</span><span class="op">.</span><span class="nam">UNCHECKED</span><span class="op">:</span> </span><span class="r"><span class="annotate short">288 ↛ 290</span><span class="annotate long">line 288 didn't jump to line 290, because the condition on line 288 was never false</span></span></p> - <p class="run"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="nam">result</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_check_plugin_provided_exclude_state_for</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="key">if</span> <span class="nam">result</span> <span class="op">==</span> <span class="nam">DiscardState</span><span class="op">.</span><span class="nam">NOT_DISCARDED</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="key">def</span> <span class="nam">exclude</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">path</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_discarded</span><span class="op">[</span><span class="nam">path</span><span class="op">]</span> <span class="op">=</span> <span class="nam">DiscardState</span><span class="op">.</span><span class="nam">DISCARDED_BY_MANIFEST_RULE</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="key">def</span> <span class="nam">_run_plugin_provided_discard_rules_on</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">path</span><span class="op">:</span> <span class="str">"VirtualPath"</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="key">for</span> <span class="nam">dr</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_auto_discard_rules</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="nam">verdict</span> <span class="op">=</span> <span class="nam">dr</span><span class="op">.</span><span class="nam">should_discard</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="key">if</span> <span class="nam">verdict</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">used_auto_discard_rules</span><span class="op">[</span><span class="nam">dr</span><span class="op">.</span><span class="nam">name</span><span class="op">]</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">path</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> <span class="key">def</span> <span class="nam">_check_plugin_provided_exclude_state_for</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="str">"VirtualPath"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">DiscardState</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="nam">cache_misses</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="nam">current_path</span> <span class="op">=</span> <span class="nam">path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="key">while</span> <span class="key">True</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="nam">fs_path</span> <span class="op">=</span> <span class="nam">current_path</span><span class="op">.</span><span class="nam">fs_path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="nam">exclude_state</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_discarded</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">fs_path</span><span class="op">,</span> <span class="nam">DiscardState</span><span class="op">.</span><span class="nam">UNCHECKED</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="key">if</span> <span class="nam">exclude_state</span> <span class="op">!=</span> <span class="nam">DiscardState</span><span class="op">.</span><span class="nam">UNCHECKED</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="nam">verdict</span> <span class="op">=</span> <span class="nam">exclude_state</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="nam">cache_misses</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">fs_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_run_plugin_provided_discard_rules_on</span><span class="op">(</span><span class="nam">current_path</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="nam">verdict</span> <span class="op">=</span> <span class="nam">DiscardState</span><span class="op">.</span><span class="nam">DISCARDED_BY_PLUGIN_PROVIDED_RULE</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="com"># We cannot trust a "NOT_DISCARDED" until we check its parent (the directory could</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> <span class="com"># be excluded without the files in it triggering the rule).</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> <span class="nam">parent_dir</span> <span class="op">=</span> <span class="nam">current_path</span><span class="op">.</span><span class="nam">parent_dir</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">parent_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> <span class="nam">verdict</span> <span class="op">=</span> <span class="nam">DiscardState</span><span class="op">.</span><span class="nam">NOT_DISCARDED</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> <span class="nam">current_path</span> <span class="op">=</span> <span class="nam">parent_dir</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> <span class="key">if</span> <span class="nam">cache_misses</span><span class="op">:</span> </span><span class="r"><span class="annotate short">329 ↛ 332</span><span class="annotate long">line 329 didn't jump to line 332, because the condition on line 329 was never false</span></span></p> - <p class="run"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">cache_misses</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_discarded</span><span class="op">[</span><span class="nam">p</span><span class="op">]</span> <span class="op">=</span> <span class="nam">verdict</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> <span class="key">return</span> <span class="nam">verdict</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> <span class="key">def</span> <span class="nam">may_match</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> <span class="nam">match</span><span class="op">:</span> <span class="nam">PathMatch</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> <span class="nam">is_exact_match</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">,</span> <span class="nam">bool</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_already_matched</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">match</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"> <span class="key">if</span> <span class="nam">m</span><span class="op">:</span> </span><span class="r"><span class="annotate short">341 ↛ 342</span><span class="annotate long">line 341 didn't jump to line 342, because the condition on line 341 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"> <span class="key">return</span> <span class="nam">m</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">,</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"> <span class="nam">current_path</span> <span class="op">=</span> <span class="nam">match</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">fs_path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> <span class="nam">discard_state</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_discarded</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">current_path</span><span class="op">,</span> <span class="nam">DiscardState</span><span class="op">.</span><span class="nam">UNCHECKED</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"> <span class="key">if</span> <span class="nam">discard_state</span> <span class="op">==</span> <span class="nam">DiscardState</span><span class="op">.</span><span class="nam">UNCHECKED</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"> <span class="nam">discard_state</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_check_plugin_provided_exclude_state_for</span><span class="op">(</span><span class="nam">match</span><span class="op">.</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"> <span class="key">assert</span> <span class="nam">discard_state</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">discard_state</span> <span class="op">!=</span> <span class="nam">DiscardState</span><span class="op">.</span><span class="nam">UNCHECKED</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"> <span class="nam">is_discarded</span> <span class="op">=</span> <span class="nam">discard_state</span> <span class="op">!=</span> <span class="nam">DiscardState</span><span class="op">.</span><span class="nam">NOT_DISCARDED</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"> <span class="nam">is_exact_match</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"> <span class="key">and</span> <span class="nam">discard_state</span> <span class="op">==</span> <span class="nam">DiscardState</span><span class="op">.</span><span class="nam">DISCARDED_BY_PLUGIN_PROVIDED_RULE</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"> <span class="nam">is_discarded</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"> <span class="key">return</span> <span class="nam">frozenset</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> <span class="nam">is_discarded</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"> <span class="key">def</span> <span class="nam">reserve</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="str">"VirtualPath"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"> <span class="nam">reserved_by</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"> <span class="nam">is_exact_match</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"> <span class="nam">fs_path</span> <span class="op">=</span> <span class="nam">path</span><span class="op">.</span><span class="nam">fs_path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_already_matched</span><span class="op">[</span><span class="nam">fs_path</span><span class="op">]</span> <span class="op">=</span> <span class="nam">reserved_by</span><span class="op">,</span> <span class="nam">definition_source</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">is_exact_match</span><span class="op">:</span> </span><span class="r"><span class="annotate short">369 ↛ 371</span><span class="annotate long">line 369 didn't jump to line 371, because the condition on line 369 was never false</span></span></p> - <p class="run"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"> <span class="key">for</span> <span class="nam">pkg</span> <span class="key">in</span> <span class="nam">reserved_by</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"> <span class="nam">m_key</span> <span class="op">=</span> <span class="op">(</span><span class="nam">pkg</span><span class="op">.</span><span class="nam">name</span><span class="op">,</span> <span class="nam">fs_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_exact_match_request</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">m_key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"> <span class="key">del</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_discarded</span><span class="op">[</span><span class="nam">fs_path</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"> <span class="key">except</span> <span class="nam">KeyError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"> <span class="key">for</span> <span class="nam">discarded_paths</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">used_auto_discard_rules</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"> <span class="nam">discarded_paths</span><span class="op">.</span><span class="nam">discard</span><span class="op">(</span><span class="nam">fs_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"> <span class="key">def</span> <span class="nam">detect_missing</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">search_dir</span><span class="op">:</span> <span class="str">"VirtualPath"</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="str">"VirtualPath"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"> <span class="nam">stack</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">search_dir</span><span class="op">.</span><span class="nam">iterdir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"> <span class="key">while</span> <span class="nam">stack</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="nam">stack</span><span class="op">.</span><span class="nam">pop</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t385" href="#t385">385</a></span><span class="t"> <span class="key">if</span> <span class="nam">m</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t386" href="#t386">386</a></span><span class="t"> <span class="nam">s_len</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">stack</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t387" href="#t387">387</a></span><span class="t"> <span class="nam">stack</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">m</span><span class="op">.</span><span class="nam">iterdir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t388" href="#t388">388</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t389" href="#t389">389</a></span><span class="t"> <span class="key">if</span> <span class="nam">s_len</span> <span class="op">==</span> <span class="nam">len</span><span class="op">(</span><span class="nam">stack</span><span class="op">)</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_reserved</span><span class="op">(</span><span class="nam">m</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t390" href="#t390">390</a></span><span class="t"> <span class="com"># "Explicitly" empty dir</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t391" href="#t391">391</a></span><span class="t"> <span class="key">yield</span> <span class="nam">m</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t392" href="#t392">392</a></span><span class="t"> <span class="key">elif</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_reserved</span><span class="op">(</span><span class="nam">m</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t393" href="#t393">393</a></span><span class="t"> <span class="key">yield</span> <span class="nam">m</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t394" href="#t394">394</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t395" href="#t395">395</a></span><span class="t"> <span class="key">def</span> <span class="nam">find_and_reserve_all_matches</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t396" href="#t396">396</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t397" href="#t397">397</a></span><span class="t"> <span class="nam">match_rule</span><span class="op">:</span> <span class="nam">MatchRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t398" href="#t398">398</a></span><span class="t"> <span class="nam">search_dirs</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">SearchDir</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t399" href="#t399">399</a></span><span class="t"> <span class="nam">dir_only_match</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t400" href="#t400">400</a></span><span class="t"> <span class="nam">match_filter</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="str">"VirtualPath"</span><span class="op">]</span><span class="op">,</span> <span class="nam">bool</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t401" href="#t401">401</a></span><span class="t"> <span class="nam">reserved_by</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t402" href="#t402">402</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t403" href="#t403">403</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">PathMatch</span><span class="op">]</span><span class="op">,</span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">int</span><span class="op">,</span> <span class="op">...</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t404" href="#t404">404</a></span><span class="t"> <span class="nam">matched</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t405" href="#t405">405</a></span><span class="t"> <span class="nam">already_installed_paths</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t406" href="#t406">406</a></span><span class="t"> <span class="nam">already_excluded_paths</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t407" href="#t407">407</a></span><span class="t"> <span class="nam">glob_expand</span> <span class="op">=</span> <span class="key">False</span> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">match_rule</span><span class="op">,</span> <span class="nam">ExactFileSystemPath</span><span class="op">)</span> <span class="key">else</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t408" href="#t408">408</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t409" href="#t409">409</a></span><span class="t"> <span class="key">for</span> <span class="nam">match</span> <span class="key">in</span> <span class="nam">_resolve_path</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t410" href="#t410">410</a></span><span class="t"> <span class="nam">match_rule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t411" href="#t411">411</a></span><span class="t"> <span class="nam">search_dirs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t412" href="#t412">412</a></span><span class="t"> <span class="nam">dir_only_match</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t413" href="#t413">413</a></span><span class="t"> <span class="nam">match_filter</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t414" href="#t414">414</a></span><span class="t"> <span class="nam">reserved_by</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t415" href="#t415">415</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t416" href="#t416">416</a></span><span class="t"> <span class="nam">installed_into</span><span class="op">,</span> <span class="nam">excluded</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">may_match</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t417" href="#t417">417</a></span><span class="t"> <span class="nam">match</span><span class="op">,</span> <span class="nam">is_exact_match</span><span class="op">=</span><span class="key">not</span> <span class="nam">glob_expand</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t418" href="#t418">418</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t419" href="#t419">419</a></span><span class="t"> <span class="key">if</span> <span class="nam">installed_into</span><span class="op">:</span> </span><span class="r"><span class="annotate short">419 ↛ 420</span><span class="annotate long">line 419 didn't jump to line 420, because the condition on line 419 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t420" href="#t420">420</a></span><span class="t"> <span class="key">if</span> <span class="nam">glob_expand</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t421" href="#t421">421</a></span><span class="t"> <span class="nam">already_installed_paths</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t422" href="#t422">422</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t423" href="#t423">423</a></span><span class="t"> <span class="nam">packages</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">p</span><span class="op">.</span><span class="nam">name</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">installed_into</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t424" href="#t424">424</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PathAlreadyInstalledOrDiscardedError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t425" href="#t425">425</a></span><span class="t"> <span class="str">f'The "{match.path.fs_path}" has been reserved by and installed into {packages}.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t426" href="#t426">426</a></span><span class="t"> <span class="str">f" The definition that triggered this issue is {definition_source}."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t427" href="#t427">427</a></span><span class="t"> <span class="nam">match</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t428" href="#t428">428</a></span><span class="t"> <span class="nam">installed_into</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t429" href="#t429">429</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t430" href="#t430">430</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t431" href="#t431">431</a></span><span class="t"> <span class="key">if</span> <span class="nam">excluded</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t432" href="#t432">432</a></span><span class="t"> <span class="key">if</span> <span class="nam">glob_expand</span><span class="op">:</span> </span><span class="r"><span class="annotate short">432 ↛ 435</span><span class="annotate long">line 432 didn't jump to line 435, because the condition on line 432 was never false</span></span></p> - <p class="run"><span class="n"><a id="t433" href="#t433">433</a></span><span class="t"> <span class="nam">already_excluded_paths</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t434" href="#t434">434</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t435" href="#t435">435</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PathAlreadyInstalledOrDiscardedError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t436" href="#t436">436</a></span><span class="t"> <span class="str">f'The "{match.path.fs_path}" has been excluded. If you want this path installed, move it'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t437" href="#t437">437</a></span><span class="t"> <span class="str">f" above the exclusion rule that excluded it. The definition that triggered this"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t438" href="#t438">438</a></span><span class="t"> <span class="str">f" issue is {definition_source}."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t439" href="#t439">439</a></span><span class="t"> <span class="nam">match</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t440" href="#t440">440</a></span><span class="t"> <span class="nam">installed_into</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t441" href="#t441">441</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t442" href="#t442">442</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t443" href="#t443">443</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">glob_expand</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t444" href="#t444">444</a></span><span class="t"> <span class="key">for</span> <span class="nam">pkg</span> <span class="key">in</span> <span class="nam">match</span><span class="op">.</span><span class="nam">into</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t445" href="#t445">445</a></span><span class="t"> <span class="nam">m_key</span> <span class="op">=</span> <span class="op">(</span><span class="nam">pkg</span><span class="op">.</span><span class="nam">name</span><span class="op">,</span> <span class="nam">match</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t446" href="#t446">446</a></span><span class="t"> <span class="key">if</span> <span class="nam">m_key</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_exact_match_request</span><span class="op">:</span> </span><span class="r"><span class="annotate short">446 ↛ 447</span><span class="annotate long">line 446 didn't jump to line 447, because the condition on line 446 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t447" href="#t447">447</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ExactPathMatchTwiceError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t448" href="#t448">448</a></span><span class="t"> <span class="str">f'The path "{match.path.fs_path}" (via exact match) has already been installed'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t449" href="#t449">449</a></span><span class="t"> <span class="str">f" into {pkg.name}. The second installation triggered by {definition_source}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t450" href="#t450">450</a></span><span class="t"> <span class="nam">match</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t451" href="#t451">451</a></span><span class="t"> <span class="nam">pkg</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t452" href="#t452">452</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t453" href="#t453">453</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t454" href="#t454">454</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_exact_match_request</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">m_key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t455" href="#t455">455</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t456" href="#t456">456</a></span><span class="t"> <span class="key">if</span> <span class="nam">reserved_by</span><span class="op">:</span> </span><span class="r"><span class="annotate short">456 ↛ 462</span><span class="annotate long">line 456 didn't jump to line 462, because the condition on line 456 was never false</span></span></p> - <p class="run"><span class="n"><a id="t457" href="#t457">457</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_already_matched</span><span class="op">[</span><span class="nam">match</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">]</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t458" href="#t458">458</a></span><span class="t"> <span class="nam">match</span><span class="op">.</span><span class="nam">into</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t459" href="#t459">459</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t460" href="#t460">460</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t461" href="#t461">461</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t462" href="#t462">462</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">exclude</span><span class="op">(</span><span class="nam">match</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t463" href="#t463">463</a></span><span class="t"> <span class="nam">matched</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">match</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t464" href="#t464">464</a></span><span class="t"> <span class="nam">exclude_counts</span> <span class="op">=</span> <span class="nam">already_installed_paths</span><span class="op">,</span> <span class="nam">already_excluded_paths</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t465" href="#t465">465</a></span><span class="t"> <span class="key">return</span> <span class="nam">matched</span><span class="op">,</span> <span class="nam">exclude_counts</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t466" href="#t466">466</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t467" href="#t467">467</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t468" href="#t468">468</a></span><span class="t"><span class="key">def</span> <span class="nam">_resolve_path</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t469" href="#t469">469</a></span><span class="t"> <span class="nam">match_rule</span><span class="op">:</span> <span class="nam">MatchRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t470" href="#t470">470</a></span><span class="t"> <span class="nam">search_dirs</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="str">"SearchDir"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t471" href="#t471">471</a></span><span class="t"> <span class="nam">dir_only_match</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t472" href="#t472">472</a></span><span class="t"> <span class="nam">match_filter</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="str">"VirtualPath"</span><span class="op">]</span><span class="op">,</span> <span class="nam">bool</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t473" href="#t473">473</a></span><span class="t"> <span class="nam">into</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t474" href="#t474">474</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">PathMatch</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t475" href="#t475">475</a></span><span class="t"> <span class="nam">missing_matches</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="nam">into</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t476" href="#t476">476</a></span><span class="t"> <span class="key">for</span> <span class="nam">sdir</span> <span class="key">in</span> <span class="nam">search_dirs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t477" href="#t477">477</a></span><span class="t"> <span class="nam">matched</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t478" href="#t478">478</a></span><span class="t"> <span class="key">if</span> <span class="nam">into</span> <span class="key">and</span> <span class="nam">missing_matches</span><span class="op">.</span><span class="nam">isdisjoint</span><span class="op">(</span><span class="nam">sdir</span><span class="op">.</span><span class="nam">applies_to</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">478 ↛ 480</span><span class="annotate long">line 478 didn't jump to line 480, because the condition on line 478 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t479" href="#t479">479</a></span><span class="t"> <span class="com"># All the packages, where this search dir applies, already got a match</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t480" href="#t480">480</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t481" href="#t481">481</a></span><span class="t"> <span class="nam">applicable</span> <span class="op">=</span> <span class="nam">sdir</span><span class="op">.</span><span class="nam">applies_to</span> <span class="op">&</span> <span class="nam">missing_matches</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t482" href="#t482">482</a></span><span class="t"> <span class="key">for</span> <span class="nam">matched_path</span> <span class="key">in</span> <span class="nam">match_rule</span><span class="op">.</span><span class="nam">finditer</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t483" href="#t483">483</a></span><span class="t"> <span class="nam">sdir</span><span class="op">.</span><span class="nam">search_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t484" href="#t484">484</a></span><span class="t"> <span class="nam">ignore_paths</span><span class="op">=</span><span class="nam">match_filter</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t485" href="#t485">485</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t486" href="#t486">486</a></span><span class="t"> <span class="key">if</span> <span class="nam">dir_only_match</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">matched_path</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"><span class="annotate short">486 ↛ 487</span><span class="annotate long">line 486 didn't jump to line 487, because the condition on line 486 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t487" href="#t487">487</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t488" href="#t488">488</a></span><span class="t"> <span class="key">if</span> <span class="nam">matched_path</span><span class="op">.</span><span class="nam">parent_dir</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t489" href="#t489">489</a></span><span class="t"> <span class="key">if</span> <span class="nam">match_rule</span> <span class="key">is</span> <span class="nam">MATCH_ANYTHING</span><span class="op">:</span> </span><span class="r"><span class="annotate short">489 ↛ 491</span><span class="annotate long">line 489 didn't jump to line 491, because the condition on line 489 was never false</span></span></p> - <p class="run"><span class="n"><a id="t490" href="#t490">490</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t491" href="#t491">491</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t492" href="#t492">492</a></span><span class="t"> <span class="str">f"The pattern {match_rule.describe_match_short()} matched the root dir."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t493" href="#t493">493</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t494" href="#t494">494</a></span><span class="t"> <span class="key">yield</span> <span class="nam">PathMatch</span><span class="op">(</span><span class="nam">matched_path</span><span class="op">,</span> <span class="nam">sdir</span><span class="op">.</span><span class="nam">search_dir</span><span class="op">,</span> <span class="key">False</span><span class="op">,</span> <span class="nam">applicable</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t495" href="#t495">495</a></span><span class="t"> <span class="nam">matched</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t496" href="#t496">496</a></span><span class="t"> <span class="com"># continue; we want to match everything we can from this search directory.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t497" href="#t497">497</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t498" href="#t498">498</a></span><span class="t"> <span class="key">if</span> <span class="nam">matched</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t499" href="#t499">499</a></span><span class="t"> <span class="nam">missing_matches</span> <span class="op">-=</span> <span class="nam">applicable</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t500" href="#t500">500</a></span><span class="t"> <span class="key">if</span> <span class="nam">into</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">missing_matches</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t501" href="#t501">501</a></span><span class="t"> <span class="com"># For install rules, we can stop as soon as all packages had a match</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t502" href="#t502">502</a></span><span class="t"> <span class="com"># For discard rules, all search directories must be visited. Otherwise,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t503" href="#t503">503</a></span><span class="t"> <span class="com"># you would have to repeat the discard rule once per search dir to be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t504" href="#t504">504</a></span><span class="t"> <span class="com"># sure something is fully discarded</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t505" href="#t505">505</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t506" href="#t506">506</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t507" href="#t507">507</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t508" href="#t508">508</a></span><span class="t"><span class="key">def</span> <span class="nam">_resolve_dest_paths</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t509" href="#t509">509</a></span><span class="t"> <span class="nam">match</span><span class="op">:</span> <span class="nam">PathMatch</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t510" href="#t510">510</a></span><span class="t"> <span class="nam">dest_paths</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">bool</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t511" href="#t511">511</a></span><span class="t"> <span class="nam">install_context</span><span class="op">:</span> <span class="str">"InstallRuleContext"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t512" href="#t512">512</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="str">"FSPath"</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t513" href="#t513">513</a></span><span class="t"> <span class="nam">dest_and_roots</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t514" href="#t514">514</a></span><span class="t"> <span class="key">for</span> <span class="nam">dest_path</span><span class="op">,</span> <span class="nam">dest_path_is_format</span> <span class="key">in</span> <span class="nam">dest_paths</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t515" href="#t515">515</a></span><span class="t"> <span class="key">if</span> <span class="nam">dest_path_is_format</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t516" href="#t516">516</a></span><span class="t"> <span class="key">for</span> <span class="nam">pkg</span> <span class="key">in</span> <span class="nam">match</span><span class="op">.</span><span class="nam">into</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t517" href="#t517">517</a></span><span class="t"> <span class="nam">parent_dir</span> <span class="op">=</span> <span class="nam">match</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">parent_dir</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t518" href="#t518">518</a></span><span class="t"> <span class="nam">pkg_install_context</span> <span class="op">=</span> <span class="nam">install_context</span><span class="op">[</span><span class="nam">pkg</span><span class="op">.</span><span class="nam">name</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t519" href="#t519">519</a></span><span class="t"> <span class="nam">fs_root</span> <span class="op">=</span> <span class="nam">pkg_install_context</span><span class="op">.</span><span class="nam">fs_root</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t520" href="#t520">520</a></span><span class="t"> <span class="nam">dpath</span> <span class="op">=</span> <span class="nam">dest_path</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t521" href="#t521">521</a></span><span class="t"> <span class="nam">basename</span><span class="op">=</span><span class="nam">match</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t522" href="#t522">522</a></span><span class="t"> <span class="nam">dirname</span><span class="op">=</span><span class="nam">parent_dir</span><span class="op">.</span><span class="nam">path</span> <span class="key">if</span> <span class="nam">parent_dir</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">else</span> <span class="str">""</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t523" href="#t523">523</a></span><span class="t"> <span class="nam">package_name</span><span class="op">=</span><span class="nam">pkg</span><span class="op">.</span><span class="nam">name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t524" href="#t524">524</a></span><span class="t"> <span class="nam">doc_main_package_name</span><span class="op">=</span><span class="nam">pkg_install_context</span><span class="op">.</span><span class="nam">doc_main_package</span><span class="op">.</span><span class="nam">name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t525" href="#t525">525</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t526" href="#t526">526</a></span><span class="t"> <span class="key">if</span> <span class="nam">dpath</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">526 ↛ 527</span><span class="annotate long">line 526 didn't jump to line 527, because the condition on line 526 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t527" href="#t527">527</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t528" href="#t528">528</a></span><span class="t"> <span class="str">f'Provided destination (when resolved for {pkg.name}) for "{match.path.path}" ended'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t529" href="#t529">529</a></span><span class="t"> <span class="str">f' with "/" ("{dest_path}"), which it must not!'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t530" href="#t530">530</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t531" href="#t531">531</a></span><span class="t"> <span class="nam">dest_and_roots</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="op">(</span><span class="nam">dpath</span><span class="op">,</span> <span class="nam">fs_root</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t532" href="#t532">532</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t533" href="#t533">533</a></span><span class="t"> <span class="key">if</span> <span class="nam">dest_path</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">533 ↛ 534</span><span class="annotate long">line 533 didn't jump to line 534, because the condition on line 533 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t534" href="#t534">534</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t535" href="#t535">535</a></span><span class="t"> <span class="str">f'Provided destination for "{match.path.path}" ended with "/" ("{dest_path}"),'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t536" href="#t536">536</a></span><span class="t"> <span class="str">" which it must not!"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t537" href="#t537">537</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t538" href="#t538">538</a></span><span class="t"> <span class="nam">dest_and_roots</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t539" href="#t539">539</a></span><span class="t"> <span class="op">(</span><span class="nam">dest_path</span><span class="op">,</span> <span class="nam">install_context</span><span class="op">[</span><span class="nam">pkg</span><span class="op">.</span><span class="nam">name</span><span class="op">]</span><span class="op">.</span><span class="nam">fs_root</span><span class="op">)</span> <span class="key">for</span> <span class="nam">pkg</span> <span class="key">in</span> <span class="nam">match</span><span class="op">.</span><span class="nam">into</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t540" href="#t540">540</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t541" href="#t541">541</a></span><span class="t"> <span class="key">return</span> <span class="nam">dest_and_roots</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t542" href="#t542">542</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t543" href="#t543">543</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t544" href="#t544">544</a></span><span class="t"><span class="key">def</span> <span class="nam">_resolve_matches</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t545" href="#t545">545</a></span><span class="t"> <span class="nam">matches</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">PathMatch</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t546" href="#t546">546</a></span><span class="t"> <span class="nam">dest_paths</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">Sequence</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">bool</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">PathMatch</span><span class="op">]</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t547" href="#t547">547</a></span><span class="t"> <span class="nam">install_context</span><span class="op">:</span> <span class="str">"InstallRuleContext"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t548" href="#t548">548</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">PathMatch</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="str">"FSPath"</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t549" href="#t549">549</a></span><span class="t"> <span class="key">if</span> <span class="nam">callable</span><span class="op">(</span><span class="nam">dest_paths</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">549 ↛ 550</span><span class="annotate long">line 549 didn't jump to line 550, because the condition on line 549 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t550" href="#t550">550</a></span><span class="t"> <span class="nam">compute_dest_path</span> <span class="op">=</span> <span class="nam">dest_paths</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t551" href="#t551">551</a></span><span class="t"> <span class="key">for</span> <span class="nam">match</span> <span class="key">in</span> <span class="nam">matches</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t552" href="#t552">552</a></span><span class="t"> <span class="nam">dpath</span> <span class="op">=</span> <span class="nam">compute_dest_path</span><span class="op">(</span><span class="nam">match</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t553" href="#t553">553</a></span><span class="t"> <span class="key">if</span> <span class="nam">dpath</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t554" href="#t554">554</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t555" href="#t555">555</a></span><span class="t"> <span class="str">f'Provided destination for "{match.path.path}" ended with "/" ("{dpath}"), which it must not!'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t556" href="#t556">556</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t557" href="#t557">557</a></span><span class="t"> <span class="nam">dest_and_roots</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t558" href="#t558">558</a></span><span class="t"> <span class="op">(</span><span class="nam">dpath</span><span class="op">,</span> <span class="nam">install_context</span><span class="op">[</span><span class="nam">pkg</span><span class="op">.</span><span class="nam">name</span><span class="op">]</span><span class="op">.</span><span class="nam">fs_root</span><span class="op">)</span> <span class="key">for</span> <span class="nam">pkg</span> <span class="key">in</span> <span class="nam">match</span><span class="op">.</span><span class="nam">into</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t559" href="#t559">559</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t560" href="#t560">560</a></span><span class="t"> <span class="key">yield</span> <span class="nam">match</span><span class="op">,</span> <span class="nam">dest_and_roots</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t561" href="#t561">561</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t562" href="#t562">562</a></span><span class="t"> <span class="key">for</span> <span class="nam">match</span> <span class="key">in</span> <span class="nam">matches</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t563" href="#t563">563</a></span><span class="t"> <span class="nam">dest_and_roots</span> <span class="op">=</span> <span class="nam">_resolve_dest_paths</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t564" href="#t564">564</a></span><span class="t"> <span class="nam">match</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t565" href="#t565">565</a></span><span class="t"> <span class="nam">dest_paths</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t566" href="#t566">566</a></span><span class="t"> <span class="nam">install_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t567" href="#t567">567</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t568" href="#t568">568</a></span><span class="t"> <span class="key">yield</span> <span class="nam">match</span><span class="op">,</span> <span class="nam">dest_and_roots</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t569" href="#t569">569</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t570" href="#t570">570</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t571" href="#t571">571</a></span><span class="t"><span class="key">class</span> <span class="nam">InstallRule</span><span class="op">(</span><span class="nam">DebputyDispatchableType</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t572" href="#t572">572</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t573" href="#t573">573</a></span><span class="t"> <span class="str">"_already_matched"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t574" href="#t574">574</a></span><span class="t"> <span class="str">"_exact_match_request"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t575" href="#t575">575</a></span><span class="t"> <span class="str">"_condition"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t576" href="#t576">576</a></span><span class="t"> <span class="str">"_match_filter"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t577" href="#t577">577</a></span><span class="t"> <span class="str">"_definition_source"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t578" href="#t578">578</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t579" href="#t579">579</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t580" href="#t580">580</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t581" href="#t581">581</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t582" href="#t582">582</a></span><span class="t"> <span class="nam">condition</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ManifestCondition</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t583" href="#t583">583</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t584" href="#t584">584</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t585" href="#t585">585</a></span><span class="t"> <span class="nam">match_filter</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="str">"VirtualPath"</span><span class="op">]</span><span class="op">,</span> <span class="nam">bool</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t586" href="#t586">586</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t587" href="#t587">587</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_condition</span> <span class="op">=</span> <span class="nam">condition</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t588" href="#t588">588</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_definition_source</span> <span class="op">=</span> <span class="nam">definition_source</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t589" href="#t589">589</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_match_filter</span> <span class="op">=</span> <span class="nam">match_filter</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t590" href="#t590">590</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t591" href="#t591">591</a></span><span class="t"> <span class="key">def</span> <span class="nam">_check_single_match</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t592" href="#t592">592</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> <span class="nam">source</span><span class="op">:</span> <span class="nam">FileSystemMatchRule</span><span class="op">,</span> <span class="nam">matches</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">PathMatch</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t593" href="#t593">593</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t594" href="#t594">594</a></span><span class="t"> <span class="nam">seen_pkgs</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t595" href="#t595">595</a></span><span class="t"> <span class="nam">problem_pkgs</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t596" href="#t596">596</a></span><span class="t"> <span class="key">for</span> <span class="nam">m</span> <span class="key">in</span> <span class="nam">matches</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t597" href="#t597">597</a></span><span class="t"> <span class="nam">problem_pkgs</span> <span class="op">=</span> <span class="nam">seen_pkgs</span> <span class="op">&</span> <span class="nam">m</span><span class="op">.</span><span class="nam">into</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t598" href="#t598">598</a></span><span class="t"> <span class="key">if</span> <span class="nam">problem_pkgs</span><span class="op">:</span> </span><span class="r"><span class="annotate short">598 ↛ 599</span><span class="annotate long">line 598 didn't jump to line 599, because the condition on line 598 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t599" href="#t599">599</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t600" href="#t600">600</a></span><span class="t"> <span class="nam">seen_pkgs</span><span class="op">.</span><span class="nam">update</span><span class="op">(</span><span class="nam">problem_pkgs</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t601" href="#t601">601</a></span><span class="t"> <span class="key">if</span> <span class="nam">problem_pkgs</span><span class="op">:</span> </span><span class="r"><span class="annotate short">601 ↛ 602</span><span class="annotate long">line 601 didn't jump to line 602, because the condition on line 601 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t602" href="#t602">602</a></span><span class="t"> <span class="nam">pkg_names</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">sorted</span><span class="op">(</span><span class="nam">p</span><span class="op">.</span><span class="nam">name</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">problem_pkgs</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t603" href="#t603">603</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t604" href="#t604">604</a></span><span class="t"> <span class="str">f'The pattern "{source.raw_match_rule}" matched multiple entries for the packages: {pkg_names}.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t605" href="#t605">605</a></span><span class="t"> <span class="str">"However, it should matched exactly one item. Please tighten the pattern defined"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t606" href="#t606">606</a></span><span class="t"> <span class="str">f" in {self._definition_source}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t607" href="#t607">607</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t608" href="#t608">608</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t609" href="#t609">609</a></span><span class="t"> <span class="key">def</span> <span class="nam">_match_pattern</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t610" href="#t610">610</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t611" href="#t611">611</a></span><span class="t"> <span class="nam">path_matcher</span><span class="op">:</span> <span class="nam">SourcePathMatcher</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t612" href="#t612">612</a></span><span class="t"> <span class="nam">fs_match_rule</span><span class="op">:</span> <span class="nam">FileSystemMatchRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t613" href="#t613">613</a></span><span class="t"> <span class="nam">condition_context</span><span class="op">:</span> <span class="nam">ConditionContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t614" href="#t614">614</a></span><span class="t"> <span class="nam">search_dirs</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">SearchDir</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t615" href="#t615">615</a></span><span class="t"> <span class="nam">into</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t616" href="#t616">616</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">List</span><span class="op">[</span><span class="nam">PathMatch</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t617" href="#t617">617</a></span><span class="t"> <span class="op">(</span><span class="nam">matched</span><span class="op">,</span> <span class="nam">exclude_counts</span><span class="op">)</span> <span class="op">=</span> <span class="nam">path_matcher</span><span class="op">.</span><span class="nam">find_and_reserve_all_matches</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t618" href="#t618">618</a></span><span class="t"> <span class="nam">fs_match_rule</span><span class="op">.</span><span class="nam">match_rule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t619" href="#t619">619</a></span><span class="t"> <span class="nam">search_dirs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t620" href="#t620">620</a></span><span class="t"> <span class="nam">fs_match_rule</span><span class="op">.</span><span class="nam">raw_match_rule</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t621" href="#t621">621</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_match_filter</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t622" href="#t622">622</a></span><span class="t"> <span class="nam">into</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t623" href="#t623">623</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_definition_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t624" href="#t624">624</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t625" href="#t625">625</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t626" href="#t626">626</a></span><span class="t"> <span class="nam">already_installed_paths</span><span class="op">,</span> <span class="nam">already_excluded_paths</span> <span class="op">=</span> <span class="nam">exclude_counts</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t627" href="#t627">627</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t628" href="#t628">628</a></span><span class="t"> <span class="key">if</span> <span class="nam">into</span><span class="op">:</span> </span><span class="r"><span class="annotate short">628 ↛ 633</span><span class="annotate long">line 628 didn't jump to line 633, because the condition on line 628 was never false</span></span></p> - <p class="par run show_par"><span class="n"><a id="t629" href="#t629">629</a></span><span class="t"> <span class="nam">allow_empty_match</span> <span class="op">=</span> <span class="nam">all</span><span class="op">(</span><span class="key">not</span> <span class="nam">p</span><span class="op">.</span><span class="nam">should_be_acted_on</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">into</span><span class="op">)</span> </span><span class="r"><span class="annotate short">629 ↛ exit</span><span class="annotate long">line 629 didn't finish the generator expression on line 629</span></span></p> - <p class="pln"><span class="n"><a id="t630" href="#t630">630</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t631" href="#t631">631</a></span><span class="t"> <span class="com"># discard rules must match provided at least one search dir exist. If none of them</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t632" href="#t632">632</a></span><span class="t"> <span class="com"># exist, then we assume the discard rule is for a package that will not be built</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t633" href="#t633">633</a></span><span class="t"> <span class="nam">allow_empty_match</span> <span class="op">=</span> <span class="nam">any</span><span class="op">(</span><span class="nam">s</span><span class="op">.</span><span class="nam">search_dir</span><span class="op">.</span><span class="nam">is_dir</span> <span class="key">for</span> <span class="nam">s</span> <span class="key">in</span> <span class="nam">search_dirs</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t634" href="#t634">634</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_condition</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_condition</span><span class="op">.</span><span class="nam">evaluate</span><span class="op">(</span> </span><span class="r"><span class="annotate short">634 ↛ 637</span><span class="annotate long">line 634 didn't jump to line 637, because the condition on line 634 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t635" href="#t635">635</a></span><span class="t"> <span class="nam">condition_context</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t636" href="#t636">636</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t637" href="#t637">637</a></span><span class="t"> <span class="nam">allow_empty_match</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t638" href="#t638">638</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t639" href="#t639">639</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">matched</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">allow_empty_match</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t640" href="#t640">640</a></span><span class="t"> <span class="nam">search_dir_text</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">x</span><span class="op">.</span><span class="nam">search_dir</span><span class="op">.</span><span class="nam">fs_path</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">search_dirs</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t641" href="#t641">641</a></span><span class="t"> <span class="key">if</span> <span class="nam">already_excluded_paths</span> <span class="key">and</span> <span class="nam">already_installed_paths</span><span class="op">:</span> </span><span class="r"><span class="annotate short">641 ↛ 642</span><span class="annotate long">line 641 didn't jump to line 642, because the condition on line 641 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t642" href="#t642">642</a></span><span class="t"> <span class="nam">total_paths</span> <span class="op">=</span> <span class="nam">already_excluded_paths</span> <span class="op">+</span> <span class="nam">already_installed_paths</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t643" href="#t643">643</a></span><span class="t"> <span class="nam">msg</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t644" href="#t644">644</a></span><span class="t"> <span class="str">f"There were no matches for {fs_match_rule.raw_match_rule} in {search_dir_text} after ignoring"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t645" href="#t645">645</a></span><span class="t"> <span class="str">f" {total_paths} path(s) already been matched previously either by install or"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t646" href="#t646">646</a></span><span class="t"> <span class="str">f" exclude rules. If you wanted to install some of these paths into multiple"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t647" href="#t647">647</a></span><span class="t"> <span class="str">f" packages, please tweak the definition that installed them to install them"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t648" href="#t648">648</a></span><span class="t"> <span class="str">f' into multiple packages (usually change "into: foo" to "into: [foo, bar]".'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t649" href="#t649">649</a></span><span class="t"> <span class="str">f" If you wanted to install these paths and exclude rules are getting in your"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t650" href="#t650">650</a></span><span class="t"> <span class="str">f" way, then please move this install rule before the exclusion rule that causes"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t651" href="#t651">651</a></span><span class="t"> <span class="str">f" issue or, in case of built-in excludes, list the paths explicitly (without"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t652" href="#t652">652</a></span><span class="t"> <span class="str">f" using patterns). Source for this issue is {self._definition_source}. Match rule:"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t653" href="#t653">653</a></span><span class="t"> <span class="str">f" {fs_match_rule.match_rule.describe_match_exact()}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t654" href="#t654">654</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t655" href="#t655">655</a></span><span class="t"> <span class="key">elif</span> <span class="nam">already_excluded_paths</span><span class="op">:</span> </span><span class="r"><span class="annotate short">655 ↛ 656</span><span class="annotate long">line 655 didn't jump to line 656</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t656" href="#t656">656</a></span><span class="t"> <span class="nam">msg</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t657" href="#t657">657</a></span><span class="t"> <span class="str">f"There were no matches for {fs_match_rule.raw_match_rule} in {search_dir_text} after ignoring"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t658" href="#t658">658</a></span><span class="t"> <span class="str">f" {already_excluded_paths} path(s) that have been excluded."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t659" href="#t659">659</a></span><span class="t"> <span class="str">" If you wanted to install some of these paths, please move the install rule"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t660" href="#t660">660</a></span><span class="t"> <span class="str">" before the exclusion rule or, in case of built-in excludes, list the paths explicitly"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t661" href="#t661">661</a></span><span class="t"> <span class="str">f" (without using patterns). Source for this issue is {self._definition_source}. Match rule:"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t662" href="#t662">662</a></span><span class="t"> <span class="str">f" {fs_match_rule.match_rule.describe_match_exact()}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t663" href="#t663">663</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t664" href="#t664">664</a></span><span class="t"> <span class="key">elif</span> <span class="nam">already_installed_paths</span><span class="op">:</span> </span><span class="r"><span class="annotate short">664 ↛ 665</span><span class="annotate long">line 664 didn't jump to line 665</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t665" href="#t665">665</a></span><span class="t"> <span class="nam">msg</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t666" href="#t666">666</a></span><span class="t"> <span class="str">f"There were no matches for {fs_match_rule.raw_match_rule} in {search_dir_text} after ignoring"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t667" href="#t667">667</a></span><span class="t"> <span class="str">f" {already_installed_paths} path(s) already been matched previously."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t668" href="#t668">668</a></span><span class="t"> <span class="str">" If you wanted to install some of these paths into multiple packages,"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t669" href="#t669">669</a></span><span class="t"> <span class="str">f" please tweak the definition that installed them to install them into"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t670" href="#t670">670</a></span><span class="t"> <span class="str">f' multiple packages (usually change "into: foo" to "into: [foo, bar]".'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t671" href="#t671">671</a></span><span class="t"> <span class="str">f" Source for this issue is {self._definition_source}. Match rule:"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t672" href="#t672">672</a></span><span class="t"> <span class="str">f" {fs_match_rule.match_rule.describe_match_exact()}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t673" href="#t673">673</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t674" href="#t674">674</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t675" href="#t675">675</a></span><span class="t"> <span class="com"># TODO: Try harder to find the match and point out possible typos</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t676" href="#t676">676</a></span><span class="t"> <span class="nam">msg</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t677" href="#t677">677</a></span><span class="t"> <span class="str">f"There were no matches for {fs_match_rule.raw_match_rule} in {search_dir_text} (definition:"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t678" href="#t678">678</a></span><span class="t"> <span class="str">f" {self._definition_source}). Match rule: {fs_match_rule.match_rule.describe_match_exact()}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t679" href="#t679">679</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t680" href="#t680">680</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NoMatchForInstallPatternError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t681" href="#t681">681</a></span><span class="t"> <span class="nam">msg</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t682" href="#t682">682</a></span><span class="t"> <span class="nam">fs_match_rule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t683" href="#t683">683</a></span><span class="t"> <span class="nam">search_dirs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t684" href="#t684">684</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_definition_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t685" href="#t685">685</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t686" href="#t686">686</a></span><span class="t"> <span class="key">return</span> <span class="nam">matched</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t687" href="#t687">687</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t688" href="#t688">688</a></span><span class="t"> <span class="key">def</span> <span class="nam">_install_matches</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t689" href="#t689">689</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t690" href="#t690">690</a></span><span class="t"> <span class="nam">path_matcher</span><span class="op">:</span> <span class="nam">SourcePathMatcher</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t691" href="#t691">691</a></span><span class="t"> <span class="nam">matches</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">PathMatch</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t692" href="#t692">692</a></span><span class="t"> <span class="nam">dest_paths</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">Sequence</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">bool</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">PathMatch</span><span class="op">]</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t693" href="#t693">693</a></span><span class="t"> <span class="nam">install_context</span><span class="op">:</span> <span class="str">"InstallRuleContext"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t694" href="#t694">694</a></span><span class="t"> <span class="nam">into</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t695" href="#t695">695</a></span><span class="t"> <span class="nam">condition_context</span><span class="op">:</span> <span class="nam">ConditionContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t696" href="#t696">696</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t697" href="#t697">697</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"><span class="annotate short">697 ↛ exit, 697 ↛ 703</span><span class="annotate long">2 missed branches: 1) line 697 didn't jump to the function exit, 2) line 697 didn't jump to line 703, because the condition on line 697 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t698" href="#t698">698</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_condition</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t699" href="#t699">699</a></span><span class="t"> <span class="key">and</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_condition</span><span class="op">.</span><span class="nam">evaluate</span><span class="op">(</span><span class="nam">condition_context</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t700" href="#t700">700</a></span><span class="t"> <span class="op">)</span> <span class="key">or</span> <span class="key">not</span> <span class="nam">any</span><span class="op">(</span><span class="nam">p</span><span class="op">.</span><span class="nam">should_be_acted_on</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">into</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t701" href="#t701">701</a></span><span class="t"> <span class="com"># Rule is disabled; skip all its actions - also allow empty matches</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t702" href="#t702">702</a></span><span class="t"> <span class="com"># for this particular case.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t703" href="#t703">703</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t704" href="#t704">704</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t705" href="#t705">705</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">matches</span><span class="op">:</span> </span><span class="r"><span class="annotate short">705 ↛ 706</span><span class="annotate long">line 705 didn't jump to line 706, because the condition on line 705 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t706" href="#t706">706</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"matches must not be empty"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t707" href="#t707">707</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t708" href="#t708">708</a></span><span class="t"> <span class="key">for</span> <span class="nam">match</span><span class="op">,</span> <span class="nam">dest_paths_and_roots</span> <span class="key">in</span> <span class="nam">_resolve_matches</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t709" href="#t709">709</a></span><span class="t"> <span class="nam">matches</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t710" href="#t710">710</a></span><span class="t"> <span class="nam">dest_paths</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t711" href="#t711">711</a></span><span class="t"> <span class="nam">install_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t712" href="#t712">712</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t713" href="#t713">713</a></span><span class="t"> <span class="nam">install_recursively_into_dirs</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t714" href="#t714">714</a></span><span class="t"> <span class="key">for</span> <span class="nam">dest</span><span class="op">,</span> <span class="nam">fs_root</span> <span class="key">in</span> <span class="nam">dest_paths_and_roots</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t715" href="#t715">715</a></span><span class="t"> <span class="nam">dir_part</span><span class="op">,</span> <span class="nam">basename</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="nam">dest</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t716" href="#t716">716</a></span><span class="t"> <span class="com"># We do not associate these with the FS path. First off,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t717" href="#t717">717</a></span><span class="t"> <span class="com"># it is complicated to do in most cases (indeed, debhelper</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t718" href="#t718">718</a></span><span class="t"> <span class="com"># does not preserve these directories either) and secondly,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t719" href="#t719">719</a></span><span class="t"> <span class="com"># it is "only" mtime and mode - mostly irrelevant as the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t720" href="#t720">720</a></span><span class="t"> <span class="com"># directory is 99.9% likely to be 0755 (we are talking</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t721" href="#t721">721</a></span><span class="t"> <span class="com"># directories like "/usr", "/usr/share").</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t722" href="#t722">722</a></span><span class="t"> <span class="nam">dir_path</span> <span class="op">=</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">mkdirs</span><span class="op">(</span><span class="nam">dir_part</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t723" href="#t723">723</a></span><span class="t"> <span class="nam">existing_path</span> <span class="op">=</span> <span class="nam">dir_path</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">basename</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t724" href="#t724">724</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t725" href="#t725">725</a></span><span class="t"> <span class="key">if</span> <span class="nam">match</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t726" href="#t726">726</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing_path</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">existing_path</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"><span class="annotate short">726 ↛ 727</span><span class="annotate long">line 726 didn't jump to line 727, because the condition on line 726 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t727" href="#t727">727</a></span><span class="t"> <span class="nam">existing_path</span><span class="op">.</span><span class="nam">unlink</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t728" href="#t728">728</a></span><span class="t"> <span class="nam">existing_path</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t729" href="#t729">729</a></span><span class="t"> <span class="nam">current_dir</span> <span class="op">=</span> <span class="nam">existing_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t730" href="#t730">730</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t731" href="#t731">731</a></span><span class="t"> <span class="key">if</span> <span class="nam">current_dir</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">731 ↛ 735</span><span class="annotate long">line 731 didn't jump to line 735, because the condition on line 731 was never false</span></span></p> - <p class="run"><span class="n"><a id="t732" href="#t732">732</a></span><span class="t"> <span class="nam">current_dir</span> <span class="op">=</span> <span class="nam">dir_path</span><span class="op">.</span><span class="nam">mkdir</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t733" href="#t733">733</a></span><span class="t"> <span class="nam">basename</span><span class="op">,</span> <span class="nam">reference_path</span><span class="op">=</span><span class="nam">match</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t734" href="#t734">734</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t735" href="#t735">735</a></span><span class="t"> <span class="nam">install_recursively_into_dirs</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">current_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t736" href="#t736">736</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t737" href="#t737">737</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing_path</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">existing_path</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"><span class="annotate short">737 ↛ 738</span><span class="annotate long">line 737 didn't jump to line 738, because the condition on line 737 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t738" href="#t738">738</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t739" href="#t739">739</a></span><span class="t"> <span class="str">f"Cannot install {match.path} ({match.path.fs_path}) as {dest}. That path already exist"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t740" href="#t740">740</a></span><span class="t"> <span class="str">f" and is a directory. This error was triggered via {self._definition_source}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t741" href="#t741">741</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t742" href="#t742">742</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t743" href="#t743">743</a></span><span class="t"> <span class="key">if</span> <span class="nam">match</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">is_symlink</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t744" href="#t744">744</a></span><span class="t"> <span class="nam">dir_path</span><span class="op">.</span><span class="nam">add_symlink</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t745" href="#t745">745</a></span><span class="t"> <span class="nam">basename</span><span class="op">,</span> <span class="nam">match</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">readlink</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> <span class="nam">reference_path</span><span class="op">=</span><span class="nam">match</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t746" href="#t746">746</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t747" href="#t747">747</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t748" href="#t748">748</a></span><span class="t"> <span class="nam">dir_path</span><span class="op">.</span><span class="nam">insert_file_from_fs_path</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t749" href="#t749">749</a></span><span class="t"> <span class="nam">basename</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t750" href="#t750">750</a></span><span class="t"> <span class="nam">match</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t751" href="#t751">751</a></span><span class="t"> <span class="nam">follow_symlinks</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t752" href="#t752">752</a></span><span class="t"> <span class="nam">use_fs_path_mode</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t753" href="#t753">753</a></span><span class="t"> <span class="nam">reference_path</span><span class="op">=</span><span class="nam">match</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t754" href="#t754">754</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t755" href="#t755">755</a></span><span class="t"> <span class="key">if</span> <span class="nam">install_recursively_into_dirs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t756" href="#t756">756</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_install_dir_recursively</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t757" href="#t757">757</a></span><span class="t"> <span class="nam">path_matcher</span><span class="op">,</span> <span class="nam">install_recursively_into_dirs</span><span class="op">,</span> <span class="nam">match</span><span class="op">,</span> <span class="nam">into</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t758" href="#t758">758</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t759" href="#t759">759</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t760" href="#t760">760</a></span><span class="t"> <span class="key">def</span> <span class="nam">_install_dir_recursively</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t761" href="#t761">761</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t762" href="#t762">762</a></span><span class="t"> <span class="nam">path_matcher</span><span class="op">:</span> <span class="nam">SourcePathMatcher</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t763" href="#t763">763</a></span><span class="t"> <span class="nam">parent_dirs</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">FSPath</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t764" href="#t764">764</a></span><span class="t"> <span class="nam">match</span><span class="op">:</span> <span class="nam">PathMatch</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t765" href="#t765">765</a></span><span class="t"> <span class="nam">into</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t766" href="#t766">766</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t767" href="#t767">767</a></span><span class="t"> <span class="nam">stack</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t768" href="#t768">768</a></span><span class="t"> <span class="op">(</span><span class="nam">parent_dirs</span><span class="op">,</span> <span class="nam">e</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t769" href="#t769">769</a></span><span class="t"> <span class="key">for</span> <span class="nam">e</span> <span class="key">in</span> <span class="nam">match</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">iterdir</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t770" href="#t770">770</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">path_matcher</span><span class="op">.</span><span class="nam">is_reserved</span><span class="op">(</span><span class="nam">e</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t771" href="#t771">771</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t772" href="#t772">772</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t773" href="#t773">773</a></span><span class="t"> <span class="key">while</span> <span class="nam">stack</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t774" href="#t774">774</a></span><span class="t"> <span class="nam">current_dirs</span><span class="op">,</span> <span class="nam">dir_entry</span> <span class="op">=</span> <span class="nam">stack</span><span class="op">.</span><span class="nam">pop</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t775" href="#t775">775</a></span><span class="t"> <span class="nam">path_matcher</span><span class="op">.</span><span class="nam">reserve</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t776" href="#t776">776</a></span><span class="t"> <span class="nam">dir_entry</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t777" href="#t777">777</a></span><span class="t"> <span class="nam">into</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t778" href="#t778">778</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_definition_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t779" href="#t779">779</a></span><span class="t"> <span class="nam">is_exact_match</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t780" href="#t780">780</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t781" href="#t781">781</a></span><span class="t"> <span class="key">if</span> <span class="nam">dir_entry</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"><span class="annotate short">781 ↛ 782</span><span class="annotate long">line 781 didn't jump to line 782, because the condition on line 781 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t782" href="#t782">782</a></span><span class="t"> <span class="nam">new_dirs</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t783" href="#t783">783</a></span><span class="t"> <span class="nam">d</span><span class="op">.</span><span class="nam">mkdir</span><span class="op">(</span><span class="nam">dir_entry</span><span class="op">.</span><span class="nam">name</span><span class="op">,</span> <span class="nam">reference_path</span><span class="op">=</span><span class="nam">dir_entry</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t784" href="#t784">784</a></span><span class="t"> <span class="key">for</span> <span class="nam">d</span> <span class="key">in</span> <span class="nam">current_dirs</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t785" href="#t785">785</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t786" href="#t786">786</a></span><span class="t"> <span class="nam">stack</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t787" href="#t787">787</a></span><span class="t"> <span class="op">(</span><span class="nam">new_dirs</span><span class="op">,</span> <span class="nam">de</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t788" href="#t788">788</a></span><span class="t"> <span class="key">for</span> <span class="nam">de</span> <span class="key">in</span> <span class="nam">dir_entry</span><span class="op">.</span><span class="nam">iterdir</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t789" href="#t789">789</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">path_matcher</span><span class="op">.</span><span class="nam">is_reserved</span><span class="op">(</span><span class="nam">de</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t790" href="#t790">790</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t791" href="#t791">791</a></span><span class="t"> <span class="key">elif</span> <span class="nam">dir_entry</span><span class="op">.</span><span class="nam">is_symlink</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t792" href="#t792">792</a></span><span class="t"> <span class="key">for</span> <span class="nam">current_dir</span> <span class="key">in</span> <span class="nam">current_dirs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t793" href="#t793">793</a></span><span class="t"> <span class="nam">current_dir</span><span class="op">.</span><span class="nam">add_symlink</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t794" href="#t794">794</a></span><span class="t"> <span class="nam">dir_entry</span><span class="op">.</span><span class="nam">name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t795" href="#t795">795</a></span><span class="t"> <span class="nam">dir_entry</span><span class="op">.</span><span class="nam">readlink</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t796" href="#t796">796</a></span><span class="t"> <span class="nam">reference_path</span><span class="op">=</span><span class="nam">dir_entry</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t797" href="#t797">797</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t798" href="#t798">798</a></span><span class="t"> <span class="key">elif</span> <span class="nam">dir_entry</span><span class="op">.</span><span class="nam">is_file</span><span class="op">:</span> </span><span class="r"><span class="annotate short">798 ↛ 808</span><span class="annotate long">line 798 didn't jump to line 808, because the condition on line 798 was never false</span></span></p> - <p class="run"><span class="n"><a id="t799" href="#t799">799</a></span><span class="t"> <span class="key">for</span> <span class="nam">current_dir</span> <span class="key">in</span> <span class="nam">current_dirs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t800" href="#t800">800</a></span><span class="t"> <span class="nam">current_dir</span><span class="op">.</span><span class="nam">insert_file_from_fs_path</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t801" href="#t801">801</a></span><span class="t"> <span class="nam">dir_entry</span><span class="op">.</span><span class="nam">name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t802" href="#t802">802</a></span><span class="t"> <span class="nam">dir_entry</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t803" href="#t803">803</a></span><span class="t"> <span class="nam">use_fs_path_mode</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t804" href="#t804">804</a></span><span class="t"> <span class="nam">follow_symlinks</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t805" href="#t805">805</a></span><span class="t"> <span class="nam">reference_path</span><span class="op">=</span><span class="nam">dir_entry</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t806" href="#t806">806</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t807" href="#t807">807</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t808" href="#t808">808</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t809" href="#t809">809</a></span><span class="t"> <span class="str">f"Unsupported file type: {dir_entry.fs_path} - neither a file, directory or symlink"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t810" href="#t810">810</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t811" href="#t811">811</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t812" href="#t812">812</a></span><span class="t"> <span class="key">def</span> <span class="nam">perform_install</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t813" href="#t813">813</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t814" href="#t814">814</a></span><span class="t"> <span class="nam">path_matcher</span><span class="op">:</span> <span class="nam">SourcePathMatcher</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t815" href="#t815">815</a></span><span class="t"> <span class="nam">install_context</span><span class="op">:</span> <span class="nam">InstallRuleContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t816" href="#t816">816</a></span><span class="t"> <span class="nam">condition_context</span><span class="op">:</span> <span class="nam">ConditionContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t817" href="#t817">817</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t818" href="#t818">818</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t819" href="#t819">819</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t820" href="#t820">820</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t821" href="#t821">821</a></span><span class="t"> <span class="key">def</span> <span class="nam">install_as</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t822" href="#t822">822</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t823" href="#t823">823</a></span><span class="t"> <span class="nam">source</span><span class="op">:</span> <span class="nam">FileSystemMatchRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t824" href="#t824">824</a></span><span class="t"> <span class="nam">dest_path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t825" href="#t825">825</a></span><span class="t"> <span class="nam">into</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t826" href="#t826">826</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t827" href="#t827">827</a></span><span class="t"> <span class="nam">condition</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ManifestCondition</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t828" href="#t828">828</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"InstallRule"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t829" href="#t829">829</a></span><span class="t"> <span class="key">return</span> <span class="nam">GenericInstallationRule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t830" href="#t830">830</a></span><span class="t"> <span class="op">[</span><span class="nam">source</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t831" href="#t831">831</a></span><span class="t"> <span class="op">[</span><span class="op">(</span><span class="nam">dest_path</span><span class="op">,</span> <span class="key">False</span><span class="op">)</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t832" href="#t832">832</a></span><span class="t"> <span class="nam">into</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t833" href="#t833">833</a></span><span class="t"> <span class="nam">condition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t834" href="#t834">834</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t835" href="#t835">835</a></span><span class="t"> <span class="nam">require_single_match</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t836" href="#t836">836</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t837" href="#t837">837</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t838" href="#t838">838</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t839" href="#t839">839</a></span><span class="t"> <span class="key">def</span> <span class="nam">install_dest</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t840" href="#t840">840</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t841" href="#t841">841</a></span><span class="t"> <span class="nam">sources</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">FileSystemMatchRule</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t842" href="#t842">842</a></span><span class="t"> <span class="nam">dest_dir</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t843" href="#t843">843</a></span><span class="t"> <span class="nam">into</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t844" href="#t844">844</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t845" href="#t845">845</a></span><span class="t"> <span class="nam">condition</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ManifestCondition</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t846" href="#t846">846</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"InstallRule"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t847" href="#t847">847</a></span><span class="t"> <span class="key">if</span> <span class="nam">dest_dir</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t848" href="#t848">848</a></span><span class="t"> <span class="nam">dest_dir</span> <span class="op">=</span> <span class="str">"{dirname}/{basename}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t849" href="#t849">849</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t850" href="#t850">850</a></span><span class="t"> <span class="nam">dest_dir</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">dest_dir</span><span class="op">,</span> <span class="str">"{basename}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t851" href="#t851">851</a></span><span class="t"> <span class="key">return</span> <span class="nam">GenericInstallationRule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t852" href="#t852">852</a></span><span class="t"> <span class="nam">sources</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t853" href="#t853">853</a></span><span class="t"> <span class="op">[</span><span class="op">(</span><span class="nam">dest_dir</span><span class="op">,</span> <span class="key">True</span><span class="op">)</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t854" href="#t854">854</a></span><span class="t"> <span class="nam">into</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t855" href="#t855">855</a></span><span class="t"> <span class="nam">condition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t856" href="#t856">856</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t857" href="#t857">857</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t858" href="#t858">858</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t859" href="#t859">859</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t860" href="#t860">860</a></span><span class="t"> <span class="key">def</span> <span class="nam">install_multi_as</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t861" href="#t861">861</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t862" href="#t862">862</a></span><span class="t"> <span class="nam">source</span><span class="op">:</span> <span class="nam">FileSystemMatchRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t863" href="#t863">863</a></span><span class="t"> <span class="nam">dest_paths</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t864" href="#t864">864</a></span><span class="t"> <span class="nam">into</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t865" href="#t865">865</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t866" href="#t866">866</a></span><span class="t"> <span class="nam">condition</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ManifestCondition</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t867" href="#t867">867</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"InstallRule"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t868" href="#t868">868</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">dest_paths</span><span class="op">)</span> <span class="op"><</span> <span class="num">2</span><span class="op">:</span> </span><span class="r"><span class="annotate short">868 ↛ 869</span><span class="annotate long">line 868 didn't jump to line 869, because the condition on line 868 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t869" href="#t869">869</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t870" href="#t870">870</a></span><span class="t"> <span class="str">"Please use `install_as` when there is less than 2 dest path"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t871" href="#t871">871</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t872" href="#t872">872</a></span><span class="t"> <span class="nam">dps</span> <span class="op">=</span> <span class="nam">tuple</span><span class="op">(</span><span class="op">(</span><span class="nam">dp</span><span class="op">,</span> <span class="key">False</span><span class="op">)</span> <span class="key">for</span> <span class="nam">dp</span> <span class="key">in</span> <span class="nam">dest_paths</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t873" href="#t873">873</a></span><span class="t"> <span class="key">return</span> <span class="nam">GenericInstallationRule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t874" href="#t874">874</a></span><span class="t"> <span class="op">[</span><span class="nam">source</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t875" href="#t875">875</a></span><span class="t"> <span class="nam">dps</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t876" href="#t876">876</a></span><span class="t"> <span class="nam">into</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t877" href="#t877">877</a></span><span class="t"> <span class="nam">condition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t878" href="#t878">878</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t879" href="#t879">879</a></span><span class="t"> <span class="nam">require_single_match</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t880" href="#t880">880</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t881" href="#t881">881</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t882" href="#t882">882</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t883" href="#t883">883</a></span><span class="t"> <span class="key">def</span> <span class="nam">install_multi_dest</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t884" href="#t884">884</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t885" href="#t885">885</a></span><span class="t"> <span class="nam">sources</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">FileSystemMatchRule</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t886" href="#t886">886</a></span><span class="t"> <span class="nam">dest_dirs</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t887" href="#t887">887</a></span><span class="t"> <span class="nam">into</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t888" href="#t888">888</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t889" href="#t889">889</a></span><span class="t"> <span class="nam">condition</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ManifestCondition</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t890" href="#t890">890</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"InstallRule"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t891" href="#t891">891</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">dest_dirs</span><span class="op">)</span> <span class="op"><</span> <span class="num">2</span><span class="op">:</span> </span><span class="r"><span class="annotate short">891 ↛ 892</span><span class="annotate long">line 891 didn't jump to line 892, because the condition on line 891 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t892" href="#t892">892</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t893" href="#t893">893</a></span><span class="t"> <span class="str">"Please use `install_dest` when there is less than 2 dest dir"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t894" href="#t894">894</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t895" href="#t895">895</a></span><span class="t"> <span class="nam">dest_paths</span> <span class="op">=</span> <span class="nam">tuple</span><span class="op">(</span><span class="op">(</span><span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">dp</span><span class="op">,</span> <span class="str">"{basename}"</span><span class="op">)</span><span class="op">,</span> <span class="key">True</span><span class="op">)</span> <span class="key">for</span> <span class="nam">dp</span> <span class="key">in</span> <span class="nam">dest_dirs</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t896" href="#t896">896</a></span><span class="t"> <span class="key">return</span> <span class="nam">GenericInstallationRule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t897" href="#t897">897</a></span><span class="t"> <span class="nam">sources</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t898" href="#t898">898</a></span><span class="t"> <span class="nam">dest_paths</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t899" href="#t899">899</a></span><span class="t"> <span class="nam">into</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t900" href="#t900">900</a></span><span class="t"> <span class="nam">condition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t901" href="#t901">901</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t902" href="#t902">902</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t903" href="#t903">903</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t904" href="#t904">904</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t905" href="#t905">905</a></span><span class="t"> <span class="key">def</span> <span class="nam">install_doc</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t906" href="#t906">906</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t907" href="#t907">907</a></span><span class="t"> <span class="nam">sources</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">FileSystemMatchRule</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t908" href="#t908">908</a></span><span class="t"> <span class="nam">dest_dir</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t909" href="#t909">909</a></span><span class="t"> <span class="nam">into</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t910" href="#t910">910</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t911" href="#t911">911</a></span><span class="t"> <span class="nam">condition</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ManifestCondition</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t912" href="#t912">912</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"InstallRule"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t913" href="#t913">913</a></span><span class="t"> <span class="nam">cond</span><span class="op">:</span> <span class="nam">ManifestCondition</span> <span class="op">=</span> <span class="nam">_BUILD_DOCS_BDO</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t914" href="#t914">914</a></span><span class="t"> <span class="key">if</span> <span class="nam">condition</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t915" href="#t915">915</a></span><span class="t"> <span class="nam">cond</span> <span class="op">=</span> <span class="nam">ManifestCondition</span><span class="op">.</span><span class="nam">all_of</span><span class="op">(</span><span class="op">[</span><span class="nam">cond</span><span class="op">,</span> <span class="nam">condition</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t916" href="#t916">916</a></span><span class="t"> <span class="nam">dest_path_is_format</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t917" href="#t917">917</a></span><span class="t"> <span class="key">if</span> <span class="nam">dest_dir</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t918" href="#t918">918</a></span><span class="t"> <span class="nam">dest_dir</span> <span class="op">=</span> <span class="str">"usr/share/doc/{doc_main_package_name}/{basename}"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t919" href="#t919">919</a></span><span class="t"> <span class="nam">dest_path_is_format</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t920" href="#t920">920</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t921" href="#t921">921</a></span><span class="t"> <span class="key">return</span> <span class="nam">GenericInstallationRule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t922" href="#t922">922</a></span><span class="t"> <span class="nam">sources</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t923" href="#t923">923</a></span><span class="t"> <span class="op">[</span><span class="op">(</span><span class="nam">dest_dir</span><span class="op">,</span> <span class="nam">dest_path_is_format</span><span class="op">)</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t924" href="#t924">924</a></span><span class="t"> <span class="nam">into</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t925" href="#t925">925</a></span><span class="t"> <span class="nam">cond</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t926" href="#t926">926</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t927" href="#t927">927</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t928" href="#t928">928</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t929" href="#t929">929</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t930" href="#t930">930</a></span><span class="t"> <span class="key">def</span> <span class="nam">install_doc_as</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t931" href="#t931">931</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t932" href="#t932">932</a></span><span class="t"> <span class="nam">source</span><span class="op">:</span> <span class="nam">FileSystemMatchRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t933" href="#t933">933</a></span><span class="t"> <span class="nam">dest_path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t934" href="#t934">934</a></span><span class="t"> <span class="nam">into</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t935" href="#t935">935</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t936" href="#t936">936</a></span><span class="t"> <span class="nam">condition</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ManifestCondition</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t937" href="#t937">937</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"InstallRule"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t938" href="#t938">938</a></span><span class="t"> <span class="nam">cond</span><span class="op">:</span> <span class="nam">ManifestCondition</span> <span class="op">=</span> <span class="nam">_BUILD_DOCS_BDO</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t939" href="#t939">939</a></span><span class="t"> <span class="key">if</span> <span class="nam">condition</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t940" href="#t940">940</a></span><span class="t"> <span class="nam">cond</span> <span class="op">=</span> <span class="nam">ManifestCondition</span><span class="op">.</span><span class="nam">all_of</span><span class="op">(</span><span class="op">[</span><span class="nam">cond</span><span class="op">,</span> <span class="nam">condition</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t941" href="#t941">941</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t942" href="#t942">942</a></span><span class="t"> <span class="key">return</span> <span class="nam">GenericInstallationRule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t943" href="#t943">943</a></span><span class="t"> <span class="op">[</span><span class="nam">source</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t944" href="#t944">944</a></span><span class="t"> <span class="op">[</span><span class="op">(</span><span class="nam">dest_path</span><span class="op">,</span> <span class="key">False</span><span class="op">)</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t945" href="#t945">945</a></span><span class="t"> <span class="nam">into</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t946" href="#t946">946</a></span><span class="t"> <span class="nam">cond</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t947" href="#t947">947</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t948" href="#t948">948</a></span><span class="t"> <span class="nam">require_single_match</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t949" href="#t949">949</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t950" href="#t950">950</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t951" href="#t951">951</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t952" href="#t952">952</a></span><span class="t"> <span class="key">def</span> <span class="nam">install_examples</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t953" href="#t953">953</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t954" href="#t954">954</a></span><span class="t"> <span class="nam">sources</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">FileSystemMatchRule</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t955" href="#t955">955</a></span><span class="t"> <span class="nam">into</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t956" href="#t956">956</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t957" href="#t957">957</a></span><span class="t"> <span class="nam">condition</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ManifestCondition</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t958" href="#t958">958</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"InstallRule"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t959" href="#t959">959</a></span><span class="t"> <span class="nam">cond</span><span class="op">:</span> <span class="nam">ManifestCondition</span> <span class="op">=</span> <span class="nam">_BUILD_DOCS_BDO</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t960" href="#t960">960</a></span><span class="t"> <span class="key">if</span> <span class="nam">condition</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">960 ↛ 961</span><span class="annotate long">line 960 didn't jump to line 961, because the condition on line 960 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t961" href="#t961">961</a></span><span class="t"> <span class="nam">cond</span> <span class="op">=</span> <span class="nam">ManifestCondition</span><span class="op">.</span><span class="nam">all_of</span><span class="op">(</span><span class="op">[</span><span class="nam">cond</span><span class="op">,</span> <span class="nam">condition</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t962" href="#t962">962</a></span><span class="t"> <span class="key">return</span> <span class="nam">GenericInstallationRule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t963" href="#t963">963</a></span><span class="t"> <span class="nam">sources</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t964" href="#t964">964</a></span><span class="t"> <span class="op">[</span><span class="op">(</span><span class="str">"usr/share/doc/{doc_main_package_name}/examples/{basename}"</span><span class="op">,</span> <span class="key">True</span><span class="op">)</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t965" href="#t965">965</a></span><span class="t"> <span class="nam">into</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t966" href="#t966">966</a></span><span class="t"> <span class="nam">cond</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t967" href="#t967">967</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t968" href="#t968">968</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t969" href="#t969">969</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t970" href="#t970">970</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t971" href="#t971">971</a></span><span class="t"> <span class="key">def</span> <span class="nam">install_man</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t972" href="#t972">972</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t973" href="#t973">973</a></span><span class="t"> <span class="nam">sources</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">FileSystemMatchRule</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t974" href="#t974">974</a></span><span class="t"> <span class="nam">into</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t975" href="#t975">975</a></span><span class="t"> <span class="nam">section</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t976" href="#t976">976</a></span><span class="t"> <span class="nam">language</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t977" href="#t977">977</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t978" href="#t978">978</a></span><span class="t"> <span class="nam">condition</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ManifestCondition</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t979" href="#t979">979</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"InstallRule"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t980" href="#t980">980</a></span><span class="t"> <span class="nam">cond</span><span class="op">:</span> <span class="nam">ManifestCondition</span> <span class="op">=</span> <span class="nam">_BUILD_DOCS_BDO</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t981" href="#t981">981</a></span><span class="t"> <span class="key">if</span> <span class="nam">condition</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">981 ↛ 982</span><span class="annotate long">line 981 didn't jump to line 982, because the condition on line 981 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t982" href="#t982">982</a></span><span class="t"> <span class="nam">cond</span> <span class="op">=</span> <span class="nam">ManifestCondition</span><span class="op">.</span><span class="nam">all_of</span><span class="op">(</span><span class="op">[</span><span class="nam">cond</span><span class="op">,</span> <span class="nam">condition</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t983" href="#t983">983</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t984" href="#t984">984</a></span><span class="t"> <span class="nam">dest_path_computer</span> <span class="op">=</span> <span class="nam">_dest_path_for_manpage</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t985" href="#t985">985</a></span><span class="t"> <span class="nam">section</span><span class="op">,</span> <span class="nam">language</span><span class="op">,</span> <span class="nam">definition_source</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t986" href="#t986">986</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t987" href="#t987">987</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t988" href="#t988">988</a></span><span class="t"> <span class="key">return</span> <span class="nam">GenericInstallationRule</span><span class="op">(</span> </span><span class="r"><span class="annotate short">988 ↛ exit</span><span class="annotate long">line 988 didn't jump to the function exit</span></span></p> - <p class="pln"><span class="n"><a id="t989" href="#t989">989</a></span><span class="t"> <span class="nam">sources</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t990" href="#t990">990</a></span><span class="t"> <span class="nam">dest_path_computer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t991" href="#t991">991</a></span><span class="t"> <span class="nam">into</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t992" href="#t992">992</a></span><span class="t"> <span class="nam">cond</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t993" href="#t993">993</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t994" href="#t994">994</a></span><span class="t"> <span class="nam">match_filter</span><span class="op">=</span><span class="key">lambda</span> <span class="nam">m</span><span class="op">:</span> <span class="key">not</span> <span class="nam">m</span><span class="op">.</span><span class="nam">is_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t995" href="#t995">995</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t996" href="#t996">996</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t997" href="#t997">997</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t998" href="#t998">998</a></span><span class="t"> <span class="key">def</span> <span class="nam">discard_paths</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t999" href="#t999">999</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1000" href="#t1000">1000</a></span><span class="t"> <span class="nam">paths</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">FileSystemMatchRule</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1001" href="#t1001">1001</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1002" href="#t1002">1002</a></span><span class="t"> <span class="nam">condition</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ManifestCondition</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1003" href="#t1003">1003</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1004" href="#t1004">1004</a></span><span class="t"> <span class="nam">limit_to</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Sequence</span><span class="op">[</span><span class="nam">FileSystemExactMatchRule</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1005" href="#t1005">1005</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"InstallRule"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1006" href="#t1006">1006</a></span><span class="t"> <span class="key">return</span> <span class="nam">DiscardRule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1007" href="#t1007">1007</a></span><span class="t"> <span class="nam">paths</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1008" href="#t1008">1008</a></span><span class="t"> <span class="nam">condition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1009" href="#t1009">1009</a></span><span class="t"> <span class="nam">tuple</span><span class="op">(</span><span class="nam">limit_to</span><span class="op">)</span> <span class="key">if</span> <span class="nam">limit_to</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">else</span> <span class="nam">tuple</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1010" href="#t1010">1010</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1011" href="#t1011">1011</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1012" href="#t1012">1012</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1013" href="#t1013">1013</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1014" href="#t1014">1014</a></span><span class="t"><span class="key">class</span> <span class="nam">PPFInstallRule</span><span class="op">(</span><span class="nam">InstallRule</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1015" href="#t1015">1015</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1016" href="#t1016">1016</a></span><span class="t"> <span class="str">"_ppfs"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1017" href="#t1017">1017</a></span><span class="t"> <span class="str">"_substitution"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1018" href="#t1018">1018</a></span><span class="t"> <span class="str">"_into"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1019" href="#t1019">1019</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1020" href="#t1020">1020</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1021" href="#t1021">1021</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1022" href="#t1022">1022</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1023" href="#t1023">1023</a></span><span class="t"> <span class="nam">into</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1024" href="#t1024">1024</a></span><span class="t"> <span class="nam">substitution</span><span class="op">:</span> <span class="nam">Substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1025" href="#t1025">1025</a></span><span class="t"> <span class="nam">ppfs</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="str">"PackagerProvidedFile"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1026" href="#t1026">1026</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1027" href="#t1027">1027</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1028" href="#t1028">1028</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1029" href="#t1029">1029</a></span><span class="t"> <span class="str">"<built-in; PPF install rule>"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1030" href="#t1030">1030</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1031" href="#t1031">1031</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_substitution</span> <span class="op">=</span> <span class="nam">substitution</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1032" href="#t1032">1032</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_ppfs</span> <span class="op">=</span> <span class="nam">ppfs</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1033" href="#t1033">1033</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_into</span> <span class="op">=</span> <span class="nam">into</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1034" href="#t1034">1034</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1035" href="#t1035">1035</a></span><span class="t"> <span class="key">def</span> <span class="nam">perform_install</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1036" href="#t1036">1036</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1037" href="#t1037">1037</a></span><span class="t"> <span class="nam">path_matcher</span><span class="op">:</span> <span class="nam">SourcePathMatcher</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1038" href="#t1038">1038</a></span><span class="t"> <span class="nam">install_context</span><span class="op">:</span> <span class="nam">InstallRuleContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1039" href="#t1039">1039</a></span><span class="t"> <span class="nam">condition_context</span><span class="op">:</span> <span class="nam">ConditionContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1040" href="#t1040">1040</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1041" href="#t1041">1041</a></span><span class="t"> <span class="nam">binary_install_context</span> <span class="op">=</span> <span class="nam">install_context</span><span class="op">[</span><span class="nam">self</span><span class="op">.</span><span class="nam">_into</span><span class="op">.</span><span class="nam">name</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1042" href="#t1042">1042</a></span><span class="t"> <span class="nam">fs_root</span> <span class="op">=</span> <span class="nam">binary_install_context</span><span class="op">.</span><span class="nam">fs_root</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1043" href="#t1043">1043</a></span><span class="t"> <span class="key">for</span> <span class="nam">ppf</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_ppfs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1044" href="#t1044">1044</a></span><span class="t"> <span class="nam">source_path</span> <span class="op">=</span> <span class="nam">ppf</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">fs_path</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1045" href="#t1045">1045</a></span><span class="t"> <span class="nam">dest_dir</span><span class="op">,</span> <span class="nam">name</span> <span class="op">=</span> <span class="nam">ppf</span><span class="op">.</span><span class="nam">compute_dest</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1046" href="#t1046">1046</a></span><span class="t"> <span class="nam">dir_path</span> <span class="op">=</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">mkdirs</span><span class="op">(</span><span class="nam">dest_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1047" href="#t1047">1047</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1048" href="#t1048">1048</a></span><span class="t"> <span class="nam">dir_path</span><span class="op">.</span><span class="nam">insert_file_from_fs_path</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1049" href="#t1049">1049</a></span><span class="t"> <span class="nam">name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1050" href="#t1050">1050</a></span><span class="t"> <span class="nam">source_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1051" href="#t1051">1051</a></span><span class="t"> <span class="nam">follow_symlinks</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1052" href="#t1052">1052</a></span><span class="t"> <span class="nam">use_fs_path_mode</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1053" href="#t1053">1053</a></span><span class="t"> <span class="nam">mode</span><span class="op">=</span><span class="nam">ppf</span><span class="op">.</span><span class="nam">definition</span><span class="op">.</span><span class="nam">default_mode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1054" href="#t1054">1054</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1055" href="#t1055">1055</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1056" href="#t1056">1056</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1057" href="#t1057">1057</a></span><span class="t"><span class="key">class</span> <span class="nam">GenericInstallationRule</span><span class="op">(</span><span class="nam">InstallRule</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1058" href="#t1058">1058</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1059" href="#t1059">1059</a></span><span class="t"> <span class="str">"_sources"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1060" href="#t1060">1060</a></span><span class="t"> <span class="str">"_into"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1061" href="#t1061">1061</a></span><span class="t"> <span class="str">"_dest_paths"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1062" href="#t1062">1062</a></span><span class="t"> <span class="str">"_require_single_match"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1063" href="#t1063">1063</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1064" href="#t1064">1064</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1065" href="#t1065">1065</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1066" href="#t1066">1066</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1067" href="#t1067">1067</a></span><span class="t"> <span class="nam">sources</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">FileSystemMatchRule</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1068" href="#t1068">1068</a></span><span class="t"> <span class="nam">dest_paths</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">Sequence</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">bool</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">PathMatch</span><span class="op">]</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1069" href="#t1069">1069</a></span><span class="t"> <span class="nam">into</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1070" href="#t1070">1070</a></span><span class="t"> <span class="nam">condition</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ManifestCondition</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1071" href="#t1071">1071</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1072" href="#t1072">1072</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1073" href="#t1073">1073</a></span><span class="t"> <span class="nam">require_single_match</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1074" href="#t1074">1074</a></span><span class="t"> <span class="nam">match_filter</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="str">"VirtualPath"</span><span class="op">]</span><span class="op">,</span> <span class="nam">bool</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1075" href="#t1075">1075</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1076" href="#t1076">1076</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1077" href="#t1077">1077</a></span><span class="t"> <span class="nam">condition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1078" href="#t1078">1078</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1079" href="#t1079">1079</a></span><span class="t"> <span class="nam">match_filter</span><span class="op">=</span><span class="nam">match_filter</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1080" href="#t1080">1080</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1081" href="#t1081">1081</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_sources</span> <span class="op">=</span> <span class="nam">sources</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1082" href="#t1082">1082</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_into</span> <span class="op">=</span> <span class="nam">into</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1083" href="#t1083">1083</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_dest_paths</span> <span class="op">=</span> <span class="nam">dest_paths</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1084" href="#t1084">1084</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_require_single_match</span> <span class="op">=</span> <span class="nam">require_single_match</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1085" href="#t1085">1085</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_require_single_match</span> <span class="key">and</span> <span class="nam">len</span><span class="op">(</span><span class="nam">sources</span><span class="op">)</span> <span class="op">!=</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1085 ↛ 1086</span><span class="annotate long">line 1085 didn't jump to line 1086, because the condition on line 1085 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1086" href="#t1086">1086</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"require_single_match implies sources must have len 1"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1087" href="#t1087">1087</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1088" href="#t1088">1088</a></span><span class="t"> <span class="key">def</span> <span class="nam">perform_install</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1089" href="#t1089">1089</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1090" href="#t1090">1090</a></span><span class="t"> <span class="nam">path_matcher</span><span class="op">:</span> <span class="nam">SourcePathMatcher</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1091" href="#t1091">1091</a></span><span class="t"> <span class="nam">install_context</span><span class="op">:</span> <span class="nam">InstallRuleContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1092" href="#t1092">1092</a></span><span class="t"> <span class="nam">condition_context</span><span class="op">:</span> <span class="nam">ConditionContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1093" href="#t1093">1093</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1094" href="#t1094">1094</a></span><span class="t"> <span class="key">for</span> <span class="nam">source</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_sources</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1095" href="#t1095">1095</a></span><span class="t"> <span class="nam">matches</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_match_pattern</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1096" href="#t1096">1096</a></span><span class="t"> <span class="nam">path_matcher</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1097" href="#t1097">1097</a></span><span class="t"> <span class="nam">source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1098" href="#t1098">1098</a></span><span class="t"> <span class="nam">condition_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1099" href="#t1099">1099</a></span><span class="t"> <span class="nam">install_context</span><span class="op">.</span><span class="nam">search_dirs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1100" href="#t1100">1100</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_into</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1101" href="#t1101">1101</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1102" href="#t1102">1102</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_require_single_match</span> <span class="key">and</span> <span class="nam">len</span><span class="op">(</span><span class="nam">matches</span><span class="op">)</span> <span class="op">></span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1103" href="#t1103">1103</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_check_single_match</span><span class="op">(</span><span class="nam">source</span><span class="op">,</span> <span class="nam">matches</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1104" href="#t1104">1104</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_install_matches</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1105" href="#t1105">1105</a></span><span class="t"> <span class="nam">path_matcher</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1106" href="#t1106">1106</a></span><span class="t"> <span class="nam">matches</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1107" href="#t1107">1107</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_dest_paths</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1108" href="#t1108">1108</a></span><span class="t"> <span class="nam">install_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1109" href="#t1109">1109</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_into</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1110" href="#t1110">1110</a></span><span class="t"> <span class="nam">condition_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1111" href="#t1111">1111</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1112" href="#t1112">1112</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1113" href="#t1113">1113</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1114" href="#t1114">1114</a></span><span class="t"><span class="key">class</span> <span class="nam">DiscardRule</span><span class="op">(</span><span class="nam">InstallRule</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1115" href="#t1115">1115</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"_fs_match_rules"</span><span class="op">,</span> <span class="str">"_limit_to"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1116" href="#t1116">1116</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1117" href="#t1117">1117</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1118" href="#t1118">1118</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1119" href="#t1119">1119</a></span><span class="t"> <span class="nam">fs_match_rules</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">FileSystemMatchRule</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1120" href="#t1120">1120</a></span><span class="t"> <span class="nam">condition</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ManifestCondition</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1121" href="#t1121">1121</a></span><span class="t"> <span class="nam">limit_to</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">FileSystemExactMatchRule</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1122" href="#t1122">1122</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1123" href="#t1123">1123</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1124" href="#t1124">1124</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="nam">condition</span><span class="op">,</span> <span class="nam">definition_source</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1125" href="#t1125">1125</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_fs_match_rules</span> <span class="op">=</span> <span class="nam">fs_match_rules</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1126" href="#t1126">1126</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_limit_to</span> <span class="op">=</span> <span class="nam">limit_to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1127" href="#t1127">1127</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1128" href="#t1128">1128</a></span><span class="t"> <span class="key">def</span> <span class="nam">perform_install</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1129" href="#t1129">1129</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1130" href="#t1130">1130</a></span><span class="t"> <span class="nam">path_matcher</span><span class="op">:</span> <span class="nam">SourcePathMatcher</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1131" href="#t1131">1131</a></span><span class="t"> <span class="nam">install_context</span><span class="op">:</span> <span class="nam">InstallRuleContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1132" href="#t1132">1132</a></span><span class="t"> <span class="nam">condition_context</span><span class="op">:</span> <span class="nam">ConditionContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1133" href="#t1133">1133</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1134" href="#t1134">1134</a></span><span class="t"> <span class="nam">into</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1135" href="#t1135">1135</a></span><span class="t"> <span class="nam">limit_to</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_limit_to</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1136" href="#t1136">1136</a></span><span class="t"> <span class="key">if</span> <span class="nam">limit_to</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1137" href="#t1137">1137</a></span><span class="t"> <span class="nam">matches</span> <span class="op">=</span> <span class="op">{</span><span class="nam">x</span><span class="op">.</span><span class="nam">match_rule</span><span class="op">.</span><span class="nam">path</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">limit_to</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1138" href="#t1138">1138</a></span><span class="t"> <span class="nam">search_dirs</span> <span class="op">=</span> <span class="nam">tuple</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1139" href="#t1139">1139</a></span><span class="t"> <span class="nam">s</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1140" href="#t1140">1140</a></span><span class="t"> <span class="key">for</span> <span class="nam">s</span> <span class="key">in</span> <span class="nam">install_context</span><span class="op">.</span><span class="nam">search_dirs</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1141" href="#t1141">1141</a></span><span class="t"> <span class="key">if</span> <span class="nam">s</span><span class="op">.</span><span class="nam">search_dir</span><span class="op">.</span><span class="nam">fs_path</span> <span class="key">in</span> <span class="nam">matches</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1142" href="#t1142">1142</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1143" href="#t1143">1143</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">limit_to</span><span class="op">)</span> <span class="op">!=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">search_dirs</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1144" href="#t1144">1144</a></span><span class="t"> <span class="nam">matches</span><span class="op">.</span><span class="nam">difference</span><span class="op">(</span><span class="nam">s</span><span class="op">.</span><span class="nam">search_dir</span><span class="op">.</span><span class="nam">fs_path</span> <span class="key">for</span> <span class="nam">s</span> <span class="key">in</span> <span class="nam">search_dirs</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1145" href="#t1145">1145</a></span><span class="t"> <span class="nam">paths</span> <span class="op">=</span> <span class="str">":"</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">matches</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1146" href="#t1146">1146</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1147" href="#t1147">1147</a></span><span class="t"> <span class="str">f"The discard rule defined at {self._definition_source} mentions the following"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1148" href="#t1148">1148</a></span><span class="t"> <span class="str">f" search directories that were not known to debputy: {paths}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1149" href="#t1149">1149</a></span><span class="t"> <span class="str">" Either the search dir is missing somewhere else or it should be removed from"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1150" href="#t1150">1150</a></span><span class="t"> <span class="str">" the discard rule."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1151" href="#t1151">1151</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1152" href="#t1152">1152</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1153" href="#t1153">1153</a></span><span class="t"> <span class="nam">search_dirs</span> <span class="op">=</span> <span class="nam">install_context</span><span class="op">.</span><span class="nam">search_dirs</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1154" href="#t1154">1154</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1155" href="#t1155">1155</a></span><span class="t"> <span class="key">for</span> <span class="nam">fs_match_rule</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_fs_match_rules</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1156" href="#t1156">1156</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_match_pattern</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1157" href="#t1157">1157</a></span><span class="t"> <span class="nam">path_matcher</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1158" href="#t1158">1158</a></span><span class="t"> <span class="nam">fs_match_rule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1159" href="#t1159">1159</a></span><span class="t"> <span class="nam">condition_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1160" href="#t1160">1160</a></span><span class="t"> <span class="nam">search_dirs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1161" href="#t1161">1161</a></span><span class="t"> <span class="nam">into</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1162" href="#t1162">1162</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_highlevel_manifest_parser_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_intermediate_manifest_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_267b6307937f1878_intermediate_manifest_py.html b/coverage-report/d_267b6307937f1878_intermediate_manifest_py.html deleted file mode 100644 index 685223a..0000000 --- a/coverage-report/d_267b6307937f1878_intermediate_manifest_py.html +++ /dev/null @@ -1,432 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/intermediate_manifest.py: 62%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/intermediate_manifest.py</b>: - <span class="pc_cov">62%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">172 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">120<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">52<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">22<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_installations_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_interpreter_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">dataclasses</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">json</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">import</span> <span class="nam">stat</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">import</span> <span class="nam">sys</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">import</span> <span class="nam">tarfile</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">from</span> <span class="nam">enum</span> <span class="key">import</span> <span class="nam">Enum</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Optional</span><span class="op">,</span> <span class="nam">List</span><span class="op">,</span> <span class="nam">Dict</span><span class="op">,</span> <span class="nam">Any</span><span class="op">,</span> <span class="nam">Iterable</span><span class="op">,</span> <span class="nam">Union</span><span class="op">,</span> <span class="nam">Self</span><span class="op">,</span> <span class="nam">Mapping</span><span class="op">,</span> <span class="nam">IO</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="nam">IntermediateManifest</span> <span class="op">=</span> <span class="nam">List</span><span class="op">[</span><span class="str">"TarMember"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"><span class="key">class</span> <span class="nam">PathType</span><span class="op">(</span><span class="nam">Enum</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">FILE</span> <span class="op">=</span> <span class="op">(</span><span class="str">"file"</span><span class="op">,</span> <span class="nam">tarfile</span><span class="op">.</span><span class="nam">REGTYPE</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">DIRECTORY</span> <span class="op">=</span> <span class="op">(</span><span class="str">"directory"</span><span class="op">,</span> <span class="nam">tarfile</span><span class="op">.</span><span class="nam">DIRTYPE</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">SYMLINK</span> <span class="op">=</span> <span class="op">(</span><span class="str">"symlink"</span><span class="op">,</span> <span class="nam">tarfile</span><span class="op">.</span><span class="nam">SYMTYPE</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="com"># TODO: Add hardlink, FIFO, Char device, BLK device, etc.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="key">def</span> <span class="nam">manifest_key</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">value</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="key">def</span> <span class="nam">tarinfo_type</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bytes</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">value</span><span class="op">[</span><span class="num">1</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="key">def</span> <span class="nam">can_be_virtual</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span> <span class="key">in</span> <span class="op">(</span><span class="nam">PathType</span><span class="op">.</span><span class="nam">DIRECTORY</span><span class="op">,</span> <span class="nam">PathType</span><span class="op">.</span><span class="nam">SYMLINK</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"><span class="nam">KEY2PATH_TYPE</span> <span class="op">=</span> <span class="op">{</span><span class="nam">pt</span><span class="op">.</span><span class="nam">manifest_key</span><span class="op">:</span> <span class="nam">pt</span> <span class="key">for</span> <span class="nam">pt</span> <span class="key">in</span> <span class="nam">PathType</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="key">def</span> <span class="nam">_dirname</span><span class="op">(</span><span class="nam">path</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="nam">path</span> <span class="op">=</span> <span class="nam">path</span><span class="op">.</span><span class="nam">rstrip</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span> <span class="op">==</span> <span class="str">"."</span><span class="op">:</span> </span><span class="r"><span class="annotate short">39 ↛ 41</span><span class="annotate long">line 39 didn't jump to line 41, because the condition on line 39 was never false</span></span></p> - <p class="run"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="key">return</span> <span class="nam">path</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="key">return</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">dirname</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"><span class="key">def</span> <span class="nam">_fs_type_from_st_mode</span><span class="op">(</span><span class="nam">fs_path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">st_mode</span><span class="op">:</span> <span class="nam">int</span><span class="op">)</span> <span class="op">-></span> <span class="nam">PathType</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="key">if</span> <span class="nam">stat</span><span class="op">.</span><span class="nam">S_ISREG</span><span class="op">(</span><span class="nam">st_mode</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="nam">path_type</span> <span class="op">=</span> <span class="nam">PathType</span><span class="op">.</span><span class="nam">FILE</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="key">elif</span> <span class="nam">stat</span><span class="op">.</span><span class="nam">S_ISDIR</span><span class="op">(</span><span class="nam">st_mode</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="nam">path_type</span> <span class="op">=</span> <span class="nam">PathType</span><span class="op">.</span><span class="nam">DIRECTORY</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="com"># elif stat.S_ISFIFO(st_result):</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="com"># type = FIFOTYPE</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="key">elif</span> <span class="nam">stat</span><span class="op">.</span><span class="nam">S_ISLNK</span><span class="op">(</span><span class="nam">st_mode</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="str">"Symlinks should have been rewritten to use the virtual rule."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="str">" Otherwise, the link would not be normalized according to Debian Policy."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="com"># elif stat.S_ISCHR(st_result):</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="com"># type = CHRTYPE</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="com"># elif stat.S_ISBLK(st_result):</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="com"># type = BLKTYPE</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="str">f"The path {fs_path} had an unsupported/unknown file type."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="str">f" Probably a bug in the tool"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="key">return</span> <span class="nam">path_type</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"><span class="key">class</span> <span class="nam">TarMember</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="nam">member_path</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="nam">path_type</span><span class="op">:</span> <span class="nam">PathType</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="nam">fs_path</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="nam">mode</span><span class="op">:</span> <span class="nam">int</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="nam">owner</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="nam">uid</span><span class="op">:</span> <span class="nam">int</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="nam">group</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="nam">gid</span><span class="op">:</span> <span class="nam">int</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="nam">mtime</span><span class="op">:</span> <span class="nam">float</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="nam">link_target</span><span class="op">:</span> <span class="nam">str</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="nam">is_virtual_entry</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="nam">may_steal_fs_path</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="key">def</span> <span class="nam">create_tar_info</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">tar_fd</span><span class="op">:</span> <span class="nam">tarfile</span><span class="op">.</span><span class="nam">TarFile</span><span class="op">)</span> <span class="op">-></span> <span class="nam">tarfile</span><span class="op">.</span><span class="nam">TarInfo</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="nam">tar_info</span><span class="op">:</span> <span class="nam">tarfile</span><span class="op">.</span><span class="nam">TarInfo</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_virtual_entry</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="key">assert</span> <span class="nam">self</span><span class="op">.</span><span class="nam">path_type</span><span class="op">.</span><span class="nam">can_be_virtual</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="nam">tar_info</span> <span class="op">=</span> <span class="nam">tar_fd</span><span class="op">.</span><span class="nam">tarinfo</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">member_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="nam">tar_info</span><span class="op">.</span><span class="nam">size</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="nam">tar_info</span><span class="op">.</span><span class="nam">type</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">path_type</span><span class="op">.</span><span class="nam">tarinfo_type</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="nam">tar_info</span><span class="op">.</span><span class="nam">linkpath</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">link_target</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="nam">tar_info</span> <span class="op">=</span> <span class="nam">tar_fd</span><span class="op">.</span><span class="nam">gettarinfo</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="nam">name</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">,</span> <span class="nam">arcname</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">member_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="key">except</span> <span class="op">(</span><span class="nam">TypeError</span><span class="op">,</span> <span class="nam">ValueError</span><span class="op">)</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="str">f"Unable to prepare tar info for {self.member_path}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="op">)</span> <span class="key">from</span> <span class="nam">e</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="com"># TODO: Eventually, we should be able to unconditionally rely on link_target. However,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="com"># until we got symlinks and hardlinks correctly done in the JSON generator, it will be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="com"># conditional for now.</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">link_target</span> <span class="op">!=</span> <span class="str">""</span><span class="op">:</span> </span><span class="r"><span class="annotate short">103 ↛ 104</span><span class="annotate long">line 103 didn't jump to line 104, because the condition on line 103 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="nam">tar_info</span><span class="op">.</span><span class="nam">linkpath</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">link_target</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="nam">tar_info</span><span class="op">.</span><span class="nam">mode</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">mode</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="nam">tar_info</span><span class="op">.</span><span class="nam">uname</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">owner</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="nam">tar_info</span><span class="op">.</span><span class="nam">uid</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">uid</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="nam">tar_info</span><span class="op">.</span><span class="nam">gname</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">group</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="nam">tar_info</span><span class="op">.</span><span class="nam">gid</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">gid</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="nam">tar_info</span><span class="op">.</span><span class="nam">mode</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">mode</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="nam">tar_info</span><span class="op">.</span><span class="nam">mtime</span> <span class="op">=</span> <span class="nam">int</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">mtime</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="key">return</span> <span class="nam">tar_info</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="key">def</span> <span class="nam">from_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="nam">member_path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="nam">fs_path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="nam">mode</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="nam">owner</span><span class="op">:</span> <span class="nam">str</span> <span class="op">=</span> <span class="str">"root"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="nam">uid</span><span class="op">:</span> <span class="nam">int</span> <span class="op">=</span> <span class="num">0</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="nam">group</span><span class="op">:</span> <span class="nam">str</span> <span class="op">=</span> <span class="str">"root"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="nam">gid</span><span class="op">:</span> <span class="nam">int</span> <span class="op">=</span> <span class="num">0</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="nam">path_mtime</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">float</span><span class="op">,</span> <span class="nam">int</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="nam">clamp_mtime_to</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="nam">path_type</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">PathType</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="nam">may_steal_fs_path</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"TarMember"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="com"># Avoid lstat'ing if we can as it makes it easier to do tests of the code</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="com"># (as we do not need an existing physical fs path)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="key">if</span> <span class="nam">path_type</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">path_mtime</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">mode</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">132 ↛ 133</span><span class="annotate long">line 132 didn't jump to line 133, because the condition on line 132 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="nam">st_result</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">lstat</span><span class="op">(</span><span class="nam">fs_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="nam">st_mode</span> <span class="op">=</span> <span class="nam">st_result</span><span class="op">.</span><span class="nam">st_mode</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="key">if</span> <span class="nam">mode</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="nam">mode</span> <span class="op">=</span> <span class="nam">st_mode</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="key">if</span> <span class="nam">path_mtime</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="nam">path_mtime</span> <span class="op">=</span> <span class="nam">st_result</span><span class="op">.</span><span class="nam">st_mtime</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="key">if</span> <span class="nam">path_type</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="nam">path_type</span> <span class="op">=</span> <span class="nam">_fs_type_from_st_mode</span><span class="op">(</span><span class="nam">fs_path</span><span class="op">,</span> <span class="nam">st_mode</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="key">if</span> <span class="nam">clamp_mtime_to</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">path_mtime</span> <span class="op">></span> <span class="nam">clamp_mtime_to</span><span class="op">:</span> </span><span class="r"><span class="annotate short">142 ↛ 143</span><span class="annotate long">line 142 didn't jump to line 143, because the condition on line 142 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="nam">path_mtime</span> <span class="op">=</span> <span class="nam">clamp_mtime_to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="key">if</span> <span class="nam">may_steal_fs_path</span><span class="op">:</span> </span><span class="r"><span class="annotate short">145 ↛ 146</span><span class="annotate long">line 145 didn't jump to line 146, because the condition on line 145 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="key">assert</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="str">"debputy/scratch-dir/"</span> <span class="key">in</span> <span class="nam">fs_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> <span class="str">f"{fs_path} should not have been stealable"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="key">return</span> <span class="nam">cls</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="nam">member_path</span><span class="op">=</span><span class="nam">member_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="nam">path_type</span><span class="op">=</span><span class="nam">path_type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="nam">fs_path</span><span class="op">=</span><span class="nam">fs_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="nam">mode</span><span class="op">=</span><span class="nam">mode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="nam">owner</span><span class="op">=</span><span class="nam">owner</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="nam">uid</span><span class="op">=</span><span class="nam">uid</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="nam">group</span><span class="op">=</span><span class="nam">group</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="nam">gid</span><span class="op">=</span><span class="nam">gid</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="nam">mtime</span><span class="op">=</span><span class="nam">float</span><span class="op">(</span><span class="nam">path_mtime</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="nam">is_virtual_entry</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="nam">may_steal_fs_path</span><span class="op">=</span><span class="nam">may_steal_fs_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="key">def</span> <span class="nam">virtual_path</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="nam">member_path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="nam">path_type</span><span class="op">:</span> <span class="nam">PathType</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="nam">mtime</span><span class="op">:</span> <span class="nam">float</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="nam">mode</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="nam">link_target</span><span class="op">:</span> <span class="nam">str</span> <span class="op">=</span> <span class="str">""</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="nam">owner</span><span class="op">:</span> <span class="nam">str</span> <span class="op">=</span> <span class="str">"root"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">uid</span><span class="op">:</span> <span class="nam">int</span> <span class="op">=</span> <span class="num">0</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="nam">group</span><span class="op">:</span> <span class="nam">str</span> <span class="op">=</span> <span class="str">"root"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="nam">gid</span><span class="op">:</span> <span class="nam">int</span> <span class="op">=</span> <span class="num">0</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Self</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">path_type</span><span class="op">.</span><span class="nam">can_be_virtual</span><span class="op">:</span> </span><span class="r"><span class="annotate short">177 ↛ 178</span><span class="annotate long">line 177 didn't jump to line 178, because the condition on line 177 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">f"The path type {path_type.name} cannot be virtual"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span><span class="nam">path_type</span> <span class="op">==</span> <span class="nam">PathType</span><span class="op">.</span><span class="nam">SYMLINK</span><span class="op">)</span> <span class="op">^</span> <span class="nam">bool</span><span class="op">(</span><span class="nam">link_target</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">179 ↛ 180</span><span class="annotate long">line 179 didn't jump to line 180, because the condition on line 179 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">link_target</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"Symlinks must have a link target"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="com"># TODO: Dear future programmer. Hardlinks will appear here some day and you will have to fix this</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="com"># code then!</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"Non-symlinks must not have a link target"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="key">return</span> <span class="nam">cls</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="nam">member_path</span><span class="op">=</span><span class="nam">member_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="nam">path_type</span><span class="op">=</span><span class="nam">path_type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="nam">fs_path</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="nam">link_target</span><span class="op">=</span><span class="nam">link_target</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="nam">mode</span><span class="op">=</span><span class="nam">mode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="nam">owner</span><span class="op">=</span><span class="nam">owner</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="nam">uid</span><span class="op">=</span><span class="nam">uid</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="nam">group</span><span class="op">=</span><span class="nam">group</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="nam">gid</span><span class="op">=</span><span class="nam">gid</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="nam">mtime</span><span class="op">=</span><span class="nam">mtime</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="nam">is_virtual_entry</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="key">def</span> <span class="nam">clone_and_replace</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">/</span><span class="op">,</span> <span class="op">**</span><span class="nam">changes</span><span class="op">:</span> <span class="nam">Any</span><span class="op">)</span> <span class="op">-></span> <span class="str">"TarMember"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="key">return</span> <span class="nam">dataclasses</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">**</span><span class="nam">changes</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="key">def</span> <span class="nam">to_manifest</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="nam">d</span> <span class="op">=</span> <span class="nam">dataclasses</span><span class="op">.</span><span class="nam">asdict</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="nam">d</span><span class="op">[</span><span class="str">"mode"</span><span class="op">]</span> <span class="op">=</span> <span class="nam">oct</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">mode</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="key">except</span> <span class="op">(</span><span class="nam">TypeError</span><span class="op">,</span> <span class="nam">ValueError</span><span class="op">)</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TypeError</span><span class="op">(</span><span class="str">f"Bad mode in TarMember {self.member_path}"</span><span class="op">)</span> <span class="key">from</span> <span class="nam">e</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="nam">d</span><span class="op">[</span><span class="str">"path_type"</span><span class="op">]</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">path_type</span><span class="op">.</span><span class="nam">manifest_key</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="com"># "compress" the output by removing redundant fields</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">link_target</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">self</span><span class="op">.</span><span class="nam">link_target</span> <span class="op">==</span> <span class="str">""</span><span class="op">:</span> </span><span class="r"><span class="annotate short">210 ↛ 212</span><span class="annotate long">line 210 didn't jump to line 212, because the condition on line 210 was never false</span></span></p> - <p class="run"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="key">del</span> <span class="nam">d</span><span class="op">[</span><span class="str">"link_target"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_virtual_entry</span><span class="op">:</span> </span><span class="r"><span class="annotate short">212 ↛ 216</span><span class="annotate long">line 212 didn't jump to line 216, because the condition on line 212 was never false</span></span></p> - <p class="run"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="key">assert</span> <span class="nam">self</span><span class="op">.</span><span class="nam">fs_path</span> <span class="key">is</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="key">del</span> <span class="nam">d</span><span class="op">[</span><span class="str">"fs_path"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="key">del</span> <span class="nam">d</span><span class="op">[</span><span class="str">"is_virtual_entry"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="key">return</span> <span class="nam">d</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="key">def</span> <span class="nam">parse_intermediate_manifest</span><span class="op">(</span><span class="nam">cls</span><span class="op">,</span> <span class="nam">manifest_path</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">IntermediateManifest</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="nam">directories</span> <span class="op">=</span> <span class="op">{</span><span class="str">"."</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="key">if</span> <span class="nam">manifest_path</span> <span class="op">==</span> <span class="str">"-"</span><span class="op">:</span> </span><span class="r"><span class="annotate short">222 ↛ 223</span><span class="annotate long">line 222 didn't jump to line 223, because the condition on line 222 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="key">with</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">stdin</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="nam">data</span> <span class="op">=</span> <span class="nam">json</span><span class="op">.</span><span class="nam">load</span><span class="op">(</span><span class="nam">fd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="nam">contents</span> <span class="op">=</span> <span class="op">[</span><span class="nam">TarMember</span><span class="op">.</span><span class="nam">from_dict</span><span class="op">(</span><span class="nam">m</span><span class="op">)</span> <span class="key">for</span> <span class="nam">m</span> <span class="key">in</span> <span class="nam">data</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="key">with</span> <span class="nam">open</span><span class="op">(</span><span class="nam">manifest_path</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="nam">data</span> <span class="op">=</span> <span class="nam">json</span><span class="op">.</span><span class="nam">load</span><span class="op">(</span><span class="nam">fd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="nam">contents</span> <span class="op">=</span> <span class="op">[</span><span class="nam">TarMember</span><span class="op">.</span><span class="nam">from_dict</span><span class="op">(</span><span class="nam">m</span><span class="op">)</span> <span class="key">for</span> <span class="nam">m</span> <span class="key">in</span> <span class="nam">data</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">contents</span><span class="op">:</span> </span><span class="r"><span class="annotate short">230 ↛ 231</span><span class="annotate long">line 230 didn't jump to line 231, because the condition on line 230 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="str">"Empty manifest (note that the root directory should always be present"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="key">if</span> <span class="nam">contents</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">.</span><span class="nam">member_path</span> <span class="op">!=</span> <span class="str">"./"</span><span class="op">:</span> </span><span class="r"><span class="annotate short">234 ↛ 235</span><span class="annotate long">line 234 didn't jump to line 235, because the condition on line 234 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">'The first member must always be the root directory "./"'</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="key">for</span> <span class="nam">tar_member</span> <span class="key">in</span> <span class="nam">contents</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="nam">directory</span> <span class="op">=</span> <span class="nam">_dirname</span><span class="op">(</span><span class="nam">tar_member</span><span class="op">.</span><span class="nam">member_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="key">if</span> <span class="nam">directory</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">directories</span><span class="op">:</span> </span><span class="r"><span class="annotate short">238 ↛ 239</span><span class="annotate long">line 238 didn't jump to line 239, because the condition on line 238 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="str">f'The path "{tar_member.member_path}" came before the directory it is in (or the path'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="str">f" is not a directory). Either way leads to a broken deb."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="key">if</span> <span class="nam">tar_member</span><span class="op">.</span><span class="nam">path_type</span> <span class="op">==</span> <span class="nam">PathType</span><span class="op">.</span><span class="nam">DIRECTORY</span><span class="op">:</span> </span><span class="r"><span class="annotate short">243 ↛ 236</span><span class="annotate long">line 243 didn't jump to line 236, because the condition on line 243 was never false</span></span></p> - <p class="run"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="nam">directories</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">tar_member</span><span class="op">.</span><span class="nam">member_path</span><span class="op">.</span><span class="nam">rstrip</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="key">return</span> <span class="nam">contents</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="key">def</span> <span class="nam">from_dict</span><span class="op">(</span><span class="nam">cls</span><span class="op">,</span> <span class="nam">d</span><span class="op">:</span> <span class="nam">Any</span><span class="op">)</span> <span class="op">-></span> <span class="str">"TarMember"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="nam">member_path</span> <span class="op">=</span> <span class="nam">d</span><span class="op">[</span><span class="str">"member_path"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="nam">raw_mode</span> <span class="op">=</span> <span class="nam">d</span><span class="op">[</span><span class="str">"mode"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">raw_mode</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"0o"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">251 ↛ 252</span><span class="annotate long">line 251 didn't jump to line 252, because the condition on line 251 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">f"Bad mode for {member_path}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="nam">is_virtual_entry</span> <span class="op">=</span> <span class="nam">d</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"is_virtual_entry"</span><span class="op">)</span> <span class="key">or</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="nam">path_type</span> <span class="op">=</span> <span class="nam">KEY2PATH_TYPE</span><span class="op">[</span><span class="nam">d</span><span class="op">[</span><span class="str">"path_type"</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="nam">fs_path</span> <span class="op">=</span> <span class="nam">d</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"fs_path"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="nam">mode</span> <span class="op">=</span> <span class="nam">int</span><span class="op">(</span><span class="nam">raw_mode</span><span class="op">[</span><span class="num">2</span><span class="op">:</span><span class="op">]</span><span class="op">,</span> <span class="num">8</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_virtual_entry</span><span class="op">:</span> </span><span class="r"><span class="annotate short">257 ↛ 268</span><span class="annotate long">line 257 didn't jump to line 268, because the condition on line 257 was never false</span></span></p> - <p class="par run show_par"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">path_type</span><span class="op">.</span><span class="nam">can_be_virtual</span><span class="op">:</span> </span><span class="r"><span class="annotate short">258 ↛ 259</span><span class="annotate long">line 258 didn't jump to line 259, because the condition on line 258 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="str">f"Bad file type or is_virtual_entry for {d['member_path']}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="str">" The file type cannot be virtual"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="key">if</span> <span class="nam">fs_path</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">263 ↛ 264</span><span class="annotate long">line 263 didn't jump to line 264, because the condition on line 263 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="str">f'Invalid declaration for "{member_path}".'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="str">" The path is listed as a virtual entry but has a file system path"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="key">elif</span> <span class="nam">fs_path</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="str">f'Invalid declaration for "{member_path}".'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="str">" The path is neither a virtual path nor does it have a file system path!"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="key">if</span> <span class="nam">path_type</span> <span class="op">==</span> <span class="nam">PathType</span><span class="op">.</span><span class="nam">DIRECTORY</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">member_path</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">273 ↛ 274</span><span class="annotate long">line 273 didn't jump to line 274, because the condition on line 273 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="str">f'Invalid declaration for "{member_path}".'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="str">" The path is listed as a directory but does not end with a slash"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="nam">link_target</span> <span class="op">=</span> <span class="nam">d</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"link_target"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="key">if</span> <span class="nam">path_type</span> <span class="op">==</span> <span class="nam">PathType</span><span class="op">.</span><span class="nam">SYMLINK</span><span class="op">:</span> </span><span class="r"><span class="annotate short">280 ↛ 281</span><span class="annotate long">line 280 didn't jump to line 281, because the condition on line 280 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="key">if</span> <span class="nam">mode</span> <span class="op">!=</span> <span class="num">0o777</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="str">f'Invalid declaration for "{member_path}".'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="str">f" Symlinks must have mode 0o0777, got {oct(mode)[2:]}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">link_target</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="str">f'Invalid declaration for "{member_path}".'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="str">" Symlinks must have a link_target"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="key">elif</span> <span class="nam">link_target</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">link_target</span> <span class="op">!=</span> <span class="str">""</span><span class="op">:</span> </span><span class="r"><span class="annotate short">291 ↛ 293</span><span class="annotate long">line 291 didn't jump to line 293, because the condition on line 291 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> <span class="com"># TODO: Eventually hardlinks should have them too. But that is a problem for a future programmer</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> <span class="str">f'Invalid declaration for "{member_path}".'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="str">" Only symlinks can have a link_target"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="nam">link_target</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="nam">may_steal_fs_path</span> <span class="op">=</span> <span class="nam">d</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"may_steal_fs_path"</span><span class="op">)</span> <span class="key">or</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="key">if</span> <span class="nam">may_steal_fs_path</span><span class="op">:</span> </span><span class="r"><span class="annotate short">301 ↛ 302</span><span class="annotate long">line 301 didn't jump to line 302, because the condition on line 301 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="key">assert</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="str">"debputy/scratch-dir/"</span> <span class="key">in</span> <span class="nam">fs_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> <span class="str">f"{fs_path} should not have been stealable"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="key">return</span> <span class="nam">cls</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> <span class="nam">member_path</span><span class="op">=</span><span class="nam">member_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="nam">path_type</span><span class="op">=</span><span class="nam">path_type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="nam">fs_path</span><span class="op">=</span><span class="nam">fs_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="nam">mode</span><span class="op">=</span><span class="nam">mode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="nam">owner</span><span class="op">=</span><span class="nam">d</span><span class="op">[</span><span class="str">"owner"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="nam">uid</span><span class="op">=</span><span class="nam">d</span><span class="op">[</span><span class="str">"uid"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="nam">group</span><span class="op">=</span><span class="nam">d</span><span class="op">[</span><span class="str">"group"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="nam">gid</span><span class="op">=</span><span class="nam">d</span><span class="op">[</span><span class="str">"gid"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="nam">mtime</span><span class="op">=</span><span class="nam">float</span><span class="op">(</span><span class="nam">d</span><span class="op">[</span><span class="str">"mtime"</span><span class="op">]</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="nam">link_target</span><span class="op">=</span><span class="nam">link_target</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="nam">is_virtual_entry</span><span class="op">=</span><span class="nam">is_virtual_entry</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="nam">may_steal_fs_path</span><span class="op">=</span><span class="nam">may_steal_fs_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"><span class="key">def</span> <span class="nam">output_intermediate_manifest</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="nam">manifest_output_file</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> <span class="nam">members</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">TarMember</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> <span class="key">with</span> <span class="nam">open</span><span class="op">(</span><span class="nam">manifest_output_file</span><span class="op">,</span> <span class="str">"w"</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> <span class="nam">output_intermediate_manifest_to_fd</span><span class="op">(</span><span class="nam">fd</span><span class="op">,</span> <span class="nam">members</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"><span class="key">def</span> <span class="nam">output_intermediate_manifest_to_fd</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> <span class="nam">fd</span><span class="op">:</span> <span class="nam">IO</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">members</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">TarMember</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> <span class="nam">serial_format</span> <span class="op">=</span> <span class="op">[</span><span class="nam">m</span><span class="op">.</span><span class="nam">to_manifest</span><span class="op">(</span><span class="op">)</span> <span class="key">for</span> <span class="nam">m</span> <span class="key">in</span> <span class="nam">members</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> <span class="nam">json</span><span class="op">.</span><span class="nam">dump</span><span class="op">(</span><span class="nam">serial_format</span><span class="op">,</span> <span class="nam">fd</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_installations_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_interpreter_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_267b6307937f1878_interpreter_py.html b/coverage-report/d_267b6307937f1878_interpreter_py.html deleted file mode 100644 index b851c18..0000000 --- a/coverage-report/d_267b6307937f1878_interpreter_py.html +++ /dev/null @@ -1,319 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/interpreter.py: 96%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/interpreter.py</b>: - <span class="pc_cov">96%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">82 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">80<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">2<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">6<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">3<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_intermediate_manifest_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_7764373ba25ba45b___init___py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">dataclasses</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">re</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">import</span> <span class="nam">shutil</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Optional</span><span class="op">,</span> <span class="nam">IO</span><span class="op">,</span> <span class="nam">TYPE_CHECKING</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">if</span> <span class="nam">TYPE_CHECKING</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="nam">VirtualPath</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"><span class="nam">_SHEBANG_RE</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="str">rb"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="str"> ^[#][!]\s*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"><span class="str"> (/\S+/([a-zA-Z][^/\s]*))</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"><span class="str">"""</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">re</span><span class="op">.</span><span class="nam">VERBOSE</span> <span class="op">|</span> <span class="nam">re</span><span class="op">.</span><span class="nam">ASCII</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"><span class="nam">_WORD</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">rb"\s+(\S+)"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"><span class="nam">_STRIP_VERSION</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r"(-?\d+(?:[.]\d.+)?)$"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"><span class="nam">_KNOWN_INTERPRETERS</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">basename</span><span class="op">(</span><span class="nam">c</span><span class="op">)</span><span class="op">:</span> <span class="nam">c</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="key">for</span> <span class="nam">c</span> <span class="key">in</span> <span class="op">[</span><span class="str">"/bin/sh"</span><span class="op">,</span> <span class="str">"/bin/bash"</span><span class="op">,</span> <span class="str">"/bin/dash"</span><span class="op">,</span> <span class="str">"/usr/bin/perl"</span><span class="op">,</span> <span class="str">"/usr/bin/python"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"><span class="key">class</span> <span class="nam">Interpreter</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="key">def</span> <span class="nam">original_command</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="str">"""The original command (without arguments) from the #! line</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"><span class="str"> This returns the command as it was written (without flags/arguments) in the file.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"><span class="str"> Note as a special-case, if the original command is `env` then the first argument is included</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"><span class="str"> as well, because it is assumed to be the real command.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="str"> >>> # Note: Normally, you would use `VirtualPath.interpreter()` instead for extracting the interpreter</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"><span class="str"> >>> python3 = extract_shebang_interpreter(b"#! /usr/bin/python3 -b")</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"><span class="str"> >>> python3.original_command</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"><span class="str"> '/usr/bin/python3'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"><span class="str"> >>> env_sh = extract_shebang_interpreter(b"#! /usr/bin/env sh")</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"><span class="str"> >>> env_sh.original_command</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"><span class="str"> '/usr/bin/env sh'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"><span class="str"> :return: The original command in the #!-line</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="key">def</span> <span class="nam">command_full_basename</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="str">"""The full basename of the command (with version)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"><span class="str"> Note that for #!-lines that uses `env`, this will return the argument for `env` rather than</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"><span class="str"> `env`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"><span class="str"> >>> # Note: Normally, you would use `VirtualPath.interpreter()` instead for extracting the interpreter</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"><span class="str"> >>> python3 = extract_shebang_interpreter(b"#! /usr/bin/python3 -b")</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"><span class="str"> >>> python3.command_full_basename</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"><span class="str"> 'python3'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"><span class="str"> >>> env_sh = extract_shebang_interpreter(b"#! /usr/bin/env sh")</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"><span class="str"> >>> env_sh.command_full_basename</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"><span class="str"> 'sh'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"><span class="str"> :return: The full basename of the command.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="key">def</span> <span class="nam">command_stem</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="str">"""The basename of the command **without** version</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"><span class="str"> Note that for #!-lines that uses `env`, this will return the argument for `env` rather than</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"><span class="str"> `env`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"><span class="str"> >>> # Note: Normally, you would use `VirtualPath.interpreter()` instead for extracting the interpreter</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"><span class="str"> >>> python3 = extract_shebang_interpreter(b"#! /usr/bin/python3 -b")</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"><span class="str"> >>> python3.command_stem</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"><span class="str"> 'python'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"><span class="str"> >>> env_sh = extract_shebang_interpreter(b"#! /usr/bin/env sh")</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"><span class="str"> >>> env_sh.command_stem</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"><span class="str"> 'sh'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"><span class="str"> >>> python3 = extract_shebang_interpreter(b"#! /usr/bin/python3.12-dbg -b")</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"><span class="str"> >>> python3.command_stem</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"><span class="str"> 'python'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"><span class="str"> :return: The basename of the command **without** version.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="key">def</span> <span class="nam">interpreter_version</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="str">"""The version part of the basename</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"><span class="str"> Note that for #!-lines that uses `env`, this will return the argument for `env` rather than</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"><span class="str"> `env`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"><span class="str"> >>> # Note: Normally, you would use `VirtualPath.interpreter()` instead for extracting the interpreter</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"><span class="str"> >>> python3 = extract_shebang_interpreter(b"#! /usr/bin/python3 -b")</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"><span class="str"> >>> python3.interpreter_version</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"><span class="str"> '3'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"><span class="str"> >>> env_sh = extract_shebang_interpreter(b"#! /usr/bin/env sh")</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"><span class="str"> >>> env_sh.interpreter_version</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"><span class="str"> ''</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"><span class="str"> >>> python3 = extract_shebang_interpreter(b"#! /usr/bin/python3.12-dbg -b")</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"><span class="str"> >>> python3.interpreter_version</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"><span class="str"> '3.12-dbg'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"><span class="str"> :return: The version part of the command or the empty string if the command is versionless.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="key">def</span> <span class="nam">fixup_needed</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="str">"""Whether the interpreter uses a non-canonical location</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"><span class="str"> >>> # Note: Normally, you would use `VirtualPath.interpreter()` instead for extracting the interpreter</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"><span class="str"> >>> python3 = extract_shebang_interpreter(b"#! /usr/bin/python3 -b")</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"><span class="str"> >>> python3.fixup_needed</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"><span class="str"> False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"><span class="str"> >>> env_sh = extract_shebang_interpreter(b"#! /usr/bin/env sh")</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"><span class="str"> >>> env_sh.fixup_needed</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"><span class="str"> True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"><span class="str"> >>> ub_sh = extract_shebang_interpreter(b"#! /usr/bin/sh")</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"><span class="str"> >>> ub_sh.fixup_needed</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"><span class="str"> True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"><span class="str"> >>> sh = extract_shebang_interpreter(b"#! /bin/sh")</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"><span class="str"> >>> sh.fixup_needed</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"><span class="str"> False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"><span class="str"> :return: True if this interpreter is uses a non-canonical version.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"><span class="key">class</span> <span class="nam">DetectedInterpreter</span><span class="op">(</span><span class="nam">Interpreter</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="nam">original_command</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="nam">command_full_basename</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="nam">command_stem</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="nam">interpreter_version</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="nam">correct_command</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="nam">corrected_shebang_line</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="key">def</span> <span class="nam">fixup_needed</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">corrected_shebang_line</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="key">def</span> <span class="nam">replace_shebang_line</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">path</span><span class="op">:</span> <span class="str">"VirtualPath"</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="nam">new_shebang_line</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">corrected_shebang_line</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="key">assert</span> <span class="nam">new_shebang_line</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"#!"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">new_shebang_line</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">151 ↛ 153</span><span class="annotate long">line 151 didn't jump to line 153, because the condition on line 151 was never false</span></span></p> - <p class="run"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="nam">new_shebang_line</span> <span class="op">+=</span> <span class="str">"\n"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="nam">parent_dir</span> <span class="op">=</span> <span class="nam">path</span><span class="op">.</span><span class="nam">parent_dir</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="key">assert</span> <span class="nam">parent_dir</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="key">with</span> <span class="nam">path</span><span class="op">.</span><span class="nam">open</span><span class="op">(</span><span class="nam">byte_io</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> <span class="key">as</span> <span class="nam">rfd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="nam">original_first_line</span> <span class="op">=</span> <span class="nam">rfd</span><span class="op">.</span><span class="nam">readline</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">original_first_line</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">b"#!"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">157 ↛ 158</span><span class="annotate long">line 157 didn't jump to line 158, because the condition on line 157 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="str">f'The provided path "{path.path}" does not start with a shebang line!?'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="nam">mtime</span> <span class="op">=</span> <span class="nam">path</span><span class="op">.</span><span class="nam">mtime</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="key">with</span> <span class="nam">path</span><span class="op">.</span><span class="nam">replace_fs_path_content</span><span class="op">(</span><span class="op">)</span> <span class="key">as</span> <span class="nam">new_fs_path</span><span class="op">,</span> <span class="nam">open</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="nam">new_fs_path</span><span class="op">,</span> <span class="str">"wb"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="op">)</span> <span class="key">as</span> <span class="nam">wfd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="nam">wfd</span><span class="op">.</span><span class="nam">write</span><span class="op">(</span><span class="nam">new_shebang_line</span><span class="op">.</span><span class="nam">encode</span><span class="op">(</span><span class="str">"utf-8"</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="nam">shutil</span><span class="op">.</span><span class="nam">copyfileobj</span><span class="op">(</span><span class="nam">rfd</span><span class="op">,</span> <span class="nam">wfd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="com"># Ensure the mtime is not updated (we do not count interpreter correction as a "change")</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="nam">path</span><span class="op">.</span><span class="nam">mtime</span> <span class="op">=</span> <span class="nam">mtime</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"><span class="key">def</span> <span class="nam">extract_shebang_interpreter_from_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="nam">fd</span><span class="op">:</span> <span class="nam">IO</span><span class="op">[</span><span class="nam">bytes</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">DetectedInterpreter</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="nam">first_line</span> <span class="op">=</span> <span class="nam">fd</span><span class="op">.</span><span class="nam">readline</span><span class="op">(</span><span class="num">4096</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="key">if</span> <span class="str">b"\n"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">first_line</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="com"># If there is no newline, then it is probably not a shebang line</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="key">return</span> <span class="nam">extract_shebang_interpreter</span><span class="op">(</span><span class="nam">first_line</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"><span class="key">def</span> <span class="nam">extract_shebang_interpreter</span><span class="op">(</span><span class="nam">first_line</span><span class="op">:</span> <span class="nam">bytes</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">DetectedInterpreter</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="nam">_SHEBANG_RE</span><span class="op">.</span><span class="nam">search</span><span class="op">(</span><span class="nam">first_line</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">m</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="nam">raw_command</span> <span class="op">=</span> <span class="nam">m</span><span class="op">.</span><span class="nam">group</span><span class="op">(</span><span class="num">1</span><span class="op">)</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">decode</span><span class="op">(</span><span class="str">"utf-8"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="nam">command_full_basename</span> <span class="op">=</span> <span class="nam">m</span><span class="op">.</span><span class="nam">group</span><span class="op">(</span><span class="num">2</span><span class="op">)</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">decode</span><span class="op">(</span><span class="str">"utf-8"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="nam">endpos</span> <span class="op">=</span> <span class="nam">m</span><span class="op">.</span><span class="nam">end</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="key">if</span> <span class="nam">command_full_basename</span> <span class="op">==</span> <span class="str">"env"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="nam">wm</span> <span class="op">=</span> <span class="nam">_WORD</span><span class="op">.</span><span class="nam">search</span><span class="op">(</span><span class="nam">first_line</span><span class="op">,</span> <span class="nam">pos</span><span class="op">=</span><span class="nam">m</span><span class="op">.</span><span class="nam">end</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="key">if</span> <span class="nam">wm</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">190 ↛ 194</span><span class="annotate long">line 190 didn't jump to line 194, because the condition on line 190 was never false</span></span></p> - <p class="run"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="nam">command_full_basename</span> <span class="op">=</span> <span class="nam">wm</span><span class="op">.</span><span class="nam">group</span><span class="op">(</span><span class="num">1</span><span class="op">)</span><span class="op">.</span><span class="nam">decode</span><span class="op">(</span><span class="str">"utf-8"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="nam">raw_command</span> <span class="op">+=</span> <span class="str">" "</span> <span class="op">+</span> <span class="nam">command_full_basename</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="nam">endpos</span> <span class="op">=</span> <span class="nam">wm</span><span class="op">.</span><span class="nam">end</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="nam">command_stem</span> <span class="op">=</span> <span class="nam">command_full_basename</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="nam">vm</span> <span class="op">=</span> <span class="nam">_STRIP_VERSION</span><span class="op">.</span><span class="nam">search</span><span class="op">(</span><span class="nam">command_full_basename</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="key">if</span> <span class="nam">vm</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="nam">version</span> <span class="op">=</span> <span class="nam">vm</span><span class="op">.</span><span class="nam">group</span><span class="op">(</span><span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="nam">command_stem</span> <span class="op">=</span> <span class="nam">command_full_basename</span><span class="op">[</span><span class="op">:</span> <span class="op">-</span><span class="nam">len</span><span class="op">(</span><span class="nam">version</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="nam">version</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="nam">correct_command</span> <span class="op">=</span> <span class="nam">_KNOWN_INTERPRETERS</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">command_stem</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="key">if</span> <span class="nam">correct_command</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">version</span> <span class="op">!=</span> <span class="str">""</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="nam">correct_command</span> <span class="op">+=</span> <span class="nam">version</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="key">if</span> <span class="nam">correct_command</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">correct_command</span> <span class="op">!=</span> <span class="nam">raw_command</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="nam">trailing</span> <span class="op">=</span> <span class="nam">first_line</span><span class="op">[</span><span class="nam">endpos</span> <span class="op">+</span> <span class="num">1</span> <span class="op">:</span><span class="op">]</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">decode</span><span class="op">(</span><span class="str">"utf-8"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="nam">corrected_shebang_line</span> <span class="op">=</span> <span class="str">"#! "</span> <span class="op">+</span> <span class="nam">correct_command</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="key">if</span> <span class="nam">trailing</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="nam">corrected_shebang_line</span> <span class="op">+=</span> <span class="str">" "</span> <span class="op">+</span> <span class="nam">trailing</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="nam">corrected_shebang_line</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="key">return</span> <span class="nam">DetectedInterpreter</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="nam">raw_command</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="nam">command_full_basename</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="nam">command_stem</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="nam">version</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="nam">correct_command</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="nam">corrected_shebang_line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_intermediate_manifest_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_7764373ba25ba45b___init___py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_267b6307937f1878_maintscript_snippet_py.html b/coverage-report/d_267b6307937f1878_maintscript_snippet_py.html deleted file mode 100644 index 1bdbaed..0000000 --- a/coverage-report/d_267b6307937f1878_maintscript_snippet_py.html +++ /dev/null @@ -1,283 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/maintscript_snippet.py: 63%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/maintscript_snippet.py</b>: - <span class="pc_cov">63%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">87 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">59<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">28<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">6<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_e9c451f4ae334f76_types_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_manifest_conditions_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">dataclasses</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Sequence</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">,</span> <span class="nam">List</span><span class="op">,</span> <span class="nam">Literal</span><span class="op">,</span> <span class="nam">Iterable</span><span class="op">,</span> <span class="nam">Dict</span><span class="op">,</span> <span class="nam">Self</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">base_types</span> <span class="key">import</span> <span class="nam">DebputyDispatchableType</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">AttributePath</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="nam">STD_CONTROL_SCRIPTS</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="str">"preinst"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="str">"prerm"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="str">"postinst"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="str">"postrm"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"><span class="nam">UDEB_CONTROL_SCRIPTS</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="str">"postinst"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="str">"menutest"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="str">"isinstallable"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"><span class="nam">ALL_CONTROL_SCRIPTS</span> <span class="op">=</span> <span class="nam">STD_CONTROL_SCRIPTS</span> <span class="op">|</span> <span class="nam">UDEB_CONTROL_SCRIPTS</span> <span class="op">|</span> <span class="op">{</span><span class="str">"config"</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"><span class="key">class</span> <span class="nam">MaintscriptSnippet</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="nam">snippet</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="nam">snippet_order</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Literal</span><span class="op">[</span><span class="str">"service"</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="key">def</span> <span class="nam">script_content</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="nam">lines</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="str">f"# Snippet source: {self.definition_source}\n"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">snippet</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">snippet</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">36 ↛ 37</span><span class="annotate long">line 36 didn't jump to line 37, because the condition on line 36 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="nam">lines</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="key">return</span> <span class="str">""</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">lines</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"><span class="key">class</span> <span class="nam">MaintscriptSnippetContainer</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_generic_snippets</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">MaintscriptSnippet</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_snippets_by_order</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">Literal</span><span class="op">[</span><span class="str">"service"</span><span class="op">]</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">MaintscriptSnippet</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="key">def</span> <span class="nam">copy</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="str">"MaintscriptSnippetContainer"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="nam">instance</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">__class__</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="nam">instance</span><span class="op">.</span><span class="nam">_generic_snippets</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_generic_snippets</span><span class="op">.</span><span class="nam">copy</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="nam">instance</span><span class="op">.</span><span class="nam">_snippets_by_order</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_snippets_by_order</span><span class="op">.</span><span class="nam">copy</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="key">return</span> <span class="nam">instance</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="key">def</span> <span class="nam">append</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">maintscript_snippet</span><span class="op">:</span> <span class="nam">MaintscriptSnippet</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="key">if</span> <span class="nam">maintscript_snippet</span><span class="op">.</span><span class="nam">snippet_order</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">53 ↛ 56</span><span class="annotate long">line 53 didn't jump to line 56, because the condition on line 53 was never false</span></span></p> - <p class="run"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_generic_snippets</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">maintscript_snippet</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="key">if</span> <span class="nam">maintscript_snippet</span><span class="op">.</span><span class="nam">snippet_order</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_snippets_by_order</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_snippets_by_order</span><span class="op">[</span><span class="nam">maintscript_snippet</span><span class="op">.</span><span class="nam">snippet_order</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_snippets_by_order</span><span class="op">[</span><span class="nam">maintscript_snippet</span><span class="op">.</span><span class="nam">snippet_order</span><span class="op">]</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="nam">maintscript_snippet</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="key">def</span> <span class="nam">has_content</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">snippet_order</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Literal</span><span class="op">[</span><span class="str">"service"</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="key">if</span> <span class="nam">snippet_order</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="key">return</span> <span class="nam">bool</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_generic_snippets</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="key">if</span> <span class="nam">snippet_order</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_snippets_by_order</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="key">return</span> <span class="nam">bool</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_snippets_by_order</span><span class="op">[</span><span class="nam">snippet_order</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="key">def</span> <span class="nam">all_snippets</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">MaintscriptSnippet</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_generic_snippets</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="key">for</span> <span class="nam">snippets</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_snippets_by_order</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">snippets</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="key">def</span> <span class="nam">generate_snippet</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="nam">tool_with_version</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="nam">snippet_order</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Literal</span><span class="op">[</span><span class="str">"service"</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="nam">reverse</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="nam">inner_content</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="key">if</span> <span class="nam">snippet_order</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">81 ↛ 86</span><span class="annotate long">line 81 didn't jump to line 86, because the condition on line 81 was never false</span></span></p> - <p class="run"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="nam">snippets</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="nam">reversed</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_generic_snippets</span><span class="op">)</span> <span class="key">if</span> <span class="nam">reverse</span> <span class="key">else</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_generic_snippets</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="nam">inner_content</span> <span class="op">=</span> <span class="str">""</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">s</span><span class="op">.</span><span class="nam">script_content</span><span class="op">(</span><span class="op">)</span> <span class="key">for</span> <span class="nam">s</span> <span class="key">in</span> <span class="nam">snippets</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="key">elif</span> <span class="nam">snippet_order</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_snippets_by_order</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="nam">snippets</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_snippets_by_order</span><span class="op">[</span><span class="nam">snippet_order</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="key">if</span> <span class="nam">reverse</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="nam">snippets</span> <span class="op">=</span> <span class="nam">reversed</span><span class="op">(</span><span class="nam">snippets</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="nam">inner_content</span> <span class="op">=</span> <span class="str">""</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">s</span><span class="op">.</span><span class="nam">script_content</span><span class="op">(</span><span class="op">)</span> <span class="key">for</span> <span class="nam">s</span> <span class="key">in</span> <span class="nam">snippets</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">inner_content</span><span class="op">:</span> </span><span class="r"><span class="annotate short">92 ↛ 93</span><span class="annotate long">line 92 didn't jump to line 93, because the condition on line 92 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="key">if</span> <span class="nam">tool_with_version</span><span class="op">:</span> </span><span class="r"><span class="annotate short">95 ↛ 96</span><span class="annotate long">line 95 didn't jump to line 96, because the condition on line 95 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="key">return</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="str">f"# Automatically added by {tool_with_version}\n"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="op">+</span> <span class="nam">inner_content</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="op">+</span> <span class="str">"# End automatically added section"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="key">return</span> <span class="nam">inner_content</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"><span class="key">class</span> <span class="nam">DpkgMaintscriptHelperCommand</span><span class="op">(</span><span class="nam">DebputyDispatchableType</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"cmdline"</span><span class="op">,</span> <span class="str">"definition_source"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">cmdline</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">cmdline</span> <span class="op">=</span> <span class="nam">cmdline</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">definition_source</span> <span class="op">=</span> <span class="nam">definition_source</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="key">def</span> <span class="nam">_finish_cmd</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="nam">cmdline</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="nam">prior_version</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="nam">owning_package</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Self</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="key">if</span> <span class="nam">prior_version</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="nam">cmdline</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">prior_version</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="key">if</span> <span class="nam">owning_package</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="key">if</span> <span class="nam">prior_version</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">122 ↛ 124</span><span class="annotate long">line 122 didn't jump to line 124, because the condition on line 122 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="com"># Empty is allowed according to `man dpkg-maintscript-helper`</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="nam">cmdline</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">""</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="nam">cmdline</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">owning_package</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="key">return</span> <span class="nam">cls</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="nam">tuple</span><span class="op">(</span><span class="nam">cmdline</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="key">def</span> <span class="nam">rm_conffile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="nam">conffile</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="nam">prior_version</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="nam">owning_package</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Self</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="nam">cmdline</span> <span class="op">=</span> <span class="op">[</span><span class="str">"rm_conffile"</span><span class="op">,</span> <span class="nam">conffile</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="key">return</span> <span class="nam">cls</span><span class="op">.</span><span class="nam">_finish_cmd</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> <span class="nam">cmdline</span><span class="op">,</span> <span class="nam">prior_version</span><span class="op">,</span> <span class="nam">owning_package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="key">def</span> <span class="nam">mv_conffile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="nam">old_conffile</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="nam">new_confile</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="nam">prior_version</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="nam">owning_package</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Self</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="nam">cmdline</span> <span class="op">=</span> <span class="op">[</span><span class="str">"mv_conffile"</span><span class="op">,</span> <span class="nam">old_conffile</span><span class="op">,</span> <span class="nam">new_confile</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="key">return</span> <span class="nam">cls</span><span class="op">.</span><span class="nam">_finish_cmd</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> <span class="nam">cmdline</span><span class="op">,</span> <span class="nam">prior_version</span><span class="op">,</span> <span class="nam">owning_package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="key">def</span> <span class="nam">symlink_to_dir</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="nam">pathname</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="nam">old_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="nam">prior_version</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="nam">owning_package</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Self</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="nam">cmdline</span> <span class="op">=</span> <span class="op">[</span><span class="str">"symlink_to_dir"</span><span class="op">,</span> <span class="nam">pathname</span><span class="op">,</span> <span class="nam">old_target</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="key">return</span> <span class="nam">cls</span><span class="op">.</span><span class="nam">_finish_cmd</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> <span class="nam">cmdline</span><span class="op">,</span> <span class="nam">prior_version</span><span class="op">,</span> <span class="nam">owning_package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="key">def</span> <span class="nam">dir_to_symlink</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="nam">pathname</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="nam">new_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="nam">prior_version</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="nam">owning_package</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Self</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="nam">cmdline</span> <span class="op">=</span> <span class="op">[</span><span class="str">"dir_to_symlink"</span><span class="op">,</span> <span class="nam">pathname</span><span class="op">,</span> <span class="nam">new_target</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="key">return</span> <span class="nam">cls</span><span class="op">.</span><span class="nam">_finish_cmd</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> <span class="nam">cmdline</span><span class="op">,</span> <span class="nam">prior_version</span><span class="op">,</span> <span class="nam">owning_package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_e9c451f4ae334f76_types_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_manifest_conditions_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_267b6307937f1878_manifest_conditions_py.html b/coverage-report/d_267b6307937f1878_manifest_conditions_py.html deleted file mode 100644 index f548dd4..0000000 --- a/coverage-report/d_267b6307937f1878_manifest_conditions_py.html +++ /dev/null @@ -1,338 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/manifest_conditions.py: 65%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/manifest_conditions.py</b>: - <span class="pc_cov">65%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">134 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">91<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">43<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">2<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">3<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_maintscript_snippet_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_4f754ff76d8638bb___init___py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">dataclasses</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">from</span> <span class="nam">enum</span> <span class="key">import</span> <span class="nam">Enum</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">List</span><span class="op">,</span> <span class="nam">Callable</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">,</span> <span class="nam">Sequence</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">from</span> <span class="nam">debian</span><span class="op">.</span><span class="nam">debian_support</span> <span class="key">import</span> <span class="nam">DpkgArchTable</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">_deb_options_profiles</span> <span class="key">import</span> <span class="nam">DebBuildOptionsAndProfiles</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">architecture_support</span> <span class="key">import</span> <span class="nam">DpkgArchitectureBuildProcessValuesTable</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">base_types</span> <span class="key">import</span> <span class="nam">DebputyDispatchableType</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">packages</span> <span class="key">import</span> <span class="nam">BinaryPackage</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">substitution</span> <span class="key">import</span> <span class="nam">Substitution</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">active_profiles_match</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"><span class="key">class</span> <span class="nam">ConditionContext</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">build_env</span><span class="op">:</span> <span class="nam">DebBuildOptionsAndProfiles</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">substitution</span><span class="op">:</span> <span class="nam">Substitution</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">dpkg_architecture_variables</span><span class="op">:</span> <span class="nam">DpkgArchitectureBuildProcessValuesTable</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">dpkg_arch_query_table</span><span class="op">:</span> <span class="nam">DpkgArchTable</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"><span class="key">class</span> <span class="nam">ManifestCondition</span><span class="op">(</span><span class="nam">DebputyDispatchableType</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="key">def</span> <span class="nam">describe</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="key">def</span> <span class="nam">negated</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="str">"ManifestCondition"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="key">return</span> <span class="nam">NegatedManifestCondition</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="key">def</span> <span class="nam">evaluate</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">context</span><span class="op">:</span> <span class="nam">ConditionContext</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="key">def</span> <span class="nam">_manifest_group</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">match_type</span><span class="op">:</span> <span class="str">"_ConditionGroupMatchType"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="nam">conditions</span><span class="op">:</span> <span class="str">"Sequence[ManifestCondition]"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"ManifestCondition"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">condition</span> <span class="op">=</span> <span class="nam">conditions</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"><span class="annotate short">43 ↛ 47</span><span class="annotate long">line 43 didn't jump to line 47</span></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">condition</span><span class="op">,</span> <span class="nam">ManifestConditionGroup</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="key">and</span> <span class="nam">condition</span><span class="op">.</span><span class="nam">match_type</span> <span class="op">==</span> <span class="nam">match_type</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="key">return</span> <span class="nam">condition</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">conditions</span><span class="op">[</span><span class="num">1</span><span class="op">:</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="key">return</span> <span class="nam">ManifestConditionGroup</span><span class="op">(</span><span class="nam">match_type</span><span class="op">,</span> <span class="nam">conditions</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="key">def</span> <span class="nam">any_of</span><span class="op">(</span><span class="nam">cls</span><span class="op">,</span> <span class="nam">conditions</span><span class="op">:</span> <span class="str">"Sequence[ManifestCondition]"</span><span class="op">)</span> <span class="op">-></span> <span class="str">"ManifestCondition"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="key">return</span> <span class="nam">cls</span><span class="op">.</span><span class="nam">_manifest_group</span><span class="op">(</span><span class="nam">_ConditionGroupMatchType</span><span class="op">.</span><span class="nam">ANY_OF</span><span class="op">,</span> <span class="nam">conditions</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="key">def</span> <span class="nam">all_of</span><span class="op">(</span><span class="nam">cls</span><span class="op">,</span> <span class="nam">conditions</span><span class="op">:</span> <span class="str">"Sequence[ManifestCondition]"</span><span class="op">)</span> <span class="op">-></span> <span class="str">"ManifestCondition"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="key">return</span> <span class="nam">cls</span><span class="op">.</span><span class="nam">_manifest_group</span><span class="op">(</span><span class="nam">_ConditionGroupMatchType</span><span class="op">.</span><span class="nam">ALL_OF</span><span class="op">,</span> <span class="nam">conditions</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_cross_building</span><span class="op">(</span><span class="nam">cls</span><span class="op">)</span> <span class="op">-></span> <span class="str">"ManifestCondition"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="key">return</span> <span class="nam">_IS_CROSS_BUILDING</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="key">def</span> <span class="nam">can_execute_compiled_binaries</span><span class="op">(</span><span class="nam">cls</span><span class="op">)</span> <span class="op">-></span> <span class="str">"ManifestCondition"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="key">return</span> <span class="nam">_CAN_EXECUTE_COMPILED_BINARIES</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="key">def</span> <span class="nam">run_build_time_tests</span><span class="op">(</span><span class="nam">cls</span><span class="op">)</span> <span class="op">-></span> <span class="str">"ManifestCondition"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="key">return</span> <span class="nam">_RUN_BUILD_TIME_TESTS</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"><span class="key">class</span> <span class="nam">NegatedManifestCondition</span><span class="op">(</span><span class="nam">ManifestCondition</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"_condition"</span><span class="op">,</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">condition</span><span class="op">:</span> <span class="nam">ManifestCondition</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_condition</span> <span class="op">=</span> <span class="nam">condition</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="key">def</span> <span class="nam">negated</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="str">"ManifestCondition"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_condition</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="key">def</span> <span class="nam">describe</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="key">return</span> <span class="str">f"not ({self._condition.describe()})"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="key">def</span> <span class="nam">evaluate</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">context</span><span class="op">:</span> <span class="nam">ConditionContext</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="key">return</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_condition</span><span class="op">.</span><span class="nam">evaluate</span><span class="op">(</span><span class="nam">context</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"><span class="key">class</span> <span class="nam">_ConditionGroupMatchType</span><span class="op">(</span><span class="nam">Enum</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="nam">ANY_OF</span> <span class="op">=</span> <span class="op">(</span><span class="nam">any</span><span class="op">,</span> <span class="str">"At least one of: [{conditions}]"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="nam">ALL_OF</span> <span class="op">=</span> <span class="op">(</span><span class="nam">all</span><span class="op">,</span> <span class="str">"All of: [{conditions}]"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="key">def</span> <span class="nam">describe</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">conditions</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">ManifestCondition</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">value</span><span class="op">[</span><span class="num">1</span><span class="op">]</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="nam">conditions</span><span class="op">=</span><span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">x</span><span class="op">.</span><span class="nam">describe</span><span class="op">(</span><span class="op">)</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">conditions</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="key">def</span> <span class="nam">evaluate</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> <span class="nam">conditions</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">ManifestCondition</span><span class="op">]</span><span class="op">,</span> <span class="nam">context</span><span class="op">:</span> <span class="nam">ConditionContext</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">value</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">(</span><span class="nam">c</span><span class="op">.</span><span class="nam">evaluate</span><span class="op">(</span><span class="nam">context</span><span class="op">)</span> <span class="key">for</span> <span class="nam">c</span> <span class="key">in</span> <span class="nam">conditions</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"><span class="key">class</span> <span class="nam">ManifestConditionGroup</span><span class="op">(</span><span class="nam">ManifestCondition</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"match_type"</span><span class="op">,</span> <span class="str">"_conditions"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="nam">match_type</span><span class="op">:</span> <span class="nam">_ConditionGroupMatchType</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="nam">conditions</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">ManifestCondition</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">match_type</span> <span class="op">=</span> <span class="nam">match_type</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_conditions</span> <span class="op">=</span> <span class="nam">conditions</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="key">def</span> <span class="nam">describe</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">match_type</span><span class="op">.</span><span class="nam">describe</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_conditions</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="key">def</span> <span class="nam">evaluate</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">context</span><span class="op">:</span> <span class="nam">ConditionContext</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">match_type</span><span class="op">.</span><span class="nam">evaluate</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_conditions</span><span class="op">,</span> <span class="nam">context</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="key">def</span> <span class="nam">extend</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="nam">conditions</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">ManifestCondition</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"ManifestConditionGroup"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="nam">combined</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_conditions</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="nam">combined</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">conditions</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="key">return</span> <span class="nam">ManifestConditionGroup</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">match_type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="nam">combined</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"><span class="key">class</span> <span class="nam">ArchMatchManifestConditionBase</span><span class="op">(</span><span class="nam">ManifestCondition</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"_arch_spec"</span><span class="op">,</span> <span class="str">"_is_negated"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">arch_spec</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">is_negated</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_arch_spec</span> <span class="op">=</span> <span class="nam">arch_spec</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_is_negated</span> <span class="op">=</span> <span class="nam">is_negated</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="key">def</span> <span class="nam">negated</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="str">"ManifestCondition"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">__class__</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_arch_spec</span><span class="op">,</span> <span class="nam">is_negated</span><span class="op">=</span><span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_is_negated</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"><span class="key">class</span> <span class="nam">SourceContextArchMatchManifestCondition</span><span class="op">(</span><span class="nam">ArchMatchManifestConditionBase</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="key">def</span> <span class="nam">describe</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_is_negated</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="key">return</span> <span class="str">f'architecture (for source package) matches *none* of [{", ".join(self._arch_spec)}]'</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="key">return</span> <span class="str">f'architecture (for source package) matches any of [{", ".join(self._arch_spec)}]'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="key">def</span> <span class="nam">evaluate</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">context</span><span class="op">:</span> <span class="nam">ConditionContext</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="nam">arch</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">dpkg_architecture_variables</span><span class="op">.</span><span class="nam">current_host_arch</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="nam">match</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">dpkg_arch_query_table</span><span class="op">.</span><span class="nam">architecture_is_concerned</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="nam">arch</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_arch_spec</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="key">return</span> <span class="key">not</span> <span class="nam">match</span> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_is_negated</span> <span class="key">else</span> <span class="nam">match</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"><span class="key">class</span> <span class="nam">BinaryPackageContextArchMatchManifestCondition</span><span class="op">(</span><span class="nam">ArchMatchManifestConditionBase</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="key">def</span> <span class="nam">describe</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_is_negated</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="key">return</span> <span class="str">f'architecture (for binary package) matches *none* of [{", ".join(self._arch_spec)}]'</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="key">return</span> <span class="str">f'architecture (for binary package) matches any of [{", ".join(self._arch_spec)}]'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="key">def</span> <span class="nam">evaluate</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">context</span><span class="op">:</span> <span class="nam">ConditionContext</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="nam">binary_package</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">binary_package</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="key">if</span> <span class="nam">binary_package</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="key">raise</span> <span class="nam">RuntimeError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="str">"Condition only applies in the context of a BinaryPackage, but was evaluated"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="str">" without one"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="nam">arch</span> <span class="op">=</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">resolved_architecture</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="nam">match</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">dpkg_arch_query_table</span><span class="op">.</span><span class="nam">architecture_is_concerned</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="nam">arch</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_arch_spec</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="key">return</span> <span class="key">not</span> <span class="nam">match</span> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_is_negated</span> <span class="key">else</span> <span class="nam">match</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"><span class="key">class</span> <span class="nam">BuildProfileMatch</span><span class="op">(</span><span class="nam">ManifestCondition</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"_profile_spec"</span><span class="op">,</span> <span class="str">"_is_negated"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">profile_spec</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">is_negated</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_profile_spec</span> <span class="op">=</span> <span class="nam">profile_spec</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_is_negated</span> <span class="op">=</span> <span class="nam">is_negated</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="key">def</span> <span class="nam">negated</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="str">"ManifestCondition"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">__class__</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_profile_spec</span><span class="op">,</span> <span class="nam">is_negated</span><span class="op">=</span><span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_is_negated</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="key">def</span> <span class="nam">describe</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_is_negated</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="key">return</span> <span class="str">f"DEB_BUILD_PROFILES matches *none* of [{self._profile_spec}]"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="key">return</span> <span class="str">f"DEB_BUILD_PROFILES matches any of [{self._profile_spec}]"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="key">def</span> <span class="nam">evaluate</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">context</span><span class="op">:</span> <span class="nam">ConditionContext</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="nam">match</span> <span class="op">=</span> <span class="nam">active_profiles_match</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_profile_spec</span><span class="op">,</span> <span class="nam">context</span><span class="op">.</span><span class="nam">build_env</span><span class="op">.</span><span class="nam">deb_build_profiles</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="key">return</span> <span class="key">not</span> <span class="nam">match</span> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_is_negated</span> <span class="key">else</span> <span class="nam">match</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"><span class="key">class</span> <span class="nam">_SingletonCondition</span><span class="op">(</span><span class="nam">ManifestCondition</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="nam">description</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="nam">implementation</span><span class="op">:</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">ConditionContext</span><span class="op">]</span><span class="op">,</span> <span class="nam">bool</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="key">def</span> <span class="nam">describe</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">description</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="key">def</span> <span class="nam">evaluate</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">context</span><span class="op">:</span> <span class="nam">ConditionContext</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">implementation</span><span class="op">(</span><span class="nam">context</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"><span class="key">def</span> <span class="nam">_can_run_built_binaries</span><span class="op">(</span><span class="nam">context</span><span class="op">:</span> <span class="nam">ConditionContext</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">context</span><span class="op">.</span><span class="nam">dpkg_architecture_variables</span><span class="op">.</span><span class="nam">is_cross_compiling</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="com"># User / Builder asserted that we could even though we are cross-compiling, so we have to assume it is true</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="key">return</span> <span class="str">"crossbuildcanrunhostbinaries"</span> <span class="key">in</span> <span class="nam">context</span><span class="op">.</span><span class="nam">build_env</span><span class="op">.</span><span class="nam">deb_build_options</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"><span class="nam">_IS_CROSS_BUILDING</span> <span class="op">=</span> <span class="nam">_SingletonCondition</span><span class="op">(</span> </span><span class="r"><span class="annotate short">217 ↛ exit</span><span class="annotate long">line 217 didn't jump to the function exit</span></span></p> - <p class="pln"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="str">"Cross Compiling (i.e., DEB_HOST_GNU_TYPE != DEB_BUILD_GNU_TYPE)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="key">lambda</span> <span class="nam">c</span><span class="op">:</span> <span class="nam">c</span><span class="op">.</span><span class="nam">dpkg_architecture_variables</span><span class="op">.</span><span class="nam">is_cross_compiling</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"><span class="nam">_CAN_EXECUTE_COMPILED_BINARIES</span> <span class="op">=</span> <span class="nam">_SingletonCondition</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="str">"Can run built binaries (natively or via transparent emulation)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="nam">_can_run_built_binaries</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"><span class="nam">_RUN_BUILD_TIME_TESTS</span> <span class="op">=</span> <span class="nam">_SingletonCondition</span><span class="op">(</span> </span><span class="r"><span class="annotate short">227 ↛ exit</span><span class="annotate long">line 227 didn't jump to the function exit</span></span></p> - <p class="pln"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="str">"Run build time tests"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="key">lambda</span> <span class="nam">c</span><span class="op">:</span> <span class="str">"nocheck"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">c</span><span class="op">.</span><span class="nam">build_env</span><span class="op">.</span><span class="nam">deb_build_options</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"><span class="nam">_BUILD_DOCS_BDO</span> <span class="op">=</span> <span class="nam">_SingletonCondition</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="str">"Build docs (nodocs not in DEB_BUILD_OPTIONS)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="key">lambda</span> <span class="nam">c</span><span class="op">:</span> <span class="str">"nodocs"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">c</span><span class="op">.</span><span class="nam">build_env</span><span class="op">.</span><span class="nam">deb_build_options</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"><span class="key">del</span> <span class="nam">_SingletonCondition</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"><span class="key">del</span> <span class="nam">_can_run_built_binaries</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_maintscript_snippet_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_4f754ff76d8638bb___init___py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_267b6307937f1878_packager_provided_files_py.html b/coverage-report/d_267b6307937f1878_packager_provided_files_py.html deleted file mode 100644 index e481e46..0000000 --- a/coverage-report/d_267b6307937f1878_packager_provided_files_py.html +++ /dev/null @@ -1,422 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/packager_provided_files.py: 84%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/packager_provided_files.py</b>: - <span class="pc_cov">84%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">140 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">118<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">22<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">14<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_128305113a77411b_assemble_deb_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_packages_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">collections</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">dataclasses</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Mapping</span><span class="op">,</span> <span class="nam">Iterable</span><span class="op">,</span> <span class="nam">Dict</span><span class="op">,</span> <span class="nam">List</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">,</span> <span class="nam">Tuple</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">packages</span> <span class="key">import</span> <span class="nam">BinaryPackage</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="nam">VirtualPath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">impl_types</span> <span class="key">import</span> <span class="nam">PackagerProvidedFileClassSpec</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">_error</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="key">class</span> <span class="nam">PackagerProvidedFile</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">package_name</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">installed_as_basename</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">provided_key</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">definition</span><span class="op">:</span> <span class="nam">PackagerProvidedFileClassSpec</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">match_priority</span><span class="op">:</span> <span class="nam">int</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">fuzzy_match</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="key">def</span> <span class="nam">compute_dest</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">definition</span><span class="op">.</span><span class="nam">compute_dest</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">installed_as_basename</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">owning_package</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">package_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="nam">path</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"><span class="key">class</span> <span class="nam">PerPackagePackagerProvidedResult</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="nam">auto_installable</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">PackagerProvidedFile</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="nam">reserved_only</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">PackagerProvidedFile</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"><span class="key">def</span> <span class="nam">_find_package_name_prefix</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="nam">binary_packages</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="nam">main_binary_package</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="nam">max_periods_in_package_name</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="nam">allow_fuzzy_matches</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">bool</span><span class="op">,</span> <span class="nam">bool</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="key">if</span> <span class="nam">max_periods_in_package_name</span> <span class="op"><</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="nam">prefix</span><span class="op">,</span> <span class="nam">remaining</span> <span class="op">=</span> <span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="str">"."</span><span class="op">,</span> <span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="nam">package_name</span> <span class="op">=</span> <span class="nam">prefix</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="nam">bug_950723</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="key">if</span> <span class="nam">allow_fuzzy_matches</span> <span class="key">and</span> <span class="nam">package_name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"@"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">47 ↛ 48</span><span class="annotate long">line 47 didn't jump to line 48, because the condition on line 47 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="nam">package_name</span> <span class="op">=</span> <span class="nam">package_name</span><span class="op">[</span><span class="op">:</span><span class="op">-</span><span class="num">1</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="nam">bug_950723</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="key">if</span> <span class="nam">package_name</span> <span class="key">in</span> <span class="nam">binary_packages</span><span class="op">:</span> </span><span class="r"><span class="annotate short">50 ↛ 53</span><span class="annotate long">line 50 didn't jump to line 53, because the condition on line 50 was never false</span></span></p> - <p class="run"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="key">yield</span> <span class="nam">package_name</span><span class="op">,</span> <span class="nam">remaining</span><span class="op">,</span> <span class="key">True</span><span class="op">,</span> <span class="nam">bug_950723</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="key">yield</span> <span class="nam">main_binary_package</span><span class="op">,</span> <span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">,</span> <span class="key">False</span><span class="op">,</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">parts</span> <span class="op">=</span> <span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="str">"."</span><span class="op">,</span> <span class="nam">max_periods_in_package_name</span> <span class="op">+</span> <span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">range</span><span class="op">(</span><span class="nam">len</span><span class="op">(</span><span class="nam">parts</span><span class="op">)</span> <span class="op">-</span> <span class="num">1</span><span class="op">,</span> <span class="num">0</span><span class="op">,</span> <span class="op">-</span><span class="num">1</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="nam">name</span> <span class="op">=</span> <span class="str">"."</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">parts</span><span class="op">[</span><span class="num">0</span><span class="op">:</span><span class="nam">p</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="nam">bug_950723</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="key">if</span> <span class="nam">allow_fuzzy_matches</span> <span class="key">and</span> <span class="nam">name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"@"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">60 ↛ 61</span><span class="annotate long">line 60 didn't jump to line 61, because the condition on line 60 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="nam">name</span> <span class="op">=</span> <span class="nam">name</span><span class="op">[</span><span class="op">:</span><span class="op">-</span><span class="num">1</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="nam">bug_950723</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="key">if</span> <span class="nam">name</span> <span class="key">in</span> <span class="nam">binary_packages</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="nam">remaining</span> <span class="op">=</span> <span class="str">"."</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">parts</span><span class="op">[</span><span class="nam">p</span><span class="op">:</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="key">yield</span> <span class="nam">name</span><span class="op">,</span> <span class="nam">remaining</span><span class="op">,</span> <span class="key">True</span><span class="op">,</span> <span class="nam">bug_950723</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="com"># main package case</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="key">yield</span> <span class="nam">main_binary_package</span><span class="op">,</span> <span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">,</span> <span class="key">False</span><span class="op">,</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"><span class="key">def</span> <span class="nam">_find_definition</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="nam">packager_provided_files</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">PackagerProvidedFileClassSpec</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="nam">basename</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">PackagerProvidedFileClassSpec</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="nam">definition</span> <span class="op">=</span> <span class="nam">packager_provided_files</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">basename</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="key">if</span> <span class="nam">definition</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span><span class="op">,</span> <span class="nam">definition</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="nam">install_as_name</span> <span class="op">=</span> <span class="nam">basename</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="nam">file_class</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="key">while</span> <span class="str">"."</span> <span class="key">in</span> <span class="nam">install_as_name</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="nam">install_as_name</span><span class="op">,</span> <span class="nam">file_class_part</span> <span class="op">=</span> <span class="nam">install_as_name</span><span class="op">.</span><span class="nam">rsplit</span><span class="op">(</span><span class="str">"."</span><span class="op">,</span> <span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="nam">file_class</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="nam">file_class_part</span> <span class="op">+</span> <span class="str">"."</span> <span class="op">+</span> <span class="nam">file_class</span> <span class="key">if</span> <span class="nam">file_class</span> <span class="op">!=</span> <span class="str">""</span> <span class="key">else</span> <span class="nam">file_class_part</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="nam">definition</span> <span class="op">=</span> <span class="nam">packager_provided_files</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">file_class</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="key">if</span> <span class="nam">definition</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="key">return</span> <span class="nam">install_as_name</span><span class="op">,</span> <span class="nam">definition</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span><span class="op">,</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"><span class="key">def</span> <span class="nam">_check_mismatches</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="nam">definition</span><span class="op">:</span> <span class="nam">PackagerProvidedFileClassSpec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="nam">owning_package</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="nam">install_as_name</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="nam">had_arch</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="key">if</span> <span class="nam">install_as_name</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">definition</span><span class="op">.</span><span class="nam">allow_name_segment</span><span class="op">:</span> </span><span class="r"><span class="annotate short">98 ↛ 99</span><span class="annotate long">line 98 didn't jump to line 99, because the condition on line 98 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="str">f'The file "{path.fs_path}" looks like a packager provided file for'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="str">f' {owning_package.name} of type {definition.stem} with the custom name "{install_as_name}".'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="str">" However, this file type does not allow custom naming. The file type was registered"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="str">f" by {definition.debputy_plugin_metadata.plugin_name} in case you disagree and want"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="str">" to file a bug/feature request."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="key">if</span> <span class="nam">had_arch</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="key">if</span> <span class="nam">owning_package</span><span class="op">.</span><span class="nam">is_arch_all</span><span class="op">:</span> </span><span class="r"><span class="annotate short">107 ↛ 108</span><span class="annotate long">line 107 didn't jump to line 108, because the condition on line 107 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="str">f'The file "{path.fs_path}" looks like an architecture specific packager provided file for'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="str">f" {owning_package.name} of type {definition.stem}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="str">" However, the package in question is arch:all. The use of architecture specific files"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="str">" for arch:all packages does not make sense."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">definition</span><span class="op">.</span><span class="nam">allow_architecture_segment</span><span class="op">:</span> </span><span class="r"><span class="annotate short">114 ↛ 115</span><span class="annotate long">line 114 didn't jump to line 115, because the condition on line 114 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="str">f'The file "{path.fs_path}" looks like an architecture specific packager provided file for'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="str">f" {owning_package.name} of type {definition.stem}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="str">" However, this file type does not allow architecture specific variants. The file type was registered"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="str">f" by {definition.debputy_plugin_metadata.plugin_name} in case you disagree and want"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="str">" to file a bug/feature request."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"><span class="key">def</span> <span class="nam">_split_path</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="nam">packager_provided_files</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">PackagerProvidedFileClassSpec</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="nam">binary_packages</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="nam">main_binary_package</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="nam">max_periods_in_package_name</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="nam">allow_fuzzy_matches</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">PackagerProvidedFile</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="nam">owning_package_name</span> <span class="op">=</span> <span class="nam">main_binary_package</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="nam">basename</span> <span class="op">=</span> <span class="nam">path</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="nam">match_priority</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="nam">had_arch</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="key">if</span> <span class="str">"."</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">basename</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="nam">definition</span> <span class="op">=</span> <span class="nam">packager_provided_files</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">basename</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="key">if</span> <span class="nam">definition</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">139 ↛ 140</span><span class="annotate long">line 139 didn't jump to line 140, because the condition on line 139 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="key">if</span> <span class="nam">definition</span><span class="op">.</span><span class="nam">packageless_is_fallback_for_all_packages</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="nam">PackagerProvidedFile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="nam">path</span><span class="op">=</span><span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="nam">package_name</span><span class="op">=</span><span class="nam">n</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="nam">installed_as_basename</span><span class="op">=</span><span class="nam">n</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="nam">provided_key</span><span class="op">=</span><span class="str">".UNNAMED."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="nam">definition</span><span class="op">=</span><span class="nam">definition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="nam">match_priority</span><span class="op">=</span><span class="nam">match_priority</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="nam">fuzzy_match</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="key">for</span> <span class="nam">n</span> <span class="key">in</span> <span class="nam">binary_packages</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="key">yield</span> <span class="nam">PackagerProvidedFile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="nam">path</span><span class="op">=</span><span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="nam">package_name</span><span class="op">=</span><span class="nam">owning_package_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="nam">installed_as_basename</span><span class="op">=</span><span class="nam">owning_package_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="nam">provided_key</span><span class="op">=</span><span class="str">".UNNAMED."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="nam">definition</span><span class="op">=</span><span class="nam">definition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="nam">match_priority</span><span class="op">=</span><span class="nam">match_priority</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="nam">fuzzy_match</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="key">for</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="nam">owning_package_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="nam">basename</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="nam">explicit_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="nam">bug_950723</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="op">)</span> <span class="key">in</span> <span class="nam">_find_package_name_prefix</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="nam">binary_packages</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">main_binary_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="nam">max_periods_in_package_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="nam">allow_fuzzy_matches</span><span class="op">=</span><span class="nam">allow_fuzzy_matches</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="nam">owning_package</span> <span class="op">=</span> <span class="nam">binary_packages</span><span class="op">[</span><span class="nam">owning_package_name</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="nam">match_priority</span> <span class="op">=</span> <span class="num">1</span> <span class="key">if</span> <span class="nam">explicit_package</span> <span class="key">else</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="nam">fuzzy_match</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="key">if</span> <span class="nam">allow_fuzzy_matches</span> <span class="key">and</span> <span class="nam">basename</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">".in"</span><span class="op">)</span> <span class="key">and</span> <span class="nam">len</span><span class="op">(</span><span class="nam">basename</span><span class="op">)</span> <span class="op">></span> <span class="num">3</span><span class="op">:</span> </span><span class="r"><span class="annotate short">182 ↛ 183</span><span class="annotate long">line 182 didn't jump to line 183, because the condition on line 182 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="nam">basename</span> <span class="op">=</span> <span class="nam">basename</span><span class="op">[</span><span class="op">:</span><span class="op">-</span><span class="num">3</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="nam">fuzzy_match</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="key">if</span> <span class="str">"."</span> <span class="key">in</span> <span class="nam">basename</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="nam">remaining</span><span class="op">,</span> <span class="nam">last_word</span> <span class="op">=</span> <span class="nam">basename</span><span class="op">.</span><span class="nam">rsplit</span><span class="op">(</span><span class="str">"."</span><span class="op">,</span> <span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="com"># We cannot use "resolved_architecture" as it would return "all".</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="key">if</span> <span class="nam">last_word</span> <span class="op">==</span> <span class="nam">owning_package</span><span class="op">.</span><span class="nam">package_deb_architecture_variable</span><span class="op">(</span><span class="str">"ARCH"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="nam">match_priority</span> <span class="op">=</span> <span class="num">3</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="nam">basename</span> <span class="op">=</span> <span class="nam">remaining</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="nam">had_arch</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="key">elif</span> <span class="nam">last_word</span> <span class="op">==</span> <span class="nam">owning_package</span><span class="op">.</span><span class="nam">package_deb_architecture_variable</span><span class="op">(</span> </span><span class="r"><span class="annotate short">193 ↛ 196</span><span class="annotate long">line 193 didn't jump to line 196, because the condition on line 193 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="str">"ARCH_OS"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="nam">match_priority</span> <span class="op">=</span> <span class="num">2</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="nam">basename</span> <span class="op">=</span> <span class="nam">remaining</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="nam">had_arch</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="key">elif</span> <span class="nam">last_word</span> <span class="op">==</span> <span class="str">"all"</span> <span class="key">and</span> <span class="nam">owning_package</span><span class="op">.</span><span class="nam">is_arch_all</span><span class="op">:</span> </span><span class="r"><span class="annotate short">199 ↛ 202</span><span class="annotate long">line 199 didn't jump to line 202, because the condition on line 199 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="com"># This case does not make sense, but we detect it so we can report an error</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="com"># via _check_mismatches.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="nam">match_priority</span> <span class="op">=</span> <span class="op">-</span><span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="nam">basename</span> <span class="op">=</span> <span class="nam">remaining</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="nam">had_arch</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="nam">install_as_name</span><span class="op">,</span> <span class="nam">definition</span> <span class="op">=</span> <span class="nam">_find_definition</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="nam">packager_provided_files</span><span class="op">,</span> <span class="nam">basename</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="key">if</span> <span class="nam">definition</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="com"># Note: bug_950723 implies allow_fuzzy_matches</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="key">if</span> <span class="nam">bug_950723</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">definition</span><span class="op">.</span><span class="nam">bug_950723</span><span class="op">:</span> </span><span class="r"><span class="annotate short">213 ↛ 214</span><span class="annotate long">line 213 didn't jump to line 214, because the condition on line 213 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="nam">_check_mismatches</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="nam">definition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="nam">owning_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="nam">install_as_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="nam">had_arch</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="nam">definition</span><span class="op">.</span><span class="nam">packageless_is_fallback_for_all_packages</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="key">and</span> <span class="nam">install_as_name</span> <span class="key">is</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="key">and</span> <span class="key">not</span> <span class="nam">had_arch</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="key">and</span> <span class="key">not</span> <span class="nam">explicit_package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="nam">PackagerProvidedFile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="nam">path</span><span class="op">=</span><span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="nam">package_name</span><span class="op">=</span><span class="nam">n</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="nam">installed_as_basename</span><span class="op">=</span><span class="str">f"{n}@"</span> <span class="key">if</span> <span class="nam">bug_950723</span> <span class="key">else</span> <span class="nam">n</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="nam">provided_key</span><span class="op">=</span><span class="str">".UNNAMED."</span> <span class="key">if</span> <span class="nam">bug_950723</span> <span class="key">else</span> <span class="str">".UNNAMED@."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="nam">definition</span><span class="op">=</span><span class="nam">definition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="nam">match_priority</span><span class="op">=</span><span class="nam">match_priority</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="nam">fuzzy_match</span><span class="op">=</span><span class="nam">fuzzy_match</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="key">for</span> <span class="nam">n</span> <span class="key">in</span> <span class="nam">binary_packages</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="nam">provided_key</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="nam">install_as_name</span> <span class="key">if</span> <span class="nam">install_as_name</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">else</span> <span class="str">".UNNAMED."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="nam">basename</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="nam">install_as_name</span> <span class="key">if</span> <span class="nam">install_as_name</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">else</span> <span class="nam">owning_package_name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="key">if</span> <span class="nam">bug_950723</span><span class="op">:</span> </span><span class="r"><span class="annotate short">248 ↛ 249</span><span class="annotate long">line 248 didn't jump to line 249, because the condition on line 248 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="nam">provided_key</span> <span class="op">=</span> <span class="str">f"{provided_key}@"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="nam">basename</span> <span class="op">=</span> <span class="str">f"{basename}@"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="key">yield</span> <span class="nam">PackagerProvidedFile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="nam">path</span><span class="op">=</span><span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="nam">package_name</span><span class="op">=</span><span class="nam">owning_package_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="nam">installed_as_basename</span><span class="op">=</span><span class="nam">basename</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="nam">provided_key</span><span class="op">=</span><span class="nam">provided_key</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="nam">definition</span><span class="op">=</span><span class="nam">definition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="nam">match_priority</span><span class="op">=</span><span class="nam">match_priority</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="nam">fuzzy_match</span><span class="op">=</span><span class="nam">fuzzy_match</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"><span class="key">def</span> <span class="nam">detect_all_packager_provided_files</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="nam">packager_provided_files</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">PackagerProvidedFileClassSpec</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="nam">binary_packages</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="nam">allow_fuzzy_matches</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">PerPackagePackagerProvidedResult</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="nam">main_binary_package</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="nam">p</span><span class="op">.</span><span class="nam">name</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">binary_packages</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span> <span class="key">if</span> <span class="nam">p</span><span class="op">.</span><span class="nam">is_main_package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="op">]</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="nam">provided_files</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">PackagerProvidedFile</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="nam">n</span><span class="op">:</span> <span class="op">{</span><span class="op">}</span> <span class="key">for</span> <span class="nam">n</span> <span class="key">in</span> <span class="nam">binary_packages</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="nam">max_periods_in_package_name</span> <span class="op">=</span> <span class="nam">max</span><span class="op">(</span><span class="nam">name</span><span class="op">.</span><span class="nam">count</span><span class="op">(</span><span class="str">"."</span><span class="op">)</span> <span class="key">for</span> <span class="nam">name</span> <span class="key">in</span> <span class="nam">binary_packages</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="key">for</span> <span class="nam">entry</span> <span class="key">in</span> <span class="nam">debian_dir</span><span class="op">.</span><span class="nam">iterdir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="key">if</span> <span class="nam">entry</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"><span class="annotate short">279 ↛ 280</span><span class="annotate long">line 279 didn't jump to line 280, because the condition on line 279 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="nam">matching_ppfs</span> <span class="op">=</span> <span class="nam">_split_path</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="nam">packager_provided_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="nam">binary_packages</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="nam">main_binary_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="nam">max_periods_in_package_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="nam">entry</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="nam">allow_fuzzy_matches</span><span class="op">=</span><span class="nam">allow_fuzzy_matches</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="key">for</span> <span class="nam">packager_provided_file</span> <span class="key">in</span> <span class="nam">matching_ppfs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="nam">provided_files_for_package</span> <span class="op">=</span> <span class="nam">provided_files</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="nam">packager_provided_file</span><span class="op">.</span><span class="nam">package_name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="nam">match_key</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> <span class="nam">packager_provided_file</span><span class="op">.</span><span class="nam">definition</span><span class="op">.</span><span class="nam">stem</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="nam">packager_provided_file</span><span class="op">.</span><span class="nam">provided_key</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="nam">existing</span> <span class="op">=</span> <span class="nam">provided_files_for_package</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">match_key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="nam">existing</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="key">and</span> <span class="nam">existing</span><span class="op">.</span><span class="nam">match_priority</span> <span class="op">></span> <span class="nam">packager_provided_file</span><span class="op">.</span><span class="nam">match_priority</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="nam">provided_files_for_package</span><span class="op">[</span><span class="nam">match_key</span><span class="op">]</span> <span class="op">=</span> <span class="nam">packager_provided_file</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="nam">result</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> <span class="key">for</span> <span class="nam">package_name</span><span class="op">,</span> <span class="nam">provided_file_data</span> <span class="key">in</span> <span class="nam">provided_files</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="nam">auto_install_list</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="nam">x</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">provided_file_data</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span> <span class="key">if</span> <span class="key">not</span> <span class="nam">x</span><span class="op">.</span><span class="nam">definition</span><span class="op">.</span><span class="nam">reservation_only</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="nam">reservation_only</span> <span class="op">=</span> <span class="nam">collections</span><span class="op">.</span><span class="nam">defaultdict</span><span class="op">(</span><span class="nam">list</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="key">for</span> <span class="nam">packager_provided_file</span> <span class="key">in</span> <span class="nam">provided_file_data</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">packager_provided_file</span><span class="op">.</span><span class="nam">definition</span><span class="op">.</span><span class="nam">reservation_only</span><span class="op">:</span> </span><span class="r"><span class="annotate short">312 ↛ 314</span><span class="annotate long">line 312 didn't jump to line 314, because the condition on line 312 was never false</span></span></p> - <p class="run"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="nam">reservation_only</span><span class="op">[</span><span class="nam">packager_provided_file</span><span class="op">.</span><span class="nam">definition</span><span class="op">.</span><span class="nam">stem</span><span class="op">]</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="nam">packager_provided_file</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="nam">result</span><span class="op">[</span><span class="nam">package_name</span><span class="op">]</span> <span class="op">=</span> <span class="nam">PerPackagePackagerProvidedResult</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="nam">auto_install_list</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="nam">reservation_only</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> <span class="key">return</span> <span class="nam">result</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_128305113a77411b_assemble_deb_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_packages_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_267b6307937f1878_packages_py.html b/coverage-report/d_267b6307937f1878_packages_py.html deleted file mode 100644 index a71d42b..0000000 --- a/coverage-report/d_267b6307937f1878_packages_py.html +++ /dev/null @@ -1,431 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/packages.py: 51%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/packages.py</b>: - <span class="pc_cov">51%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">167 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">91<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">76<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">2<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">6<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_packager_provided_files_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_36a196ce5f578895___init___py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"> <span class="nam">Dict</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="nam">Set</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">cast</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">Mapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">FrozenSet</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">TYPE_CHECKING</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"><span class="key">from</span> <span class="nam">debian</span><span class="op">.</span><span class="nam">deb822</span> <span class="key">import</span> <span class="nam">Deb822</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"><span class="key">from</span> <span class="nam">debian</span><span class="op">.</span><span class="nam">debian_support</span> <span class="key">import</span> <span class="nam">DpkgArchTable</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">_deb_options_profiles</span> <span class="key">import</span> <span class="nam">DebBuildOptionsAndProfiles</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">architecture_support</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">DpkgArchitectureBuildProcessValuesTable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">dpkg_architecture_table</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">DEFAULT_PACKAGE_TYPE</span><span class="op">,</span> <span class="nam">UDEB_PACKAGE_TYPE</span><span class="op">,</span> <span class="nam">_error</span><span class="op">,</span> <span class="nam">active_profiles_match</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"><span class="key">if</span> <span class="nam">TYPE_CHECKING</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="key">from</span> <span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="nam">VirtualPath</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"><span class="nam">_MANDATORY_BINARY_PACKAGE_FIELD</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="str">"Package"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="str">"Architecture"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"><span class="key">def</span> <span class="nam">parse_source_debian_control</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="nam">debian_control</span><span class="op">:</span> <span class="str">"VirtualPath"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="nam">selected_packages</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="nam">excluded_packages</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="nam">select_arch_all</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="nam">select_arch_any</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">dpkg_architecture_variables</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="nam">DpkgArchitectureBuildProcessValuesTable</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">dpkg_arch_query_table</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">DpkgArchTable</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">build_env</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">DebBuildOptionsAndProfiles</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="str">"SourcePackage"</span><span class="op">,</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="str">"BinaryPackage"</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="key">if</span> <span class="nam">dpkg_architecture_variables</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="nam">dpkg_architecture_variables</span> <span class="op">=</span> <span class="nam">dpkg_architecture_table</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="key">if</span> <span class="nam">dpkg_arch_query_table</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="nam">dpkg_arch_query_table</span> <span class="op">=</span> <span class="nam">DpkgArchTable</span><span class="op">.</span><span class="nam">load_arch_table</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="key">if</span> <span class="nam">build_env</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="nam">build_env</span> <span class="op">=</span> <span class="nam">DebBuildOptionsAndProfiles</span><span class="op">.</span><span class="nam">instance</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="com"># If no selection option is set, then all packages are acted on (except the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="com"># excluded ones)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">selected_packages</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">select_arch_all</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">select_arch_any</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="nam">select_arch_all</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">select_arch_any</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="key">with</span> <span class="nam">debian_control</span><span class="op">.</span><span class="nam">open</span><span class="op">(</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="nam">dctrl_paragraphs</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">Deb822</span><span class="op">.</span><span class="nam">iter_paragraphs</span><span class="op">(</span><span class="nam">fd</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">dctrl_paragraphs</span><span class="op">)</span> <span class="op"><</span> <span class="num">2</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="str">"debian/control must contain at least two stanza (1 Source + 1-N Package stanza)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="nam">source_package</span> <span class="op">=</span> <span class="nam">SourcePackage</span><span class="op">(</span><span class="nam">dctrl_paragraphs</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="nam">bin_pkgs</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="nam">_create_binary_package</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="nam">p</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="nam">selected_packages</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="nam">excluded_packages</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="nam">select_arch_all</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="nam">select_arch_any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="nam">dpkg_architecture_variables</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="nam">dpkg_arch_query_table</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="nam">build_env</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="nam">i</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="key">for</span> <span class="nam">i</span><span class="op">,</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">dctrl_paragraphs</span><span class="op">[</span><span class="num">1</span><span class="op">:</span><span class="op">]</span><span class="op">,</span> <span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="nam">bin_pkgs_table</span> <span class="op">=</span> <span class="op">{</span><span class="nam">p</span><span class="op">.</span><span class="nam">name</span><span class="op">:</span> <span class="nam">p</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">bin_pkgs</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">selected_packages</span><span class="op">.</span><span class="nam">issubset</span><span class="op">(</span><span class="nam">bin_pkgs_table</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="nam">unknown</span> <span class="op">=</span> <span class="nam">selected_packages</span> <span class="op">-</span> <span class="nam">bin_pkgs_table</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="str">f"The following *selected* packages (-p) are not listed in debian/control: {sorted(unknown)}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">excluded_packages</span><span class="op">.</span><span class="nam">issubset</span><span class="op">(</span><span class="nam">bin_pkgs_table</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="nam">unknown</span> <span class="op">=</span> <span class="nam">selected_packages</span> <span class="op">-</span> <span class="nam">bin_pkgs_table</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="str">f"The following *excluded* packages (-N) are not listed in debian/control: {sorted(unknown)}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="key">return</span> <span class="nam">source_package</span><span class="op">,</span> <span class="nam">bin_pkgs_table</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"><span class="key">def</span> <span class="nam">_check_package_sets</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="nam">provided_packages</span><span class="op">:</span> <span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="nam">valid_package_names</span><span class="op">:</span> <span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="nam">option_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="com"># SonarLint proposes to use `provided_packages > valid_package_names`, which is valid for boolean</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="com"># logic, but not for set logic. We want to assert that provided_packages is a proper subset</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="com"># of valid_package_names. The rewrite would cause no errors for {'foo'} > {'bar'} - in set logic,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="com"># neither is a superset / subset of the other, but we want an error for this case.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="com"># Bug filed:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="com"># https://community.sonarsource.com/t/sonarlint-python-s1940-rule-does-not-seem-to-take-set-logic-into-account/79718</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="op">(</span><span class="nam">provided_packages</span> <span class="op"><=</span> <span class="nam">valid_package_names</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="nam">non_existing_packages</span> <span class="op">=</span> <span class="nam">sorted</span><span class="op">(</span><span class="nam">provided_packages</span> <span class="op">-</span> <span class="nam">valid_package_names</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="nam">invalid_package_list</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">non_existing_packages</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="nam">msg</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="str">f"Invalid package names passed to {option_name}: {invalid_package_list}: "</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="str">f'Valid package names are: {", ".join(valid_package_names)}'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span><span class="nam">msg</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"><span class="key">def</span> <span class="nam">_create_binary_package</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="nam">paragraph</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">Deb822</span><span class="op">,</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="nam">selected_packages</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="nam">excluded_packages</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="nam">select_arch_all</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="nam">select_arch_any</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="nam">dpkg_architecture_variables</span><span class="op">:</span> <span class="nam">DpkgArchitectureBuildProcessValuesTable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="nam">dpkg_arch_query_table</span><span class="op">:</span> <span class="nam">DpkgArchTable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="nam">build_env</span><span class="op">:</span> <span class="nam">DebBuildOptionsAndProfiles</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="nam">paragraph_index</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="str">"BinaryPackage"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="nam">package_name</span> <span class="op">=</span> <span class="nam">paragraph</span><span class="op">[</span><span class="str">"Package"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="key">except</span> <span class="nam">KeyError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span><span class="str">f'Missing mandatory field "Package" in stanza number {paragraph_index}'</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="com"># The raise is there to help PyCharm type-checking (which fails at "NoReturn")</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="key">raise</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="key">for</span> <span class="nam">mandatory_field</span> <span class="key">in</span> <span class="nam">_MANDATORY_BINARY_PACKAGE_FIELD</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="key">if</span> <span class="nam">mandatory_field</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">paragraph</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="str">f'Missing mandatory field "{mandatory_field}" for binary package {package_name}'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="str">f" (stanza number {paragraph_index})"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="nam">architecture</span> <span class="op">=</span> <span class="nam">paragraph</span><span class="op">[</span><span class="str">"Architecture"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="key">if</span> <span class="nam">paragraph_index</span> <span class="op"><</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"stanza index must be 1-indexed (1, 2, ...)"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="nam">is_main_package</span> <span class="op">=</span> <span class="nam">paragraph_index</span> <span class="op">==</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="key">if</span> <span class="nam">package_name</span> <span class="key">in</span> <span class="nam">excluded_packages</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="nam">should_act_on</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="key">elif</span> <span class="nam">package_name</span> <span class="key">in</span> <span class="nam">selected_packages</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="nam">should_act_on</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="key">elif</span> <span class="nam">architecture</span> <span class="op">==</span> <span class="str">"all"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="nam">should_act_on</span> <span class="op">=</span> <span class="nam">select_arch_all</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="nam">should_act_on</span> <span class="op">=</span> <span class="nam">select_arch_any</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="nam">profiles_raw</span> <span class="op">=</span> <span class="nam">paragraph</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"Build-Profiles"</span><span class="op">,</span> <span class="str">""</span><span class="op">)</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="key">if</span> <span class="nam">should_act_on</span> <span class="key">and</span> <span class="nam">profiles_raw</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="nam">should_act_on</span> <span class="op">=</span> <span class="nam">active_profiles_match</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="nam">profiles_raw</span><span class="op">,</span> <span class="nam">build_env</span><span class="op">.</span><span class="nam">deb_build_profiles</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="key">except</span> <span class="nam">ValueError</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span><span class="str">f"Invalid Build-Profiles field for {package_name}: {e.args[0]}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="key">return</span> <span class="nam">BinaryPackage</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="nam">paragraph</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="nam">dpkg_architecture_variables</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="nam">dpkg_arch_query_table</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="nam">should_be_acted_on</span><span class="op">=</span><span class="nam">should_act_on</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">is_main_package</span><span class="op">=</span><span class="nam">is_main_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"><span class="key">def</span> <span class="nam">_check_binary_arch</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="nam">arch_table</span><span class="op">:</span> <span class="nam">DpkgArchTable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="nam">binary_arch</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="nam">declared_arch</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="key">if</span> <span class="nam">binary_arch</span> <span class="op">==</span> <span class="str">"all"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="nam">arch_wildcards</span> <span class="op">=</span> <span class="nam">declared_arch</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="key">for</span> <span class="nam">arch_wildcard</span> <span class="key">in</span> <span class="nam">arch_wildcards</span><span class="op">:</span> </span><span class="r"><span class="annotate short">185 ↛ 188</span><span class="annotate long">line 185 didn't jump to line 188, because the loop on line 185 didn't complete</span></span></p> - <p class="par run show_par"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="key">if</span> <span class="nam">arch_table</span><span class="op">.</span><span class="nam">matches_architecture</span><span class="op">(</span><span class="nam">binary_arch</span><span class="op">,</span> <span class="nam">arch_wildcard</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">186 ↛ 185</span><span class="annotate long">line 186 didn't jump to line 185, because the condition on line 186 was never false</span></span></p> - <p class="run"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"><span class="key">class</span> <span class="nam">BinaryPackage</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="str">"_package_fields"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="str">"_dbgsym_binary_package"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="str">"_should_be_acted_on"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="str">"_dpkg_architecture_variables"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="str">"_declared_arch_matches_output_arch"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="str">"_is_main_package"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="str">"_substvars"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="str">"_maintscript_snippets"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="nam">fields</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">Deb822</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="nam">dpkg_architecture_variables</span><span class="op">:</span> <span class="nam">DpkgArchitectureBuildProcessValuesTable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="nam">dpkg_arch_query</span><span class="op">:</span> <span class="nam">DpkgArchTable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="nam">is_main_package</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="nam">should_be_acted_on</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="nam">BinaryPackage</span><span class="op">,</span> <span class="nam">self</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="com"># Typing-wise, Deb822 is *not* a Mapping[str, str] but it behaves enough</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="com"># like one that we rely on it and just cast it.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_fields</span> <span class="op">=</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"Mapping[str, str]"</span><span class="op">,</span> <span class="nam">fields</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_dbgsym_binary_package</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_should_be_acted_on</span> <span class="op">=</span> <span class="nam">should_be_acted_on</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_dpkg_architecture_variables</span> <span class="op">=</span> <span class="nam">dpkg_architecture_variables</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_is_main_package</span> <span class="op">=</span> <span class="nam">is_main_package</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_declared_arch_matches_output_arch</span> <span class="op">=</span> <span class="nam">_check_binary_arch</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="nam">dpkg_arch_query</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">resolved_architecture</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">declared_architecture</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="key">def</span> <span class="nam">name</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">fields</span><span class="op">[</span><span class="str">"Package"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="key">def</span> <span class="nam">archive_section</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="nam">value</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">fields</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"Section"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="key">if</span> <span class="nam">value</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">231 ↛ 232</span><span class="annotate long">line 231 didn't jump to line 232, because the condition on line 231 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="key">return</span> <span class="str">"Unknown"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="key">return</span> <span class="nam">value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="key">def</span> <span class="nam">archive_component</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="nam">component</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="nam">section</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">archive_section</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="key">if</span> <span class="str">"/"</span> <span class="key">in</span> <span class="nam">section</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="nam">component</span> <span class="op">=</span> <span class="nam">section</span><span class="op">.</span><span class="nam">rsplit</span><span class="op">(</span><span class="str">"/"</span><span class="op">,</span> <span class="num">1</span><span class="op">)</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="com"># The "main" component is always shortened to ""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="key">if</span> <span class="nam">component</span> <span class="op">==</span> <span class="str">"main"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="nam">component</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="key">return</span> <span class="nam">component</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_essential</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_fields</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"Essential"</span><span class="op">)</span> <span class="op">==</span> <span class="str">"yes"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_udeb</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">package_type</span> <span class="op">==</span> <span class="nam">UDEB_PACKAGE_TYPE</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="key">def</span> <span class="nam">should_be_acted_on</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_should_be_acted_on</span> <span class="key">and</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_declared_arch_matches_output_arch</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="key">def</span> <span class="nam">fields</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_fields</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="key">def</span> <span class="nam">resolved_architecture</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="nam">arch</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">declared_architecture</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="key">if</span> <span class="nam">arch</span> <span class="op">==</span> <span class="str">"all"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="key">return</span> <span class="nam">arch</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_x_dh_build_for_type</span> <span class="op">==</span> <span class="str">"target"</span><span class="op">:</span> </span><span class="r"><span class="annotate short">267 ↛ 268</span><span class="annotate long">line 267 didn't jump to line 268, because the condition on line 267 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_dpkg_architecture_variables</span><span class="op">[</span><span class="str">"DEB_TARGET_ARCH"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_dpkg_architecture_variables</span><span class="op">.</span><span class="nam">current_host_arch</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="key">def</span> <span class="nam">package_deb_architecture_variable</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">variable_suffix</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_x_dh_build_for_type</span> <span class="op">==</span> <span class="str">"target"</span><span class="op">:</span> </span><span class="r"><span class="annotate short">272 ↛ 273</span><span class="annotate long">line 272 didn't jump to line 273, because the condition on line 272 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_dpkg_architecture_variables</span><span class="op">[</span><span class="str">f"DEB_TARGET_{variable_suffix}"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_dpkg_architecture_variables</span><span class="op">[</span><span class="str">f"DEB_HOST_{variable_suffix}"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="key">def</span> <span class="nam">deb_multiarch</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">package_deb_architecture_variable</span><span class="op">(</span><span class="str">"MULTIARCH"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="key">def</span> <span class="nam">_x_dh_build_for_type</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="nam">v</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_fields</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"X-DH-Build-For-Type"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="key">if</span> <span class="nam">v</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">283 ↛ 285</span><span class="annotate long">line 283 didn't jump to line 285, because the condition on line 283 was never false</span></span></p> - <p class="run"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="key">return</span> <span class="str">"host"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="key">return</span> <span class="nam">v</span><span class="op">.</span><span class="nam">lower</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="key">def</span> <span class="nam">package_type</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="str">"""Short for Package-Type (with proper default if absent)"""</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="nam">v</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">fields</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"Package-Type"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="key">if</span> <span class="nam">v</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> <span class="key">return</span> <span class="nam">DEFAULT_PACKAGE_TYPE</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="key">return</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_main_package</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_is_main_package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="key">def</span> <span class="nam">cross_command</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">command</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="nam">arch_table</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_dpkg_architecture_variables</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_x_dh_build_for_type</span> <span class="op">==</span> <span class="str">"target"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="nam">target_gnu_type</span> <span class="op">=</span> <span class="nam">arch_table</span><span class="op">[</span><span class="str">"DEB_TARGET_GNU_TYPE"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="key">if</span> <span class="nam">arch_table</span><span class="op">[</span><span class="str">"DEB_HOST_GNU_TYPE"</span><span class="op">]</span> <span class="op">!=</span> <span class="nam">target_gnu_type</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> <span class="key">return</span> <span class="str">f"{target_gnu_type}-{command}"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="key">if</span> <span class="nam">arch_table</span><span class="op">.</span><span class="nam">is_cross_compiling</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> <span class="key">return</span> <span class="str">f"{arch_table['DEB_HOST_GNU_TYPE']}-{command}"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="key">return</span> <span class="nam">command</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="key">def</span> <span class="nam">declared_architecture</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">fields</span><span class="op">[</span><span class="str">"Architecture"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_arch_all</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">declared_architecture</span> <span class="op">==</span> <span class="str">"all"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"><span class="key">class</span> <span class="nam">SourcePackage</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"_package_fields"</span><span class="op">,</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">fields</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">Deb822</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="com"># Typing-wise, Deb822 is *not* a Mapping[str, str] but it behaves enough</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> <span class="com"># like one that we rely on it and just cast it.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_fields</span> <span class="op">=</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"Mapping[str, str]"</span><span class="op">,</span> <span class="nam">fields</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> <span class="key">def</span> <span class="nam">fields</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_fields</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> <span class="key">def</span> <span class="nam">name</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_fields</span><span class="op">[</span><span class="str">"Source"</span><span class="op">]</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_packager_provided_files_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_36a196ce5f578895___init___py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_267b6307937f1878_path_matcher_py.html b/coverage-report/d_267b6307937f1878_path_matcher_py.html deleted file mode 100644 index 448a7aa..0000000 --- a/coverage-report/d_267b6307937f1878_path_matcher_py.html +++ /dev/null @@ -1,628 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/path_matcher.py: 72%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/path_matcher.py</b>: - <span class="pc_cov">72%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">279 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">213<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">66<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">3<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">13<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_36a196ce5f578895_makeshlibs_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_4faea183f900b252___init___py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">fnmatch</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">glob</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">itertools</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">import</span> <span class="nam">re</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">from</span> <span class="nam">enum</span> <span class="key">import</span> <span class="nam">Enum</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">Callable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">TypeVar</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">Iterable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">Sequence</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">intermediate_manifest</span> <span class="key">import</span> <span class="nam">PathType</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="nam">VirtualPath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">substitution</span> <span class="key">import</span> <span class="nam">Substitution</span><span class="op">,</span> <span class="nam">NULL_SUBSTITUTION</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">types</span> <span class="key">import</span> <span class="nam">VP</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">_normalize_path</span><span class="op">,</span> <span class="nam">_error</span><span class="op">,</span> <span class="nam">escape_shell</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"><span class="nam">MR</span> <span class="op">=</span> <span class="nam">TypeVar</span><span class="op">(</span><span class="str">"MR"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"><span class="nam">_GLOB_PARTS</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r"[*?]|\[]?[^]]+]"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"><span class="key">def</span> <span class="nam">_lookup_path</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VP</span><span class="op">,</span> <span class="nam">path</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">VP</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">path</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"./"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">28 ↛ 29</span><span class="annotate long">line 28 didn't jump to line 29, because the condition on line 28 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"Directory must be normalized (and not the root directory)"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="key">if</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">name</span> <span class="op">!=</span> <span class="str">"."</span> <span class="key">or</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">parent_dir</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">30 ↛ 31</span><span class="annotate long">line 30 didn't jump to line 31, because the condition on line 30 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"Provided fs_root must be the root directory"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="com"># TODO: Strictly speaking, this is unsound. (E.g., FSRootDir does not return FSRootDir on a lookup)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="key">return</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="nam">path</span><span class="op">[</span><span class="num">2</span><span class="op">:</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"><span class="key">def</span> <span class="nam">_compile_basename_glob</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="nam">basename_glob</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">bool</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">remainder</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">glob</span><span class="op">.</span><span class="nam">has_magic</span><span class="op">(</span><span class="nam">basename_glob</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">40 ↛ 41</span><span class="annotate long">line 40 didn't jump to line 41, because the condition on line 40 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="key">return</span> <span class="nam">escape_shell</span><span class="op">(</span><span class="nam">basename_glob</span><span class="op">)</span><span class="op">,</span> <span class="key">lambda</span> <span class="nam">x</span><span class="op">:</span> <span class="nam">x</span> <span class="op">==</span> <span class="nam">basename_glob</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="key">if</span> <span class="nam">basename_glob</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"*"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="key">if</span> <span class="nam">basename_glob</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"*"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="nam">remainder</span> <span class="op">=</span> <span class="nam">basename_glob</span><span class="op">[</span><span class="num">1</span><span class="op">:</span><span class="op">-</span><span class="num">1</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="nam">possible_quick_match</span> <span class="op">=</span> <span class="key">lambda</span> <span class="nam">x</span><span class="op">:</span> <span class="nam">remainder</span> <span class="key">in</span> <span class="nam">x</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="nam">escaped_pattern</span> <span class="op">=</span> <span class="str">"*"</span> <span class="op">+</span> <span class="nam">escape_shell</span><span class="op">(</span><span class="nam">remainder</span><span class="op">)</span> <span class="op">+</span> <span class="str">"*"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="nam">remainder</span> <span class="op">=</span> <span class="nam">basename_glob</span><span class="op">[</span><span class="num">1</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="nam">possible_quick_match</span> <span class="op">=</span> <span class="key">lambda</span> <span class="nam">x</span><span class="op">:</span> <span class="nam">x</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="nam">remainder</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="nam">escaped_pattern</span> <span class="op">=</span> <span class="str">"*"</span> <span class="op">+</span> <span class="nam">escape_shell</span><span class="op">(</span><span class="nam">remainder</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="nam">remainder</span> <span class="op">=</span> <span class="nam">basename_glob</span><span class="op">[</span><span class="op">:</span><span class="op">-</span><span class="num">1</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="nam">possible_quick_match</span> <span class="op">=</span> <span class="key">lambda</span> <span class="nam">x</span><span class="op">:</span> <span class="nam">x</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="nam">remainder</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="nam">escaped_pattern</span> <span class="op">=</span> <span class="nam">escape_shell</span><span class="op">(</span><span class="nam">remainder</span><span class="op">)</span> <span class="op">+</span> <span class="str">"*"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">glob</span><span class="op">.</span><span class="nam">has_magic</span><span class="op">(</span><span class="nam">remainder</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="key">return</span> <span class="nam">escaped_pattern</span><span class="op">,</span> <span class="nam">possible_quick_match</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="nam">slow_pattern</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="nam">fnmatch</span><span class="op">.</span><span class="nam">translate</span><span class="op">(</span><span class="nam">basename_glob</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span><span class="op">,</span> <span class="key">lambda</span> <span class="nam">x</span><span class="op">:</span> <span class="nam">bool</span><span class="op">(</span><span class="nam">slow_pattern</span><span class="op">.</span><span class="nam">match</span><span class="op">(</span><span class="nam">x</span><span class="op">)</span><span class="op">)</span> </span><span class="r"><span class="annotate short">60 ↛ exit</span><span class="annotate long">line 60 didn't run the lambda on line 60</span></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"><span class="key">def</span> <span class="nam">_apply_match</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="nam">fs_path</span><span class="op">:</span> <span class="nam">VP</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="nam">match_part</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">bool</span><span class="op">]</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">VP</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">match_part</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="nam">fs_path</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="nam">match_part</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="key">if</span> <span class="nam">m</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="key">yield</span> <span class="nam">m</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="op">(</span><span class="nam">p</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">fs_path</span><span class="op">.</span><span class="nam">iterdir</span> <span class="key">if</span> <span class="nam">match_part</span><span class="op">(</span><span class="nam">p</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"><span class="key">class</span> <span class="nam">MatchRuleType</span><span class="op">(</span><span class="nam">Enum</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="nam">EXACT_MATCH</span> <span class="op">=</span> <span class="str">"exact"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="nam">BASENAME_GLOB</span> <span class="op">=</span> <span class="str">"basename-glob"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="nam">DIRECT_CHILDREN_OF_DIR</span> <span class="op">=</span> <span class="str">"direct-children-of-dir"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="nam">ANYTHING_BENEATH_DIR</span> <span class="op">=</span> <span class="str">"anything-beneath-dir"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="nam">GENERIC_GLOB</span> <span class="op">=</span> <span class="str">"generic-glob"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="nam">MATCH_ANYTHING</span> <span class="op">=</span> <span class="str">"match-anything"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"><span class="key">class</span> <span class="nam">MatchRule</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"_rule_type"</span><span class="op">,</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">rule_type</span><span class="op">:</span> <span class="nam">MatchRuleType</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_rule_type</span> <span class="op">=</span> <span class="nam">rule_type</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="key">def</span> <span class="nam">rule_type</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">MatchRuleType</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_rule_type</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="key">def</span> <span class="nam">finditer</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VP</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="nam">ignore_paths</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">VP</span><span class="op">]</span><span class="op">,</span> <span class="nam">bool</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">VP</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="com"># TODO: Strictly speaking, this is unsound. (E.g., FSRootDir does not return FSRootDir on a lookup)</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="key">def</span> <span class="nam">_full_pattern</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="key">def</span> <span class="nam">path_type</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">PathType</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="key">def</span> <span class="nam">describe_match_short</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_full_pattern</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="key">def</span> <span class="nam">describe_match_exact</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="key">def</span> <span class="nam">shell_escape_pattern</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TypeError</span><span class="op">(</span><span class="str">"Pattern not suitable or not supported for shell escape"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="key">def</span> <span class="nam">recursive_beneath_directory</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="nam">directory</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="nam">path_type</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">PathType</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="nam">substitution</span><span class="op">:</span> <span class="nam">Substitution</span> <span class="op">=</span> <span class="nam">NULL_SUBSTITUTION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"MatchRule"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="key">if</span> <span class="nam">directory</span> <span class="key">in</span> <span class="op">(</span><span class="str">"."</span><span class="op">,</span> <span class="str">"/"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">127 ↛ 128</span><span class="annotate long">line 127 didn't jump to line 128, because the condition on line 127 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="key">return</span> <span class="nam">MATCH_ANYTHING</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="key">assert</span> <span class="key">not</span> <span class="nam">glob</span><span class="op">.</span><span class="nam">has_magic</span><span class="op">(</span><span class="nam">directory</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="key">return</span> <span class="nam">DirectoryBasedMatch</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="nam">MatchRuleType</span><span class="op">.</span><span class="nam">ANYTHING_BENEATH_DIR</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="nam">substitution</span><span class="op">.</span><span class="nam">substitute</span><span class="op">(</span><span class="nam">_normalize_path</span><span class="op">(</span><span class="nam">directory</span><span class="op">)</span><span class="op">,</span> <span class="nam">definition_source</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="nam">path_type</span><span class="op">=</span><span class="nam">path_type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="key">def</span> <span class="nam">from_path_or_glob</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="nam">path_or_glob</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="nam">path_type</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">PathType</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="nam">substitution</span><span class="op">:</span> <span class="nam">Substitution</span> <span class="op">=</span> <span class="nam">NULL_SUBSTITUTION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"MatchRule"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="com"># TODO: Handle '{a,b,c}' patterns too</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="com"># FIXME: Better error handling!</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="nam">normalized_no_prefix</span> <span class="op">=</span> <span class="nam">_normalize_path</span><span class="op">(</span><span class="nam">path_or_glob</span><span class="op">,</span> <span class="nam">with_prefix</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="key">if</span> <span class="nam">path_or_glob</span> <span class="key">in</span> <span class="op">(</span><span class="str">"*"</span><span class="op">,</span> <span class="str">"**/*"</span><span class="op">,</span> <span class="str">"."</span><span class="op">,</span> <span class="str">"/"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="key">assert</span> <span class="nam">path_type</span> <span class="key">is</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="key">return</span> <span class="nam">MATCH_ANYTHING</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="com"># We do not support {a,b} at the moment. This check is not perfect, but it should catch the most obvious</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="com"># unsupported usage.</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"><span class="annotate short">153 ↛ 158</span><span class="annotate long">line 153 didn't jump to line 158</span></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="str">"{"</span> <span class="key">in</span> <span class="nam">path_or_glob</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="key">and</span> <span class="op">(</span><span class="str">","</span> <span class="key">in</span> <span class="nam">path_or_glob</span> <span class="key">or</span> <span class="str">".."</span> <span class="key">in</span> <span class="nam">path_or_glob</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="key">and</span> <span class="nam">re</span><span class="op">.</span><span class="nam">search</span><span class="op">(</span><span class="str">r"[{][^},.]*(?:,|[.][.])[^},.]*[}]"</span><span class="op">,</span> <span class="nam">path_or_glob</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">search</span><span class="op">(</span><span class="str">r"(.*)[{]([^},.]*(?:,|[.][.])[^},.]*[}])"</span><span class="op">,</span> <span class="nam">path_or_glob</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="key">assert</span> <span class="nam">m</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="nam">replacement</span> <span class="op">=</span> <span class="nam">m</span><span class="op">.</span><span class="nam">group</span><span class="op">(</span><span class="num">1</span><span class="op">)</span> <span class="op">+</span> <span class="str">"{{OPEN_CURLY_BRACE}}"</span> <span class="op">+</span> <span class="nam">m</span><span class="op">.</span><span class="nam">group</span><span class="op">(</span><span class="num">2</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="str">f'The pattern "{path_or_glob}" (defined in {definition_source}) looks like it contains a'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="str">f' brace expansion (such as "{{a,b}}" or "{{a..b}}"). Brace expansions are not supported.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="str">" If you wanted to match the literal path a brace in it, please use a substitution to insert"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="str">f' the opening brace. As an example: "{replacement}"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="nam">normalized_with_prefix</span> <span class="op">=</span> <span class="str">"./"</span> <span class="op">+</span> <span class="nam">normalized_no_prefix</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="com"># TODO: Check for escapes here "foo[?]/bar" can be written as an exact match for foo?/bar</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="com"># - similar holds for "foo[?]/*" being a directory match (etc.).</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">glob</span><span class="op">.</span><span class="nam">has_magic</span><span class="op">(</span><span class="nam">normalized_with_prefix</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="key">assert</span> <span class="nam">path_type</span> <span class="key">is</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="key">return</span> <span class="nam">ExactFileSystemPath</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="nam">substitution</span><span class="op">.</span><span class="nam">substitute</span><span class="op">(</span><span class="nam">normalized_with_prefix</span><span class="op">,</span> <span class="nam">definition_source</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="nam">directory</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">dirname</span><span class="op">(</span><span class="nam">normalized_with_prefix</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="nam">basename</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">basename</span><span class="op">(</span><span class="nam">normalized_with_prefix</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span><span class="str">"**"</span> <span class="key">in</span> <span class="nam">directory</span> <span class="key">and</span> <span class="nam">directory</span> <span class="op">!=</span> <span class="str">"./**"</span><span class="op">)</span> <span class="key">or</span> <span class="str">"**"</span> <span class="key">in</span> <span class="nam">basename</span><span class="op">:</span> </span><span class="r"><span class="annotate short">180 ↛ 181</span><span class="annotate long">line 180 didn't jump to line 181, because the condition on line 180 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="str">f'Cannot process pattern "{path_or_glob}" from {definition_source}: The double-star'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="str">' glob ("**") is not supported in general. Only "**/<basename-glob>" supported.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="key">if</span> <span class="nam">basename</span> <span class="op">==</span> <span class="str">"*"</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">glob</span><span class="op">.</span><span class="nam">has_magic</span><span class="op">(</span><span class="nam">directory</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="key">return</span> <span class="nam">DirectoryBasedMatch</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="nam">MatchRuleType</span><span class="op">.</span><span class="nam">DIRECT_CHILDREN_OF_DIR</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="nam">substitution</span><span class="op">.</span><span class="nam">substitute</span><span class="op">(</span><span class="nam">directory</span><span class="op">,</span> <span class="nam">definition_source</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="nam">path_type</span><span class="op">=</span><span class="nam">path_type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="key">elif</span> <span class="nam">directory</span> <span class="op">==</span> <span class="str">"./**"</span> <span class="key">or</span> <span class="key">not</span> <span class="nam">glob</span><span class="op">.</span><span class="nam">has_magic</span><span class="op">(</span><span class="nam">directory</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="nam">basename_glob</span> <span class="op">=</span> <span class="nam">substitution</span><span class="op">.</span><span class="nam">substitute</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="nam">basename</span><span class="op">,</span> <span class="nam">definition_source</span><span class="op">,</span> <span class="nam">escape_glob_characters</span><span class="op">=</span><span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="key">if</span> <span class="nam">directory</span> <span class="key">in</span> <span class="op">(</span><span class="str">"."</span><span class="op">,</span> <span class="str">"./**"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="key">return</span> <span class="nam">BasenameGlobMatch</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="nam">basename_glob</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="nam">path_type</span><span class="op">=</span><span class="nam">path_type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="nam">recursive_match</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="key">return</span> <span class="nam">BasenameGlobMatch</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="nam">basename_glob</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="nam">only_when_in_directory</span><span class="op">=</span><span class="nam">substitution</span><span class="op">.</span><span class="nam">substitute</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="nam">directory</span><span class="op">,</span> <span class="nam">definition_source</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="nam">path_type</span><span class="op">=</span><span class="nam">path_type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="nam">recursive_match</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="key">return</span> <span class="nam">GenericGlobImplementation</span><span class="op">(</span><span class="nam">normalized_with_prefix</span><span class="op">,</span> <span class="nam">path_type</span><span class="op">=</span><span class="nam">path_type</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"><span class="key">def</span> <span class="nam">_match_file_type</span><span class="op">(</span><span class="nam">path_type</span><span class="op">:</span> <span class="nam">PathType</span><span class="op">,</span> <span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="key">if</span> <span class="nam">path_type</span> <span class="op">==</span> <span class="nam">PathType</span><span class="op">.</span><span class="nam">FILE</span> <span class="key">and</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_file</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="key">if</span> <span class="nam">path_type</span> <span class="op">==</span> <span class="nam">PathType</span><span class="op">.</span><span class="nam">DIRECTORY</span> <span class="key">and</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"><span class="annotate short">217 ↛ 218</span><span class="annotate long">line 217 didn't jump to line 218, because the condition on line 217 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="key">if</span> <span class="nam">path_type</span> <span class="op">==</span> <span class="nam">PathType</span><span class="op">.</span><span class="nam">SYMLINK</span> <span class="key">and</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_symlink</span><span class="op">:</span> </span><span class="r"><span class="annotate short">219 ↛ 220</span><span class="annotate long">line 219 didn't jump to line 220, because the condition on line 219 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="key">assert</span> <span class="nam">path_type</span> <span class="key">in</span> <span class="op">(</span><span class="nam">PathType</span><span class="op">.</span><span class="nam">FILE</span><span class="op">,</span> <span class="nam">PathType</span><span class="op">.</span><span class="nam">DIRECTORY</span><span class="op">,</span> <span class="nam">PathType</span><span class="op">.</span><span class="nam">SYMLINK</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"><span class="key">class</span> <span class="nam">MatchAnything</span><span class="op">(</span><span class="nam">MatchRule</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="nam">MatchRuleType</span><span class="op">.</span><span class="nam">MATCH_ANYTHING</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="key">def</span> <span class="nam">_full_pattern</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="key">return</span> <span class="str">"**/*"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="key">def</span> <span class="nam">finditer</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VP</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">ignore_paths</span><span class="op">=</span><span class="key">None</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">VP</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="key">if</span> <span class="nam">ignore_paths</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="op">(</span><span class="nam">p</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">all_paths</span><span class="op">(</span><span class="op">)</span> <span class="key">if</span> <span class="key">not</span> <span class="nam">ignore_paths</span><span class="op">(</span><span class="nam">p</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">all_paths</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="key">def</span> <span class="nam">describe_match_exact</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="key">return</span> <span class="str">"**/* (Match anything)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"><span class="nam">MATCH_ANYTHING</span><span class="op">:</span> <span class="nam">MatchRule</span> <span class="op">=</span> <span class="nam">MatchAnything</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"><span class="key">del</span> <span class="nam">MatchAnything</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"><span class="key">class</span> <span class="nam">ExactFileSystemPath</span><span class="op">(</span><span class="nam">MatchRule</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="str">"_path"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">path</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="nam">MatchRuleType</span><span class="op">.</span><span class="nam">EXACT_MATCH</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_path</span> <span class="op">=</span> <span class="nam">path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="key">def</span> <span class="nam">_full_pattern</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="key">def</span> <span class="nam">finditer</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VP</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">ignore_paths</span><span class="op">=</span><span class="key">None</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">VP</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="nam">p</span> <span class="op">=</span> <span class="nam">_lookup_path</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="key">if</span> <span class="nam">p</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="op">(</span><span class="nam">ignore_paths</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="key">not</span> <span class="nam">ignore_paths</span><span class="op">(</span><span class="nam">p</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="key">yield</span> <span class="nam">p</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="key">def</span> <span class="nam">describe_match_exact</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="key">return</span> <span class="str">f"{self._path} (the exact path / no globbing)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="key">def</span> <span class="nam">path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="key">def</span> <span class="nam">shell_escape_pattern</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="key">return</span> <span class="nam">escape_shell</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_path</span><span class="op">.</span><span class="nam">lstrip</span><span class="op">(</span><span class="str">"."</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"><span class="key">class</span> <span class="nam">DirectoryBasedMatch</span><span class="op">(</span><span class="nam">MatchRule</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="str">"_directory"</span><span class="op">,</span> <span class="str">"_path_type"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="nam">rule_type</span><span class="op">:</span> <span class="nam">MatchRuleType</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="nam">directory</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="nam">path_type</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">PathType</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="nam">rule_type</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_directory</span> <span class="op">=</span> <span class="nam">directory</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_path_type</span> <span class="op">=</span> <span class="nam">path_type</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="key">assert</span> <span class="nam">rule_type</span> <span class="key">in</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="nam">MatchRuleType</span><span class="op">.</span><span class="nam">DIRECT_CHILDREN_OF_DIR</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="nam">MatchRuleType</span><span class="op">.</span><span class="nam">ANYTHING_BENEATH_DIR</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="key">assert</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_directory</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="key">def</span> <span class="nam">_full_pattern</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_directory</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="key">def</span> <span class="nam">finditer</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VP</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="nam">ignore_paths</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">VP</span><span class="op">]</span><span class="op">,</span> <span class="nam">bool</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">VP</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="nam">p</span> <span class="op">=</span> <span class="nam">_lookup_path</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_directory</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="key">if</span> <span class="nam">p</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="key">not</span> <span class="nam">p</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_rule_type</span> <span class="op">==</span> <span class="nam">MatchRuleType</span><span class="op">.</span><span class="nam">ANYTHING_BENEATH_DIR</span><span class="op">:</span> </span><span class="r"><span class="annotate short">302 ↛ 303</span><span class="annotate long">line 302 didn't jump to line 303, because the condition on line 302 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="nam">path_iter</span> <span class="op">=</span> <span class="nam">p</span><span class="op">.</span><span class="nam">all_paths</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="nam">path_iter</span> <span class="op">=</span> <span class="nam">p</span><span class="op">.</span><span class="nam">iterdir</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> <span class="key">if</span> <span class="nam">ignore_paths</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="nam">path_iter</span> <span class="op">=</span> <span class="op">(</span><span class="nam">p</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">path_iter</span> <span class="key">if</span> <span class="key">not</span> <span class="nam">ignore_paths</span><span class="op">(</span><span class="nam">p</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_path_type</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">path_iter</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="op">(</span><span class="nam">m</span> <span class="key">for</span> <span class="nam">m</span> <span class="key">in</span> <span class="nam">path_iter</span> <span class="key">if</span> <span class="nam">_match_file_type</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_path_type</span><span class="op">,</span> <span class="nam">m</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="key">def</span> <span class="nam">describe_match_short</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="nam">path_type_match</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="str">""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_path_type</span> <span class="key">is</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="key">else</span> <span class="str">f" <only for path type {self._path_type.manifest_key}>"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_rule_type</span> <span class="op">==</span> <span class="nam">MatchRuleType</span><span class="op">.</span><span class="nam">ANYTHING_BENEATH_DIR</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="key">return</span> <span class="str">f"{self._directory}/**/*{path_type_match}"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="key">return</span> <span class="str">f"{self._directory}/*{path_type_match}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> <span class="key">def</span> <span class="nam">describe_match_exact</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_rule_type</span> <span class="op">==</span> <span class="nam">MatchRuleType</span><span class="op">.</span><span class="nam">ANYTHING_BENEATH_DIR</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> <span class="key">return</span> <span class="str">f"{self._directory}/**/* (anything below the directory)"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> <span class="key">return</span> <span class="str">f"{self.describe_match_short()} (anything directly in the directory)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> <span class="key">def</span> <span class="nam">path_type</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">PathType</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_path_type</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> <span class="key">def</span> <span class="nam">directory</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_directory</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> <span class="key">def</span> <span class="nam">shell_escape_pattern</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_rule_type</span> <span class="op">==</span> <span class="nam">MatchRuleType</span><span class="op">.</span><span class="nam">ANYTHING_BENEATH_DIR</span><span class="op">:</span> </span><span class="r"><span class="annotate short">337 ↛ 338</span><span class="annotate long">line 337 didn't jump to line 338, because the condition on line 337 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> <span class="key">return</span> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">shell_escape_pattern</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"> <span class="key">return</span> <span class="nam">escape_shell</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_directory</span><span class="op">.</span><span class="nam">lstrip</span><span class="op">(</span><span class="str">"."</span><span class="op">)</span><span class="op">)</span> <span class="op">+</span> <span class="str">"/*"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"><span class="key">class</span> <span class="nam">BasenameGlobMatch</span><span class="op">(</span><span class="nam">MatchRule</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> <span class="str">"_basename_glob"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"> <span class="str">"_directory"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"> <span class="str">"_matcher"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"> <span class="str">"_path_type"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"> <span class="str">"_recursive_match"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"> <span class="str">"_escaped_basename_pattern"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"> <span class="nam">basename_glob</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"> <span class="nam">only_when_in_directory</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"> <span class="nam">path_type</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">PathType</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"> <span class="nam">recursive_match</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> <span class="com"># TODO: Can this just be = False (?)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="nam">MatchRuleType</span><span class="op">.</span><span class="nam">BASENAME_GLOB</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_basename_glob</span> <span class="op">=</span> <span class="nam">basename_glob</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_directory</span> <span class="op">=</span> <span class="nam">only_when_in_directory</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_path_type</span> <span class="op">=</span> <span class="nam">path_type</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_recursive_match</span> <span class="op">=</span> <span class="nam">recursive_match</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_directory</span> <span class="key">is</span> <span class="key">None</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">recursive_match</span><span class="op">:</span> </span><span class="r"><span class="annotate short">364 ↛ 365</span><span class="annotate long">line 364 didn't jump to line 365, because the condition on line 364 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_recursive_match</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"> <span class="key">assert</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_directory</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_directory</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"> <span class="key">assert</span> <span class="str">"/"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">basename_glob</span> <span class="com"># Not a basename if it contains /</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"> <span class="key">assert</span> <span class="str">"**"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">basename_glob</span> <span class="com"># Also not a (true) basename if it has **</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_escaped_basename_pattern</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_matcher</span> <span class="op">=</span> <span class="nam">_compile_basename_glob</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"> <span class="nam">basename_glob</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"> <span class="key">def</span> <span class="nam">_full_pattern</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_directory</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"> <span class="nam">maybe_recursive</span> <span class="op">=</span> <span class="str">"**/"</span> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_recursive_match</span> <span class="key">else</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"> <span class="key">return</span> <span class="str">f"{self._directory}/{maybe_recursive}{self._basename_glob}"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_basename_glob</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"> <span class="key">def</span> <span class="nam">finditer</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VP</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">ignore_paths</span><span class="op">=</span><span class="key">None</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">VP</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"> <span class="nam">search_root</span> <span class="op">=</span> <span class="nam">fs_root</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_directory</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"> <span class="nam">p</span> <span class="op">=</span> <span class="nam">_lookup_path</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_directory</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"> <span class="key">if</span> <span class="nam">p</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="key">not</span> <span class="nam">p</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t385" href="#t385">385</a></span><span class="t"> <span class="nam">search_root</span> <span class="op">=</span> <span class="nam">p</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t386" href="#t386">386</a></span><span class="t"> <span class="nam">path_iter</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t387" href="#t387">387</a></span><span class="t"> <span class="nam">search_root</span><span class="op">.</span><span class="nam">all_paths</span><span class="op">(</span><span class="op">)</span> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_recursive_match</span> <span class="key">else</span> <span class="nam">search_root</span><span class="op">.</span><span class="nam">iterdir</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t388" href="#t388">388</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t389" href="#t389">389</a></span><span class="t"> <span class="key">if</span> <span class="nam">ignore_paths</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t390" href="#t390">390</a></span><span class="t"> <span class="nam">path_iter</span> <span class="op">=</span> <span class="op">(</span><span class="nam">p</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">path_iter</span> <span class="key">if</span> <span class="key">not</span> <span class="nam">ignore_paths</span><span class="op">(</span><span class="nam">p</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t391" href="#t391">391</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_path_type</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t392" href="#t392">392</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="op">(</span><span class="nam">m</span> <span class="key">for</span> <span class="nam">m</span> <span class="key">in</span> <span class="nam">path_iter</span> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_matcher</span><span class="op">(</span><span class="nam">m</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t393" href="#t393">393</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t394" href="#t394">394</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t395" href="#t395">395</a></span><span class="t"> <span class="nam">m</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t396" href="#t396">396</a></span><span class="t"> <span class="key">for</span> <span class="nam">m</span> <span class="key">in</span> <span class="nam">path_iter</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t397" href="#t397">397</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_matcher</span><span class="op">(</span><span class="nam">m</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> <span class="key">and</span> <span class="nam">_match_file_type</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_path_type</span><span class="op">,</span> <span class="nam">m</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t398" href="#t398">398</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t399" href="#t399">399</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t400" href="#t400">400</a></span><span class="t"> <span class="key">def</span> <span class="nam">describe_match_short</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t401" href="#t401">401</a></span><span class="t"> <span class="nam">path_type_match</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t402" href="#t402">402</a></span><span class="t"> <span class="str">""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t403" href="#t403">403</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_path_type</span> <span class="key">is</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t404" href="#t404">404</a></span><span class="t"> <span class="key">else</span> <span class="str">f" <only for path type {self._path_type.manifest_key}>"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t405" href="#t405">405</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t406" href="#t406">406</a></span><span class="t"> <span class="key">return</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t407" href="#t407">407</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_full_pattern</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t408" href="#t408">408</a></span><span class="t"> <span class="key">if</span> <span class="nam">path_type_match</span> <span class="op">==</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t409" href="#t409">409</a></span><span class="t"> <span class="key">else</span> <span class="str">f"{self._full_pattern()}{path_type_match}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t410" href="#t410">410</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t411" href="#t411">411</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t412" href="#t412">412</a></span><span class="t"> <span class="key">def</span> <span class="nam">describe_match_exact</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t413" href="#t413">413</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_directory</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t414" href="#t414">414</a></span><span class="t"> <span class="key">return</span> <span class="str">f"{self.describe_match_short()} (glob / directly in the directory)"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t415" href="#t415">415</a></span><span class="t"> <span class="key">return</span> <span class="str">f"{self.describe_match_short()} (basename match)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t416" href="#t416">416</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t417" href="#t417">417</a></span><span class="t"> <span class="key">def</span> <span class="nam">__eq__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">other</span><span class="op">:</span> <span class="nam">object</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t418" href="#t418">418</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">other</span><span class="op">,</span> <span class="nam">BasenameGlobMatch</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t419" href="#t419">419</a></span><span class="t"> <span class="key">return</span> <span class="nam">NotImplemented</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t420" href="#t420">420</a></span><span class="t"> <span class="key">return</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t421" href="#t421">421</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_basename_glob</span> <span class="op">==</span> <span class="nam">other</span><span class="op">.</span><span class="nam">_basename_glob</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t422" href="#t422">422</a></span><span class="t"> <span class="key">and</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_directory</span> <span class="op">==</span> <span class="nam">other</span><span class="op">.</span><span class="nam">_directory</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t423" href="#t423">423</a></span><span class="t"> <span class="key">and</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_path_type</span> <span class="op">==</span> <span class="nam">other</span><span class="op">.</span><span class="nam">_path_type</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t424" href="#t424">424</a></span><span class="t"> <span class="key">and</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_recursive_match</span> <span class="op">==</span> <span class="nam">other</span><span class="op">.</span><span class="nam">_recursive_match</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t425" href="#t425">425</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t426" href="#t426">426</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t427" href="#t427">427</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t428" href="#t428">428</a></span><span class="t"> <span class="key">def</span> <span class="nam">path_type</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">PathType</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t429" href="#t429">429</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_path_type</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t430" href="#t430">430</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t431" href="#t431">431</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t432" href="#t432">432</a></span><span class="t"> <span class="key">def</span> <span class="nam">directory</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t433" href="#t433">433</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_directory</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t434" href="#t434">434</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t435" href="#t435">435</a></span><span class="t"> <span class="key">def</span> <span class="nam">shell_escape_pattern</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t436" href="#t436">436</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_directory</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_escaped_basename_pattern</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t437" href="#t437">437</a></span><span class="t"> <span class="key">return</span> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">shell_escape_pattern</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t438" href="#t438">438</a></span><span class="t"> <span class="key">return</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t439" href="#t439">439</a></span><span class="t"> <span class="nam">escape_shell</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_directory</span><span class="op">.</span><span class="nam">lstrip</span><span class="op">(</span><span class="str">"."</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t440" href="#t440">440</a></span><span class="t"> <span class="op">+</span> <span class="str">f"/{self._escaped_basename_pattern}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t441" href="#t441">441</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t442" href="#t442">442</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t443" href="#t443">443</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t444" href="#t444">444</a></span><span class="t"><span class="key">class</span> <span class="nam">GenericGlobImplementation</span><span class="op">(</span><span class="nam">MatchRule</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t445" href="#t445">445</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="str">"_glob_pattern"</span><span class="op">,</span> <span class="str">"_path_type"</span><span class="op">,</span> <span class="str">"_match_parts"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t446" href="#t446">446</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t447" href="#t447">447</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t448" href="#t448">448</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t449" href="#t449">449</a></span><span class="t"> <span class="nam">glob_pattern</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t450" href="#t450">450</a></span><span class="t"> <span class="nam">path_type</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">PathType</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t451" href="#t451">451</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t452" href="#t452">452</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="nam">MatchRuleType</span><span class="op">.</span><span class="nam">GENERIC_GLOB</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t453" href="#t453">453</a></span><span class="t"> <span class="key">if</span> <span class="nam">glob_pattern</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"./"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">453 ↛ 455</span><span class="annotate long">line 453 didn't jump to line 455, because the condition on line 453 was never false</span></span></p> - <p class="run"><span class="n"><a id="t454" href="#t454">454</a></span><span class="t"> <span class="nam">glob_pattern</span> <span class="op">=</span> <span class="nam">glob_pattern</span><span class="op">[</span><span class="num">2</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t455" href="#t455">455</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_glob_pattern</span> <span class="op">=</span> <span class="nam">glob_pattern</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t456" href="#t456">456</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_path_type</span> <span class="op">=</span> <span class="nam">path_type</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t457" href="#t457">457</a></span><span class="t"> <span class="key">assert</span> <span class="str">"**"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">glob_pattern</span> <span class="com"># No recursive globs</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t458" href="#t458">458</a></span><span class="t"> <span class="key">assert</span> <span class="nam">glob</span><span class="op">.</span><span class="nam">has_magic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t459" href="#t459">459</a></span><span class="t"> <span class="nam">glob_pattern</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t460" href="#t460">460</a></span><span class="t"> <span class="op">)</span> <span class="com"># If it has no glob, then it could have been an exact match</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t461" href="#t461">461</a></span><span class="t"> <span class="key">assert</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t462" href="#t462">462</a></span><span class="t"> <span class="str">"/"</span> <span class="key">in</span> <span class="nam">glob_pattern</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t463" href="#t463">463</a></span><span class="t"> <span class="op">)</span> <span class="com"># If it does not have a / then a BasenameGlob could have been used instead</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t464" href="#t464">464</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_match_parts</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_compile_glob</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t465" href="#t465">465</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t466" href="#t466">466</a></span><span class="t"> <span class="key">def</span> <span class="nam">_full_pattern</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t467" href="#t467">467</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_glob_pattern</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t468" href="#t468">468</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t469" href="#t469">469</a></span><span class="t"> <span class="key">def</span> <span class="nam">finditer</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VP</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">ignore_paths</span><span class="op">=</span><span class="key">None</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">VP</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t470" href="#t470">470</a></span><span class="t"> <span class="nam">search_history</span> <span class="op">=</span> <span class="op">[</span><span class="nam">fs_root</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t471" href="#t471">471</a></span><span class="t"> <span class="key">for</span> <span class="nam">part</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_match_parts</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t472" href="#t472">472</a></span><span class="t"> <span class="nam">next_layer</span> <span class="op">=</span> <span class="nam">itertools</span><span class="op">.</span><span class="nam">chain</span><span class="op">.</span><span class="nam">from_iterable</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t473" href="#t473">473</a></span><span class="t"> <span class="nam">_apply_match</span><span class="op">(</span><span class="nam">m</span><span class="op">,</span> <span class="nam">part</span><span class="op">)</span> <span class="key">for</span> <span class="nam">m</span> <span class="key">in</span> <span class="nam">search_history</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t474" href="#t474">474</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t475" href="#t475">475</a></span><span class="t"> <span class="com"># TODO: Figure out why we need to materialize next_layer into a list for this to work.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t476" href="#t476">476</a></span><span class="t"> <span class="nam">search_history</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">next_layer</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t477" href="#t477">477</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">search_history</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t478" href="#t478">478</a></span><span class="t"> <span class="com"># While we have it as a list, we might as well have an "early exit".</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t479" href="#t479">479</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t480" href="#t480">480</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t481" href="#t481">481</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_path_type</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t482" href="#t482">482</a></span><span class="t"> <span class="key">if</span> <span class="nam">ignore_paths</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t483" href="#t483">483</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">search_history</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t484" href="#t484">484</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t485" href="#t485">485</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="op">(</span><span class="nam">p</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">search_history</span> <span class="key">if</span> <span class="key">not</span> <span class="nam">ignore_paths</span><span class="op">(</span><span class="nam">p</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t486" href="#t486">486</a></span><span class="t"> <span class="key">elif</span> <span class="nam">ignore_paths</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t487" href="#t487">487</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t488" href="#t488">488</a></span><span class="t"> <span class="nam">m</span> <span class="key">for</span> <span class="nam">m</span> <span class="key">in</span> <span class="nam">search_history</span> <span class="key">if</span> <span class="nam">_match_file_type</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_path_type</span><span class="op">,</span> <span class="nam">m</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t489" href="#t489">489</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t490" href="#t490">490</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t491" href="#t491">491</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t492" href="#t492">492</a></span><span class="t"> <span class="nam">m</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t493" href="#t493">493</a></span><span class="t"> <span class="key">for</span> <span class="nam">m</span> <span class="key">in</span> <span class="nam">search_history</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t494" href="#t494">494</a></span><span class="t"> <span class="key">if</span> <span class="nam">_match_file_type</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_path_type</span><span class="op">,</span> <span class="nam">m</span><span class="op">)</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">ignore_paths</span><span class="op">(</span><span class="nam">m</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t495" href="#t495">495</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t496" href="#t496">496</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t497" href="#t497">497</a></span><span class="t"> <span class="key">def</span> <span class="nam">describe_match_short</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t498" href="#t498">498</a></span><span class="t"> <span class="nam">path_type_match</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t499" href="#t499">499</a></span><span class="t"> <span class="str">""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t500" href="#t500">500</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_path_type</span> <span class="key">is</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t501" href="#t501">501</a></span><span class="t"> <span class="key">else</span> <span class="str">f" <only for path type {self._path_type.manifest_key}>"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t502" href="#t502">502</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t503" href="#t503">503</a></span><span class="t"> <span class="key">return</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t504" href="#t504">504</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_full_pattern</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t505" href="#t505">505</a></span><span class="t"> <span class="key">if</span> <span class="nam">path_type_match</span> <span class="op">==</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t506" href="#t506">506</a></span><span class="t"> <span class="key">else</span> <span class="str">f"{self._full_pattern()}{path_type_match}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t507" href="#t507">507</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t508" href="#t508">508</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t509" href="#t509">509</a></span><span class="t"> <span class="key">def</span> <span class="nam">describe_match_exact</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t510" href="#t510">510</a></span><span class="t"> <span class="key">return</span> <span class="str">f"{self.describe_match_short()} (glob)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t511" href="#t511">511</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t512" href="#t512">512</a></span><span class="t"> <span class="key">def</span> <span class="nam">_compile_glob</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">bool</span><span class="op">]</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t513" href="#t513">513</a></span><span class="t"> <span class="key">assert</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_glob_pattern</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span> <span class="op">==</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_glob_pattern</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t514" href="#t514">514</a></span><span class="t"> <span class="key">return</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t515" href="#t515">515</a></span><span class="t"> <span class="nam">_compile_basename_glob</span><span class="op">(</span><span class="nam">part</span><span class="op">)</span> <span class="key">if</span> <span class="nam">glob</span><span class="op">.</span><span class="nam">has_magic</span><span class="op">(</span><span class="nam">part</span><span class="op">)</span> <span class="key">else</span> <span class="nam">part</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t516" href="#t516">516</a></span><span class="t"> <span class="key">for</span> <span class="nam">part</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_glob_pattern</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t517" href="#t517">517</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t518" href="#t518">518</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t519" href="#t519">519</a></span><span class="t"> <span class="key">def</span> <span class="nam">__eq__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">other</span><span class="op">:</span> <span class="nam">object</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t520" href="#t520">520</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">other</span><span class="op">,</span> <span class="nam">GenericGlobImplementation</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t521" href="#t521">521</a></span><span class="t"> <span class="key">return</span> <span class="nam">NotImplemented</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t522" href="#t522">522</a></span><span class="t"> <span class="key">return</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t523" href="#t523">523</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_glob_pattern</span> <span class="op">==</span> <span class="nam">other</span><span class="op">.</span><span class="nam">_glob_pattern</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t524" href="#t524">524</a></span><span class="t"> <span class="key">and</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_path_type</span> <span class="op">==</span> <span class="nam">other</span><span class="op">.</span><span class="nam">_path_type</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t525" href="#t525">525</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t526" href="#t526">526</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t527" href="#t527">527</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t528" href="#t528">528</a></span><span class="t"> <span class="key">def</span> <span class="nam">path_type</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">PathType</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t529" href="#t529">529</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_path_type</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_36a196ce5f578895_makeshlibs_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_4faea183f900b252___init___py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_267b6307937f1878_substitution_py.html b/coverage-report/d_267b6307937f1878_substitution_py.html deleted file mode 100644 index 07beea1..0000000 --- a/coverage-report/d_267b6307937f1878_substitution_py.html +++ /dev/null @@ -1,435 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/substitution.py: 85%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/substitution.py</b>: - <span class="pc_cov">85%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">153 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">133<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">20<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">6<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">8<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_d5d6843b45eec01e_types_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_transformation_rules_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">dataclasses</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">re</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">from</span> <span class="nam">enum</span> <span class="key">import</span> <span class="nam">IntEnum</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">FrozenSet</span><span class="op">,</span> <span class="nam">NoReturn</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">,</span> <span class="nam">Set</span><span class="op">,</span> <span class="nam">Mapping</span><span class="op">,</span> <span class="nam">TYPE_CHECKING</span><span class="op">,</span> <span class="nam">Self</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">architecture_support</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">dpkg_architecture_table</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">DpkgArchitectureBuildProcessValuesTable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">exceptions</span> <span class="key">import</span> <span class="nam">DebputySubstitutionError</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">glob_escape</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"><span class="key">if</span> <span class="nam">TYPE_CHECKING</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">feature_set</span> <span class="key">import</span> <span class="nam">PluginProvidedFeatureSet</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="nam">VirtualPath</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"><span class="nam">SUBST_VAR_RE</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="str">r"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"><span class="str"> ([{][{][ ]*)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"><span class="str"> (</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"><span class="str"> _?[A-Za-z0-9]+</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"><span class="str"> (?:[-_:][A-Za-z0-9]+)*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"><span class="str"> )</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"><span class="str"> ([ ]*[}][}])</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"><span class="str">"""</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="nam">re</span><span class="op">.</span><span class="nam">VERBOSE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"><span class="key">class</span> <span class="nam">VariableNameState</span><span class="op">(</span><span class="nam">IntEnum</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="nam">UNDEFINED</span> <span class="op">=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="nam">RESERVED</span> <span class="op">=</span> <span class="num">2</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="nam">DEFINED</span> <span class="op">=</span> <span class="num">3</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"><span class="key">class</span> <span class="nam">VariableContext</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="str">"VirtualPath"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"><span class="key">class</span> <span class="nam">Substitution</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="key">def</span> <span class="nam">substitute</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="nam">value</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="op">/</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="nam">escape_glob_characters</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="key">def</span> <span class="nam">with_extra_substitutions</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">**</span><span class="nam">extra_substitutions</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="str">"Substitution"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="key">def</span> <span class="nam">with_unresolvable_substitutions</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> <span class="op">*</span><span class="nam">extra_substitutions</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"Substitution"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="key">def</span> <span class="nam">variable_state</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">variable_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">VariableNameState</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="key">return</span> <span class="nam">VariableNameState</span><span class="op">.</span><span class="nam">UNDEFINED</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_used</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">variable_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="key">def</span> <span class="nam">_mark_used</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">variable_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="key">def</span> <span class="nam">_replacement</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">matched_key</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="str">"Cannot resolve {{"</span> <span class="op">+</span> <span class="nam">matched_key</span> <span class="op">+</span> <span class="str">"}}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="str">f" The error occurred while trying to process {definition_source}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="key">def</span> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="nam">msg</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="nam">caused_by</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">BaseException</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">NoReturn</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="key">raise</span> <span class="nam">DebputySubstitutionError</span><span class="op">(</span><span class="nam">msg</span><span class="op">)</span> <span class="key">from</span> <span class="nam">caused_by</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="key">def</span> <span class="nam">_apply_substitution</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="nam">pattern</span><span class="op">:</span> <span class="nam">re</span><span class="op">.</span><span class="nam">Pattern</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="nam">value</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="op">/</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="nam">escape_glob_characters</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="nam">replacement</span> <span class="op">=</span> <span class="nam">value</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="nam">offset</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="key">for</span> <span class="nam">match</span> <span class="key">in</span> <span class="nam">pattern</span><span class="op">.</span><span class="nam">finditer</span><span class="op">(</span><span class="nam">value</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="nam">prefix</span><span class="op">,</span> <span class="nam">matched_key</span><span class="op">,</span> <span class="nam">suffix</span> <span class="op">=</span> <span class="nam">match</span><span class="op">.</span><span class="nam">groups</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="nam">replacement_value</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_replacement</span><span class="op">(</span><span class="nam">matched_key</span><span class="op">,</span> <span class="nam">definition_source</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_mark_used</span><span class="op">(</span><span class="nam">matched_key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="key">if</span> <span class="nam">escape_glob_characters</span><span class="op">:</span> </span><span class="r"><span class="annotate short">100 ↛ 101</span><span class="annotate long">line 100 didn't jump to line 101, because the condition on line 100 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="nam">replacement_value</span> <span class="op">=</span> <span class="nam">glob_escape</span><span class="op">(</span><span class="nam">replacement_value</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="nam">s</span><span class="op">,</span> <span class="nam">e</span> <span class="op">=</span> <span class="nam">match</span><span class="op">.</span><span class="nam">span</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="nam">s</span> <span class="op">+=</span> <span class="nam">offset</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="nam">e</span> <span class="op">+=</span> <span class="nam">offset</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="nam">replacement</span> <span class="op">=</span> <span class="nam">replacement</span><span class="op">[</span><span class="op">:</span><span class="nam">s</span><span class="op">]</span> <span class="op">+</span> <span class="nam">replacement_value</span> <span class="op">+</span> <span class="nam">replacement</span><span class="op">[</span><span class="nam">e</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="nam">token_fluff_len</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">prefix</span><span class="op">)</span> <span class="op">+</span> <span class="nam">len</span><span class="op">(</span><span class="nam">suffix</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="nam">offset</span> <span class="op">+=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">replacement_value</span><span class="op">)</span> <span class="op">-</span> <span class="nam">len</span><span class="op">(</span><span class="nam">matched_key</span><span class="op">)</span> <span class="op">-</span> <span class="nam">token_fluff_len</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="key">return</span> <span class="nam">replacement</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"><span class="key">class</span> <span class="nam">NullSubstitution</span><span class="op">(</span><span class="nam">Substitution</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="key">def</span> <span class="nam">substitute</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="nam">value</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="op">/</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="nam">escape_glob_characters</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="key">return</span> <span class="nam">value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="key">def</span> <span class="nam">with_extra_substitutions</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">**</span><span class="nam">extra_substitutions</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="str">"Substitution"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="key">def</span> <span class="nam">with_unresolvable_substitutions</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> <span class="op">*</span><span class="nam">extra_substitutions</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"Substitution"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"><span class="nam">NULL_SUBSTITUTION</span> <span class="op">=</span> <span class="nam">NullSubstitution</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"><span class="key">del</span> <span class="nam">NullSubstitution</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"><span class="key">class</span> <span class="nam">SubstitutionImpl</span><span class="op">(</span><span class="nam">Substitution</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="str">"_used"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="str">"_env"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="str">"_plugin_feature_set"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="str">"_static_variables"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="str">"_unresolvable_substitutions"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="str">"_dpkg_arch_table"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="str">"_parent"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="str">"_variable_context"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="op">/</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="nam">plugin_feature_set</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"PluginProvidedFeatureSet"</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="nam">static_variables</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="nam">unresolvable_substitutions</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="nam">dpkg_arch_table</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">DpkgArchitectureBuildProcessValuesTable</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="nam">environment</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="nam">parent</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"SubstitutionImpl"</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="nam">variable_context</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">VariableContext</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_used</span><span class="op">:</span> <span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_feature_set</span> <span class="op">=</span> <span class="nam">plugin_feature_set</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_static_variables</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="nam">dict</span><span class="op">(</span><span class="nam">static_variables</span><span class="op">)</span> <span class="key">if</span> <span class="nam">static_variables</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">else</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_unresolvable_substitutions</span> <span class="op">=</span> <span class="nam">unresolvable_substitutions</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_dpkg_arch_table</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="nam">dpkg_arch_table</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="key">if</span> <span class="nam">dpkg_arch_table</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="key">else</span> <span class="nam">dpkg_architecture_table</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_env</span> <span class="op">=</span> <span class="nam">environment</span> <span class="key">if</span> <span class="nam">environment</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">else</span> <span class="nam">os</span><span class="op">.</span><span class="nam">environ</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent</span> <span class="op">=</span> <span class="nam">parent</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="key">if</span> <span class="nam">variable_context</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_variable_context</span> <span class="op">=</span> <span class="nam">variable_context</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="key">elif</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">172 ↛ 175</span><span class="annotate long">line 172 didn't jump to line 175, because the condition on line 172 was never false</span></span></p> - <p class="run"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_variable_context</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent</span><span class="op">.</span><span class="nam">_variable_context</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="str">"variable_context is required either directly or via the parent"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="key">def</span> <span class="nam">copy_for_subst_test</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="nam">plugin_feature_set</span><span class="op">:</span> <span class="str">"PluginProvidedFeatureSet"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="nam">variable_context</span><span class="op">:</span> <span class="nam">VariableContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="nam">extra_substitutions</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="nam">environment</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"Self"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="nam">extra_substitutions_impl</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="nam">dict</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_static_variables</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_static_variables</span> <span class="key">else</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="key">if</span> <span class="nam">extra_substitutions</span><span class="op">:</span> </span><span class="r"><span class="annotate short">190 ↛ 191</span><span class="annotate long">line 190 didn't jump to line 191, because the condition on line 190 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="nam">extra_substitutions_impl</span><span class="op">.</span><span class="nam">update</span><span class="op">(</span><span class="nam">extra_substitutions</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">__class__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="nam">plugin_feature_set</span><span class="op">=</span><span class="nam">plugin_feature_set</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="nam">variable_context</span><span class="op">=</span><span class="nam">variable_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="nam">static_variables</span><span class="op">=</span><span class="nam">extra_substitutions_impl</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="nam">unresolvable_substitutions</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">_unresolvable_substitutions</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="nam">dpkg_arch_table</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">_dpkg_arch_table</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="nam">environment</span><span class="op">=</span><span class="nam">environment</span> <span class="key">if</span> <span class="nam">environment</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">else</span> <span class="op">{</span><span class="op">}</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="key">def</span> <span class="nam">variable_state</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">key</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">VariableNameState</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="key">if</span> <span class="nam">key</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"DEB_"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="key">if</span> <span class="nam">key</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_dpkg_arch_table</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="key">return</span> <span class="nam">VariableNameState</span><span class="op">.</span><span class="nam">DEFINED</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="key">return</span> <span class="nam">VariableNameState</span><span class="op">.</span><span class="nam">RESERVED</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="nam">plugin_feature_set</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_feature_set</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="nam">plugin_feature_set</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="key">and</span> <span class="nam">key</span> <span class="key">in</span> <span class="nam">plugin_feature_set</span><span class="op">.</span><span class="nam">manifest_variables</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="key">return</span> <span class="nam">VariableNameState</span><span class="op">.</span><span class="nam">DEFINED</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="key">if</span> <span class="nam">key</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"env:"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="nam">k</span> <span class="op">=</span> <span class="nam">key</span><span class="op">[</span><span class="num">4</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="key">if</span> <span class="nam">k</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_env</span><span class="op">:</span> </span><span class="r"><span class="annotate short">214 ↛ 215</span><span class="annotate long">line 214 didn't jump to line 215, because the condition on line 214 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="key">return</span> <span class="nam">VariableNameState</span><span class="op">.</span><span class="nam">DEFINED</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="key">return</span> <span class="nam">VariableNameState</span><span class="op">.</span><span class="nam">RESERVED</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_static_variables</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">key</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_static_variables</span><span class="op">:</span> </span><span class="r"><span class="annotate short">217 ↛ 218</span><span class="annotate long">line 217 didn't jump to line 218, because the condition on line 217 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="key">return</span> <span class="nam">VariableNameState</span><span class="op">.</span><span class="nam">DEFINED</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="key">if</span> <span class="nam">key</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_unresolvable_substitutions</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="key">return</span> <span class="nam">VariableNameState</span><span class="op">.</span><span class="nam">RESERVED</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent</span><span class="op">.</span><span class="nam">variable_state</span><span class="op">(</span><span class="nam">key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="key">return</span> <span class="nam">VariableNameState</span><span class="op">.</span><span class="nam">UNDEFINED</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_used</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">variable_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="key">if</span> <span class="nam">variable_name</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_used</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="nam">parent</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="key">if</span> <span class="nam">parent</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="key">return</span> <span class="nam">parent</span><span class="op">.</span><span class="nam">is_used</span><span class="op">(</span><span class="nam">variable_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="key">def</span> <span class="nam">_mark_used</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">variable_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="nam">p</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="key">while</span> <span class="nam">p</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="com"># Find the parent that has the variable if possible. This ensures that is_used works</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="com"># correctly.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="key">if</span> <span class="nam">p</span><span class="op">.</span><span class="nam">_static_variables</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">variable_name</span> <span class="key">in</span> <span class="nam">p</span><span class="op">.</span><span class="nam">_static_variables</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="nam">p</span><span class="op">.</span><span class="nam">_mark_used</span><span class="op">(</span><span class="nam">variable_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="nam">plugin_feature_set</span> <span class="op">=</span> <span class="nam">p</span><span class="op">.</span><span class="nam">_plugin_feature_set</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"><span class="annotate short">242 ↛ 249</span><span class="annotate long">line 242 didn't jump to line 249</span></span></p> - <p class="pln"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="nam">plugin_feature_set</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="key">and</span> <span class="nam">variable_name</span> <span class="key">in</span> <span class="nam">plugin_feature_set</span><span class="op">.</span><span class="nam">manifest_variables</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="key">and</span> <span class="key">not</span> <span class="nam">plugin_feature_set</span><span class="op">.</span><span class="nam">manifest_variables</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="nam">variable_name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="op">]</span><span class="op">.</span><span class="nam">is_documentation_placeholder</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="nam">p</span><span class="op">.</span><span class="nam">_mark_used</span><span class="op">(</span><span class="nam">variable_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="nam">p</span> <span class="op">=</span> <span class="nam">p</span><span class="op">.</span><span class="nam">_parent</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_used</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">variable_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="key">def</span> <span class="nam">_replacement</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">key</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="key">if</span> <span class="nam">key</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"DEB_"</span><span class="op">)</span> <span class="key">and</span> <span class="nam">key</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_dpkg_arch_table</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_dpkg_arch_table</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="key">if</span> <span class="nam">key</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"env:"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">257 ↛ 258</span><span class="annotate long">line 257 didn't jump to line 258, because the condition on line 257 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="nam">k</span> <span class="op">=</span> <span class="nam">key</span><span class="op">[</span><span class="num">4</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="key">if</span> <span class="nam">k</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_env</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_env</span><span class="op">[</span><span class="nam">k</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="str">f'The environment does not contain the variable "{key}" '</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="str">f"(error occurred while trying to process {definition_source})"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="com"># The order between extra_substitution and plugin_feature_set is leveraged by</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="com"># the tests to implement mocking variables. If the order needs tweaking,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="com"># you will need a custom resolver for the tests to support mocking.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="nam">static_variables</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_static_variables</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="key">if</span> <span class="nam">static_variables</span> <span class="key">and</span> <span class="nam">key</span> <span class="key">in</span> <span class="nam">static_variables</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="key">return</span> <span class="nam">static_variables</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="nam">plugin_feature_set</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_feature_set</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="key">if</span> <span class="nam">plugin_feature_set</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="nam">provided_var</span> <span class="op">=</span> <span class="nam">plugin_feature_set</span><span class="op">.</span><span class="nam">manifest_variables</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="nam">provided_var</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="key">and</span> <span class="key">not</span> <span class="nam">provided_var</span><span class="op">.</span><span class="nam">is_documentation_placeholder</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="nam">v</span> <span class="op">=</span> <span class="nam">provided_var</span><span class="op">.</span><span class="nam">resolve</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_variable_context</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="com"># cache it for next time.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="key">if</span> <span class="nam">static_variables</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="nam">static_variables</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_static_variables</span> <span class="op">=</span> <span class="nam">static_variables</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="nam">static_variables</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> <span class="op">=</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="key">return</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="key">if</span> <span class="nam">key</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_unresolvable_substitutions</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="str">"The variable {{"</span> <span class="op">+</span> <span class="nam">key</span> <span class="op">+</span> <span class="str">"}}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="str">f" is not available while processing {definition_source}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="nam">parent</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> <span class="key">if</span> <span class="nam">parent</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="key">return</span> <span class="nam">parent</span><span class="op">.</span><span class="nam">_replacement</span><span class="op">(</span><span class="nam">key</span><span class="op">,</span> <span class="nam">definition_source</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="str">"Cannot resolve {{"</span> <span class="op">+</span> <span class="nam">key</span> <span class="op">+</span> <span class="str">"}}: it is not a known key."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> <span class="str">f" The error occurred while trying to process {definition_source}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="key">def</span> <span class="nam">with_extra_substitutions</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">**</span><span class="nam">extra_substitutions</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="str">"Substitution"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">extra_substitutions</span><span class="op">:</span> </span><span class="r"><span class="annotate short">300 ↛ 301</span><span class="annotate long">line 300 didn't jump to line 301, because the condition on line 300 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="key">return</span> <span class="nam">SubstitutionImpl</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="nam">dpkg_arch_table</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">_dpkg_arch_table</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> <span class="nam">environment</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">_env</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="nam">static_variables</span><span class="op">=</span><span class="nam">extra_substitutions</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> <span class="nam">parent</span><span class="op">=</span><span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="key">def</span> <span class="nam">with_unresolvable_substitutions</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="op">*</span><span class="nam">extra_substitutions</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"Substitution"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">extra_substitutions</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="key">return</span> <span class="nam">SubstitutionImpl</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="nam">dpkg_arch_table</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">_dpkg_arch_table</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="nam">environment</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">_env</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="nam">unresolvable_substitutions</span><span class="op">=</span><span class="nam">frozenset</span><span class="op">(</span><span class="nam">extra_substitutions</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="nam">parent</span><span class="op">=</span><span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="key">def</span> <span class="nam">substitute</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> <span class="nam">value</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> <span class="op">/</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> <span class="nam">escape_glob_characters</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> <span class="key">if</span> <span class="str">"{{"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">value</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> <span class="key">return</span> <span class="nam">value</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_apply_substitution</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> <span class="nam">SUBST_VAR_RE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> <span class="nam">value</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> <span class="nam">escape_glob_characters</span><span class="op">=</span><span class="nam">escape_glob_characters</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_d5d6843b45eec01e_types_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_transformation_rules_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_267b6307937f1878_transformation_rules_py.html b/coverage-report/d_267b6307937f1878_transformation_rules_py.html deleted file mode 100644 index a6e4f58..0000000 --- a/coverage-report/d_267b6307937f1878_transformation_rules_py.html +++ /dev/null @@ -1,695 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/transformation_rules.py: 73%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/transformation_rules.py</b>: - <span class="pc_cov">73%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">271 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">214<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">57<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">2<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">24<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_substitution_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_types_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">dataclasses</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> <span class="nam">NoReturn</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="nam">Callable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">Sequence</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">List</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">Literal</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">Dict</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">TypeVar</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">cast</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">exceptions</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">DebputyRuntimeError</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">PureVirtualPathError</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">TestPathWithNonExistentFSPathError</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">filesystem_scan</span> <span class="key">import</span> <span class="nam">FSPath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">interpreter</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="nam">extract_shebang_interpreter_from_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_conditions</span> <span class="key">import</span> <span class="nam">ConditionContext</span><span class="op">,</span> <span class="nam">ManifestCondition</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">base_types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="nam">FileSystemMode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="nam">StaticFileSystemOwner</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="nam">StaticFileSystemGroup</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="nam">DebputyDispatchableType</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">AttributePath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">path_matcher</span> <span class="key">import</span> <span class="nam">MatchRule</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="nam">VirtualPath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">debputy</span><span class="op">.</span><span class="nam">types</span> <span class="key">import</span> <span class="nam">DebputyCapability</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">_warn</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"><span class="key">class</span> <span class="nam">TransformationRuntimeError</span><span class="op">(</span><span class="nam">DebputyRuntimeError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"><span class="nam">CreateSymlinkReplacementRule</span> <span class="op">=</span> <span class="nam">Literal</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="str">"error-if-exists"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="str">"error-if-directory"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="str">"abort-on-non-empty-directory"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="str">"discard-existing"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"><span class="nam">VP</span> <span class="op">=</span> <span class="nam">TypeVar</span><span class="op">(</span><span class="str">"VP"</span><span class="op">,</span> <span class="nam">bound</span><span class="op">=</span><span class="nam">VirtualPath</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"><span class="key">class</span> <span class="nam">PreProvidedExclusion</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">tag</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="nam">description</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="nam">pruner</span><span class="op">:</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">FSPath</span><span class="op">]</span><span class="op">,</span> <span class="key">None</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"><span class="key">class</span> <span class="nam">TransformationRule</span><span class="op">(</span><span class="nam">DebputyDispatchableType</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="key">def</span> <span class="nam">transform_file_system</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">FSPath</span><span class="op">,</span> <span class="nam">condition_context</span><span class="op">:</span> <span class="nam">ConditionContext</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="key">def</span> <span class="nam">_evaluate_condition</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="nam">condition</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ManifestCondition</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="nam">condition_context</span><span class="op">:</span> <span class="nam">ConditionContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="nam">result_if_condition_is_missing</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="key">if</span> <span class="nam">condition</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">75 ↛ 77</span><span class="annotate long">line 75 didn't jump to line 77, because the condition on line 75 was never false</span></span></p> - <p class="run"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="key">return</span> <span class="nam">result_if_condition_is_missing</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="key">return</span> <span class="nam">condition</span><span class="op">.</span><span class="nam">evaluate</span><span class="op">(</span><span class="nam">condition_context</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="key">def</span> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="nam">msg</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="nam">caused_by</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">BaseException</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">NoReturn</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TransformationRuntimeError</span><span class="op">(</span><span class="nam">msg</span><span class="op">)</span> <span class="key">from</span> <span class="nam">caused_by</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="key">def</span> <span class="nam">_match_rule_had_no_matches</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> <span class="nam">match_rule</span><span class="op">:</span> <span class="nam">MatchRule</span><span class="op">,</span> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">NoReturn</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="str">f'The match rule "{match_rule.describe_match_short()}" in transformation "{definition_source}" did'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="str">" not match any paths. Either the definition is redundant (and can be omitted) or the match rule is"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="str">" incorrect."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="key">def</span> <span class="nam">_fs_path_as_dir</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">VP</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">VP</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"><span class="annotate short">101 ↛ 103</span><span class="annotate long">line 101 didn't jump to line 103, because the condition on line 101 was never false</span></span></p> - <p class="run"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="key">return</span> <span class="nam">path</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="nam">path_type</span> <span class="op">=</span> <span class="str">"file"</span> <span class="key">if</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_file</span> <span class="key">else</span> <span class="str">'symlink/"special file system object"'</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="str">f"The path {path.path} was expected to be a directory (or non-existing) due to"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="str">f" {definition_source}. However that path existed and is a {path_type}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="str">f" You may need a `remove: {path.path}` prior to {definition_source} to"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="str">" to make this transformation succeed."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="key">def</span> <span class="nam">_ensure_is_directory</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">FSPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="nam">path_to_directory</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">FSPath</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="nam">current</span><span class="op">,</span> <span class="nam">missing_parts</span> <span class="op">=</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">attempt_lookup</span><span class="op">(</span><span class="nam">path_to_directory</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="nam">current</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_fs_path_as_dir</span><span class="op">(</span><span class="nam">cast</span><span class="op">(</span><span class="str">"FSPath"</span><span class="op">,</span> <span class="nam">current</span><span class="op">)</span><span class="op">,</span> <span class="nam">definition_source</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="key">if</span> <span class="nam">missing_parts</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="key">return</span> <span class="nam">current</span><span class="op">.</span><span class="nam">mkdirs</span><span class="op">(</span><span class="str">"/"</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">missing_parts</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="key">return</span> <span class="nam">current</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"><span class="key">class</span> <span class="nam">RemoveTransformationRule</span><span class="op">(</span><span class="nam">TransformationRule</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="str">"_match_rules"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="str">"_keep_empty_parent_dirs"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="str">"_definition_source"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="nam">match_rules</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">MatchRule</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="nam">keep_empty_parent_dirs</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_match_rules</span> <span class="op">=</span> <span class="nam">match_rules</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_keep_empty_parent_dirs</span> <span class="op">=</span> <span class="nam">keep_empty_parent_dirs</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_definition_source</span> <span class="op">=</span> <span class="nam">definition_source</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="key">def</span> <span class="nam">transform_file_system</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">FSPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="nam">condition_context</span><span class="op">:</span> <span class="nam">ConditionContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="nam">matched_any</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="key">for</span> <span class="nam">match_rule</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_match_rules</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="com"># Fully resolve the matches to avoid RuntimeError caused by collection changing size as a</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="com"># consequence of the removal: https://salsa.debian.org/debian/debputy/-/issues/52</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="nam">matches</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">match_rule</span><span class="op">.</span><span class="nam">finditer</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="key">for</span> <span class="nam">m</span> <span class="key">in</span> <span class="nam">matches</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="nam">matched_any</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="nam">parent</span> <span class="op">=</span> <span class="nam">m</span><span class="op">.</span><span class="nam">parent_dir</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="key">if</span> <span class="nam">parent</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">154 ↛ 155</span><span class="annotate long">line 154 didn't jump to line 155, because the condition on line 154 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="str">f"Cannot remove the root directory (triggered by {self._definition_source})"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="nam">m</span><span class="op">.</span><span class="nam">unlink</span><span class="op">(</span><span class="nam">recursive</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_keep_empty_parent_dirs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="nam">parent</span><span class="op">.</span><span class="nam">prune_if_empty_dir</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="com"># FIXME: `rm` should probably be forgiving or at least support a condition to avoid failures</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">matched_any</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_match_rule_had_no_matches</span><span class="op">(</span><span class="nam">match_rule</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_definition_source</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"><span class="key">class</span> <span class="nam">MoveTransformationRule</span><span class="op">(</span><span class="nam">TransformationRule</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="str">"_match_rule"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="str">"_dest_path"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="str">"_dest_is_dir"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="str">"_definition_source"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="str">"_condition"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="nam">match_rule</span><span class="op">:</span> <span class="nam">MatchRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="nam">dest_path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="nam">dest_is_dir</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="nam">condition</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ManifestCondition</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_match_rule</span> <span class="op">=</span> <span class="nam">match_rule</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_dest_path</span> <span class="op">=</span> <span class="nam">dest_path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_dest_is_dir</span> <span class="op">=</span> <span class="nam">dest_is_dir</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_definition_source</span> <span class="op">=</span> <span class="nam">definition_source</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_condition</span> <span class="op">=</span> <span class="nam">condition</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="key">def</span> <span class="nam">transform_file_system</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">FSPath</span><span class="op">,</span> <span class="nam">condition_context</span><span class="op">:</span> <span class="nam">ConditionContext</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_evaluate_condition</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_condition</span><span class="op">,</span> <span class="nam">condition_context</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">192 ↛ 193</span><span class="annotate long">line 192 didn't jump to line 193, because the condition on line 192 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="com"># Eager resolve is necessary to avoid "self-recursive" matching in special cases (e.g., **/*.la)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="nam">matches</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_match_rule</span><span class="op">.</span><span class="nam">finditer</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">matches</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_match_rule_had_no_matches</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_match_rule</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_definition_source</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="nam">target_dir</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_dest_is_dir</span><span class="op">:</span> </span><span class="r"><span class="annotate short">200 ↛ 201</span><span class="annotate long">line 200 didn't jump to line 201, because the condition on line 200 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="nam">target_dir</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_ensure_is_directory</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_dest_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_definition_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="nam">dir_part</span><span class="op">,</span> <span class="nam">basename</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_dest_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="nam">target_parent_dir</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_ensure_is_directory</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="nam">dir_part</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_definition_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="nam">target_dir</span> <span class="op">=</span> <span class="nam">target_parent_dir</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">basename</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="key">if</span> <span class="nam">target_dir</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="key">not</span> <span class="nam">target_dir</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"><span class="annotate short">215 ↛ 235</span><span class="annotate long">line 215 didn't jump to line 235, because the condition on line 215 was never false</span></span></p> - <p class="par run show_par"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">matches</span><span class="op">)</span> <span class="op">></span> <span class="num">1</span><span class="op">:</span> </span><span class="r"><span class="annotate short">216 ↛ 217</span><span class="annotate long">line 216 didn't jump to line 217, because the condition on line 216 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="str">f"Could not rename {self._match_rule.describe_match_short()} to {self._dest_path}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="str">f" (from: {self._definition_source}). Multiple paths matched the pattern and the"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="str">" destination was not a directory. Either correct the pattern to only match only source"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="str">" OR define the destination to be a directory (E.g., add a trailing slash - example:"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="str">f' "{self._dest_path}/")'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="nam">p</span> <span class="op">=</span> <span class="nam">matches</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="key">if</span> <span class="nam">p</span><span class="op">.</span><span class="nam">path</span> <span class="op">==</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_dest_path</span><span class="op">:</span> </span><span class="r"><span class="annotate short">225 ↛ 226</span><span class="annotate long">line 225 didn't jump to line 226, because the condition on line 225 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="str">f"Error in {self._definition_source}, the source"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="str">f" {self._match_rule.describe_match_short()} matched {self._dest_path} making the"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="str">" rename redundant!?"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="nam">p</span><span class="op">.</span><span class="nam">parent_dir</span> <span class="op">=</span> <span class="nam">target_parent_dir</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="nam">p</span><span class="op">.</span><span class="nam">name</span> <span class="op">=</span> <span class="nam">basename</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="key">assert</span> <span class="nam">target_dir</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">target_dir</span><span class="op">.</span><span class="nam">is_dir</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="nam">basenames</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">VirtualPath</span><span class="op">]</span> <span class="op">=</span> <span class="nam">dict</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="nam">target_dir_path</span> <span class="op">=</span> <span class="nam">target_dir</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="key">for</span> <span class="nam">m</span> <span class="key">in</span> <span class="nam">matches</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="key">if</span> <span class="nam">m</span><span class="op">.</span><span class="nam">path</span> <span class="op">==</span> <span class="nam">target_dir_path</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="str">f"Error in {self._definition_source}, the source {self._match_rule.describe_match_short()}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="str">f"matched {self._dest_path} (among other), but it is not possible to copy a directory into"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="str">" itself"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="key">if</span> <span class="nam">m</span><span class="op">.</span><span class="nam">name</span> <span class="key">in</span> <span class="nam">basenames</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="nam">alt_path</span> <span class="op">=</span> <span class="nam">basenames</span><span class="op">[</span><span class="nam">m</span><span class="op">.</span><span class="nam">name</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="com"># We document "two *distinct*" paths. However, as the glob matches are written, it should not be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="com"># possible for a *single* glob to match the same path twice.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="key">assert</span> <span class="nam">alt_path</span> <span class="key">is</span> <span class="key">not</span> <span class="nam">m</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="str">f"Could not rename {self._match_rule.describe_match_short()} to {self._dest_path}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="str">f" (from: {self._definition_source}). Multiple paths matched the pattern had the"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="str">f' same basename "{m.name}" ("{m.path}" vs. "{alt_path.path}"). Please correct the'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="str">f" pattern, so it only matches one path with that basename to avoid this conflict."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="nam">existing</span> <span class="op">=</span> <span class="nam">m</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">m</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing</span> <span class="key">and</span> <span class="nam">existing</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="str">f"Could not rename {self._match_rule.describe_match_short()} to {self._dest_path}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="str">f" (from: {self._definition_source}). The pattern matched {m.path} which would replace"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="str">f" the existing directory {existing.path}. If this replacement is intentional, then please"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="str">f' remove "{existing.path}" first (e.g., via `- remove: "{existing.path}"`)'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="nam">basenames</span><span class="op">[</span><span class="nam">m</span><span class="op">.</span><span class="nam">name</span><span class="op">]</span> <span class="op">=</span> <span class="nam">m</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="nam">m</span><span class="op">.</span><span class="nam">parent_dir</span> <span class="op">=</span> <span class="nam">target_dir</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"><span class="key">class</span> <span class="nam">CreateSymlinkPathTransformationRule</span><span class="op">(</span><span class="nam">TransformationRule</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="str">"_link_dest"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="str">"_link_target"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="str">"_replacement_rule"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="str">"_definition_source"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="str">"_condition"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="nam">link_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="nam">link_dest</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="nam">replacement_rule</span><span class="op">:</span> <span class="nam">CreateSymlinkReplacementRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="nam">condition</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ManifestCondition</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_link_target</span> <span class="op">=</span> <span class="nam">link_target</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_link_dest</span> <span class="op">=</span> <span class="nam">link_dest</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_replacement_rule</span> <span class="op">=</span> <span class="nam">replacement_rule</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_definition_source</span> <span class="op">=</span> <span class="nam">definition_source</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_condition</span> <span class="op">=</span> <span class="nam">condition</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> <span class="key">def</span> <span class="nam">transform_file_system</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">FSPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="nam">condition_context</span><span class="op">:</span> <span class="nam">ConditionContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_evaluate_condition</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_condition</span><span class="op">,</span> <span class="nam">condition_context</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">297 ↛ 298</span><span class="annotate long">line 297 didn't jump to line 298, because the condition on line 297 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="nam">dir_path_part</span><span class="op">,</span> <span class="nam">link_name</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_link_dest</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="nam">dir_path</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_ensure_is_directory</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="nam">dir_path_part</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_definition_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="nam">existing</span> <span class="op">=</span> <span class="nam">dir_path</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">link_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_handle_existing_path</span><span class="op">(</span><span class="nam">existing</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="nam">dir_path</span><span class="op">.</span><span class="nam">add_symlink</span><span class="op">(</span><span class="nam">link_name</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_link_target</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="key">def</span> <span class="nam">_handle_existing_path</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">existing</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="nam">replacement_rule</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_replacement_rule</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="key">if</span> <span class="nam">replacement_rule</span> <span class="op">==</span> <span class="str">"abort-on-non-empty-directory"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="nam">unlink</span> <span class="op">=</span> <span class="key">not</span> <span class="nam">existing</span><span class="op">.</span><span class="nam">is_dir</span> <span class="key">or</span> <span class="key">not</span> <span class="nam">any</span><span class="op">(</span><span class="nam">existing</span><span class="op">.</span><span class="nam">iterdir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="nam">reason</span> <span class="op">=</span> <span class="str">"the path is a non-empty directory"</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="key">elif</span> <span class="nam">replacement_rule</span> <span class="op">==</span> <span class="str">"discard-existing"</span><span class="op">:</span> </span><span class="r"><span class="annotate short">315 ↛ 316</span><span class="annotate long">line 315 didn't jump to line 316, because the condition on line 315 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="nam">unlink</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="nam">reason</span> <span class="op">=</span> <span class="str">"<<internal error: you should not see an error with this message>>"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="key">elif</span> <span class="nam">replacement_rule</span> <span class="op">==</span> <span class="str">"error-if-directory"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="nam">unlink</span> <span class="op">=</span> <span class="key">not</span> <span class="nam">existing</span><span class="op">.</span><span class="nam">is_dir</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="nam">reason</span> <span class="op">=</span> <span class="str">"the path is a directory"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="key">assert</span> <span class="nam">replacement_rule</span> <span class="op">==</span> <span class="str">"error-if-exists"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> <span class="nam">unlink</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> <span class="nam">reason</span> <span class="op">=</span> <span class="str">"the path exists"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> <span class="key">if</span> <span class="nam">unlink</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> <span class="nam">existing</span><span class="op">.</span><span class="nam">unlink</span><span class="op">(</span><span class="nam">recursive</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> <span class="str">f"Refusing to replace {existing.path} with a symlink; {reason} and"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> <span class="str">f" the active replacement-rule was {self._replacement_rule}. You can"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> <span class="str">f' set the replacement-rule to "discard-existing", if you are not interested'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> <span class="str">f" in the contents of {existing.path}. This error was triggered by {self._definition_source}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"><span class="key">class</span> <span class="nam">CreateDirectoryTransformationRule</span><span class="op">(</span><span class="nam">TransformationRule</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"> <span class="str">"_directories"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> <span class="str">"_owner"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"> <span class="str">"_group"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"> <span class="str">"_mode"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"> <span class="str">"_definition_source"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> <span class="str">"_condition"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"> <span class="nam">directories</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"> <span class="nam">owner</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">StaticFileSystemOwner</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"> <span class="nam">group</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">StaticFileSystemGroup</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"> <span class="nam">mode</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">FileSystemMode</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"> <span class="nam">condition</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ManifestCondition</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_directories</span> <span class="op">=</span> <span class="nam">directories</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_owner</span> <span class="op">=</span> <span class="nam">owner</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_group</span> <span class="op">=</span> <span class="nam">group</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_mode</span> <span class="op">=</span> <span class="nam">mode</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_definition_source</span> <span class="op">=</span> <span class="nam">definition_source</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_condition</span> <span class="op">=</span> <span class="nam">condition</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"> <span class="key">def</span> <span class="nam">transform_file_system</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">FSPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"> <span class="nam">condition_context</span><span class="op">:</span> <span class="nam">ConditionContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_evaluate_condition</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_condition</span><span class="op">,</span> <span class="nam">condition_context</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">369 ↛ 370</span><span class="annotate long">line 369 didn't jump to line 370, because the condition on line 369 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"> <span class="nam">owner</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_owner</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"> <span class="nam">group</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_group</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"> <span class="nam">mode</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_mode</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"> <span class="key">for</span> <span class="nam">directory</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_directories</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"> <span class="nam">dir_path</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_ensure_is_directory</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"> <span class="nam">directory</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_definition_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"> <span class="key">if</span> <span class="nam">mode</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"> <span class="nam">desired_mode</span> <span class="op">=</span> <span class="nam">mode</span><span class="op">.</span><span class="nam">compute_mode</span><span class="op">(</span><span class="nam">dir_path</span><span class="op">.</span><span class="nam">mode</span><span class="op">,</span> <span class="nam">dir_path</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"> <span class="key">except</span> <span class="nam">ValueError</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t385" href="#t385">385</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t386" href="#t386">386</a></span><span class="t"> <span class="str">f"Could not compute desired mode for {dir_path.path} as"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t387" href="#t387">387</a></span><span class="t"> <span class="str">f" requested in {self._definition_source}: {e.args[0]}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t388" href="#t388">388</a></span><span class="t"> <span class="nam">caused_by</span><span class="op">=</span><span class="nam">e</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t389" href="#t389">389</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t390" href="#t390">390</a></span><span class="t"> <span class="nam">dir_path</span><span class="op">.</span><span class="nam">mode</span> <span class="op">=</span> <span class="nam">desired_mode</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t391" href="#t391">391</a></span><span class="t"> <span class="nam">dir_path</span><span class="op">.</span><span class="nam">chown</span><span class="op">(</span><span class="nam">owner</span><span class="op">,</span> <span class="nam">group</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t392" href="#t392">392</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t393" href="#t393">393</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t394" href="#t394">394</a></span><span class="t"><span class="key">def</span> <span class="nam">_apply_owner_and_mode</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t395" href="#t395">395</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t396" href="#t396">396</a></span><span class="t"> <span class="nam">owner</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">StaticFileSystemOwner</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t397" href="#t397">397</a></span><span class="t"> <span class="nam">group</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">StaticFileSystemGroup</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t398" href="#t398">398</a></span><span class="t"> <span class="nam">mode</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">FileSystemMode</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t399" href="#t399">399</a></span><span class="t"> <span class="nam">capabilities</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t400" href="#t400">400</a></span><span class="t"> <span class="nam">capability_mode</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">FileSystemMode</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t401" href="#t401">401</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t402" href="#t402">402</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t403" href="#t403">403</a></span><span class="t"> <span class="key">if</span> <span class="nam">owner</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">group</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">403 ↛ 405</span><span class="annotate long">line 403 didn't jump to line 405, because the condition on line 403 was never false</span></span></p> - <p class="run"><span class="n"><a id="t404" href="#t404">404</a></span><span class="t"> <span class="nam">path</span><span class="op">.</span><span class="nam">chown</span><span class="op">(</span><span class="nam">owner</span><span class="op">,</span> <span class="nam">group</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t405" href="#t405">405</a></span><span class="t"> <span class="key">if</span> <span class="nam">mode</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">405 ↛ 415</span><span class="annotate long">line 405 didn't jump to line 415, because the condition on line 405 was never false</span></span></p> - <p class="run"><span class="n"><a id="t406" href="#t406">406</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t407" href="#t407">407</a></span><span class="t"> <span class="nam">desired_mode</span> <span class="op">=</span> <span class="nam">mode</span><span class="op">.</span><span class="nam">compute_mode</span><span class="op">(</span><span class="nam">path</span><span class="op">.</span><span class="nam">mode</span><span class="op">,</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t408" href="#t408">408</a></span><span class="t"> <span class="key">except</span> <span class="nam">ValueError</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t409" href="#t409">409</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TransformationRuntimeError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t410" href="#t410">410</a></span><span class="t"> <span class="str">f"Could not compute desired mode for {path.path} as"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t411" href="#t411">411</a></span><span class="t"> <span class="str">f" requested in {definition_source}: {e.args[0]}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t412" href="#t412">412</a></span><span class="t"> <span class="op">)</span> <span class="key">from</span> <span class="nam">e</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t413" href="#t413">413</a></span><span class="t"> <span class="nam">path</span><span class="op">.</span><span class="nam">mode</span> <span class="op">=</span> <span class="nam">desired_mode</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t414" href="#t414">414</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t415" href="#t415">415</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_file</span> <span class="key">and</span> <span class="nam">capabilities</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">415 ↛ 416</span><span class="annotate long">line 415 didn't jump to line 416, because the condition on line 415 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t416" href="#t416">416</a></span><span class="t"> <span class="nam">cap_ref</span> <span class="op">=</span> <span class="nam">path</span><span class="op">.</span><span class="nam">metadata</span><span class="op">(</span><span class="nam">DebputyCapability</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t417" href="#t417">417</a></span><span class="t"> <span class="nam">cap_value</span> <span class="op">=</span> <span class="nam">cap_ref</span><span class="op">.</span><span class="nam">value</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t418" href="#t418">418</a></span><span class="t"> <span class="key">if</span> <span class="nam">cap_value</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t419" href="#t419">419</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t420" href="#t420">420</a></span><span class="t"> <span class="str">f"Replacing the capabilities set on path {path.path} from {cap_value.definition_source} due"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t421" href="#t421">421</a></span><span class="t"> <span class="str">f" to {definition_source}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t422" href="#t422">422</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t423" href="#t423">423</a></span><span class="t"> <span class="key">assert</span> <span class="nam">capability_mode</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t424" href="#t424">424</a></span><span class="t"> <span class="nam">cap_ref</span><span class="op">.</span><span class="nam">value</span> <span class="op">=</span> <span class="nam">DebputyCapability</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t425" href="#t425">425</a></span><span class="t"> <span class="nam">capabilities</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t426" href="#t426">426</a></span><span class="t"> <span class="nam">capability_mode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t427" href="#t427">427</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t428" href="#t428">428</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t429" href="#t429">429</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t430" href="#t430">430</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t431" href="#t431">431</a></span><span class="t"><span class="key">class</span> <span class="nam">PathMetadataTransformationRule</span><span class="op">(</span><span class="nam">TransformationRule</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t432" href="#t432">432</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t433" href="#t433">433</a></span><span class="t"> <span class="str">"_match_rules"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t434" href="#t434">434</a></span><span class="t"> <span class="str">"_owner"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t435" href="#t435">435</a></span><span class="t"> <span class="str">"_group"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t436" href="#t436">436</a></span><span class="t"> <span class="str">"_mode"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t437" href="#t437">437</a></span><span class="t"> <span class="str">"_capabilities"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t438" href="#t438">438</a></span><span class="t"> <span class="str">"_capability_mode"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t439" href="#t439">439</a></span><span class="t"> <span class="str">"_recursive"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t440" href="#t440">440</a></span><span class="t"> <span class="str">"_definition_source"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t441" href="#t441">441</a></span><span class="t"> <span class="str">"_condition"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t442" href="#t442">442</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t443" href="#t443">443</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t444" href="#t444">444</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t445" href="#t445">445</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t446" href="#t446">446</a></span><span class="t"> <span class="nam">match_rules</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">MatchRule</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t447" href="#t447">447</a></span><span class="t"> <span class="nam">owner</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">StaticFileSystemOwner</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t448" href="#t448">448</a></span><span class="t"> <span class="nam">group</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">StaticFileSystemGroup</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t449" href="#t449">449</a></span><span class="t"> <span class="nam">mode</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">FileSystemMode</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t450" href="#t450">450</a></span><span class="t"> <span class="nam">recursive</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t451" href="#t451">451</a></span><span class="t"> <span class="nam">capabilities</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t452" href="#t452">452</a></span><span class="t"> <span class="nam">capability_mode</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">FileSystemMode</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t453" href="#t453">453</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t454" href="#t454">454</a></span><span class="t"> <span class="nam">condition</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ManifestCondition</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t455" href="#t455">455</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t456" href="#t456">456</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t457" href="#t457">457</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_match_rules</span> <span class="op">=</span> <span class="nam">match_rules</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t458" href="#t458">458</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_owner</span> <span class="op">=</span> <span class="nam">owner</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t459" href="#t459">459</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_group</span> <span class="op">=</span> <span class="nam">group</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t460" href="#t460">460</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_mode</span> <span class="op">=</span> <span class="nam">mode</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t461" href="#t461">461</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_capabilities</span> <span class="op">=</span> <span class="nam">capabilities</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t462" href="#t462">462</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_capability_mode</span> <span class="op">=</span> <span class="nam">capability_mode</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t463" href="#t463">463</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_recursive</span> <span class="op">=</span> <span class="nam">recursive</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t464" href="#t464">464</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_definition_source</span> <span class="op">=</span> <span class="nam">definition_source</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t465" href="#t465">465</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_condition</span> <span class="op">=</span> <span class="nam">condition</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t466" href="#t466">466</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_capabilities</span> <span class="key">is</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_capability_mode</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">466 ↛ 467</span><span class="annotate long">line 466 didn't jump to line 467, because the condition on line 466 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t467" href="#t467">467</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"capability_mode without capabilities"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t468" href="#t468">468</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_capabilities</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_capability_mode</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">468 ↛ 469</span><span class="annotate long">line 468 didn't jump to line 469, because the condition on line 468 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t469" href="#t469">469</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"capabilities without capability_mode"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t470" href="#t470">470</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t471" href="#t471">471</a></span><span class="t"> <span class="key">def</span> <span class="nam">transform_file_system</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t472" href="#t472">472</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t473" href="#t473">473</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">FSPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t474" href="#t474">474</a></span><span class="t"> <span class="nam">condition_context</span><span class="op">:</span> <span class="nam">ConditionContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t475" href="#t475">475</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t476" href="#t476">476</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_evaluate_condition</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_condition</span><span class="op">,</span> <span class="nam">condition_context</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">476 ↛ 477</span><span class="annotate long">line 476 didn't jump to line 477, because the condition on line 476 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t477" href="#t477">477</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t478" href="#t478">478</a></span><span class="t"> <span class="nam">owner</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_owner</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t479" href="#t479">479</a></span><span class="t"> <span class="nam">group</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_group</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t480" href="#t480">480</a></span><span class="t"> <span class="nam">mode</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_mode</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t481" href="#t481">481</a></span><span class="t"> <span class="nam">capabilities</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_capabilities</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t482" href="#t482">482</a></span><span class="t"> <span class="nam">capability_mode</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_capability_mode</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t483" href="#t483">483</a></span><span class="t"> <span class="nam">definition_source</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_definition_source</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t484" href="#t484">484</a></span><span class="t"> <span class="nam">d</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">FSPath</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_recursive</span> <span class="key">else</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t485" href="#t485">485</a></span><span class="t"> <span class="nam">needs_file_match</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t486" href="#t486">486</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_owner</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_group</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_mode</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">486 ↛ 489</span><span class="annotate long">line 486 didn't jump to line 489, because the condition on line 486 was never false</span></span></p> - <p class="run"><span class="n"><a id="t487" href="#t487">487</a></span><span class="t"> <span class="nam">needs_file_match</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t488" href="#t488">488</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t489" href="#t489">489</a></span><span class="t"> <span class="key">for</span> <span class="nam">match_rule</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_match_rules</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t490" href="#t490">490</a></span><span class="t"> <span class="nam">match_ok</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t491" href="#t491">491</a></span><span class="t"> <span class="nam">saw_symlink</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t492" href="#t492">492</a></span><span class="t"> <span class="nam">saw_directory</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t493" href="#t493">493</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t494" href="#t494">494</a></span><span class="t"> <span class="key">for</span> <span class="nam">path</span> <span class="key">in</span> <span class="nam">match_rule</span><span class="op">.</span><span class="nam">finditer</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t495" href="#t495">495</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_symlink</span><span class="op">:</span> </span><span class="r"><span class="annotate short">495 ↛ 496</span><span class="annotate long">line 495 didn't jump to line 496, because the condition on line 495 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t496" href="#t496">496</a></span><span class="t"> <span class="nam">saw_symlink</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t497" href="#t497">497</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t498" href="#t498">498</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_file</span> <span class="key">or</span> <span class="key">not</span> <span class="nam">needs_file_match</span><span class="op">:</span> </span><span class="r"><span class="annotate short">498 ↛ 500</span><span class="annotate long">line 498 didn't jump to line 500, because the condition on line 498 was never false</span></span></p> - <p class="run"><span class="n"><a id="t499" href="#t499">499</a></span><span class="t"> <span class="nam">match_ok</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t500" href="#t500">500</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"><span class="annotate short">500 ↛ 501</span><span class="annotate long">line 500 didn't jump to line 501, because the condition on line 500 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t501" href="#t501">501</a></span><span class="t"> <span class="nam">saw_directory</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t502" href="#t502">502</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">match_ok</span> <span class="key">and</span> <span class="nam">needs_file_match</span> <span class="key">and</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_recursive</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t503" href="#t503">503</a></span><span class="t"> <span class="nam">match_ok</span> <span class="op">=</span> <span class="nam">any</span><span class="op">(</span><span class="nam">p</span><span class="op">.</span><span class="nam">is_file</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">path</span><span class="op">.</span><span class="nam">all_paths</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t504" href="#t504">504</a></span><span class="t"> <span class="nam">_apply_owner_and_mode</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t505" href="#t505">505</a></span><span class="t"> <span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t506" href="#t506">506</a></span><span class="t"> <span class="nam">owner</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t507" href="#t507">507</a></span><span class="t"> <span class="nam">group</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t508" href="#t508">508</a></span><span class="t"> <span class="nam">mode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t509" href="#t509">509</a></span><span class="t"> <span class="nam">capabilities</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t510" href="#t510">510</a></span><span class="t"> <span class="nam">capability_mode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t511" href="#t511">511</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t512" href="#t512">512</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t513" href="#t513">513</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_dir</span> <span class="key">and</span> <span class="nam">d</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">513 ↛ 514</span><span class="annotate long">line 513 didn't jump to line 514, because the condition on line 513 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t514" href="#t514">514</a></span><span class="t"> <span class="nam">d</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t515" href="#t515">515</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t516" href="#t516">516</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">match_ok</span><span class="op">:</span> </span><span class="r"><span class="annotate short">516 ↛ 517</span><span class="annotate long">line 516 didn't jump to line 517, because the condition on line 516 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t517" href="#t517">517</a></span><span class="t"> <span class="key">if</span> <span class="nam">needs_file_match</span> <span class="key">and</span> <span class="op">(</span><span class="nam">saw_directory</span> <span class="key">or</span> <span class="nam">saw_symlink</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t518" href="#t518">518</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t519" href="#t519">519</a></span><span class="t"> <span class="str">f"The match rule {match_rule.describe_match_short()} (from {self._definition_source})"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t520" href="#t520">520</a></span><span class="t"> <span class="str">" did not match any files, but given the attributes it can only apply to files."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t521" href="#t521">521</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t522" href="#t522">522</a></span><span class="t"> <span class="key">elif</span> <span class="nam">saw_symlink</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t523" href="#t523">523</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t524" href="#t524">524</a></span><span class="t"> <span class="str">f"The match rule {match_rule.describe_match_short()} (from {self._definition_source})"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t525" href="#t525">525</a></span><span class="t"> <span class="str">' matched symlinks, but "path-metadata" cannot apply to symlinks.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t526" href="#t526">526</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t527" href="#t527">527</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_match_rule_had_no_matches</span><span class="op">(</span><span class="nam">match_rule</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_definition_source</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t528" href="#t528">528</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t529" href="#t529">529</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">d</span><span class="op">:</span> </span><span class="r"><span class="annotate short">529 ↛ 531</span><span class="annotate long">line 529 didn't jump to line 531, because the condition on line 529 was never false</span></span></p> - <p class="run"><span class="n"><a id="t530" href="#t530">530</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t531" href="#t531">531</a></span><span class="t"> <span class="key">for</span> <span class="nam">recurse_dir</span> <span class="key">in</span> <span class="nam">d</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t532" href="#t532">532</a></span><span class="t"> <span class="key">for</span> <span class="nam">path</span> <span class="key">in</span> <span class="nam">recurse_dir</span><span class="op">.</span><span class="nam">all_paths</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t533" href="#t533">533</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_symlink</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t534" href="#t534">534</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t535" href="#t535">535</a></span><span class="t"> <span class="nam">_apply_owner_and_mode</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t536" href="#t536">536</a></span><span class="t"> <span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t537" href="#t537">537</a></span><span class="t"> <span class="nam">owner</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t538" href="#t538">538</a></span><span class="t"> <span class="nam">group</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t539" href="#t539">539</a></span><span class="t"> <span class="nam">mode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t540" href="#t540">540</a></span><span class="t"> <span class="nam">capabilities</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t541" href="#t541">541</a></span><span class="t"> <span class="nam">capability_mode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t542" href="#t542">542</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t543" href="#t543">543</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t544" href="#t544">544</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t545" href="#t545">545</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t546" href="#t546">546</a></span><span class="t"><span class="key">class</span> <span class="nam">ModeNormalizationTransformationRule</span><span class="op">(</span><span class="nam">TransformationRule</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t547" href="#t547">547</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"_normalizations"</span><span class="op">,</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t548" href="#t548">548</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t549" href="#t549">549</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t550" href="#t550">550</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t551" href="#t551">551</a></span><span class="t"> <span class="nam">normalizations</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">MatchRule</span><span class="op">,</span> <span class="nam">FileSystemMode</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t552" href="#t552">552</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t553" href="#t553">553</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_normalizations</span> <span class="op">=</span> <span class="nam">normalizations</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t554" href="#t554">554</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t555" href="#t555">555</a></span><span class="t"> <span class="key">def</span> <span class="nam">transform_file_system</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t556" href="#t556">556</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t557" href="#t557">557</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">FSPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t558" href="#t558">558</a></span><span class="t"> <span class="nam">condition_context</span><span class="op">:</span> <span class="nam">ConditionContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t559" href="#t559">559</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t560" href="#t560">560</a></span><span class="t"> <span class="nam">seen</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t561" href="#t561">561</a></span><span class="t"> <span class="key">for</span> <span class="nam">match_rule</span><span class="op">,</span> <span class="nam">fs_mode</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_normalizations</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t562" href="#t562">562</a></span><span class="t"> <span class="key">for</span> <span class="nam">path</span> <span class="key">in</span> <span class="nam">match_rule</span><span class="op">.</span><span class="nam">finditer</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t563" href="#t563">563</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">,</span> <span class="nam">ignore_paths</span><span class="op">=</span><span class="key">lambda</span> <span class="nam">p</span><span class="op">:</span> <span class="nam">p</span><span class="op">.</span><span class="nam">path</span> <span class="key">in</span> <span class="nam">seen</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t564" href="#t564">564</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t565" href="#t565">565</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_symlink</span> <span class="key">or</span> <span class="nam">path</span><span class="op">.</span><span class="nam">path</span> <span class="key">in</span> <span class="nam">seen</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t566" href="#t566">566</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t567" href="#t567">567</a></span><span class="t"> <span class="nam">seen</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">path</span><span class="op">.</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t568" href="#t568">568</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t569" href="#t569">569</a></span><span class="t"> <span class="nam">desired_mode</span> <span class="op">=</span> <span class="nam">fs_mode</span><span class="op">.</span><span class="nam">compute_mode</span><span class="op">(</span><span class="nam">path</span><span class="op">.</span><span class="nam">mode</span><span class="op">,</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t570" href="#t570">570</a></span><span class="t"> <span class="key">except</span> <span class="nam">ValueError</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t571" href="#t571">571</a></span><span class="t"> <span class="key">raise</span> <span class="nam">AssertionError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t572" href="#t572">572</a></span><span class="t"> <span class="str">"Error while applying built-in mode normalization rule"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t573" href="#t573">573</a></span><span class="t"> <span class="op">)</span> <span class="key">from</span> <span class="nam">e</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t574" href="#t574">574</a></span><span class="t"> <span class="nam">path</span><span class="op">.</span><span class="nam">mode</span> <span class="op">=</span> <span class="nam">desired_mode</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t575" href="#t575">575</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t576" href="#t576">576</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t577" href="#t577">577</a></span><span class="t"><span class="key">class</span> <span class="nam">NormalizeShebangLineTransformation</span><span class="op">(</span><span class="nam">TransformationRule</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t578" href="#t578">578</a></span><span class="t"> <span class="key">def</span> <span class="nam">transform_file_system</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t579" href="#t579">579</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t580" href="#t580">580</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t581" href="#t581">581</a></span><span class="t"> <span class="nam">condition_context</span><span class="op">:</span> <span class="nam">ConditionContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t582" href="#t582">582</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t583" href="#t583">583</a></span><span class="t"> <span class="key">for</span> <span class="nam">path</span> <span class="key">in</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">all_paths</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t584" href="#t584">584</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_file</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t585" href="#t585">585</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t586" href="#t586">586</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t587" href="#t587">587</a></span><span class="t"> <span class="key">with</span> <span class="nam">path</span><span class="op">.</span><span class="nam">open</span><span class="op">(</span><span class="nam">byte_io</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">buffering</span><span class="op">=</span><span class="num">4096</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t588" href="#t588">588</a></span><span class="t"> <span class="nam">interpreter</span> <span class="op">=</span> <span class="nam">extract_shebang_interpreter_from_file</span><span class="op">(</span><span class="nam">fd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t589" href="#t589">589</a></span><span class="t"> <span class="key">except</span> <span class="op">(</span><span class="nam">PureVirtualPathError</span><span class="op">,</span> <span class="nam">TestPathWithNonExistentFSPathError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t590" href="#t590">590</a></span><span class="t"> <span class="com"># Do not make tests unnecessarily complex to write</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t591" href="#t591">591</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t592" href="#t592">592</a></span><span class="t"> <span class="key">if</span> <span class="nam">interpreter</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t593" href="#t593">593</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t594" href="#t594">594</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t595" href="#t595">595</a></span><span class="t"> <span class="key">if</span> <span class="nam">interpreter</span><span class="op">.</span><span class="nam">fixup_needed</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t596" href="#t596">596</a></span><span class="t"> <span class="nam">interpreter</span><span class="op">.</span><span class="nam">replace_shebang_line</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_substitution_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_types_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_267b6307937f1878_types_py.html b/coverage-report/d_267b6307937f1878_types_py.html deleted file mode 100644 index 20b664a..0000000 --- a/coverage-report/d_267b6307937f1878_types_py.html +++ /dev/null @@ -1,108 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/types.py: 100%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/types.py</b>: - <span class="pc_cov">100%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">3 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">3<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">0<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">3<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_transformation_rules_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_util_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">TypeVar</span><span class="op">,</span> <span class="nam">TYPE_CHECKING</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">if</span> <span class="nam">TYPE_CHECKING</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="nam">VirtualPath</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">filesystem_scan</span> <span class="key">import</span> <span class="nam">FSPath</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="nam">VP</span> <span class="op">=</span> <span class="nam">TypeVar</span><span class="op">(</span><span class="str">"VP"</span><span class="op">,</span> <span class="str">"VirtualPath"</span><span class="op">,</span> <span class="str">"FSPath"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="nam">S</span> <span class="op">=</span> <span class="nam">TypeVar</span><span class="op">(</span><span class="str">"S"</span><span class="op">,</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">bytes</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_transformation_rules_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_util_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_267b6307937f1878_util_py.html b/coverage-report/d_267b6307937f1878_util_py.html deleted file mode 100644 index 5381dcb..0000000 --- a/coverage-report/d_267b6307937f1878_util_py.html +++ /dev/null @@ -1,903 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/util.py: 65%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/util.py</b>: - <span class="pc_cov">65%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">426 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">290<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">136<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">9<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">31<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_types_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_version_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">argparse</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">collections</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">functools</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">import</span> <span class="nam">glob</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">import</span> <span class="nam">logging</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">import</span> <span class="nam">re</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="key">import</span> <span class="nam">shutil</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="key">import</span> <span class="nam">subprocess</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"><span class="key">import</span> <span class="nam">sys</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"><span class="key">import</span> <span class="nam">time</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="key">from</span> <span class="nam">itertools</span> <span class="key">import</span> <span class="nam">zip_longest</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"><span class="key">from</span> <span class="nam">pathlib</span> <span class="key">import</span> <span class="nam">Path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">NoReturn</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">TYPE_CHECKING</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">Set</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">FrozenSet</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">TypeVar</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">Dict</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="nam">Iterator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">Iterable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="nam">Literal</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="nam">Sequence</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="nam">List</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="nam">Mapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"><span class="key">from</span> <span class="nam">debian</span><span class="op">.</span><span class="nam">deb822</span> <span class="key">import</span> <span class="nam">Deb822</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">architecture_support</span> <span class="key">import</span> <span class="nam">DpkgArchitectureBuildProcessValuesTable</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">exceptions</span> <span class="key">import</span> <span class="nam">DebputySubstitutionError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"><span class="key">if</span> <span class="nam">TYPE_CHECKING</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">packages</span> <span class="key">import</span> <span class="nam">BinaryPackage</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">substitution</span> <span class="key">import</span> <span class="nam">Substitution</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"><span class="nam">T</span> <span class="op">=</span> <span class="nam">TypeVar</span><span class="op">(</span><span class="str">"T"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"><span class="nam">SLASH_PRUNE</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">"//+"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"><span class="nam">PKGNAME_REGEX</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r"[a-z0-9][-+.a-z0-9]+"</span><span class="op">,</span> <span class="nam">re</span><span class="op">.</span><span class="nam">ASCII</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"><span class="nam">PKGVERSION_REGEX</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="str">r"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"><span class="str"> (?: \d+ : )? # Optional epoch</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"><span class="str"> \d[0-9A-Za-z.+:~]* # Upstream version (with no hyphens)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"><span class="str"> (?: - [0-9A-Za-z.+:~]+ )* # Optional debian revision (+ upstreams versions with hyphens)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"><span class="str">"""</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="nam">re</span><span class="op">.</span><span class="nam">VERBOSE</span> <span class="op">|</span> <span class="nam">re</span><span class="op">.</span><span class="nam">ASCII</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"><span class="nam">DEFAULT_PACKAGE_TYPE</span> <span class="op">=</span> <span class="str">"deb"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"><span class="nam">DBGSYM_PACKAGE_TYPE</span> <span class="op">=</span> <span class="str">"deb"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"><span class="nam">UDEB_PACKAGE_TYPE</span> <span class="op">=</span> <span class="str">"udeb"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"><span class="nam">POSTINST_DEFAULT_CONDITION</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="str">'[ "$1" = "configure" ]'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="str">' || [ "$1" = "abort-upgrade" ]'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="str">' || [ "$1" = "abort-deconfigure" ]'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="str">' || [ "$1" = "abort-remove" ]'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"><span class="nam">_SPACE_RE</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r"\s"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"><span class="nam">_DOUBLE_ESCAPEES</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r'([\n`$"\\])'</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"><span class="nam">_REGULAR_ESCAPEES</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r'([\s!"$()*+#;<>?@\[\]\\`|~])'</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"><span class="nam">_PROFILE_GROUP_SPLIT</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r">\s+<"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"><span class="nam">_DEFAULT_LOGGER</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">logging</span><span class="op">.</span><span class="nam">Logger</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"><span class="nam">_STDOUT_HANDLER</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">logging</span><span class="op">.</span><span class="nam">StreamHandler</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"><span class="nam">_STDERR_HANDLER</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">logging</span><span class="op">.</span><span class="nam">StreamHandler</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"><span class="key">def</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">x</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">T</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="nam">T</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="key">if</span> <span class="nam">x</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> <span class="com"># pragma: no cover</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="str">'Internal error: None was given, but the receiver assumed "not None" here'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="key">return</span> <span class="nam">x</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"><span class="key">def</span> <span class="nam">_info</span><span class="op">(</span><span class="nam">msg</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="key">global</span> <span class="nam">_DEFAULT_LOGGER</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="nam">logger</span> <span class="op">=</span> <span class="nam">_DEFAULT_LOGGER</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="key">if</span> <span class="nam">logger</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="nam">logger</span><span class="op">.</span><span class="nam">info</span><span class="op">(</span><span class="nam">msg</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="com"># No fallback print for info</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"><span class="key">def</span> <span class="nam">_error</span><span class="op">(</span><span class="nam">msg</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">prog</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">)</span> <span class="op">-></span> <span class="str">"NoReturn"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="key">global</span> <span class="nam">_DEFAULT_LOGGER</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="nam">logger</span> <span class="op">=</span> <span class="nam">_DEFAULT_LOGGER</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="key">if</span> <span class="nam">logger</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="nam">logger</span><span class="op">.</span><span class="nam">error</span><span class="op">(</span><span class="nam">msg</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="nam">me</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">basename</span><span class="op">(</span><span class="nam">sys</span><span class="op">.</span><span class="nam">argv</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">)</span> <span class="key">if</span> <span class="nam">prog</span> <span class="key">is</span> <span class="key">None</span> <span class="key">else</span> <span class="nam">prog</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="str">f"{me}: error: {msg}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="nam">file</span><span class="op">=</span><span class="nam">sys</span><span class="op">.</span><span class="nam">stderr</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="nam">sys</span><span class="op">.</span><span class="nam">exit</span><span class="op">(</span><span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"><span class="key">def</span> <span class="nam">_warn</span><span class="op">(</span><span class="nam">msg</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">prog</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="key">global</span> <span class="nam">_DEFAULT_LOGGER</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="nam">logger</span> <span class="op">=</span> <span class="nam">_DEFAULT_LOGGER</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="key">if</span> <span class="nam">logger</span><span class="op">:</span> </span><span class="r"><span class="annotate short">110 ↛ 111</span><span class="annotate long">line 110 didn't jump to line 111, because the condition on line 110 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="nam">logger</span><span class="op">.</span><span class="nam">warning</span><span class="op">(</span><span class="nam">msg</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="nam">me</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">basename</span><span class="op">(</span><span class="nam">sys</span><span class="op">.</span><span class="nam">argv</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">)</span> <span class="key">if</span> <span class="nam">prog</span> <span class="key">is</span> <span class="key">None</span> <span class="key">else</span> <span class="nam">prog</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="str">f"{me}: warning: {msg}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="nam">file</span><span class="op">=</span><span class="nam">sys</span><span class="op">.</span><span class="nam">stderr</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"><span class="key">class</span> <span class="nam">ColorizedArgumentParser</span><span class="op">(</span><span class="nam">argparse</span><span class="op">.</span><span class="nam">ArgumentParser</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="key">def</span> <span class="nam">error</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">message</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">NoReturn</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">print_usage</span><span class="op">(</span><span class="nam">sys</span><span class="op">.</span><span class="nam">stderr</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span><span class="nam">message</span><span class="op">,</span> <span class="nam">prog</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">prog</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"><span class="key">def</span> <span class="nam">ensure_dir</span><span class="op">(</span><span class="nam">path</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">isdir</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">128 ↛ 129</span><span class="annotate long">line 128 didn't jump to line 129, because the condition on line 128 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">makedirs</span><span class="op">(</span><span class="nam">path</span><span class="op">,</span> <span class="nam">mode</span><span class="op">=</span><span class="num">0o755</span><span class="op">,</span> <span class="nam">exist_ok</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"><span class="key">def</span> <span class="nam">_clean_path</span><span class="op">(</span><span class="nam">orig_p</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="nam">p</span> <span class="op">=</span> <span class="nam">SLASH_PRUNE</span><span class="op">.</span><span class="nam">sub</span><span class="op">(</span><span class="str">"/"</span><span class="op">,</span> <span class="nam">orig_p</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="key">if</span> <span class="str">"."</span> <span class="key">in</span> <span class="nam">p</span><span class="op">:</span> </span><span class="r"><span class="annotate short">134 ↛ 147</span><span class="annotate long">line 134 didn't jump to line 147, because the condition on line 134 was never false</span></span></p> - <p class="run"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="nam">path_base</span> <span class="op">=</span> <span class="nam">p</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="com"># We permit a single leading "./" because we add that when we normalize a path, and we want normalization</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="com"># of a normalized path to be a no-op.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="key">if</span> <span class="nam">path_base</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"./"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="nam">path_base</span> <span class="op">=</span> <span class="nam">path_base</span><span class="op">[</span><span class="num">2</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="key">assert</span> <span class="nam">path_base</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="key">for</span> <span class="nam">segment</span> <span class="key">in</span> <span class="nam">path_base</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="key">if</span> <span class="nam">segment</span> <span class="key">in</span> <span class="op">(</span><span class="str">"."</span><span class="op">,</span> <span class="str">".."</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="str">'Please provide paths that are normalized (i.e., no ".." or ".").'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="str">f' Offending input "{orig_p}"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="key">return</span> <span class="nam">p</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"><span class="key">def</span> <span class="nam">_normalize_path</span><span class="op">(</span><span class="nam">path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">with_prefix</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="nam">path</span> <span class="op">=</span> <span class="nam">path</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">path</span> <span class="key">or</span> <span class="nam">path</span> <span class="op">==</span> <span class="str">"."</span><span class="op">:</span> </span><span class="r"><span class="annotate short">152 ↛ 153</span><span class="annotate long">line 152 didn't jump to line 153, because the condition on line 152 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="key">return</span> <span class="str">"."</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="key">if</span> <span class="str">"//"</span> <span class="key">in</span> <span class="nam">path</span> <span class="key">or</span> <span class="str">"."</span> <span class="key">in</span> <span class="nam">path</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="nam">path</span> <span class="op">=</span> <span class="nam">_clean_path</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="key">if</span> <span class="nam">with_prefix</span> <span class="op">^</span> <span class="nam">path</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"./"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="key">if</span> <span class="nam">with_prefix</span><span class="op">:</span> </span><span class="r"><span class="annotate short">157 ↛ 160</span><span class="annotate long">line 157 didn't jump to line 160, because the condition on line 157 was never false</span></span></p> - <p class="run"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="nam">path</span> <span class="op">=</span> <span class="str">"./"</span> <span class="op">+</span> <span class="nam">path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="nam">path</span> <span class="op">=</span> <span class="nam">path</span><span class="op">[</span><span class="num">2</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="key">return</span> <span class="nam">path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"><span class="key">def</span> <span class="nam">_normalize_link_target</span><span class="op">(</span><span class="nam">link_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="nam">link_target</span> <span class="op">=</span> <span class="nam">SLASH_PRUNE</span><span class="op">.</span><span class="nam">sub</span><span class="op">(</span><span class="str">"/"</span><span class="op">,</span> <span class="nam">link_target</span><span class="op">.</span><span class="nam">lstrip</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="nam">result</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="key">for</span> <span class="nam">segment</span> <span class="key">in</span> <span class="nam">link_target</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="key">if</span> <span class="nam">segment</span> <span class="key">in</span> <span class="op">(</span><span class="str">"."</span><span class="op">,</span> <span class="str">""</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="com"># Ignore these - the empty string is generally a trailing slash</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="key">if</span> <span class="nam">segment</span> <span class="op">==</span> <span class="str">".."</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="com"># We ignore "root escape attempts" like the OS would (mapping /.. -> /)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="key">if</span> <span class="nam">result</span><span class="op">:</span> </span><span class="r"><span class="annotate short">173 ↛ 167</span><span class="annotate long">line 173 didn't jump to line 167, because the condition on line 173 was never false</span></span></p> - <p class="run"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="nam">result</span><span class="op">.</span><span class="nam">pop</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="nam">result</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">segment</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="key">return</span> <span class="str">"/"</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">result</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"><span class="key">def</span> <span class="nam">_backslash_escape</span><span class="op">(</span><span class="nam">m</span><span class="op">:</span> <span class="nam">re</span><span class="op">.</span><span class="nam">Match</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="key">return</span> <span class="str">"\\"</span> <span class="op">+</span> <span class="nam">m</span><span class="op">.</span><span class="nam">group</span><span class="op">(</span><span class="num">0</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"><span class="key">def</span> <span class="nam">_escape_shell_word</span><span class="op">(</span><span class="nam">w</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="key">if</span> <span class="nam">_SPACE_RE</span><span class="op">.</span><span class="nam">match</span><span class="op">(</span><span class="nam">w</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">185 ↛ 186</span><span class="annotate long">line 185 didn't jump to line 186, because the condition on line 185 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="nam">w</span> <span class="op">=</span> <span class="nam">_DOUBLE_ESCAPEES</span><span class="op">.</span><span class="nam">sub</span><span class="op">(</span><span class="nam">_backslash_escape</span><span class="op">,</span> <span class="nam">w</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="key">return</span> <span class="str">f'"{w}"'</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="key">return</span> <span class="nam">_REGULAR_ESCAPEES</span><span class="op">.</span><span class="nam">sub</span><span class="op">(</span><span class="nam">_backslash_escape</span><span class="op">,</span> <span class="nam">w</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"><span class="key">def</span> <span class="nam">escape_shell</span><span class="op">(</span><span class="op">*</span><span class="nam">args</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="key">return</span> <span class="str">" "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">_escape_shell_word</span><span class="op">(</span><span class="nam">w</span><span class="op">)</span> <span class="key">for</span> <span class="nam">w</span> <span class="key">in</span> <span class="nam">args</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"><span class="key">def</span> <span class="nam">print_command</span><span class="op">(</span><span class="op">*</span><span class="nam">args</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">f" {escape_shell(*args)}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"><span class="key">def</span> <span class="nam">debian_policy_normalize_symlink_target</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="nam">link_path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="nam">link_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="nam">normalize_link_path</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="key">if</span> <span class="nam">normalize_link_path</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="nam">link_path</span> <span class="op">=</span> <span class="nam">_normalize_path</span><span class="op">(</span><span class="nam">link_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="key">elif</span> <span class="key">not</span> <span class="nam">link_path</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"./"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">206 ↛ 207</span><span class="annotate long">line 206 didn't jump to line 207, because the condition on line 206 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"Link part was not normalized"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="nam">link_path</span> <span class="op">=</span> <span class="nam">link_path</span><span class="op">[</span><span class="num">2</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">link_target</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="nam">link_target</span> <span class="op">=</span> <span class="str">"/"</span> <span class="op">+</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">dirname</span><span class="op">(</span><span class="nam">link_path</span><span class="op">)</span> <span class="op">+</span> <span class="str">"/"</span> <span class="op">+</span> <span class="nam">link_target</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="nam">link_path_parts</span> <span class="op">=</span> <span class="nam">link_path</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="nam">link_target_parts</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="nam">s</span> <span class="key">for</span> <span class="nam">s</span> <span class="key">in</span> <span class="nam">_normalize_link_target</span><span class="op">(</span><span class="nam">link_target</span><span class="op">)</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span> <span class="key">if</span> <span class="nam">s</span> <span class="op">!=</span> <span class="str">"."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="key">assert</span> <span class="nam">link_path_parts</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="key">if</span> <span class="nam">link_target_parts</span> <span class="key">and</span> <span class="nam">link_path_parts</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="op">==</span> <span class="nam">link_target_parts</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="com"># Per Debian Policy, must be relative</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="com"># First determine the length of the overlap</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="nam">common_segment_count</span> <span class="op">=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="nam">shortest_path_length</span> <span class="op">=</span> <span class="nam">min</span><span class="op">(</span><span class="nam">len</span><span class="op">(</span><span class="nam">link_target_parts</span><span class="op">)</span><span class="op">,</span> <span class="nam">len</span><span class="op">(</span><span class="nam">link_path_parts</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="key">while</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="nam">common_segment_count</span> <span class="op"><</span> <span class="nam">shortest_path_length</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="key">and</span> <span class="nam">link_target_parts</span><span class="op">[</span><span class="nam">common_segment_count</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="op">==</span> <span class="nam">link_path_parts</span><span class="op">[</span><span class="nam">common_segment_count</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="nam">common_segment_count</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="key">if</span> <span class="nam">common_segment_count</span> <span class="op">==</span> <span class="nam">shortest_path_length</span> <span class="key">and</span> <span class="nam">len</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="nam">link_path_parts</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="op">)</span> <span class="op">-</span> <span class="num">1</span> <span class="op">==</span> <span class="nam">len</span><span class="op">(</span><span class="nam">link_target_parts</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="nam">normalized_link_target</span> <span class="op">=</span> <span class="str">"."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="nam">up_dir_count</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">link_path_parts</span><span class="op">)</span> <span class="op">-</span> <span class="num">1</span> <span class="op">-</span> <span class="nam">common_segment_count</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="nam">normalized_link_target_parts</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="key">if</span> <span class="nam">up_dir_count</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="nam">up_dir_part</span> <span class="op">=</span> <span class="str">"../"</span> <span class="op">*</span> <span class="nam">up_dir_count</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="com"># We overshoot with a single '/', so rstrip it away</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="nam">normalized_link_target_parts</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">up_dir_part</span><span class="op">.</span><span class="nam">rstrip</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="com"># Add the relevant down parts</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="nam">normalized_link_target_parts</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="nam">link_target_parts</span><span class="op">[</span><span class="nam">common_segment_count</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="nam">normalized_link_target</span> <span class="op">=</span> <span class="str">"/"</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">normalized_link_target_parts</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="com"># Per Debian Policy, must be absolute</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="nam">normalized_link_target</span> <span class="op">=</span> <span class="str">"/"</span> <span class="op">+</span> <span class="str">"/"</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">link_target_parts</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="key">return</span> <span class="nam">normalized_link_target</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"><span class="key">def</span> <span class="nam">has_glob_magic</span><span class="op">(</span><span class="nam">pattern</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="key">return</span> <span class="nam">glob</span><span class="op">.</span><span class="nam">has_magic</span><span class="op">(</span><span class="nam">pattern</span><span class="op">)</span> <span class="key">or</span> <span class="str">"{"</span> <span class="key">in</span> <span class="nam">pattern</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"><span class="key">def</span> <span class="nam">glob_escape</span><span class="op">(</span><span class="nam">replacement_value</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">glob</span><span class="op">.</span><span class="nam">has_magic</span><span class="op">(</span><span class="nam">replacement_value</span><span class="op">)</span> <span class="key">or</span> <span class="str">"{"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">replacement_value</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="key">return</span> <span class="nam">replacement_value</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="key">return</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="nam">replacement_value</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">"["</span><span class="op">,</span> <span class="str">"[[]"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">"]"</span><span class="op">,</span> <span class="str">"[]]"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">"*"</span><span class="op">,</span> <span class="str">"[*]"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">"?"</span><span class="op">,</span> <span class="str">"[?]"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">"{"</span><span class="op">,</span> <span class="str">"[{]"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">"}"</span><span class="op">,</span> <span class="str">"[}]"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"><span class="com"># TODO: This logic should probably be moved to `python-debian`</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"><span class="key">def</span> <span class="nam">active_profiles_match</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="nam">profiles_raw</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="nam">active_build_profiles</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="nam">profiles_raw</span> <span class="op">=</span> <span class="nam">profiles_raw</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="key">if</span> <span class="nam">profiles_raw</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="op">!=</span> <span class="str">"<"</span> <span class="key">or</span> <span class="nam">profiles_raw</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span> <span class="op">!=</span> <span class="str">">"</span> <span class="key">or</span> <span class="nam">profiles_raw</span> <span class="op">==</span> <span class="str">"<>"</span><span class="op">:</span> </span><span class="r"><span class="annotate short">281 ↛ 282</span><span class="annotate long">line 281 didn't jump to line 282, because the condition on line 281 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="str">'Invalid Build-Profiles: Must start start and end with "<" + ">" but cannot be a literal "<>"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="nam">profile_groups</span> <span class="op">=</span> <span class="nam">_PROFILE_GROUP_SPLIT</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="nam">profiles_raw</span><span class="op">[</span><span class="num">1</span><span class="op">:</span><span class="op">-</span><span class="num">1</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="key">for</span> <span class="nam">profile_group_raw</span> <span class="key">in</span> <span class="nam">profile_groups</span><span class="op">:</span> </span><span class="r"><span class="annotate short">286 ↛ 302</span><span class="annotate long">line 286 didn't jump to line 302, because the loop on line 286 didn't complete</span></span></p> - <p class="run"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="nam">should_process_package</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="key">for</span> <span class="nam">profile_name</span> <span class="key">in</span> <span class="nam">profile_group_raw</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="nam">negation</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="key">if</span> <span class="nam">profile_name</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="op">==</span> <span class="str">"!"</span><span class="op">:</span> </span><span class="r"><span class="annotate short">290 ↛ 294</span><span class="annotate long">line 290 didn't jump to line 294, because the condition on line 290 was never false</span></span></p> - <p class="run"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="nam">negation</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> <span class="nam">profile_name</span> <span class="op">=</span> <span class="nam">profile_name</span><span class="op">[</span><span class="num">1</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> <span class="nam">matched_profile</span> <span class="op">=</span> <span class="nam">profile_name</span> <span class="key">in</span> <span class="nam">active_build_profiles</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="key">if</span> <span class="nam">matched_profile</span> <span class="op">==</span> <span class="nam">negation</span><span class="op">:</span> </span><span class="r"><span class="annotate short">295 ↛ 296</span><span class="annotate long">line 295 didn't jump to line 296, because the condition on line 295 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> <span class="nam">should_process_package</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="key">if</span> <span class="nam">should_process_package</span><span class="op">:</span> </span><span class="r"><span class="annotate short">299 ↛ 286</span><span class="annotate long">line 299 didn't jump to line 286, because the condition on line 299 was never false</span></span></p> - <p class="run"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"><span class="key">def</span> <span class="nam">_parse_build_profiles</span><span class="op">(</span><span class="nam">build_profiles_raw</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> <span class="nam">profiles_raw</span> <span class="op">=</span> <span class="nam">build_profiles_raw</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="key">if</span> <span class="nam">profiles_raw</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="op">!=</span> <span class="str">"<"</span> <span class="key">or</span> <span class="nam">profiles_raw</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span> <span class="op">!=</span> <span class="str">">"</span> <span class="key">or</span> <span class="nam">profiles_raw</span> <span class="op">==</span> <span class="str">"<>"</span><span class="op">:</span> </span><span class="r"><span class="annotate short">307 ↛ 308</span><span class="annotate long">line 307 didn't jump to line 308, because the condition on line 307 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="str">'Invalid Build-Profiles: Must start start and end with "<" + ">" but cannot be a literal "<>"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="nam">profile_groups</span> <span class="op">=</span> <span class="nam">_PROFILE_GROUP_SPLIT</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="nam">profiles_raw</span><span class="op">[</span><span class="num">1</span><span class="op">:</span><span class="op">-</span><span class="num">1</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="key">return</span> <span class="nam">frozenset</span><span class="op">(</span><span class="nam">frozenset</span><span class="op">(</span><span class="nam">g</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> <span class="key">for</span> <span class="nam">g</span> <span class="key">in</span> <span class="nam">profile_groups</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"><span class="key">def</span> <span class="nam">resolve_source_date_epoch</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="nam">command_line_value</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="nam">substitution</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"Substitution"</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="nam">mtime</span> <span class="op">=</span> <span class="nam">command_line_value</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="key">if</span> <span class="nam">mtime</span> <span class="key">is</span> <span class="key">None</span> <span class="key">and</span> <span class="str">"SOURCE_DATE_EPOCH"</span> <span class="key">in</span> <span class="nam">os</span><span class="op">.</span><span class="nam">environ</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="nam">sde_raw</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">environ</span><span class="op">[</span><span class="str">"SOURCE_DATE_EPOCH"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> <span class="key">if</span> <span class="nam">sde_raw</span> <span class="op">==</span> <span class="str">""</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span><span class="str">"SOURCE_DATE_EPOCH is set but empty."</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> <span class="nam">mtime</span> <span class="op">=</span> <span class="nam">int</span><span class="op">(</span><span class="nam">sde_raw</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> <span class="key">if</span> <span class="nam">mtime</span> <span class="key">is</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">substitution</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> <span class="nam">sde_raw</span> <span class="op">=</span> <span class="nam">substitution</span><span class="op">.</span><span class="nam">substitute</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> <span class="str">"{{SOURCE_DATE_EPOCH}}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> <span class="str">"Internal resolution"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> <span class="nam">mtime</span> <span class="op">=</span> <span class="nam">int</span><span class="op">(</span><span class="nam">sde_raw</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> <span class="key">except</span> <span class="op">(</span><span class="nam">DebputySubstitutionError</span><span class="op">,</span> <span class="nam">ValueError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> <span class="key">if</span> <span class="nam">mtime</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> <span class="nam">mtime</span> <span class="op">=</span> <span class="nam">int</span><span class="op">(</span><span class="nam">time</span><span class="op">.</span><span class="nam">time</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">environ</span><span class="op">[</span><span class="str">"SOURCE_DATE_EPOCH"</span><span class="op">]</span> <span class="op">=</span> <span class="nam">str</span><span class="op">(</span><span class="nam">mtime</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> <span class="key">return</span> <span class="nam">mtime</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"><span class="key">def</span> <span class="nam">compute_output_filename</span><span class="op">(</span><span class="nam">control_root_dir</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">is_udeb</span><span class="op">:</span> <span class="nam">bool</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"> <span class="key">with</span> <span class="nam">open</span><span class="op">(</span><span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">control_root_dir</span><span class="op">,</span> <span class="str">"control"</span><span class="op">)</span><span class="op">,</span> <span class="str">"rt"</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"> <span class="nam">control_file</span> <span class="op">=</span> <span class="nam">Deb822</span><span class="op">(</span><span class="nam">fd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"> <span class="nam">package_name</span> <span class="op">=</span> <span class="nam">control_file</span><span class="op">[</span><span class="str">"Package"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"> <span class="nam">package_version</span> <span class="op">=</span> <span class="nam">control_file</span><span class="op">[</span><span class="str">"Version"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"> <span class="nam">package_architecture</span> <span class="op">=</span> <span class="nam">control_file</span><span class="op">[</span><span class="str">"Architecture"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"> <span class="nam">extension</span> <span class="op">=</span> <span class="nam">control_file</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"Package-Type"</span><span class="op">)</span> <span class="key">or</span> <span class="str">"deb"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"> <span class="key">if</span> <span class="str">":"</span> <span class="key">in</span> <span class="nam">package_version</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"> <span class="nam">package_version</span> <span class="op">=</span> <span class="nam">package_version</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="str">":"</span><span class="op">,</span> <span class="num">1</span><span class="op">)</span><span class="op">[</span><span class="num">1</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_udeb</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"> <span class="nam">extension</span> <span class="op">=</span> <span class="str">"udeb"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"> <span class="key">return</span> <span class="str">f"{package_name}_{package_version}_{package_architecture}.{extension}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"><span class="nam">_SCRATCH_DIR</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"><span class="nam">_DH_INTEGRATION_MODE</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"><span class="key">def</span> <span class="nam">integrated_with_debhelper</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"> <span class="key">global</span> <span class="nam">_DH_INTEGRATION_MODE</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"> <span class="nam">_DH_INTEGRATION_MODE</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"><span class="key">def</span> <span class="nam">scratch_dir</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"> <span class="key">global</span> <span class="nam">_SCRATCH_DIR</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"> <span class="key">if</span> <span class="nam">_SCRATCH_DIR</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"> <span class="key">return</span> <span class="nam">_SCRATCH_DIR</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"> <span class="nam">debputy_scratch_dir</span> <span class="op">=</span> <span class="str">"debian/.debputy/scratch-dir"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"> <span class="nam">is_debputy_dir</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"> <span class="key">if</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">isdir</span><span class="op">(</span><span class="str">"debian/.debputy"</span><span class="op">)</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">_DH_INTEGRATION_MODE</span><span class="op">:</span> </span><span class="r"><span class="annotate short">372 ↛ 374</span><span class="annotate long">line 372 didn't jump to line 374, because the condition on line 372 was never false</span></span></p> - <p class="run"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"> <span class="nam">_SCRATCH_DIR</span> <span class="op">=</span> <span class="nam">debputy_scratch_dir</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"> <span class="key">elif</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">isdir</span><span class="op">(</span><span class="str">"debian/.debhelper"</span><span class="op">)</span> <span class="key">or</span> <span class="nam">_DH_INTEGRATION_MODE</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"> <span class="nam">_SCRATCH_DIR</span> <span class="op">=</span> <span class="str">"debian/.debhelper/_debputy/scratch-dir"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"> <span class="nam">is_debputy_dir</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"> <span class="nam">_SCRATCH_DIR</span> <span class="op">=</span> <span class="nam">debputy_scratch_dir</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"> <span class="nam">ensure_dir</span><span class="op">(</span><span class="nam">_SCRATCH_DIR</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_debputy_dir</span><span class="op">:</span> </span><span class="r"><span class="annotate short">380 ↛ 382</span><span class="annotate long">line 380 didn't jump to line 382, because the condition on line 380 was never false</span></span></p> - <p class="run"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"> <span class="nam">Path</span><span class="op">(</span><span class="str">"debian/.debputy/.gitignore"</span><span class="op">)</span><span class="op">.</span><span class="nam">write_text</span><span class="op">(</span><span class="str">"*\n"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"> <span class="key">return</span> <span class="nam">_SCRATCH_DIR</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t385" href="#t385">385</a></span><span class="t"><span class="nam">_RUNTIME_CONTAINER_DIR_KEY</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t386" href="#t386">386</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t387" href="#t387">387</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t388" href="#t388">388</a></span><span class="t"><span class="key">def</span> <span class="nam">generated_content_dir</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t389" href="#t389">389</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t390" href="#t390">390</a></span><span class="t"> <span class="nam">package</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"BinaryPackage"</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t391" href="#t391">391</a></span><span class="t"> <span class="nam">subdir_key</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t392" href="#t392">392</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t393" href="#t393">393</a></span><span class="t"> <span class="key">global</span> <span class="nam">_RUNTIME_CONTAINER_DIR_KEY</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t394" href="#t394">394</a></span><span class="t"> <span class="nam">container_dir</span> <span class="op">=</span> <span class="nam">_RUNTIME_CONTAINER_DIR_KEY</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t395" href="#t395">395</a></span><span class="t"> <span class="nam">first_run</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t396" href="#t396">396</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t397" href="#t397">397</a></span><span class="t"> <span class="key">if</span> <span class="nam">container_dir</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t398" href="#t398">398</a></span><span class="t"> <span class="nam">first_run</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t399" href="#t399">399</a></span><span class="t"> <span class="nam">container_dir</span> <span class="op">=</span> <span class="str">f"_pb-{os.getpid()}"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t400" href="#t400">400</a></span><span class="t"> <span class="nam">_RUNTIME_CONTAINER_DIR_KEY</span> <span class="op">=</span> <span class="nam">container_dir</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t401" href="#t401">401</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t402" href="#t402">402</a></span><span class="t"> <span class="nam">directory</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">scratch_dir</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> <span class="nam">container_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t403" href="#t403">403</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t404" href="#t404">404</a></span><span class="t"> <span class="key">if</span> <span class="nam">first_run</span> <span class="key">and</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">isdir</span><span class="op">(</span><span class="nam">directory</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">404 ↛ 409</span><span class="annotate long">line 404 didn't jump to line 409, because the condition on line 404 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t405" href="#t405">405</a></span><span class="t"> <span class="com"># In the unlikely case there is a re-run with exactly the same pid, `debputy` should not</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t406" href="#t406">406</a></span><span class="t"> <span class="com"># see "stale" data.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t407" href="#t407">407</a></span><span class="t"> <span class="com"># TODO: Ideally, we would always clean up this directory on failure, but `atexit` is not</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t408" href="#t408">408</a></span><span class="t"> <span class="com"># reliable enough for that and we do not have an obvious hook for it.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t409" href="#t409">409</a></span><span class="t"> <span class="nam">shutil</span><span class="op">.</span><span class="nam">rmtree</span><span class="op">(</span><span class="nam">directory</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t410" href="#t410">410</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t411" href="#t411">411</a></span><span class="t"> <span class="nam">directory</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t412" href="#t412">412</a></span><span class="t"> <span class="nam">directory</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t413" href="#t413">413</a></span><span class="t"> <span class="str">"generated-fs-content"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t414" href="#t414">414</a></span><span class="t"> <span class="str">f"pkg_{package.name}"</span> <span class="key">if</span> <span class="nam">package</span> <span class="key">else</span> <span class="str">"no-package"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t415" href="#t415">415</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t416" href="#t416">416</a></span><span class="t"> <span class="key">if</span> <span class="nam">subdir_key</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t417" href="#t417">417</a></span><span class="t"> <span class="nam">directory</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">directory</span><span class="op">,</span> <span class="nam">subdir_key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t418" href="#t418">418</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t419" href="#t419">419</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">makedirs</span><span class="op">(</span><span class="nam">directory</span><span class="op">,</span> <span class="nam">exist_ok</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t420" href="#t420">420</a></span><span class="t"> <span class="key">return</span> <span class="nam">directory</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t421" href="#t421">421</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t422" href="#t422">422</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t423" href="#t423">423</a></span><span class="t"><span class="nam">PerlIncDir</span> <span class="op">=</span> <span class="nam">collections</span><span class="op">.</span><span class="nam">namedtuple</span><span class="op">(</span><span class="str">"PerlIncDir"</span><span class="op">,</span> <span class="op">[</span><span class="str">"vendorlib"</span><span class="op">,</span> <span class="str">"vendorarch"</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t424" href="#t424">424</a></span><span class="t"><span class="nam">PerlConfigData</span> <span class="op">=</span> <span class="nam">collections</span><span class="op">.</span><span class="nam">namedtuple</span><span class="op">(</span><span class="str">"PerlConfigData"</span><span class="op">,</span> <span class="op">[</span><span class="str">"version"</span><span class="op">,</span> <span class="str">"debian_abi"</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t425" href="#t425">425</a></span><span class="t"><span class="nam">_PERL_MODULE_DIRS</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">PerlIncDir</span><span class="op">]</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t426" href="#t426">426</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t427" href="#t427">427</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t428" href="#t428">428</a></span><span class="t"><span class="op">@</span><span class="nam">functools</span><span class="op">.</span><span class="nam">lru_cache</span><span class="op">(</span><span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t429" href="#t429">429</a></span><span class="t"><span class="key">def</span> <span class="nam">_perl_config_data</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="nam">PerlConfigData</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t430" href="#t430">430</a></span><span class="t"> <span class="nam">d</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t431" href="#t431">431</a></span><span class="t"> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_output</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t432" href="#t432">432</a></span><span class="t"> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t433" href="#t433">433</a></span><span class="t"> <span class="str">"perl"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t434" href="#t434">434</a></span><span class="t"> <span class="str">"-MConfig"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t435" href="#t435">435</a></span><span class="t"> <span class="str">"-e"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t436" href="#t436">436</a></span><span class="t"> <span class="str">'print "$Config{version}\n$Config{debian_abi}\n"'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t437" href="#t437">437</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t438" href="#t438">438</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t439" href="#t439">439</a></span><span class="t"> <span class="op">.</span><span class="nam">decode</span><span class="op">(</span><span class="str">"utf-8"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t440" href="#t440">440</a></span><span class="t"> <span class="op">.</span><span class="nam">splitlines</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t441" href="#t441">441</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t442" href="#t442">442</a></span><span class="t"> <span class="key">return</span> <span class="nam">PerlConfigData</span><span class="op">(</span><span class="op">*</span><span class="nam">d</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t443" href="#t443">443</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t444" href="#t444">444</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t445" href="#t445">445</a></span><span class="t"><span class="key">def</span> <span class="nam">_perl_version</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t446" href="#t446">446</a></span><span class="t"> <span class="key">return</span> <span class="nam">_perl_config_data</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">version</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t447" href="#t447">447</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t448" href="#t448">448</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t449" href="#t449">449</a></span><span class="t"><span class="key">def</span> <span class="nam">perlxs_api_dependency</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t450" href="#t450">450</a></span><span class="t"> <span class="com"># dh_perl used the build version of perl for this, so we will too. Most of the perl cross logic</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t451" href="#t451">451</a></span><span class="t"> <span class="com"># assumes that the major version of build variant of Perl is the same as the host variant of Perl.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t452" href="#t452">452</a></span><span class="t"> <span class="nam">config</span> <span class="op">=</span> <span class="nam">_perl_config_data</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t453" href="#t453">453</a></span><span class="t"> <span class="key">if</span> <span class="nam">config</span><span class="op">.</span><span class="nam">debian_abi</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">config</span><span class="op">.</span><span class="nam">debian_abi</span> <span class="op">!=</span> <span class="str">""</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t454" href="#t454">454</a></span><span class="t"> <span class="key">return</span> <span class="str">f"perlapi-{config.debian_abi}"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t455" href="#t455">455</a></span><span class="t"> <span class="key">return</span> <span class="str">f"perlapi-{config.version}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t456" href="#t456">456</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t457" href="#t457">457</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t458" href="#t458">458</a></span><span class="t"><span class="key">def</span> <span class="nam">perl_module_dirs</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t459" href="#t459">459</a></span><span class="t"> <span class="nam">dpkg_architecture_variables</span><span class="op">:</span> <span class="nam">DpkgArchitectureBuildProcessValuesTable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t460" href="#t460">460</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">:</span> <span class="str">"BinaryPackage"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t461" href="#t461">461</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">PerlIncDir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t462" href="#t462">462</a></span><span class="t"> <span class="key">global</span> <span class="nam">_PERL_MODULE_DIRS</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t463" href="#t463">463</a></span><span class="t"> <span class="nam">arch</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t464" href="#t464">464</a></span><span class="t"> <span class="nam">dctrl_bin</span><span class="op">.</span><span class="nam">resolved_architecture</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t465" href="#t465">465</a></span><span class="t"> <span class="key">if</span> <span class="nam">dpkg_architecture_variables</span><span class="op">.</span><span class="nam">is_cross_compiling</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t466" href="#t466">466</a></span><span class="t"> <span class="key">else</span> <span class="str">"_default_"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t467" href="#t467">467</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t468" href="#t468">468</a></span><span class="t"> <span class="nam">module_dir</span> <span class="op">=</span> <span class="nam">_PERL_MODULE_DIRS</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">arch</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t469" href="#t469">469</a></span><span class="t"> <span class="key">if</span> <span class="nam">module_dir</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t470" href="#t470">470</a></span><span class="t"> <span class="nam">cmd</span> <span class="op">=</span> <span class="op">[</span><span class="str">"perl"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t471" href="#t471">471</a></span><span class="t"> <span class="key">if</span> <span class="nam">dpkg_architecture_variables</span><span class="op">.</span><span class="nam">is_cross_compiling</span><span class="op">:</span> </span><span class="r"><span class="annotate short">471 ↛ 472</span><span class="annotate long">line 471 didn't jump to line 472, because the condition on line 471 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t472" href="#t472">472</a></span><span class="t"> <span class="nam">version</span> <span class="op">=</span> <span class="nam">_perl_version</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t473" href="#t473">473</a></span><span class="t"> <span class="nam">inc_dir</span> <span class="op">=</span> <span class="str">f"/usr/lib/{dctrl_bin.deb_multiarch}/perl/cross-config-{version}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t474" href="#t474">474</a></span><span class="t"> <span class="com"># FIXME: This should not fallback to "build-arch" but on the other hand, we use the perl module dirs</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t475" href="#t475">475</a></span><span class="t"> <span class="com"># for every package at the moment. So mandating correct perl dirs implies mandating perl-xs-dev in</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t476" href="#t476">476</a></span><span class="t"> <span class="com"># cross builds... meh.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t477" href="#t477">477</a></span><span class="t"> <span class="key">if</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">exists</span><span class="op">(</span><span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">inc_dir</span><span class="op">,</span> <span class="str">"Config.pm"</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t478" href="#t478">478</a></span><span class="t"> <span class="nam">cmd</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">f"-I{inc_dir}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t479" href="#t479">479</a></span><span class="t"> <span class="nam">cmd</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t480" href="#t480">480</a></span><span class="t"> <span class="op">[</span><span class="str">"-MConfig"</span><span class="op">,</span> <span class="str">"-e"</span><span class="op">,</span> <span class="str">'print "$Config{vendorlib}\n$Config{vendorarch}\n"'</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t481" href="#t481">481</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t482" href="#t482">482</a></span><span class="t"> <span class="nam">output</span> <span class="op">=</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_output</span><span class="op">(</span><span class="nam">cmd</span><span class="op">)</span><span class="op">.</span><span class="nam">decode</span><span class="op">(</span><span class="str">"utf-8"</span><span class="op">)</span><span class="op">.</span><span class="nam">splitlines</span><span class="op">(</span><span class="nam">keepends</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t483" href="#t483">483</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">output</span><span class="op">)</span> <span class="op">!=</span> <span class="num">2</span><span class="op">:</span> </span><span class="r"><span class="annotate short">483 ↛ 484</span><span class="annotate long">line 483 didn't jump to line 484, because the condition on line 483 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t484" href="#t484">484</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t485" href="#t485">485</a></span><span class="t"> <span class="str">"Internal error: Unable to determine the perl include directories:"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t486" href="#t486">486</a></span><span class="t"> <span class="str">f" Raw output from perl snippet: {output}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t487" href="#t487">487</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t488" href="#t488">488</a></span><span class="t"> <span class="nam">module_dir</span> <span class="op">=</span> <span class="nam">PerlIncDir</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t489" href="#t489">489</a></span><span class="t"> <span class="nam">vendorlib</span><span class="op">=</span><span class="nam">_normalize_path</span><span class="op">(</span><span class="nam">output</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t490" href="#t490">490</a></span><span class="t"> <span class="nam">vendorarch</span><span class="op">=</span><span class="nam">_normalize_path</span><span class="op">(</span><span class="nam">output</span><span class="op">[</span><span class="num">1</span><span class="op">]</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t491" href="#t491">491</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t492" href="#t492">492</a></span><span class="t"> <span class="nam">_PERL_MODULE_DIRS</span><span class="op">[</span><span class="nam">arch</span><span class="op">]</span> <span class="op">=</span> <span class="nam">module_dir</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t493" href="#t493">493</a></span><span class="t"> <span class="key">return</span> <span class="nam">module_dir</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t494" href="#t494">494</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t495" href="#t495">495</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t496" href="#t496">496</a></span><span class="t"><span class="op">@</span><span class="nam">functools</span><span class="op">.</span><span class="nam">lru_cache</span><span class="op">(</span><span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t497" href="#t497">497</a></span><span class="t"><span class="key">def</span> <span class="nam">detect_fakeroot</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t498" href="#t498">498</a></span><span class="t"> <span class="key">if</span> <span class="nam">os</span><span class="op">.</span><span class="nam">getuid</span><span class="op">(</span><span class="op">)</span> <span class="op">!=</span> <span class="num">0</span> <span class="key">or</span> <span class="str">"LD_PRELOAD"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">os</span><span class="op">.</span><span class="nam">environ</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t499" href="#t499">499</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t500" href="#t500">500</a></span><span class="t"> <span class="nam">env</span> <span class="op">=</span> <span class="nam">dict</span><span class="op">(</span><span class="nam">os</span><span class="op">.</span><span class="nam">environ</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t501" href="#t501">501</a></span><span class="t"> <span class="key">del</span> <span class="nam">env</span><span class="op">[</span><span class="str">"LD_PRELOAD"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t502" href="#t502">502</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t503" href="#t503">503</a></span><span class="t"> <span class="key">return</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_output</span><span class="op">(</span><span class="op">[</span><span class="str">"id"</span><span class="op">,</span> <span class="str">"-u"</span><span class="op">]</span><span class="op">,</span> <span class="nam">env</span><span class="op">=</span><span class="nam">env</span><span class="op">)</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span> <span class="op">!=</span> <span class="str">b"0"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t504" href="#t504">504</a></span><span class="t"> <span class="key">except</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">CalledProcessError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t505" href="#t505">505</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t506" href="#t506">506</a></span><span class="t"> <span class="str">'Could not run "id -u" with LD_PRELOAD unset; assuming we are not run under fakeroot'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t507" href="#t507">507</a></span><span class="t"> <span class="nam">file</span><span class="op">=</span><span class="nam">sys</span><span class="op">.</span><span class="nam">stderr</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t508" href="#t508">508</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t509" href="#t509">509</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t510" href="#t510">510</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t511" href="#t511">511</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t512" href="#t512">512</a></span><span class="t"><span class="op">@</span><span class="nam">functools</span><span class="op">.</span><span class="nam">lru_cache</span><span class="op">(</span><span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t513" href="#t513">513</a></span><span class="t"><span class="key">def</span> <span class="nam">_sc_arg_max</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t514" href="#t514">514</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t515" href="#t515">515</a></span><span class="t"> <span class="key">return</span> <span class="nam">os</span><span class="op">.</span><span class="nam">sysconf</span><span class="op">(</span><span class="str">"SC_ARG_MAX"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t516" href="#t516">516</a></span><span class="t"> <span class="key">except</span> <span class="nam">RuntimeError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t517" href="#t517">517</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span><span class="str">"Could not resolve SC_ARG_MAX, falling back to a hard-coded limit"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t518" href="#t518">518</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t519" href="#t519">519</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t520" href="#t520">520</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t521" href="#t521">521</a></span><span class="t"><span class="key">def</span> <span class="nam">_split_xargs_args</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t522" href="#t522">522</a></span><span class="t"> <span class="nam">static_cmd</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t523" href="#t523">523</a></span><span class="t"> <span class="nam">max_args_byte_len</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t524" href="#t524">524</a></span><span class="t"> <span class="nam">varargs</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t525" href="#t525">525</a></span><span class="t"> <span class="nam">reuse_list_ok</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t526" href="#t526">526</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t527" href="#t527">527</a></span><span class="t"> <span class="nam">static_cmd_len</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">static_cmd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t528" href="#t528">528</a></span><span class="t"> <span class="nam">remaining_len</span> <span class="op">=</span> <span class="nam">max_args_byte_len</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t529" href="#t529">529</a></span><span class="t"> <span class="nam">pending_args</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">static_cmd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t530" href="#t530">530</a></span><span class="t"> <span class="key">for</span> <span class="nam">arg</span> <span class="key">in</span> <span class="nam">varargs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t531" href="#t531">531</a></span><span class="t"> <span class="nam">arg_len</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">arg</span><span class="op">.</span><span class="nam">encode</span><span class="op">(</span><span class="str">"utf-8"</span><span class="op">)</span><span class="op">)</span> <span class="op">+</span> <span class="num">1</span> <span class="com"># +1 for leading space</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t532" href="#t532">532</a></span><span class="t"> <span class="nam">remaining_len</span> <span class="op">-=</span> <span class="nam">arg_len</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t533" href="#t533">533</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">remaining_len</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t534" href="#t534">534</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">pending_args</span><span class="op">)</span> <span class="op"><=</span> <span class="nam">static_cmd_len</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t535" href="#t535">535</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t536" href="#t536">536</a></span><span class="t"> <span class="str">f"Could not fit a single argument into the command line !?"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t537" href="#t537">537</a></span><span class="t"> <span class="str">f" {max_args_byte_len} (variable argument limit) < {arg_len} (argument length)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t538" href="#t538">538</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t539" href="#t539">539</a></span><span class="t"> <span class="key">yield</span> <span class="nam">pending_args</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t540" href="#t540">540</a></span><span class="t"> <span class="nam">remaining_len</span> <span class="op">=</span> <span class="nam">max_args_byte_len</span> <span class="op">-</span> <span class="nam">arg_len</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t541" href="#t541">541</a></span><span class="t"> <span class="key">if</span> <span class="nam">reuse_list_ok</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t542" href="#t542">542</a></span><span class="t"> <span class="nam">pending_args</span><span class="op">.</span><span class="nam">clear</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t543" href="#t543">543</a></span><span class="t"> <span class="nam">pending_args</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">static_cmd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t544" href="#t544">544</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t545" href="#t545">545</a></span><span class="t"> <span class="nam">pending_args</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">static_cmd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t546" href="#t546">546</a></span><span class="t"> <span class="nam">pending_args</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">arg</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t547" href="#t547">547</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t548" href="#t548">548</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">pending_args</span><span class="op">)</span> <span class="op">></span> <span class="nam">static_cmd_len</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t549" href="#t549">549</a></span><span class="t"> <span class="key">yield</span> <span class="nam">pending_args</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t550" href="#t550">550</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t551" href="#t551">551</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t552" href="#t552">552</a></span><span class="t"><span class="key">def</span> <span class="nam">xargs</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t553" href="#t553">553</a></span><span class="t"> <span class="nam">static_cmd</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t554" href="#t554">554</a></span><span class="t"> <span class="nam">varargs</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t555" href="#t555">555</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t556" href="#t556">556</a></span><span class="t"> <span class="nam">env</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t557" href="#t557">557</a></span><span class="t"> <span class="nam">reuse_list_ok</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t558" href="#t558">558</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t559" href="#t559">559</a></span><span class="t"> <span class="nam">max_args_bytes</span> <span class="op">=</span> <span class="nam">_sc_arg_max</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t560" href="#t560">560</a></span><span class="t"> <span class="com"># len overshoots with one space explaining the -1. The _split_xargs_args</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t561" href="#t561">561</a></span><span class="t"> <span class="com"># will account for the space for the first argument</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t562" href="#t562">562</a></span><span class="t"> <span class="nam">static_byte_len</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t563" href="#t563">563</a></span><span class="t"> <span class="nam">len</span><span class="op">(</span><span class="nam">static_cmd</span><span class="op">)</span> <span class="op">-</span> <span class="num">1</span> <span class="op">+</span> <span class="nam">sum</span><span class="op">(</span><span class="nam">len</span><span class="op">(</span><span class="nam">a</span><span class="op">.</span><span class="nam">encode</span><span class="op">(</span><span class="str">"utf-8"</span><span class="op">)</span><span class="op">)</span> <span class="key">for</span> <span class="nam">a</span> <span class="key">in</span> <span class="nam">static_cmd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t564" href="#t564">564</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t565" href="#t565">565</a></span><span class="t"> <span class="key">if</span> <span class="nam">max_args_bytes</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t566" href="#t566">566</a></span><span class="t"> <span class="key">if</span> <span class="nam">env</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t567" href="#t567">567</a></span><span class="t"> <span class="com"># +2 for nul bytes after key and value</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t568" href="#t568">568</a></span><span class="t"> <span class="nam">static_byte_len</span> <span class="op">+=</span> <span class="nam">sum</span><span class="op">(</span><span class="nam">len</span><span class="op">(</span><span class="nam">k</span><span class="op">)</span> <span class="op">+</span> <span class="nam">len</span><span class="op">(</span><span class="nam">v</span><span class="op">)</span> <span class="op">+</span> <span class="num">2</span> <span class="key">for</span> <span class="nam">k</span><span class="op">,</span> <span class="nam">v</span> <span class="key">in</span> <span class="nam">os</span><span class="op">.</span><span class="nam">environb</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t569" href="#t569">569</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t570" href="#t570">570</a></span><span class="t"> <span class="com"># +2 for nul bytes after key and value</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t571" href="#t571">571</a></span><span class="t"> <span class="nam">static_byte_len</span> <span class="op">+=</span> <span class="nam">sum</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t572" href="#t572">572</a></span><span class="t"> <span class="nam">len</span><span class="op">(</span><span class="nam">k</span><span class="op">.</span><span class="nam">encode</span><span class="op">(</span><span class="str">"utf-8"</span><span class="op">)</span><span class="op">)</span> <span class="op">+</span> <span class="nam">len</span><span class="op">(</span><span class="nam">v</span><span class="op">.</span><span class="nam">encode</span><span class="op">(</span><span class="str">"utf-8"</span><span class="op">)</span><span class="op">)</span> <span class="op">+</span> <span class="num">2</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t573" href="#t573">573</a></span><span class="t"> <span class="key">for</span> <span class="nam">k</span><span class="op">,</span> <span class="nam">v</span> <span class="key">in</span> <span class="nam">env</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t574" href="#t574">574</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t575" href="#t575">575</a></span><span class="t"> <span class="com"># Add a fixed buffer for OS overhead here (in case env and cmd both must be page-aligned or something like</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t576" href="#t576">576</a></span><span class="t"> <span class="com"># that)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t577" href="#t577">577</a></span><span class="t"> <span class="nam">static_byte_len</span> <span class="op">+=</span> <span class="num">2</span> <span class="op">*</span> <span class="num">4096</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t578" href="#t578">578</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t579" href="#t579">579</a></span><span class="t"> <span class="com"># The 20 000 limit is from debhelper, and it did not account for environment. So neither will we here.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t580" href="#t580">580</a></span><span class="t"> <span class="nam">max_args_bytes</span> <span class="op">=</span> <span class="num">20_000</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t581" href="#t581">581</a></span><span class="t"> <span class="nam">remain_len</span> <span class="op">=</span> <span class="nam">max_args_bytes</span> <span class="op">-</span> <span class="nam">static_byte_len</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t582" href="#t582">582</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">_split_xargs_args</span><span class="op">(</span><span class="nam">static_cmd</span><span class="op">,</span> <span class="nam">remain_len</span><span class="op">,</span> <span class="nam">varargs</span><span class="op">,</span> <span class="nam">reuse_list_ok</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t583" href="#t583">583</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t584" href="#t584">584</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t585" href="#t585">585</a></span><span class="t"><span class="com"># itertools recipe</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t586" href="#t586">586</a></span><span class="t"><span class="key">def</span> <span class="nam">grouper</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t587" href="#t587">587</a></span><span class="t"> <span class="nam">iterable</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">T</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t588" href="#t588">588</a></span><span class="t"> <span class="nam">n</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t589" href="#t589">589</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t590" href="#t590">590</a></span><span class="t"> <span class="nam">incomplete</span><span class="op">:</span> <span class="nam">Literal</span><span class="op">[</span><span class="str">"fill"</span><span class="op">,</span> <span class="str">"strict"</span><span class="op">,</span> <span class="str">"ignore"</span><span class="op">]</span> <span class="op">=</span> <span class="str">"fill"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t591" href="#t591">591</a></span><span class="t"> <span class="nam">fillvalue</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">T</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t592" href="#t592">592</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">T</span><span class="op">,</span> <span class="op">...</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t593" href="#t593">593</a></span><span class="t"> <span class="str">"""Collect data into non-overlapping fixed-length chunks or blocks"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t594" href="#t594">594</a></span><span class="t"> <span class="com"># grouper('ABCDEFG', 3, fillvalue='x') --> ABC DEF Gxx</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t595" href="#t595">595</a></span><span class="t"> <span class="com"># grouper('ABCDEFG', 3, incomplete='strict') --> ABC DEF ValueError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t596" href="#t596">596</a></span><span class="t"> <span class="com"># grouper('ABCDEFG', 3, incomplete='ignore') --> ABC DEF</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t597" href="#t597">597</a></span><span class="t"> <span class="nam">args</span> <span class="op">=</span> <span class="op">[</span><span class="nam">iter</span><span class="op">(</span><span class="nam">iterable</span><span class="op">)</span><span class="op">]</span> <span class="op">*</span> <span class="nam">n</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t598" href="#t598">598</a></span><span class="t"> <span class="key">if</span> <span class="nam">incomplete</span> <span class="op">==</span> <span class="str">"fill"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t599" href="#t599">599</a></span><span class="t"> <span class="key">return</span> <span class="nam">zip_longest</span><span class="op">(</span><span class="op">*</span><span class="nam">args</span><span class="op">,</span> <span class="nam">fillvalue</span><span class="op">=</span><span class="nam">fillvalue</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t600" href="#t600">600</a></span><span class="t"> <span class="key">if</span> <span class="nam">incomplete</span> <span class="op">==</span> <span class="str">"strict"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t601" href="#t601">601</a></span><span class="t"> <span class="key">return</span> <span class="nam">zip</span><span class="op">(</span><span class="op">*</span><span class="nam">args</span><span class="op">,</span> <span class="nam">strict</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t602" href="#t602">602</a></span><span class="t"> <span class="key">if</span> <span class="nam">incomplete</span> <span class="op">==</span> <span class="str">"ignore"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t603" href="#t603">603</a></span><span class="t"> <span class="key">return</span> <span class="nam">zip</span><span class="op">(</span><span class="op">*</span><span class="nam">args</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t604" href="#t604">604</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t605" href="#t605">605</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"Expected fill, strict, or ignore"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t606" href="#t606">606</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t607" href="#t607">607</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t608" href="#t608">608</a></span><span class="t"><span class="nam">_LOGGING_SET_UP</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t609" href="#t609">609</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t610" href="#t610">610</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t611" href="#t611">611</a></span><span class="t"><span class="key">def</span> <span class="nam">_check_color</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">bool</span><span class="op">,</span> <span class="nam">bool</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t612" href="#t612">612</a></span><span class="t"> <span class="nam">dpkg_or_default</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">environ</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t613" href="#t613">613</a></span><span class="t"> <span class="str">"DPKG_COLORS"</span><span class="op">,</span> <span class="str">"never"</span> <span class="key">if</span> <span class="str">"NO_COLOR"</span> <span class="key">in</span> <span class="nam">os</span><span class="op">.</span><span class="nam">environ</span> <span class="key">else</span> <span class="str">"auto"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t614" href="#t614">614</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t615" href="#t615">615</a></span><span class="t"> <span class="nam">requested_color</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">environ</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"DEBPUTY_COLORS"</span><span class="op">,</span> <span class="nam">dpkg_or_default</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t616" href="#t616">616</a></span><span class="t"> <span class="nam">bad_request</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t617" href="#t617">617</a></span><span class="t"> <span class="key">if</span> <span class="nam">requested_color</span> <span class="key">not</span> <span class="key">in</span> <span class="op">{</span><span class="str">"auto"</span><span class="op">,</span> <span class="str">"always"</span><span class="op">,</span> <span class="str">"never"</span><span class="op">}</span><span class="op">:</span> </span><span class="r"><span class="annotate short">617 ↛ 618</span><span class="annotate long">line 617 didn't jump to line 618, because the condition on line 617 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t618" href="#t618">618</a></span><span class="t"> <span class="nam">bad_request</span> <span class="op">=</span> <span class="nam">requested_color</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t619" href="#t619">619</a></span><span class="t"> <span class="nam">requested_color</span> <span class="op">=</span> <span class="str">"auto"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t620" href="#t620">620</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t621" href="#t621">621</a></span><span class="t"> <span class="key">if</span> <span class="nam">requested_color</span> <span class="op">==</span> <span class="str">"auto"</span><span class="op">:</span> </span><span class="r"><span class="annotate short">621 ↛ 625</span><span class="annotate long">line 621 didn't jump to line 625, because the condition on line 621 was never false</span></span></p> - <p class="run"><span class="n"><a id="t622" href="#t622">622</a></span><span class="t"> <span class="nam">stdout_color</span> <span class="op">=</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">stdout</span><span class="op">.</span><span class="nam">isatty</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t623" href="#t623">623</a></span><span class="t"> <span class="nam">stderr_color</span> <span class="op">=</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">stdout</span><span class="op">.</span><span class="nam">isatty</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t624" href="#t624">624</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t625" href="#t625">625</a></span><span class="t"> <span class="nam">enable</span> <span class="op">=</span> <span class="nam">requested_color</span> <span class="op">==</span> <span class="str">"always"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t626" href="#t626">626</a></span><span class="t"> <span class="nam">stdout_color</span> <span class="op">=</span> <span class="nam">enable</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t627" href="#t627">627</a></span><span class="t"> <span class="nam">stderr_color</span> <span class="op">=</span> <span class="nam">enable</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t628" href="#t628">628</a></span><span class="t"> <span class="key">return</span> <span class="nam">stdout_color</span><span class="op">,</span> <span class="nam">stderr_color</span><span class="op">,</span> <span class="nam">bad_request</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t629" href="#t629">629</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t630" href="#t630">630</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t631" href="#t631">631</a></span><span class="t"><span class="key">def</span> <span class="nam">program_name</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t632" href="#t632">632</a></span><span class="t"> <span class="nam">name</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">basename</span><span class="op">(</span><span class="nam">sys</span><span class="op">.</span><span class="nam">argv</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t633" href="#t633">633</a></span><span class="t"> <span class="key">if</span> <span class="nam">name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">".py"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">633 ↛ 634</span><span class="annotate long">line 633 didn't jump to line 634, because the condition on line 633 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t634" href="#t634">634</a></span><span class="t"> <span class="nam">name</span> <span class="op">=</span> <span class="nam">name</span><span class="op">[</span><span class="op">:</span><span class="op">-</span><span class="num">3</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t635" href="#t635">635</a></span><span class="t"> <span class="key">if</span> <span class="nam">name</span> <span class="op">==</span> <span class="str">"__main__"</span><span class="op">:</span> </span><span class="r"><span class="annotate short">635 ↛ 636</span><span class="annotate long">line 635 didn't jump to line 636, because the condition on line 635 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t636" href="#t636">636</a></span><span class="t"> <span class="nam">name</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">basename</span><span class="op">(</span><span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">dirname</span><span class="op">(</span><span class="nam">sys</span><span class="op">.</span><span class="nam">argv</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t637" href="#t637">637</a></span><span class="t"> <span class="com"># FIXME: Not optimal that we have to hardcode these kind of things here</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t638" href="#t638">638</a></span><span class="t"> <span class="key">if</span> <span class="nam">name</span> <span class="op">==</span> <span class="str">"debputy_cmd"</span><span class="op">:</span> </span><span class="r"><span class="annotate short">638 ↛ 639</span><span class="annotate long">line 638 didn't jump to line 639, because the condition on line 638 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t639" href="#t639">639</a></span><span class="t"> <span class="nam">name</span> <span class="op">=</span> <span class="str">"debputy"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t640" href="#t640">640</a></span><span class="t"> <span class="key">return</span> <span class="nam">name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t641" href="#t641">641</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t642" href="#t642">642</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t643" href="#t643">643</a></span><span class="t"><span class="key">def</span> <span class="nam">package_cross_check_precheck</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t644" href="#t644">644</a></span><span class="t"> <span class="nam">pkg_a</span><span class="op">:</span> <span class="str">"BinaryPackage"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t645" href="#t645">645</a></span><span class="t"> <span class="nam">pkg_b</span><span class="op">:</span> <span class="str">"BinaryPackage"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t646" href="#t646">646</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">bool</span><span class="op">,</span> <span class="nam">bool</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t647" href="#t647">647</a></span><span class="t"> <span class="str">"""Whether these two packages can do content cross-checks</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t648" href="#t648">648</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t649" href="#t649">649</a></span><span class="t"><span class="str"> :param pkg_a: The first package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t650" href="#t650">650</a></span><span class="t"><span class="str"> :param pkg_b: The second package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t651" href="#t651">651</a></span><span class="t"><span class="str"> :return: A tuple if two booleans. If the first is True, then binary_package_a may do content cross-checks</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t652" href="#t652">652</a></span><span class="t"><span class="str"> that invoĺves binary_package_b. If the second is True, then binary_package_b may do content cross-checks</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t653" href="#t653">653</a></span><span class="t"><span class="str"> that involves binary_package_a. Both can be True and both can be False at the same time, which</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t654" href="#t654">654</a></span><span class="t"><span class="str"> happens in common cases (arch:all + arch:any cases both to be False as a common example).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t655" href="#t655">655</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t656" href="#t656">656</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t657" href="#t657">657</a></span><span class="t"> <span class="com"># Handle the two most obvious base-cases</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t658" href="#t658">658</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">pkg_a</span><span class="op">.</span><span class="nam">should_be_acted_on</span> <span class="key">or</span> <span class="key">not</span> <span class="nam">pkg_b</span><span class="op">.</span><span class="nam">should_be_acted_on</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t659" href="#t659">659</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span><span class="op">,</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t660" href="#t660">660</a></span><span class="t"> <span class="key">if</span> <span class="nam">pkg_a</span><span class="op">.</span><span class="nam">is_arch_all</span> <span class="op">^</span> <span class="nam">pkg_b</span><span class="op">.</span><span class="nam">is_arch_all</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t661" href="#t661">661</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span><span class="op">,</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t662" href="#t662">662</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t663" href="#t663">663</a></span><span class="t"> <span class="nam">a_may_see_b</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t664" href="#t664">664</a></span><span class="t"> <span class="nam">b_may_see_a</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t665" href="#t665">665</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t666" href="#t666">666</a></span><span class="t"> <span class="nam">a_bp</span> <span class="op">=</span> <span class="nam">pkg_a</span><span class="op">.</span><span class="nam">fields</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"Build-Profiles"</span><span class="op">,</span> <span class="str">""</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t667" href="#t667">667</a></span><span class="t"> <span class="nam">b_bp</span> <span class="op">=</span> <span class="nam">pkg_b</span><span class="op">.</span><span class="nam">fields</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"Build-Profiles"</span><span class="op">,</span> <span class="str">""</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t668" href="#t668">668</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t669" href="#t669">669</a></span><span class="t"> <span class="key">if</span> <span class="nam">a_bp</span> <span class="op">!=</span> <span class="nam">b_bp</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t670" href="#t670">670</a></span><span class="t"> <span class="nam">a_bp_set</span> <span class="op">=</span> <span class="nam">_parse_build_profiles</span><span class="op">(</span><span class="nam">a_bp</span><span class="op">)</span> <span class="key">if</span> <span class="nam">a_bp</span> <span class="op">!=</span> <span class="str">""</span> <span class="key">else</span> <span class="nam">frozenset</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t671" href="#t671">671</a></span><span class="t"> <span class="nam">b_bp_set</span> <span class="op">=</span> <span class="nam">_parse_build_profiles</span><span class="op">(</span><span class="nam">b_bp</span><span class="op">)</span> <span class="key">if</span> <span class="nam">b_bp</span> <span class="op">!=</span> <span class="str">""</span> <span class="key">else</span> <span class="nam">frozenset</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t672" href="#t672">672</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t673" href="#t673">673</a></span><span class="t"> <span class="com"># Check for build profiles being identically but just ordered differently.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t674" href="#t674">674</a></span><span class="t"> <span class="key">if</span> <span class="nam">a_bp_set</span> <span class="op">!=</span> <span class="nam">b_bp_set</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t675" href="#t675">675</a></span><span class="t"> <span class="com"># For simplicity, we let groups cancel each other out. If one side has no clauses</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t676" href="#t676">676</a></span><span class="t"> <span class="com"># left, then it will always be built when the other is built.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t677" href="#t677">677</a></span><span class="t"> <span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t678" href="#t678">678</a></span><span class="t"> <span class="com"># Eventually, someone will be here with a special case where more complex logic is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t679" href="#t679">679</a></span><span class="t"> <span class="com"># required. Good luck to you! Remember to add test cases for it (the existing logic</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t680" href="#t680">680</a></span><span class="t"> <span class="com"># has some for a reason and if the logic is going to be more complex, it will need</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t681" href="#t681">681</a></span><span class="t"> <span class="com"># tests cases to assert it fixes the problem and does not regress)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t682" href="#t682">682</a></span><span class="t"> <span class="key">if</span> <span class="nam">a_bp_set</span> <span class="op">-</span> <span class="nam">b_bp_set</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t683" href="#t683">683</a></span><span class="t"> <span class="nam">a_may_see_b</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t684" href="#t684">684</a></span><span class="t"> <span class="key">if</span> <span class="nam">b_bp_set</span> <span class="op">-</span> <span class="nam">a_bp_set</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t685" href="#t685">685</a></span><span class="t"> <span class="nam">b_may_see_a</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t686" href="#t686">686</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t687" href="#t687">687</a></span><span class="t"> <span class="key">if</span> <span class="nam">pkg_a</span><span class="op">.</span><span class="nam">declared_architecture</span> <span class="op">!=</span> <span class="nam">pkg_b</span><span class="op">.</span><span class="nam">declared_architecture</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t688" href="#t688">688</a></span><span class="t"> <span class="com"># Also here we could do a subset check, but wildcards vs. non-wildcards make that a pain</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t689" href="#t689">689</a></span><span class="t"> <span class="key">if</span> <span class="nam">pkg_a</span><span class="op">.</span><span class="nam">declared_architecture</span> <span class="op">!=</span> <span class="str">"any"</span><span class="op">:</span> </span><span class="r"><span class="annotate short">689 ↛ 691</span><span class="annotate long">line 689 didn't jump to line 691, because the condition on line 689 was never false</span></span></p> - <p class="run"><span class="n"><a id="t690" href="#t690">690</a></span><span class="t"> <span class="nam">b_may_see_a</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t691" href="#t691">691</a></span><span class="t"> <span class="key">if</span> <span class="nam">pkg_a</span><span class="op">.</span><span class="nam">declared_architecture</span> <span class="op">!=</span> <span class="str">"any"</span><span class="op">:</span> </span><span class="r"><span class="annotate short">691 ↛ 694</span><span class="annotate long">line 691 didn't jump to line 694, because the condition on line 691 was never false</span></span></p> - <p class="run"><span class="n"><a id="t692" href="#t692">692</a></span><span class="t"> <span class="nam">a_may_see_b</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t693" href="#t693">693</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t694" href="#t694">694</a></span><span class="t"> <span class="key">return</span> <span class="nam">a_may_see_b</span><span class="op">,</span> <span class="nam">b_may_see_a</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t695" href="#t695">695</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t696" href="#t696">696</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t697" href="#t697">697</a></span><span class="t"><span class="key">def</span> <span class="nam">setup_logging</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t698" href="#t698">698</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> <span class="nam">log_only_to_stderr</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> <span class="nam">reconfigure_logging</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t699" href="#t699">699</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t700" href="#t700">700</a></span><span class="t"> <span class="key">global</span> <span class="nam">_LOGGING_SET_UP</span><span class="op">,</span> <span class="nam">_DEFAULT_LOGGER</span><span class="op">,</span> <span class="nam">_STDOUT_HANDLER</span><span class="op">,</span> <span class="nam">_STDERR_HANDLER</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t701" href="#t701">701</a></span><span class="t"> <span class="key">if</span> <span class="nam">_LOGGING_SET_UP</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">reconfigure_logging</span><span class="op">:</span> </span><span class="r"><span class="annotate short">701 ↛ 702</span><span class="annotate long">line 701 didn't jump to line 702, because the condition on line 701 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t702" href="#t702">702</a></span><span class="t"> <span class="key">raise</span> <span class="nam">RuntimeError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t703" href="#t703">703</a></span><span class="t"> <span class="str">"Logging has already been configured."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t704" href="#t704">704</a></span><span class="t"> <span class="str">" Use reconfigure_logging=True if you need to reconfigure it"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t705" href="#t705">705</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t706" href="#t706">706</a></span><span class="t"> <span class="nam">stdout_color</span><span class="op">,</span> <span class="nam">stderr_color</span><span class="op">,</span> <span class="nam">bad_request</span> <span class="op">=</span> <span class="nam">_check_color</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t707" href="#t707">707</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t708" href="#t708">708</a></span><span class="t"> <span class="key">if</span> <span class="nam">stdout_color</span> <span class="key">or</span> <span class="nam">stderr_color</span><span class="op">:</span> </span><span class="r"><span class="annotate short">708 ↛ 709</span><span class="annotate long">line 708 didn't jump to line 709, because the condition on line 708 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t709" href="#t709">709</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t710" href="#t710">710</a></span><span class="t"> <span class="key">import</span> <span class="nam">colorlog</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t711" href="#t711">711</a></span><span class="t"> <span class="key">except</span> <span class="nam">ImportError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t712" href="#t712">712</a></span><span class="t"> <span class="nam">stdout_color</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t713" href="#t713">713</a></span><span class="t"> <span class="nam">stderr_color</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t714" href="#t714">714</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t715" href="#t715">715</a></span><span class="t"> <span class="key">if</span> <span class="nam">log_only_to_stderr</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t716" href="#t716">716</a></span><span class="t"> <span class="nam">stdout</span> <span class="op">=</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">stderr</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t717" href="#t717">717</a></span><span class="t"> <span class="nam">stdout_color</span> <span class="op">=</span> <span class="nam">stderr_color</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t718" href="#t718">718</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t719" href="#t719">719</a></span><span class="t"> <span class="nam">stdout</span> <span class="op">=</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">stderr</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t720" href="#t720">720</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t721" href="#t721">721</a></span><span class="t"> <span class="key">class</span> <span class="nam">LogLevelFilter</span><span class="op">(</span><span class="nam">logging</span><span class="op">.</span><span class="nam">Filter</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t722" href="#t722">722</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">threshold</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> <span class="nam">above</span><span class="op">:</span> <span class="nam">bool</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t723" href="#t723">723</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t724" href="#t724">724</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">threshold</span> <span class="op">=</span> <span class="nam">threshold</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t725" href="#t725">725</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">above</span> <span class="op">=</span> <span class="nam">above</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t726" href="#t726">726</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t727" href="#t727">727</a></span><span class="t"> <span class="key">def</span> <span class="nam">filter</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">record</span><span class="op">:</span> <span class="nam">logging</span><span class="op">.</span><span class="nam">LogRecord</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t728" href="#t728">728</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">above</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t729" href="#t729">729</a></span><span class="t"> <span class="key">return</span> <span class="nam">record</span><span class="op">.</span><span class="nam">levelno</span> <span class="op">>=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">threshold</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t730" href="#t730">730</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t731" href="#t731">731</a></span><span class="t"> <span class="key">return</span> <span class="nam">record</span><span class="op">.</span><span class="nam">levelno</span> <span class="op"><</span> <span class="nam">self</span><span class="op">.</span><span class="nam">threshold</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t732" href="#t732">732</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t733" href="#t733">733</a></span><span class="t"> <span class="nam">color_format</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t734" href="#t734">734</a></span><span class="t"> <span class="str">"{bold}{name}{reset}: {bold}{log_color}{levelnamelower}{reset}: {message}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t735" href="#t735">735</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t736" href="#t736">736</a></span><span class="t"> <span class="nam">colorless_format</span> <span class="op">=</span> <span class="str">"{name}: {levelnamelower}: {message}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t737" href="#t737">737</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t738" href="#t738">738</a></span><span class="t"> <span class="nam">existing_stdout_handler</span> <span class="op">=</span> <span class="nam">_STDOUT_HANDLER</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t739" href="#t739">739</a></span><span class="t"> <span class="nam">existing_stderr_handler</span> <span class="op">=</span> <span class="nam">_STDERR_HANDLER</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t740" href="#t740">740</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t741" href="#t741">741</a></span><span class="t"> <span class="key">if</span> <span class="nam">stdout_color</span><span class="op">:</span> </span><span class="r"><span class="annotate short">741 ↛ 742</span><span class="annotate long">line 741 didn't jump to line 742, because the condition on line 741 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t742" href="#t742">742</a></span><span class="t"> <span class="nam">stdout_handler</span> <span class="op">=</span> <span class="nam">colorlog</span><span class="op">.</span><span class="nam">StreamHandler</span><span class="op">(</span><span class="nam">stdout</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t743" href="#t743">743</a></span><span class="t"> <span class="nam">stdout_handler</span><span class="op">.</span><span class="nam">setFormatter</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t744" href="#t744">744</a></span><span class="t"> <span class="nam">colorlog</span><span class="op">.</span><span class="nam">ColoredFormatter</span><span class="op">(</span><span class="nam">color_format</span><span class="op">,</span> <span class="nam">style</span><span class="op">=</span><span class="str">"{"</span><span class="op">,</span> <span class="nam">force_color</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t745" href="#t745">745</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t746" href="#t746">746</a></span><span class="t"> <span class="nam">logger</span> <span class="op">=</span> <span class="nam">colorlog</span><span class="op">.</span><span class="nam">getLogger</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t747" href="#t747">747</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing_stdout_handler</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t748" href="#t748">748</a></span><span class="t"> <span class="nam">logger</span><span class="op">.</span><span class="nam">removeHandler</span><span class="op">(</span><span class="nam">existing_stdout_handler</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t749" href="#t749">749</a></span><span class="t"> <span class="nam">_STDOUT_HANDLER</span> <span class="op">=</span> <span class="nam">stdout_handler</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t750" href="#t750">750</a></span><span class="t"> <span class="nam">logger</span><span class="op">.</span><span class="nam">addHandler</span><span class="op">(</span><span class="nam">stdout_handler</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t751" href="#t751">751</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t752" href="#t752">752</a></span><span class="t"> <span class="nam">stdout_handler</span> <span class="op">=</span> <span class="nam">logging</span><span class="op">.</span><span class="nam">StreamHandler</span><span class="op">(</span><span class="nam">stdout</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t753" href="#t753">753</a></span><span class="t"> <span class="nam">stdout_handler</span><span class="op">.</span><span class="nam">setFormatter</span><span class="op">(</span><span class="nam">logging</span><span class="op">.</span><span class="nam">Formatter</span><span class="op">(</span><span class="nam">colorless_format</span><span class="op">,</span> <span class="nam">style</span><span class="op">=</span><span class="str">"{"</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t754" href="#t754">754</a></span><span class="t"> <span class="nam">logger</span> <span class="op">=</span> <span class="nam">logging</span><span class="op">.</span><span class="nam">getLogger</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t755" href="#t755">755</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing_stdout_handler</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t756" href="#t756">756</a></span><span class="t"> <span class="nam">logger</span><span class="op">.</span><span class="nam">removeHandler</span><span class="op">(</span><span class="nam">existing_stdout_handler</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t757" href="#t757">757</a></span><span class="t"> <span class="nam">_STDOUT_HANDLER</span> <span class="op">=</span> <span class="nam">stdout_handler</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t758" href="#t758">758</a></span><span class="t"> <span class="nam">logger</span><span class="op">.</span><span class="nam">addHandler</span><span class="op">(</span><span class="nam">stdout_handler</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t759" href="#t759">759</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t760" href="#t760">760</a></span><span class="t"> <span class="key">if</span> <span class="nam">stderr_color</span><span class="op">:</span> </span><span class="r"><span class="annotate short">760 ↛ 761</span><span class="annotate long">line 760 didn't jump to line 761, because the condition on line 760 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t761" href="#t761">761</a></span><span class="t"> <span class="nam">stderr_handler</span> <span class="op">=</span> <span class="nam">colorlog</span><span class="op">.</span><span class="nam">StreamHandler</span><span class="op">(</span><span class="nam">sys</span><span class="op">.</span><span class="nam">stderr</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t762" href="#t762">762</a></span><span class="t"> <span class="nam">stderr_handler</span><span class="op">.</span><span class="nam">setFormatter</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t763" href="#t763">763</a></span><span class="t"> <span class="nam">colorlog</span><span class="op">.</span><span class="nam">ColoredFormatter</span><span class="op">(</span><span class="nam">color_format</span><span class="op">,</span> <span class="nam">style</span><span class="op">=</span><span class="str">"{"</span><span class="op">,</span> <span class="nam">force_color</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t764" href="#t764">764</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t765" href="#t765">765</a></span><span class="t"> <span class="nam">logger</span> <span class="op">=</span> <span class="nam">logging</span><span class="op">.</span><span class="nam">getLogger</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t766" href="#t766">766</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing_stdout_handler</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t767" href="#t767">767</a></span><span class="t"> <span class="nam">logger</span><span class="op">.</span><span class="nam">removeHandler</span><span class="op">(</span><span class="nam">existing_stderr_handler</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t768" href="#t768">768</a></span><span class="t"> <span class="nam">_STDERR_HANDLER</span> <span class="op">=</span> <span class="nam">stderr_handler</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t769" href="#t769">769</a></span><span class="t"> <span class="nam">logger</span><span class="op">.</span><span class="nam">addHandler</span><span class="op">(</span><span class="nam">stderr_handler</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t770" href="#t770">770</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t771" href="#t771">771</a></span><span class="t"> <span class="nam">stderr_handler</span> <span class="op">=</span> <span class="nam">logging</span><span class="op">.</span><span class="nam">StreamHandler</span><span class="op">(</span><span class="nam">sys</span><span class="op">.</span><span class="nam">stderr</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t772" href="#t772">772</a></span><span class="t"> <span class="nam">stderr_handler</span><span class="op">.</span><span class="nam">setFormatter</span><span class="op">(</span><span class="nam">logging</span><span class="op">.</span><span class="nam">Formatter</span><span class="op">(</span><span class="nam">colorless_format</span><span class="op">,</span> <span class="nam">style</span><span class="op">=</span><span class="str">"{"</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t773" href="#t773">773</a></span><span class="t"> <span class="nam">logger</span> <span class="op">=</span> <span class="nam">logging</span><span class="op">.</span><span class="nam">getLogger</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t774" href="#t774">774</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing_stdout_handler</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t775" href="#t775">775</a></span><span class="t"> <span class="nam">logger</span><span class="op">.</span><span class="nam">removeHandler</span><span class="op">(</span><span class="nam">existing_stderr_handler</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t776" href="#t776">776</a></span><span class="t"> <span class="nam">_STDERR_HANDLER</span> <span class="op">=</span> <span class="nam">stderr_handler</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t777" href="#t777">777</a></span><span class="t"> <span class="nam">logger</span><span class="op">.</span><span class="nam">addHandler</span><span class="op">(</span><span class="nam">stderr_handler</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t778" href="#t778">778</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t779" href="#t779">779</a></span><span class="t"> <span class="nam">stdout_handler</span><span class="op">.</span><span class="nam">addFilter</span><span class="op">(</span><span class="nam">LogLevelFilter</span><span class="op">(</span><span class="nam">logging</span><span class="op">.</span><span class="nam">WARN</span><span class="op">,</span> <span class="key">False</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t780" href="#t780">780</a></span><span class="t"> <span class="nam">stderr_handler</span><span class="op">.</span><span class="nam">addFilter</span><span class="op">(</span><span class="nam">LogLevelFilter</span><span class="op">(</span><span class="nam">logging</span><span class="op">.</span><span class="nam">WARN</span><span class="op">,</span> <span class="key">True</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t781" href="#t781">781</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t782" href="#t782">782</a></span><span class="t"> <span class="nam">name</span> <span class="op">=</span> <span class="nam">program_name</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t783" href="#t783">783</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t784" href="#t784">784</a></span><span class="t"> <span class="nam">old_factory</span> <span class="op">=</span> <span class="nam">logging</span><span class="op">.</span><span class="nam">getLogRecordFactory</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t785" href="#t785">785</a></span><span class="t"> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t786" href="#t786">786</a></span><span class="t"> <span class="key">def</span> <span class="nam">record_factory</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t787" href="#t787">787</a></span><span class="t"> <span class="op">*</span><span class="nam">args</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> <span class="op">**</span><span class="nam">kwargs</span><span class="op">:</span> <span class="nam">Any</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t788" href="#t788">788</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">logging</span><span class="op">.</span><span class="nam">LogRecord</span><span class="op">:</span> <span class="com"># pragma: no cover</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t789" href="#t789">789</a></span><span class="t"> <span class="nam">record</span> <span class="op">=</span> <span class="nam">old_factory</span><span class="op">(</span><span class="op">*</span><span class="nam">args</span><span class="op">,</span> <span class="op">**</span><span class="nam">kwargs</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t790" href="#t790">790</a></span><span class="t"> <span class="nam">record</span><span class="op">.</span><span class="nam">levelnamelower</span> <span class="op">=</span> <span class="nam">record</span><span class="op">.</span><span class="nam">levelname</span><span class="op">.</span><span class="nam">lower</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t791" href="#t791">791</a></span><span class="t"> <span class="key">return</span> <span class="nam">record</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t792" href="#t792">792</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t793" href="#t793">793</a></span><span class="t"> <span class="nam">logging</span><span class="op">.</span><span class="nam">setLogRecordFactory</span><span class="op">(</span><span class="nam">record_factory</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t794" href="#t794">794</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t795" href="#t795">795</a></span><span class="t"> <span class="nam">logging</span><span class="op">.</span><span class="nam">getLogger</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">setLevel</span><span class="op">(</span><span class="nam">logging</span><span class="op">.</span><span class="nam">INFO</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t796" href="#t796">796</a></span><span class="t"> <span class="nam">_DEFAULT_LOGGER</span> <span class="op">=</span> <span class="nam">logging</span><span class="op">.</span><span class="nam">getLogger</span><span class="op">(</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t797" href="#t797">797</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t798" href="#t798">798</a></span><span class="t"> <span class="key">if</span> <span class="nam">bad_request</span><span class="op">:</span> </span><span class="r"><span class="annotate short">798 ↛ 799</span><span class="annotate long">line 798 didn't jump to line 799, because the condition on line 798 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t799" href="#t799">799</a></span><span class="t"> <span class="nam">_DEFAULT_LOGGER</span><span class="op">.</span><span class="nam">warning</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t800" href="#t800">800</a></span><span class="t"> <span class="str">f'Invalid color request for "{bad_request}" in either DEBPUTY_COLORS or DPKG_COLORS.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t801" href="#t801">801</a></span><span class="t"> <span class="str">' Resetting to "auto".'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t802" href="#t802">802</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t803" href="#t803">803</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t804" href="#t804">804</a></span><span class="t"> <span class="nam">_LOGGING_SET_UP</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_types_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_version_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_267b6307937f1878_version_py.html b/coverage-report/d_267b6307937f1878_version_py.html deleted file mode 100644 index e8a9143..0000000 --- a/coverage-report/d_267b6307937f1878_version_py.html +++ /dev/null @@ -1,166 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/version.py: 75%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/version.py</b>: - <span class="pc_cov">75%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">38 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">29<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">9<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">2<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_util_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_6c155ce9dd9f7742___init___py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Optional</span><span class="op">,</span> <span class="nam">Callable</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="nam">__version__</span> <span class="op">=</span> <span class="str">"N/A"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="nam">IS_RELEASE_BUILD</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">if</span> <span class="nam">__version__</span> <span class="key">in</span> <span class="op">(</span><span class="str">"N/A"</span><span class="op">,</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">7 ↛ 67</span><span class="annotate long">line 7 didn't jump to line 67, because the condition on line 7 was never false</span></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="key">import</span> <span class="nam">subprocess</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="key">class</span> <span class="nam">LazyString</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">initializer</span><span class="op">:</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="op">]</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_initializer</span> <span class="op">=</span> <span class="nam">initializer</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_value</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="key">def</span> <span class="nam">__str__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">value</span> <span class="op">=</span> <span class="nam">object</span><span class="op">.</span><span class="nam">__getattribute__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="str">"_value"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="key">if</span> <span class="nam">value</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">value</span> <span class="op">=</span> <span class="nam">object</span><span class="op">.</span><span class="nam">__getattribute__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="str">"_initializer"</span><span class="op">)</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">object</span><span class="op">.</span><span class="nam">__setattr__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="str">"_value"</span><span class="op">,</span> <span class="nam">value</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="key">return</span> <span class="nam">value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="key">def</span> <span class="nam">__getattribute__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">item</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="nam">value</span> <span class="op">=</span> <span class="nam">str</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="key">return</span> <span class="nam">getattr</span><span class="op">(</span><span class="nam">value</span><span class="op">,</span> <span class="nam">item</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="key">def</span> <span class="nam">__contains__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">item</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="key">return</span> <span class="nam">item</span> <span class="key">in</span> <span class="nam">str</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="key">def</span> <span class="nam">_initialize_version</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="nam">devnull</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span> <span class="op">=</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">DEVNULL</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="key">except</span> <span class="nam">AttributeError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="nam">devnull</span> <span class="op">=</span> <span class="key">None</span> <span class="com"># Not supported, but not critical</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="nam">v</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_output</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="op">[</span><span class="str">"git"</span><span class="op">,</span> <span class="str">"describe"</span><span class="op">,</span> <span class="str">"--tags"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">stderr</span><span class="op">=</span><span class="nam">devnull</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="op">.</span><span class="nam">decode</span><span class="op">(</span><span class="str">"utf-8"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="key">except</span> <span class="op">(</span><span class="nam">subprocess</span><span class="op">.</span><span class="nam">CalledProcessError</span><span class="op">,</span> <span class="nam">FileNotFoundError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="nam">v</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_output</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="op">[</span><span class="str">"dpkg-parsechangelog"</span><span class="op">,</span> <span class="str">"-SVersion"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="nam">stderr</span><span class="op">=</span><span class="nam">devnull</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="op">.</span><span class="nam">decode</span><span class="op">(</span><span class="str">"utf-8"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="key">except</span> <span class="op">(</span><span class="nam">subprocess</span><span class="op">.</span><span class="nam">CalledProcessError</span><span class="op">,</span> <span class="nam">FileNotFoundError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">v</span> <span class="op">=</span> <span class="str">"N/A"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="key">if</span> <span class="nam">v</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"debian/"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">58 ↛ 60</span><span class="annotate long">line 58 didn't jump to line 60, because the condition on line 58 was never false</span></span></p> - <p class="run"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="nam">v</span> <span class="op">=</span> <span class="nam">v</span><span class="op">[</span><span class="num">7</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="key">return</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="nam">__version__</span> <span class="op">=</span> <span class="nam">LazyString</span><span class="op">(</span><span class="nam">_initialize_version</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="nam">IS_RELEASE_BUILD</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"><span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="com"># Disregard snapshot versions (gbp dch -S) as "release builds"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="nam">IS_RELEASE_BUILD</span> <span class="op">=</span> <span class="str">".gbp"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">__version__</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_util_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_6c155ce9dd9f7742___init___py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_2882d0a735873825___init___py.html b/coverage-report/d_2882d0a735873825___init___py.html deleted file mode 100644 index bc5e7fc..0000000 --- a/coverage-report/d_2882d0a735873825___init___py.html +++ /dev/null @@ -1,99 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/commands/__init__.py: 100%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/commands/__init__.py</b>: - <span class="pc_cov">100%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">0 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">0<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">0<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_builtin_manifest_rules_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_2882d0a735873825_deb_materialization_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_builtin_manifest_rules_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_2882d0a735873825_deb_materialization_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_2882d0a735873825_deb_materialization_py.html b/coverage-report/d_2882d0a735873825_deb_materialization_py.html deleted file mode 100644 index 3dabaf3..0000000 --- a/coverage-report/d_2882d0a735873825_deb_materialization_py.html +++ /dev/null @@ -1,686 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/commands/deb_materialization.py: 9%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/commands/deb_materialization.py</b>: - <span class="pc_cov">9%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">236 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">29<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">207<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">2<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_2882d0a735873825___init___py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_2882d0a735873825_deb_packer_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="pln"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="com">#!/usr/bin/python3 -B</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">argparse</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">collections</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">import</span> <span class="nam">contextlib</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">import</span> <span class="nam">json</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">import</span> <span class="nam">subprocess</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="key">import</span> <span class="nam">sys</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="key">import</span> <span class="nam">tempfile</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"><span class="key">import</span> <span class="nam">textwrap</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"><span class="key">from</span> <span class="nam">datetime</span> <span class="key">import</span> <span class="nam">datetime</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Optional</span><span class="op">,</span> <span class="nam">List</span><span class="op">,</span> <span class="nam">Iterator</span><span class="op">,</span> <span class="nam">Dict</span><span class="op">,</span> <span class="nam">Tuple</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span> <span class="key">import</span> <span class="nam">DEBPUTY_ROOT_DIR</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">intermediate_manifest</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">TarMember</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">PathType</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">output_intermediate_manifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">output_intermediate_manifest_to_fd</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">_error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="nam">_info</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">compute_output_filename</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="nam">resolve_source_date_epoch</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="nam">ColorizedArgumentParser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="nam">setup_logging</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="nam">detect_fakeroot</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="nam">print_command</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="nam">program_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">version</span> <span class="key">import</span> <span class="nam">__version__</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"><span class="key">def</span> <span class="nam">parse_args</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="nam">argparse</span><span class="op">.</span><span class="nam">Namespace</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="nam">description</span> <span class="op">=</span> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"><span class="str"> This is a low level tool for materializing deb packages from intermediate debputy manifests or assembling</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"><span class="str"> the deb from a materialization.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"><span class="str"> The tool is not intended to be run directly by end users.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="nam">parser</span> <span class="op">=</span> <span class="nam">ColorizedArgumentParser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">description</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="nam">formatter_class</span><span class="op">=</span><span class="nam">argparse</span><span class="op">.</span><span class="nam">RawDescriptionHelpFormatter</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="nam">allow_abbrev</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="nam">prog</span><span class="op">=</span><span class="nam">program_name</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="nam">parser</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span><span class="str">"--version"</span><span class="op">,</span> <span class="nam">action</span><span class="op">=</span><span class="str">"version"</span><span class="op">,</span> <span class="nam">version</span><span class="op">=</span><span class="nam">__version__</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="nam">subparsers</span> <span class="op">=</span> <span class="nam">parser</span><span class="op">.</span><span class="nam">add_subparsers</span><span class="op">(</span><span class="nam">dest</span><span class="op">=</span><span class="str">"command"</span><span class="op">,</span> <span class="nam">required</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">materialize_deb_parser</span> <span class="op">=</span> <span class="nam">subparsers</span><span class="op">.</span><span class="nam">add_parser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="str">"materialize-deb"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="nam">allow_abbrev</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Generate .deb/.udebs structure from a root directory and"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="str">" a *intermediate* debputy manifest"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="nam">materialize_deb_parser</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="str">"control_root_dir"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="nam">metavar</span><span class="op">=</span><span class="str">"control-root-dir"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"A directory that contains the control files (usually debian/<pkg>/DEBIAN)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="nam">materialize_deb_parser</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="str">"materialization_output"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="nam">metavar</span><span class="op">=</span><span class="str">"materialization_output"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Where to place the resulting structure should be placed. Should not exist"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="nam">materialize_deb_parser</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="str">"--discard-existing-output"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="nam">dest</span><span class="op">=</span><span class="str">"discard_existing_output"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="nam">default</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="nam">action</span><span class="op">=</span><span class="str">"store_true"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"If passed, then the output location may exist."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="str">" If it does, it will be *deleted*."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="nam">materialize_deb_parser</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="str">"--source-date-epoch"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="nam">dest</span><span class="op">=</span><span class="str">"source_date_epoch"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="nam">action</span><span class="op">=</span><span class="str">"store"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="nam">type</span><span class="op">=</span><span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="nam">default</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Source date epoch (can also be given via the SOURCE_DATE_EPOCH environ"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="str">" variable"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="nam">materialize_deb_parser</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="str">"--may-move-control-files"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="nam">dest</span><span class="op">=</span><span class="str">"may_move_control_files"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="nam">action</span><span class="op">=</span><span class="str">"store_true"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="nam">default</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Whether the command may optimize by moving (rather than copying) DEBIAN files"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="nam">materialize_deb_parser</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="str">"--may-move-data-files"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="nam">dest</span><span class="op">=</span><span class="str">"may_move_data_files"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="nam">action</span><span class="op">=</span><span class="str">"store_true"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="nam">default</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Whether the command may optimize by moving (rather than copying) when materializing"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="nam">materialize_deb_parser</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="str">"--intermediate-package-manifest"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="nam">dest</span><span class="op">=</span><span class="str">"package_manifest"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="nam">metavar</span><span class="op">=</span><span class="str">"JSON_FILE"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="nam">action</span><span class="op">=</span><span class="str">"store"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="nam">default</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"INTERMEDIATE package manifest (JSON!)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="nam">materialize_deb_parser</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="str">"--udeb"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="nam">dest</span><span class="op">=</span><span class="str">"udeb"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="nam">default</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="nam">action</span><span class="op">=</span><span class="str">"store_true"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Whether this is udeb package. Affects extension and default compression"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="nam">materialize_deb_parser</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="str">"--build-method"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="nam">dest</span><span class="op">=</span><span class="str">"build_method"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="nam">choices</span><span class="op">=</span><span class="op">[</span><span class="str">"debputy"</span><span class="op">,</span> <span class="str">"dpkg-deb"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="nam">type</span><span class="op">=</span><span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="nam">default</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Immediately assemble the deb as well using the selected method"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="nam">materialize_deb_parser</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="str">"--assembled-deb-output"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="nam">dest</span><span class="op">=</span><span class="str">"assembled_deb_output"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="nam">type</span><span class="op">=</span><span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="nam">default</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Where to place the resulting deb. Only applicable with --build-method"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="com"># Added for "help only" - you cannot trigger this option in practice</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="nam">materialize_deb_parser</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="str">"--"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="nam">metavar</span><span class="op">=</span><span class="str">"DPKG_DEB_ARGS"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="nam">action</span><span class="op">=</span><span class="str">"extend"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="nam">nargs</span><span class="op">=</span><span class="str">"+"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="nam">dest</span><span class="op">=</span><span class="str">"unused"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Arguments to be passed to dpkg-deb"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="str">" (same as you might pass to dh_builddeb)."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="nam">build_deb_structure</span> <span class="op">=</span> <span class="nam">subparsers</span><span class="op">.</span><span class="nam">add_parser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="str">"build-materialized-deb"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="nam">allow_abbrev</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Produce a .deb from a directory produced by the"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="str">" materialize-deb-structure command"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="nam">build_deb_structure</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="str">"materialized_deb_root_dir"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="nam">metavar</span><span class="op">=</span><span class="str">"materialized-deb-root-dir"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"The output directory of the materialize-deb-structure command"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="nam">build_deb_structure</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="str">"build_method"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="nam">metavar</span><span class="op">=</span><span class="str">"build-method"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="nam">choices</span><span class="op">=</span><span class="op">[</span><span class="str">"debputy"</span><span class="op">,</span> <span class="str">"dpkg-deb"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="nam">type</span><span class="op">=</span><span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="nam">default</span><span class="op">=</span><span class="str">"dpkg-deb"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Which tool should assemble the deb"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="nam">build_deb_structure</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="str">"--output"</span><span class="op">,</span> <span class="nam">type</span><span class="op">=</span><span class="nam">str</span><span class="op">,</span> <span class="nam">default</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> <span class="nam">help</span><span class="op">=</span><span class="str">"Where to place the resulting deb"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="nam">argv</span> <span class="op">=</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">argv</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">i</span> <span class="op">=</span> <span class="nam">argv</span><span class="op">.</span><span class="nam">index</span><span class="op">(</span><span class="str">"--"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="nam">upstream_args</span> <span class="op">=</span> <span class="nam">argv</span><span class="op">[</span><span class="nam">i</span> <span class="op">+</span> <span class="num">1</span> <span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="nam">argv</span> <span class="op">=</span> <span class="nam">argv</span><span class="op">[</span><span class="op">:</span><span class="nam">i</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="key">except</span> <span class="op">(</span><span class="nam">IndexError</span><span class="op">,</span> <span class="nam">ValueError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="nam">upstream_args</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="nam">parsed_args</span> <span class="op">=</span> <span class="nam">parser</span><span class="op">.</span><span class="nam">parse_args</span><span class="op">(</span><span class="nam">argv</span><span class="op">[</span><span class="num">1</span><span class="op">:</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="nam">setattr</span><span class="op">(</span><span class="nam">parsed_args</span><span class="op">,</span> <span class="str">"upstream_args"</span><span class="op">,</span> <span class="nam">upstream_args</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="key">return</span> <span class="nam">parsed_args</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"><span class="key">def</span> <span class="nam">_run</span><span class="op">(</span><span class="nam">cmd</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="nam">print_command</span><span class="op">(</span><span class="op">*</span><span class="nam">cmd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_call</span><span class="op">(</span><span class="nam">cmd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"><span class="key">def</span> <span class="nam">strip_path_prefix</span><span class="op">(</span><span class="nam">member_path</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">member_path</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"./"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="str">f'Invalid manifest: "{member_path}" does not start with "./", but all paths should'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="key">return</span> <span class="nam">member_path</span><span class="op">[</span><span class="num">2</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"><span class="key">def</span> <span class="nam">_perform_data_tar_materialization</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="nam">output_packaging_root</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="nam">intermediate_manifest</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">TarMember</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="nam">may_move_data_files</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">List</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">TarMember</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="nam">start_time</span> <span class="op">=</span> <span class="nam">datetime</span><span class="op">.</span><span class="nam">now</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="nam">replacement_manifest_paths</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">"Materializing data.tar part of the deb:"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="nam">directories</span> <span class="op">=</span> <span class="op">[</span><span class="str">"mkdir"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="nam">symlinks</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="nam">bulk_copies</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="nam">collections</span><span class="op">.</span><span class="nam">defaultdict</span><span class="op">(</span><span class="nam">list</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="nam">copies</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="nam">renames</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="key">for</span> <span class="nam">tar_member</span> <span class="key">in</span> <span class="nam">intermediate_manifest</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="nam">member_path</span> <span class="op">=</span> <span class="nam">strip_path_prefix</span><span class="op">(</span><span class="nam">tar_member</span><span class="op">.</span><span class="nam">member_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="nam">new_fs_path</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="str">"deb-root"</span><span class="op">,</span> <span class="nam">member_path</span><span class="op">)</span> <span class="key">if</span> <span class="nam">member_path</span> <span class="key">else</span> <span class="str">"deb-root"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="nam">materialization_path</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="str">f"{output_packaging_root}/{member_path}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="key">if</span> <span class="nam">member_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="key">else</span> <span class="nam">output_packaging_root</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="nam">replacement_tar_member</span> <span class="op">=</span> <span class="nam">tar_member</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="nam">materialization_parent_dir</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">dirname</span><span class="op">(</span><span class="nam">materialization_path</span><span class="op">.</span><span class="nam">rstrip</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="key">if</span> <span class="nam">tar_member</span><span class="op">.</span><span class="nam">path_type</span> <span class="op">==</span> <span class="nam">PathType</span><span class="op">.</span><span class="nam">DIRECTORY</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="nam">directories</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">materialization_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="key">elif</span> <span class="nam">tar_member</span><span class="op">.</span><span class="nam">path_type</span> <span class="op">==</span> <span class="nam">PathType</span><span class="op">.</span><span class="nam">SYMLINK</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="nam">symlinks</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="op">(</span><span class="nam">tar_member</span><span class="op">.</span><span class="nam">link_target</span><span class="op">,</span> <span class="nam">materialization_path</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="key">elif</span> <span class="nam">tar_member</span><span class="op">.</span><span class="nam">fs_path</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="key">if</span> <span class="nam">tar_member</span><span class="op">.</span><span class="nam">link_target</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="com"># Not sure if hardlinks gets here yet as we do not support hardlinks</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span><span class="str">"Internal error; hardlink not supported"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="key">if</span> <span class="nam">may_move_data_files</span> <span class="key">and</span> <span class="nam">tar_member</span><span class="op">.</span><span class="nam">may_steal_fs_path</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="nam">renames</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="op">(</span><span class="nam">tar_member</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">,</span> <span class="nam">materialization_path</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="key">elif</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">basename</span><span class="op">(</span><span class="nam">tar_member</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">)</span> <span class="op">==</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">basename</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="nam">materialization_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="nam">bulk_copies</span><span class="op">[</span><span class="nam">materialization_parent_dir</span><span class="op">]</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">tar_member</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="nam">copies</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="op">(</span><span class="nam">tar_member</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">,</span> <span class="nam">materialization_path</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span><span class="str">f"Internal error; unsupported path type {tar_member.path_type}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="key">if</span> <span class="nam">tar_member</span><span class="op">.</span><span class="nam">fs_path</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="nam">replacement_tar_member</span> <span class="op">=</span> <span class="nam">tar_member</span><span class="op">.</span><span class="nam">clone_and_replace</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="nam">fs_path</span><span class="op">=</span><span class="nam">new_fs_path</span><span class="op">,</span> <span class="nam">may_steal_fs_path</span><span class="op">=</span><span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="nam">replacement_manifest_paths</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="op">(</span><span class="nam">materialization_path</span><span class="op">,</span> <span class="nam">replacement_tar_member</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">directories</span><span class="op">)</span> <span class="op">></span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="nam">_run</span><span class="op">(</span><span class="nam">directories</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="key">for</span> <span class="nam">dest_dir</span><span class="op">,</span> <span class="nam">files</span> <span class="key">in</span> <span class="nam">bulk_copies</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="nam">cmd</span> <span class="op">=</span> <span class="op">[</span><span class="str">"cp"</span><span class="op">,</span> <span class="str">"--reflink=auto"</span><span class="op">,</span> <span class="str">"-t"</span><span class="op">,</span> <span class="nam">dest_dir</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="nam">cmd</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">files</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="nam">_run</span><span class="op">(</span><span class="nam">cmd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="key">for</span> <span class="nam">source</span><span class="op">,</span> <span class="nam">dest</span> <span class="key">in</span> <span class="nam">copies</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="nam">_run</span><span class="op">(</span><span class="op">[</span><span class="str">"cp"</span><span class="op">,</span> <span class="str">"--reflink=auto"</span><span class="op">,</span> <span class="nam">source</span><span class="op">,</span> <span class="nam">dest</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="key">for</span> <span class="nam">source</span><span class="op">,</span> <span class="nam">dest</span> <span class="key">in</span> <span class="nam">renames</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="nam">print_command</span><span class="op">(</span><span class="str">"mv"</span><span class="op">,</span> <span class="nam">source</span><span class="op">,</span> <span class="nam">dest</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">rename</span><span class="op">(</span><span class="nam">source</span><span class="op">,</span> <span class="nam">dest</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="key">for</span> <span class="nam">link_target</span><span class="op">,</span> <span class="nam">link_path</span> <span class="key">in</span> <span class="nam">symlinks</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="nam">print_command</span><span class="op">(</span><span class="str">"ln"</span><span class="op">,</span> <span class="str">"-s"</span><span class="op">,</span> <span class="nam">link_target</span><span class="op">,</span> <span class="nam">link_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">symlink</span><span class="op">(</span><span class="nam">link_target</span><span class="op">,</span> <span class="nam">link_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="nam">end_time</span> <span class="op">=</span> <span class="nam">datetime</span><span class="op">.</span><span class="nam">now</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"Materialization of data.tar finished, took: {end_time - start_time}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="key">return</span> <span class="nam">replacement_manifest_paths</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"><span class="key">def</span> <span class="nam">materialize_deb</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="nam">control_root_dir</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="nam">intermediate_manifest_path</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="nam">source_date_epoch</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="nam">dpkg_deb_options</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="nam">is_udeb</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="nam">output_dir</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="nam">may_move_control_files</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="nam">may_move_data_files</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">isfile</span><span class="op">(</span><span class="str">f"{control_root_dir}/control"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="str">f'The directory "{control_root_dir}" does not look like a package root dir (there is no control file)'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="nam">intermediate_manifest</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">TarMember</span><span class="op">]</span> <span class="op">=</span> <span class="nam">parse_manifest</span><span class="op">(</span><span class="nam">intermediate_manifest_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="nam">output_packaging_root</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">output_dir</span><span class="op">,</span> <span class="str">"deb-root"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">mkdir</span><span class="op">(</span><span class="nam">output_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="nam">replacement_manifest_paths</span> <span class="op">=</span> <span class="nam">_perform_data_tar_materialization</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="nam">output_packaging_root</span><span class="op">,</span> <span class="nam">intermediate_manifest</span><span class="op">,</span> <span class="nam">may_move_data_files</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="key">for</span> <span class="nam">materialization_path</span><span class="op">,</span> <span class="nam">tar_member</span> <span class="key">in</span> <span class="nam">reversed</span><span class="op">(</span><span class="nam">replacement_manifest_paths</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="com"># TODO: Hardlinks should probably skip these commands</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="key">if</span> <span class="nam">tar_member</span><span class="op">.</span><span class="nam">path_type</span> <span class="op">!=</span> <span class="nam">PathType</span><span class="op">.</span><span class="nam">SYMLINK</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">chmod</span><span class="op">(</span><span class="nam">materialization_path</span><span class="op">,</span> <span class="nam">tar_member</span><span class="op">.</span><span class="nam">mode</span><span class="op">,</span> <span class="nam">follow_symlinks</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">utime</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> <span class="nam">materialization_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="op">(</span><span class="nam">tar_member</span><span class="op">.</span><span class="nam">mtime</span><span class="op">,</span> <span class="nam">tar_member</span><span class="op">.</span><span class="nam">mtime</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="nam">follow_symlinks</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="nam">materialized_ctrl_dir</span> <span class="op">=</span> <span class="str">f"{output_packaging_root}/DEBIAN"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="key">if</span> <span class="nam">may_move_control_files</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="nam">print_command</span><span class="op">(</span><span class="str">"mv"</span><span class="op">,</span> <span class="nam">control_root_dir</span><span class="op">,</span> <span class="nam">materialized_ctrl_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">rename</span><span class="op">(</span><span class="nam">control_root_dir</span><span class="op">,</span> <span class="nam">materialized_ctrl_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">mkdir</span><span class="op">(</span><span class="nam">materialized_ctrl_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="nam">copy_cmd</span> <span class="op">=</span> <span class="op">[</span><span class="str">"cp"</span><span class="op">,</span> <span class="str">"-a"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="nam">copy_cmd</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">control_root_dir</span><span class="op">,</span> <span class="nam">f</span><span class="op">)</span> <span class="key">for</span> <span class="nam">f</span> <span class="key">in</span> <span class="nam">os</span><span class="op">.</span><span class="nam">listdir</span><span class="op">(</span><span class="nam">control_root_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="nam">copy_cmd</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">materialized_ctrl_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="nam">_run</span><span class="op">(</span><span class="nam">copy_cmd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> <span class="nam">output_intermediate_manifest</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">output_dir</span><span class="op">,</span> <span class="str">"deb-structure-intermediate-manifest.json"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> <span class="op">[</span><span class="nam">t</span><span class="op">[</span><span class="num">1</span><span class="op">]</span> <span class="key">for</span> <span class="nam">t</span> <span class="key">in</span> <span class="nam">replacement_manifest_paths</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> <span class="key">with</span> <span class="nam">open</span><span class="op">(</span><span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">output_dir</span><span class="op">,</span> <span class="str">"env-and-cli.json"</span><span class="op">)</span><span class="op">,</span> <span class="str">"w"</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> <span class="nam">serial_format</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> <span class="str">"env"</span><span class="op">:</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> <span class="str">"SOURCE_DATE_EPOCH"</span><span class="op">:</span> <span class="nam">str</span><span class="op">(</span><span class="nam">source_date_epoch</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> <span class="str">"DPKG_DEB_COMPRESSOR_LEVEL"</span><span class="op">:</span> <span class="nam">os</span><span class="op">.</span><span class="nam">environ</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> <span class="str">"DPKG_DEB_COMPRESSOR_LEVEL"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> <span class="str">"DPKG_DEB_COMPRESSOR_TYPE"</span><span class="op">:</span> <span class="nam">os</span><span class="op">.</span><span class="nam">environ</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"DPKG_DEB_COMPRESSOR_TYPE"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> <span class="str">"DPKG_DEB_THREADS_MAX"</span><span class="op">:</span> <span class="nam">os</span><span class="op">.</span><span class="nam">environ</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"DPKG_DEB_THREADS_MAX"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> <span class="op">}</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"> <span class="str">"cli"</span><span class="op">:</span> <span class="op">{</span><span class="str">"dpkg-deb"</span><span class="op">:</span> <span class="nam">dpkg_deb_options</span><span class="op">}</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> <span class="str">"udeb"</span><span class="op">:</span> <span class="nam">is_udeb</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"> <span class="nam">json</span><span class="op">.</span><span class="nam">dump</span><span class="op">(</span><span class="nam">serial_format</span><span class="op">,</span> <span class="nam">fd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"><span class="key">def</span> <span class="nam">apply_fs_metadata</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"> <span class="nam">materialized_path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"> <span class="nam">tar_member</span><span class="op">:</span> <span class="nam">TarMember</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"> <span class="nam">apply_ownership</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"> <span class="nam">is_using_fakeroot</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"> <span class="key">if</span> <span class="nam">apply_ownership</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">chown</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"> <span class="nam">materialized_path</span><span class="op">,</span> <span class="nam">tar_member</span><span class="op">.</span><span class="nam">uid</span><span class="op">,</span> <span class="nam">tar_member</span><span class="op">.</span><span class="nam">gid</span><span class="op">,</span> <span class="nam">follow_symlinks</span><span class="op">=</span><span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"> <span class="com"># To avoid surprises, align these with the manifest. Just in case the transport did not preserve the metadata.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"> <span class="com"># Also, unsure whether metadata changes cause directory mtimes to change, so resetting them unconditionally</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"> <span class="com"># also prevents that problem.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"> <span class="key">if</span> <span class="nam">tar_member</span><span class="op">.</span><span class="nam">path_type</span> <span class="op">!=</span> <span class="nam">PathType</span><span class="op">.</span><span class="nam">SYMLINK</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">chmod</span><span class="op">(</span><span class="nam">materialized_path</span><span class="op">,</span> <span class="nam">tar_member</span><span class="op">.</span><span class="nam">mode</span><span class="op">,</span> <span class="nam">follow_symlinks</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">utime</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"> <span class="nam">materialized_path</span><span class="op">,</span> <span class="op">(</span><span class="nam">tar_member</span><span class="op">.</span><span class="nam">mtime</span><span class="op">,</span> <span class="nam">tar_member</span><span class="op">.</span><span class="nam">mtime</span><span class="op">)</span><span class="op">,</span> <span class="nam">follow_symlinks</span><span class="op">=</span><span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_using_fakeroot</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"> <span class="nam">st</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">stat</span><span class="op">(</span><span class="nam">materialized_path</span><span class="op">,</span> <span class="nam">follow_symlinks</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"> <span class="key">if</span> <span class="nam">st</span><span class="op">.</span><span class="nam">st_uid</span> <span class="op">!=</span> <span class="nam">tar_member</span><span class="op">.</span><span class="nam">uid</span> <span class="key">or</span> <span class="nam">st</span><span class="op">.</span><span class="nam">st_gid</span> <span class="op">!=</span> <span class="nam">tar_member</span><span class="op">.</span><span class="nam">gid</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"> <span class="str">'Change of ownership failed. The chown call "succeeded" but stat does not give the right result.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"> <span class="str">" Most likely a fakeroot bug. Note, when verifying this, use os.chown + os.stat from python"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"> <span class="str">" (the chmod/stat shell commands might use a different syscall that fakeroot accurately emulates)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"><span class="key">def</span> <span class="nam">_dpkg_deb_root_requirements</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"> <span class="nam">intermediate_manifest</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">TarMember</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">bool</span><span class="op">,</span> <span class="nam">bool</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"> <span class="nam">needs_root</span> <span class="op">=</span> <span class="nam">any</span><span class="op">(</span><span class="nam">tm</span><span class="op">.</span><span class="nam">uid</span> <span class="op">!=</span> <span class="num">0</span> <span class="key">or</span> <span class="nam">tm</span><span class="op">.</span><span class="nam">gid</span> <span class="op">!=</span> <span class="num">0</span> <span class="key">for</span> <span class="nam">tm</span> <span class="key">in</span> <span class="nam">intermediate_manifest</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"> <span class="key">if</span> <span class="nam">needs_root</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"> <span class="key">if</span> <span class="nam">os</span><span class="op">.</span><span class="nam">getuid</span><span class="op">(</span><span class="op">)</span> <span class="op">!=</span> <span class="num">0</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"> <span class="str">'Must be run as root/fakeroot when using the method "dpkg-deb" due to the contents'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"> <span class="nam">is_using_fakeroot</span> <span class="op">=</span> <span class="nam">detect_fakeroot</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"> <span class="nam">deb_cmd</span> <span class="op">=</span> <span class="op">[</span><span class="str">"dpkg-deb"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">"Applying ownership, mode, and utime from the intermediate manifest..."</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t385" href="#t385">385</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t386" href="#t386">386</a></span><span class="t"> <span class="com"># fakeroot does not matter in this case</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t387" href="#t387">387</a></span><span class="t"> <span class="nam">is_using_fakeroot</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t388" href="#t388">388</a></span><span class="t"> <span class="nam">deb_cmd</span> <span class="op">=</span> <span class="op">[</span><span class="str">"dpkg-deb"</span><span class="op">,</span> <span class="str">"--root-owner-group"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t389" href="#t389">389</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">"Applying mode and utime from the intermediate manifest..."</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t390" href="#t390">390</a></span><span class="t"> <span class="key">return</span> <span class="nam">deb_cmd</span><span class="op">,</span> <span class="nam">needs_root</span><span class="op">,</span> <span class="nam">is_using_fakeroot</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t391" href="#t391">391</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t392" href="#t392">392</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t393" href="#t393">393</a></span><span class="t"><span class="op">@</span><span class="nam">contextlib</span><span class="op">.</span><span class="nam">contextmanager</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t394" href="#t394">394</a></span><span class="t"><span class="key">def</span> <span class="nam">maybe_with_materialized_manifest</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t395" href="#t395">395</a></span><span class="t"> <span class="nam">content</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">TarMember</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t396" href="#t396">396</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t397" href="#t397">397</a></span><span class="t"> <span class="key">if</span> <span class="nam">content</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t398" href="#t398">398</a></span><span class="t"> <span class="key">with</span> <span class="nam">tempfile</span><span class="op">.</span><span class="nam">NamedTemporaryFile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t399" href="#t399">399</a></span><span class="t"> <span class="nam">prefix</span><span class="op">=</span><span class="str">"debputy-mat-build"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t400" href="#t400">400</a></span><span class="t"> <span class="nam">mode</span><span class="op">=</span><span class="str">"w+t"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t401" href="#t401">401</a></span><span class="t"> <span class="nam">suffix</span><span class="op">=</span><span class="str">".json"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t402" href="#t402">402</a></span><span class="t"> <span class="nam">encoding</span><span class="op">=</span><span class="str">"utf-8"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t403" href="#t403">403</a></span><span class="t"> <span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t404" href="#t404">404</a></span><span class="t"> <span class="nam">output_intermediate_manifest_to_fd</span><span class="op">(</span><span class="nam">fd</span><span class="op">,</span> <span class="nam">content</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t405" href="#t405">405</a></span><span class="t"> <span class="nam">fd</span><span class="op">.</span><span class="nam">flush</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t406" href="#t406">406</a></span><span class="t"> <span class="key">yield</span> <span class="nam">fd</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t407" href="#t407">407</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t408" href="#t408">408</a></span><span class="t"> <span class="key">yield</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t409" href="#t409">409</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t410" href="#t410">410</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t411" href="#t411">411</a></span><span class="t"><span class="key">def</span> <span class="nam">_prep_assembled_deb_output_path</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t412" href="#t412">412</a></span><span class="t"> <span class="nam">output_path</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t413" href="#t413">413</a></span><span class="t"> <span class="nam">materialized_deb_structure</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t414" href="#t414">414</a></span><span class="t"> <span class="nam">deb_root</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t415" href="#t415">415</a></span><span class="t"> <span class="nam">method</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t416" href="#t416">416</a></span><span class="t"> <span class="nam">is_udeb</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t417" href="#t417">417</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t418" href="#t418">418</a></span><span class="t"> <span class="key">if</span> <span class="nam">output_path</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t419" href="#t419">419</a></span><span class="t"> <span class="nam">ext</span> <span class="op">=</span> <span class="str">"udeb"</span> <span class="key">if</span> <span class="nam">is_udeb</span> <span class="key">else</span> <span class="str">"deb"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t420" href="#t420">420</a></span><span class="t"> <span class="nam">output_dir</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">materialized_deb_structure</span><span class="op">,</span> <span class="str">"output"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t421" href="#t421">421</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">isdir</span><span class="op">(</span><span class="nam">output_dir</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t422" href="#t422">422</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">mkdir</span><span class="op">(</span><span class="nam">output_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t423" href="#t423">423</a></span><span class="t"> <span class="nam">output</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">output_dir</span><span class="op">,</span> <span class="str">f"{method}.{ext}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t424" href="#t424">424</a></span><span class="t"> <span class="key">elif</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">isdir</span><span class="op">(</span><span class="nam">output_path</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t425" href="#t425">425</a></span><span class="t"> <span class="nam">output</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t426" href="#t426">426</a></span><span class="t"> <span class="nam">output_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t427" href="#t427">427</a></span><span class="t"> <span class="nam">compute_output_filename</span><span class="op">(</span><span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">deb_root</span><span class="op">,</span> <span class="str">"DEBIAN"</span><span class="op">)</span><span class="op">,</span> <span class="nam">is_udeb</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t428" href="#t428">428</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t429" href="#t429">429</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t430" href="#t430">430</a></span><span class="t"> <span class="nam">output</span> <span class="op">=</span> <span class="nam">output_path</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t431" href="#t431">431</a></span><span class="t"> <span class="key">return</span> <span class="nam">output</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t432" href="#t432">432</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t433" href="#t433">433</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t434" href="#t434">434</a></span><span class="t"><span class="key">def</span> <span class="nam">_apply_env</span><span class="op">(</span><span class="nam">env</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t435" href="#t435">435</a></span><span class="t"> <span class="key">for</span> <span class="nam">name</span><span class="op">,</span> <span class="nam">value</span> <span class="key">in</span> <span class="nam">env</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t436" href="#t436">436</a></span><span class="t"> <span class="key">if</span> <span class="nam">value</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t437" href="#t437">437</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">environ</span><span class="op">[</span><span class="nam">name</span><span class="op">]</span> <span class="op">=</span> <span class="nam">value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t438" href="#t438">438</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t439" href="#t439">439</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t440" href="#t440">440</a></span><span class="t"> <span class="key">del</span> <span class="nam">os</span><span class="op">.</span><span class="nam">environ</span><span class="op">[</span><span class="nam">name</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t441" href="#t441">441</a></span><span class="t"> <span class="key">except</span> <span class="nam">KeyError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t442" href="#t442">442</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t443" href="#t443">443</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t444" href="#t444">444</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t445" href="#t445">445</a></span><span class="t"><span class="key">def</span> <span class="nam">assemble_deb</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t446" href="#t446">446</a></span><span class="t"> <span class="nam">materialized_deb_structure</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t447" href="#t447">447</a></span><span class="t"> <span class="nam">method</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t448" href="#t448">448</a></span><span class="t"> <span class="nam">output_path</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t449" href="#t449">449</a></span><span class="t"> <span class="nam">combined_materialization_and_assembly</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t450" href="#t450">450</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t451" href="#t451">451</a></span><span class="t"> <span class="nam">deb_root</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">materialized_deb_structure</span><span class="op">,</span> <span class="str">"deb-root"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t452" href="#t452">452</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t453" href="#t453">453</a></span><span class="t"> <span class="key">with</span> <span class="nam">open</span><span class="op">(</span><span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">materialized_deb_structure</span><span class="op">,</span> <span class="str">"env-and-cli.json"</span><span class="op">)</span><span class="op">,</span> <span class="str">"r"</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t454" href="#t454">454</a></span><span class="t"> <span class="nam">serial_format</span> <span class="op">=</span> <span class="nam">json</span><span class="op">.</span><span class="nam">load</span><span class="op">(</span><span class="nam">fd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t455" href="#t455">455</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t456" href="#t456">456</a></span><span class="t"> <span class="nam">env</span> <span class="op">=</span> <span class="nam">serial_format</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"env"</span><span class="op">)</span> <span class="key">or</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t457" href="#t457">457</a></span><span class="t"> <span class="nam">cli</span> <span class="op">=</span> <span class="nam">serial_format</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"cli"</span><span class="op">)</span> <span class="key">or</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t458" href="#t458">458</a></span><span class="t"> <span class="nam">is_udeb</span> <span class="op">=</span> <span class="nam">serial_format</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"udeb"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t459" href="#t459">459</a></span><span class="t"> <span class="nam">source_date_epoch</span> <span class="op">=</span> <span class="nam">env</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"SOURCE_DATE_EPOCH"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t460" href="#t460">460</a></span><span class="t"> <span class="nam">dpkg_deb_options</span> <span class="op">=</span> <span class="nam">cli</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"dpkg-deb"</span><span class="op">)</span> <span class="key">or</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t461" href="#t461">461</a></span><span class="t"> <span class="nam">intermediate_manifest_path</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t462" href="#t462">462</a></span><span class="t"> <span class="nam">materialized_deb_structure</span><span class="op">,</span> <span class="str">"deb-structure-intermediate-manifest.json"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t463" href="#t463">463</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t464" href="#t464">464</a></span><span class="t"> <span class="nam">original_intermediate_manifest</span> <span class="op">=</span> <span class="nam">TarMember</span><span class="op">.</span><span class="nam">parse_intermediate_manifest</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t465" href="#t465">465</a></span><span class="t"> <span class="nam">intermediate_manifest_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t466" href="#t466">466</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t467" href="#t467">467</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t468" href="#t468">468</a></span><span class="t"> <span class="str">"Rebasing relative paths in the intermediate manifest so they are relative to current working directory ..."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t469" href="#t469">469</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t470" href="#t470">470</a></span><span class="t"> <span class="nam">intermediate_manifest</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t471" href="#t471">471</a></span><span class="t"> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t472" href="#t472">472</a></span><span class="t"> <span class="nam">tar_member</span><span class="op">.</span><span class="nam">clone_and_replace</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t473" href="#t473">473</a></span><span class="t"> <span class="nam">fs_path</span><span class="op">=</span><span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">materialized_deb_structure</span><span class="op">,</span> <span class="nam">tar_member</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t474" href="#t474">474</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t475" href="#t475">475</a></span><span class="t"> <span class="key">if</span> <span class="nam">tar_member</span><span class="op">.</span><span class="nam">fs_path</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">tar_member</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t476" href="#t476">476</a></span><span class="t"> <span class="key">else</span> <span class="nam">tar_member</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t477" href="#t477">477</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t478" href="#t478">478</a></span><span class="t"> <span class="key">for</span> <span class="nam">tar_member</span> <span class="key">in</span> <span class="nam">original_intermediate_manifest</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t479" href="#t479">479</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t480" href="#t480">480</a></span><span class="t"> <span class="nam">materialized_manifest</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t481" href="#t481">481</a></span><span class="t"> <span class="key">if</span> <span class="nam">method</span> <span class="op">==</span> <span class="str">"debputy"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t482" href="#t482">482</a></span><span class="t"> <span class="nam">materialized_manifest</span> <span class="op">=</span> <span class="nam">intermediate_manifest</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t483" href="#t483">483</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t484" href="#t484">484</a></span><span class="t"> <span class="key">if</span> <span class="nam">source_date_epoch</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t485" href="#t485">485</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t486" href="#t486">486</a></span><span class="t"> <span class="str">"Cannot reproduce the deb. No source date epoch provided in the materialized deb root."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t487" href="#t487">487</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t488" href="#t488">488</a></span><span class="t"> <span class="nam">_apply_env</span><span class="op">(</span><span class="nam">env</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t489" href="#t489">489</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t490" href="#t490">490</a></span><span class="t"> <span class="nam">output</span> <span class="op">=</span> <span class="nam">_prep_assembled_deb_output_path</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t491" href="#t491">491</a></span><span class="t"> <span class="nam">output_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t492" href="#t492">492</a></span><span class="t"> <span class="nam">materialized_deb_structure</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t493" href="#t493">493</a></span><span class="t"> <span class="nam">deb_root</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t494" href="#t494">494</a></span><span class="t"> <span class="nam">method</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t495" href="#t495">495</a></span><span class="t"> <span class="nam">is_udeb</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t496" href="#t496">496</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t497" href="#t497">497</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t498" href="#t498">498</a></span><span class="t"> <span class="key">with</span> <span class="nam">maybe_with_materialized_manifest</span><span class="op">(</span><span class="nam">materialized_manifest</span><span class="op">)</span> <span class="key">as</span> <span class="nam">tmp_file</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t499" href="#t499">499</a></span><span class="t"> <span class="key">if</span> <span class="nam">method</span> <span class="op">==</span> <span class="str">"dpkg-deb"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t500" href="#t500">500</a></span><span class="t"> <span class="nam">deb_cmd</span><span class="op">,</span> <span class="nam">needs_root</span><span class="op">,</span> <span class="nam">is_using_fakeroot</span> <span class="op">=</span> <span class="nam">_dpkg_deb_root_requirements</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t501" href="#t501">501</a></span><span class="t"> <span class="nam">intermediate_manifest</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t502" href="#t502">502</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t503" href="#t503">503</a></span><span class="t"> <span class="key">if</span> <span class="nam">needs_root</span> <span class="key">or</span> <span class="key">not</span> <span class="nam">combined_materialization_and_assembly</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t504" href="#t504">504</a></span><span class="t"> <span class="key">for</span> <span class="nam">tar_member</span> <span class="key">in</span> <span class="nam">reversed</span><span class="op">(</span><span class="nam">intermediate_manifest</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t505" href="#t505">505</a></span><span class="t"> <span class="nam">p</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t506" href="#t506">506</a></span><span class="t"> <span class="nam">deb_root</span><span class="op">,</span> <span class="nam">strip_path_prefix</span><span class="op">(</span><span class="nam">tar_member</span><span class="op">.</span><span class="nam">member_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t507" href="#t507">507</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t508" href="#t508">508</a></span><span class="t"> <span class="nam">apply_fs_metadata</span><span class="op">(</span><span class="nam">p</span><span class="op">,</span> <span class="nam">tar_member</span><span class="op">,</span> <span class="nam">needs_root</span><span class="op">,</span> <span class="nam">is_using_fakeroot</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t509" href="#t509">509</a></span><span class="t"> <span class="key">elif</span> <span class="nam">method</span> <span class="op">==</span> <span class="str">"debputy"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t510" href="#t510">510</a></span><span class="t"> <span class="nam">deb_packer</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">DEBPUTY_ROOT_DIR</span><span class="op">,</span> <span class="str">"deb_packer.py"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t511" href="#t511">511</a></span><span class="t"> <span class="key">assert</span> <span class="nam">tmp_file</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t512" href="#t512">512</a></span><span class="t"> <span class="nam">deb_cmd</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t513" href="#t513">513</a></span><span class="t"> <span class="nam">deb_packer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t514" href="#t514">514</a></span><span class="t"> <span class="str">"--intermediate-package-manifest"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t515" href="#t515">515</a></span><span class="t"> <span class="nam">tmp_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t516" href="#t516">516</a></span><span class="t"> <span class="str">"--source-date-epoch"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t517" href="#t517">517</a></span><span class="t"> <span class="nam">source_date_epoch</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t518" href="#t518">518</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t519" href="#t519">519</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t520" href="#t520">520</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span><span class="str">f"Internal error: Unsupported assembly method: {method}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t521" href="#t521">521</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t522" href="#t522">522</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_udeb</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t523" href="#t523">523</a></span><span class="t"> <span class="nam">deb_cmd</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="op">[</span><span class="str">"-z6"</span><span class="op">,</span> <span class="str">"-Zxz"</span><span class="op">,</span> <span class="str">"-Sextreme"</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t524" href="#t524">524</a></span><span class="t"> <span class="nam">deb_cmd</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">dpkg_deb_options</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t525" href="#t525">525</a></span><span class="t"> <span class="nam">deb_cmd</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="op">[</span><span class="str">"--build"</span><span class="op">,</span> <span class="nam">deb_root</span><span class="op">,</span> <span class="nam">output</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t526" href="#t526">526</a></span><span class="t"> <span class="nam">start_time</span> <span class="op">=</span> <span class="nam">datetime</span><span class="op">.</span><span class="nam">now</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t527" href="#t527">527</a></span><span class="t"> <span class="nam">_run</span><span class="op">(</span><span class="nam">deb_cmd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t528" href="#t528">528</a></span><span class="t"> <span class="nam">end_time</span> <span class="op">=</span> <span class="nam">datetime</span><span class="op">.</span><span class="nam">now</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t529" href="#t529">529</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f" - assembly command took {end_time - start_time}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t530" href="#t530">530</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t531" href="#t531">531</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t532" href="#t532">532</a></span><span class="t"><span class="key">def</span> <span class="nam">parse_manifest</span><span class="op">(</span><span class="nam">manifest_path</span><span class="op">:</span> <span class="str">"Optional[str]"</span><span class="op">)</span> <span class="op">-></span> <span class="str">"List[TarMember]"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t533" href="#t533">533</a></span><span class="t"> <span class="key">if</span> <span class="nam">manifest_path</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t534" href="#t534">534</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span><span class="str">"--intermediate-package-manifest is mandatory for now"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t535" href="#t535">535</a></span><span class="t"> <span class="key">return</span> <span class="nam">TarMember</span><span class="op">.</span><span class="nam">parse_intermediate_manifest</span><span class="op">(</span><span class="nam">manifest_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t536" href="#t536">536</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t537" href="#t537">537</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t538" href="#t538">538</a></span><span class="t"><span class="key">def</span> <span class="nam">main</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t539" href="#t539">539</a></span><span class="t"> <span class="nam">setup_logging</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t540" href="#t540">540</a></span><span class="t"> <span class="nam">parsed_args</span> <span class="op">=</span> <span class="nam">parse_args</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t541" href="#t541">541</a></span><span class="t"> <span class="key">if</span> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">command</span> <span class="op">==</span> <span class="str">"materialize-deb"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t542" href="#t542">542</a></span><span class="t"> <span class="nam">mtime</span> <span class="op">=</span> <span class="nam">resolve_source_date_epoch</span><span class="op">(</span><span class="nam">parsed_args</span><span class="op">.</span><span class="nam">source_date_epoch</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t543" href="#t543">543</a></span><span class="t"> <span class="nam">dpkg_deb_args</span> <span class="op">=</span> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">upstream_args</span> <span class="key">or</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t544" href="#t544">544</a></span><span class="t"> <span class="nam">output_dir</span> <span class="op">=</span> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">materialization_output</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t545" href="#t545">545</a></span><span class="t"> <span class="key">if</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">exists</span><span class="op">(</span><span class="nam">output_dir</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t546" href="#t546">546</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">discard_existing_output</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t547" href="#t547">547</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t548" href="#t548">548</a></span><span class="t"> <span class="str">"The output path already exists. Please either choose a non-existing path, delete the path"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t549" href="#t549">549</a></span><span class="t"> <span class="str">" or use --discard-existing-output (to have this command remove it as necessary)."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t550" href="#t550">550</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t551" href="#t551">551</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t552" href="#t552">552</a></span><span class="t"> <span class="str">f'Removing existing path "{output_dir}" as requested by --discard-existing-output'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t553" href="#t553">553</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t554" href="#t554">554</a></span><span class="t"> <span class="nam">_run</span><span class="op">(</span><span class="op">[</span><span class="str">"rm"</span><span class="op">,</span> <span class="str">"-fr"</span><span class="op">,</span> <span class="nam">output_dir</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t555" href="#t555">555</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t556" href="#t556">556</a></span><span class="t"> <span class="nam">materialize_deb</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t557" href="#t557">557</a></span><span class="t"> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">control_root_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t558" href="#t558">558</a></span><span class="t"> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">package_manifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t559" href="#t559">559</a></span><span class="t"> <span class="nam">mtime</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t560" href="#t560">560</a></span><span class="t"> <span class="nam">dpkg_deb_args</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t561" href="#t561">561</a></span><span class="t"> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">udeb</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t562" href="#t562">562</a></span><span class="t"> <span class="nam">output_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t563" href="#t563">563</a></span><span class="t"> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">may_move_control_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t564" href="#t564">564</a></span><span class="t"> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">may_move_data_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t565" href="#t565">565</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t566" href="#t566">566</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t567" href="#t567">567</a></span><span class="t"> <span class="key">if</span> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">build_method</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t568" href="#t568">568</a></span><span class="t"> <span class="nam">assemble_deb</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t569" href="#t569">569</a></span><span class="t"> <span class="nam">output_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t570" href="#t570">570</a></span><span class="t"> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">build_method</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t571" href="#t571">571</a></span><span class="t"> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">assembled_deb_output</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t572" href="#t572">572</a></span><span class="t"> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t573" href="#t573">573</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t574" href="#t574">574</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t575" href="#t575">575</a></span><span class="t"> <span class="key">elif</span> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">command</span> <span class="op">==</span> <span class="str">"build-materialized-deb"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t576" href="#t576">576</a></span><span class="t"> <span class="nam">assemble_deb</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t577" href="#t577">577</a></span><span class="t"> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">materialized_deb_root_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t578" href="#t578">578</a></span><span class="t"> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">build_method</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t579" href="#t579">579</a></span><span class="t"> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">output</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t580" href="#t580">580</a></span><span class="t"> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t581" href="#t581">581</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t582" href="#t582">582</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t583" href="#t583">583</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span><span class="str">f'Internal error: Unimplemented command "{parsed_args.command}"'</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t584" href="#t584">584</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t585" href="#t585">585</a></span><span class="t"> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t586" href="#t586">586</a></span><span class="t"><span class="key">if</span> <span class="nam">__name__</span> <span class="op">==</span> <span class="str">"__main__"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t587" href="#t587">587</a></span><span class="t"> <span class="nam">main</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_2882d0a735873825___init___py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_2882d0a735873825_deb_packer_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_2882d0a735873825_deb_packer_py.html b/coverage-report/d_2882d0a735873825_deb_packer_py.html deleted file mode 100644 index 865a9fe..0000000 --- a/coverage-report/d_2882d0a735873825_deb_packer_py.html +++ /dev/null @@ -1,656 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/commands/deb_packer.py: 58%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/commands/deb_packer.py</b>: - <span class="pc_cov">58%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">197 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">116<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">81<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">2<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">7<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_2882d0a735873825_deb_materialization_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_6e57078c9ef7177d___init___py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="pln"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="com">#!/usr/bin/python3 -B</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">argparse</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">errno</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">import</span> <span class="nam">operator</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">import</span> <span class="nam">stat</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">import</span> <span class="nam">subprocess</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="key">import</span> <span class="nam">tarfile</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="key">import</span> <span class="nam">textwrap</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Optional</span><span class="op">,</span> <span class="nam">List</span><span class="op">,</span> <span class="nam">FrozenSet</span><span class="op">,</span> <span class="nam">Iterable</span><span class="op">,</span> <span class="nam">Callable</span><span class="op">,</span> <span class="nam">BinaryIO</span><span class="op">,</span> <span class="nam">cast</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">intermediate_manifest</span> <span class="key">import</span> <span class="nam">TarMember</span><span class="op">,</span> <span class="nam">PathType</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">_error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">compute_output_filename</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">resolve_source_date_epoch</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">ColorizedArgumentParser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">setup_logging</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">program_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">assume_not_none</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">version</span> <span class="key">import</span> <span class="nam">__version__</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"><span class="com"># AR header / start of a deb file for reference</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"><span class="com"># 00000000 21 3c 61 72 63 68 3e 0a 64 65 62 69 61 6e 2d 62 |!<arch>.debian-b|</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"><span class="com"># 00000010 69 6e 61 72 79 20 20 20 31 36 36 38 39 37 33 36 |inary 16689736|</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"><span class="com"># 00000020 39 35 20 20 30 20 20 20 20 20 30 20 20 20 20 20 |95 0 0 |</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"><span class="com"># 00000030 31 30 30 36 34 34 20 20 34 20 20 20 20 20 20 20 |100644 4 |</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"><span class="com"># 00000040 20 20 60 0a 32 2e 30 0a 63 6f 6e 74 72 6f 6c 2e | `.2.0.control.|</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"><span class="com"># 00000050 74 61 72 2e 78 7a 20 20 31 36 36 38 39 37 33 36 |tar.xz 16689736|</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"><span class="com"># 00000060 39 35 20 20 30 20 20 20 20 20 30 20 20 20 20 20 |95 0 0 |</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"><span class="com"># 00000070 31 30 30 36 34 34 20 20 39 33 36 38 20 20 20 20 |100644 9368 |</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"><span class="com"># 00000080 20 20 60 0a fd 37 7a 58 5a 00 00 04 e6 d6 b4 46 | `..7zXZ......F|</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="key">class</span> <span class="nam">ArMember</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="nam">name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="nam">mtime</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">fixed_binary</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">bytes</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">write_to_impl</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">BinaryIO</span><span class="op">]</span><span class="op">,</span> <span class="key">None</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">name</span> <span class="op">=</span> <span class="nam">name</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_mtime</span> <span class="op">=</span> <span class="nam">mtime</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_write_to_impl</span> <span class="op">=</span> <span class="nam">write_to_impl</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">fixed_binary</span> <span class="op">=</span> <span class="nam">fixed_binary</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_fixed_binary</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">fixed_binary</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="key">def</span> <span class="nam">mtime</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">mtime</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="key">def</span> <span class="nam">write_to</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">fd</span><span class="op">:</span> <span class="nam">BinaryIO</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="nam">writer</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_write_to_impl</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="key">assert</span> <span class="nam">writer</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="nam">writer</span><span class="op">(</span><span class="nam">fd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"><span class="nam">AR_HEADER_LEN</span> <span class="op">=</span> <span class="num">60</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"><span class="nam">AR_HEADER</span> <span class="op">=</span> <span class="str">b" "</span> <span class="op">*</span> <span class="nam">AR_HEADER_LEN</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"><span class="key">def</span> <span class="nam">write_header</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="nam">fd</span><span class="op">:</span> <span class="nam">BinaryIO</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="nam">member</span><span class="op">:</span> <span class="nam">ArMember</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="nam">member_len</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="nam">mtime</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="nam">header</span> <span class="op">=</span> <span class="str">b"%-16s%-12d0 0 100644 %-10d\x60\n"</span> <span class="op">%</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="nam">member</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">encode</span><span class="op">(</span><span class="str">"ascii"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="nam">mtime</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="nam">member_len</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="nam">fd</span><span class="op">.</span><span class="nam">write</span><span class="op">(</span><span class="nam">header</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"><span class="key">def</span> <span class="nam">generate_ar_archive</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="nam">output_filename</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="nam">mtime</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="nam">members</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">ArMember</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="nam">prefer_raw_exceptions</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="key">with</span> <span class="nam">open</span><span class="op">(</span><span class="nam">output_filename</span><span class="op">,</span> <span class="str">"wb"</span><span class="op">,</span> <span class="nam">buffering</span><span class="op">=</span><span class="num">0</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="nam">fd</span><span class="op">.</span><span class="nam">write</span><span class="op">(</span><span class="str">b"!<arch>\n"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="key">for</span> <span class="nam">member</span> <span class="key">in</span> <span class="nam">members</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="key">if</span> <span class="nam">member</span><span class="op">.</span><span class="nam">is_fixed_binary</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="nam">fixed_binary</span> <span class="op">=</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">member</span><span class="op">.</span><span class="nam">fixed_binary</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="nam">write_header</span><span class="op">(</span><span class="nam">fd</span><span class="op">,</span> <span class="nam">member</span><span class="op">,</span> <span class="nam">len</span><span class="op">(</span><span class="nam">fixed_binary</span><span class="op">)</span><span class="op">,</span> <span class="nam">mtime</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="nam">fd</span><span class="op">.</span><span class="nam">write</span><span class="op">(</span><span class="nam">fixed_binary</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="nam">header_pos</span> <span class="op">=</span> <span class="nam">fd</span><span class="op">.</span><span class="nam">tell</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="nam">fd</span><span class="op">.</span><span class="nam">write</span><span class="op">(</span><span class="nam">AR_HEADER</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="nam">member</span><span class="op">.</span><span class="nam">write_to</span><span class="op">(</span><span class="nam">fd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="nam">current_pos</span> <span class="op">=</span> <span class="nam">fd</span><span class="op">.</span><span class="nam">tell</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="nam">fd</span><span class="op">.</span><span class="nam">seek</span><span class="op">(</span><span class="nam">header_pos</span><span class="op">,</span> <span class="nam">os</span><span class="op">.</span><span class="nam">SEEK_SET</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="nam">content_len</span> <span class="op">=</span> <span class="nam">current_pos</span> <span class="op">-</span> <span class="nam">header_pos</span> <span class="op">-</span> <span class="nam">AR_HEADER_LEN</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="key">assert</span> <span class="nam">content_len</span> <span class="op">>=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="nam">write_header</span><span class="op">(</span><span class="nam">fd</span><span class="op">,</span> <span class="nam">member</span><span class="op">,</span> <span class="nam">content_len</span><span class="op">,</span> <span class="nam">mtime</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="nam">fd</span><span class="op">.</span><span class="nam">seek</span><span class="op">(</span><span class="nam">current_pos</span><span class="op">,</span> <span class="nam">os</span><span class="op">.</span><span class="nam">SEEK_SET</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="key">except</span> <span class="nam">OSError</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="key">if</span> <span class="nam">prefer_raw_exceptions</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="key">raise</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="key">if</span> <span class="nam">e</span><span class="op">.</span><span class="nam">errno</span> <span class="op">==</span> <span class="nam">errno</span><span class="op">.</span><span class="nam">ENOSPC</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="str">f"Unable to write {output_filename}. The file system device reported disk full: {str(e)}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="key">elif</span> <span class="nam">e</span><span class="op">.</span><span class="nam">errno</span> <span class="op">==</span> <span class="nam">errno</span><span class="op">.</span><span class="nam">EIO</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="str">f"Unable to write {output_filename}. The file system reported a generic I/O error: {str(e)}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="key">elif</span> <span class="nam">e</span><span class="op">.</span><span class="nam">errno</span> <span class="op">==</span> <span class="nam">errno</span><span class="op">.</span><span class="nam">EROFS</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="str">f"Unable to write {output_filename}. The file system is read-only: {str(e)}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="key">raise</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">f"Generated {output_filename}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"><span class="key">def</span> <span class="nam">_generate_tar_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="nam">tar_members</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">TarMember</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="nam">compression_cmd</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="nam">write_to</span><span class="op">:</span> <span class="nam">BinaryIO</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="key">with</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">Popen</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="nam">compression_cmd</span><span class="op">,</span> <span class="nam">stdin</span><span class="op">=</span><span class="nam">subprocess</span><span class="op">.</span><span class="nam">PIPE</span><span class="op">,</span> <span class="nam">stdout</span><span class="op">=</span><span class="nam">write_to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="op">)</span> <span class="key">as</span> <span class="nam">compress_proc</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="nam">tarfile</span><span class="op">.</span><span class="nam">open</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="nam">mode</span><span class="op">=</span><span class="str">"w|"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="nam">fileobj</span><span class="op">=</span><span class="nam">compress_proc</span><span class="op">.</span><span class="nam">stdin</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="nam">format</span><span class="op">=</span><span class="nam">tarfile</span><span class="op">.</span><span class="nam">GNU_FORMAT</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="nam">errorlevel</span><span class="op">=</span><span class="num">1</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="op">)</span> <span class="key">as</span> <span class="nam">tar_fd</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="key">for</span> <span class="nam">tar_member</span> <span class="key">in</span> <span class="nam">tar_members</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="nam">tar_info</span><span class="op">:</span> <span class="nam">tarfile</span><span class="op">.</span><span class="nam">TarInfo</span> <span class="op">=</span> <span class="nam">tar_member</span><span class="op">.</span><span class="nam">create_tar_info</span><span class="op">(</span><span class="nam">tar_fd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="key">if</span> <span class="nam">tar_member</span><span class="op">.</span><span class="nam">path_type</span> <span class="op">==</span> <span class="nam">PathType</span><span class="op">.</span><span class="nam">FILE</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="key">with</span> <span class="nam">open</span><span class="op">(</span><span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">tar_member</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">)</span><span class="op">,</span> <span class="str">"rb"</span><span class="op">)</span> <span class="key">as</span> <span class="nam">mfd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="nam">tar_fd</span><span class="op">.</span><span class="nam">addfile</span><span class="op">(</span><span class="nam">tar_info</span><span class="op">,</span> <span class="nam">fileobj</span><span class="op">=</span><span class="nam">mfd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="nam">tar_fd</span><span class="op">.</span><span class="nam">addfile</span><span class="op">(</span><span class="nam">tar_info</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="nam">compress_proc</span><span class="op">.</span><span class="nam">wait</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="key">if</span> <span class="nam">compress_proc</span><span class="op">.</span><span class="nam">returncode</span> <span class="op">!=</span> <span class="num">0</span><span class="op">:</span> </span><span class="r"><span class="annotate short">149 ↛ 150</span><span class="annotate long">line 149 didn't jump to line 150, because the condition on line 149 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="str">f"Compression command {compression_cmd} failed with code {compress_proc.returncode}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"><span class="key">def</span> <span class="nam">generate_tar_file_member</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="nam">tar_members</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">TarMember</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="nam">compression_cmd</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">BinaryIO</span><span class="op">]</span><span class="op">,</span> <span class="key">None</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="key">def</span> <span class="nam">_impl</span><span class="op">(</span><span class="nam">fd</span><span class="op">:</span> <span class="nam">BinaryIO</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="nam">_generate_tar_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="nam">tar_members</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="nam">compression_cmd</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="nam">fd</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="key">return</span> <span class="nam">_impl</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"><span class="key">def</span> <span class="nam">_xz_cmdline</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="nam">compression_rule</span><span class="op">:</span> <span class="str">"Compression"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="nam">parsed_args</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">argparse</span><span class="op">.</span><span class="nam">Namespace</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">compression_level</span> <span class="op">=</span> <span class="nam">compression_rule</span><span class="op">.</span><span class="nam">effective_compression_level</span><span class="op">(</span><span class="nam">parsed_args</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="nam">cmdline</span> <span class="op">=</span> <span class="op">[</span><span class="str">"xz"</span><span class="op">,</span> <span class="str">"-T2"</span><span class="op">,</span> <span class="str">"-"</span> <span class="op">+</span> <span class="nam">str</span><span class="op">(</span><span class="nam">compression_level</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="nam">strategy</span> <span class="op">=</span> <span class="key">None</span> <span class="key">if</span> <span class="nam">parsed_args</span> <span class="key">is</span> <span class="key">None</span> <span class="key">else</span> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">compression_strategy</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="key">if</span> <span class="nam">strategy</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">176 ↛ 178</span><span class="annotate long">line 176 didn't jump to line 178, because the condition on line 176 was never false</span></span></p> - <p class="run"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="nam">strategy</span> <span class="op">=</span> <span class="str">"none"</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="key">if</span> <span class="nam">strategy</span> <span class="op">!=</span> <span class="str">"none"</span><span class="op">:</span> </span><span class="r"><span class="annotate short">178 ↛ 179</span><span class="annotate long">line 178 didn't jump to line 179, because the condition on line 178 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="nam">cmdline</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">"--"</span> <span class="op">+</span> <span class="nam">strategy</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="nam">cmdline</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">"--no-adjust"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="key">return</span> <span class="nam">cmdline</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"><span class="key">def</span> <span class="nam">_gzip_cmdline</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="nam">compression_rule</span><span class="op">:</span> <span class="str">"Compression"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="nam">parsed_args</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">argparse</span><span class="op">.</span><span class="nam">Namespace</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="nam">compression_level</span> <span class="op">=</span> <span class="nam">compression_rule</span><span class="op">.</span><span class="nam">effective_compression_level</span><span class="op">(</span><span class="nam">parsed_args</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="nam">cmdline</span> <span class="op">=</span> <span class="op">[</span><span class="str">"gzip"</span><span class="op">,</span> <span class="str">"-n"</span> <span class="op">+</span> <span class="nam">str</span><span class="op">(</span><span class="nam">compression_level</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="nam">strategy</span> <span class="op">=</span> <span class="key">None</span> <span class="key">if</span> <span class="nam">parsed_args</span> <span class="key">is</span> <span class="key">None</span> <span class="key">else</span> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">compression_strategy</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="key">if</span> <span class="nam">strategy</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">strategy</span> <span class="op">!=</span> <span class="str">"none"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="str">f"Not implemented: Compression strategy {strategy}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="str">" for gzip is currently unsupported (but dpkg-deb does)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="key">return</span> <span class="nam">cmdline</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"><span class="key">def</span> <span class="nam">_uncompressed_cmdline</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="nam">_unused_a</span><span class="op">:</span> <span class="str">"Compression"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="nam">_unused_b</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">argparse</span><span class="op">.</span><span class="nam">Namespace</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="key">return</span> <span class="op">[</span><span class="str">"cat"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"><span class="key">class</span> <span class="nam">Compression</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="nam">default_compression_level</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="nam">extension</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="nam">allowed_strategies</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="nam">cmdline_builder</span><span class="op">:</span> <span class="nam">Callable</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="op">[</span><span class="str">"Compression"</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">argparse</span><span class="op">.</span><span class="nam">Namespace</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">default_compression_level</span> <span class="op">=</span> <span class="nam">default_compression_level</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">extension</span> <span class="op">=</span> <span class="nam">extension</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">allowed_strategies</span> <span class="op">=</span> <span class="nam">allowed_strategies</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">cmdline_builder</span> <span class="op">=</span> <span class="nam">cmdline_builder</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="key">def</span> <span class="nam">__repr__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="key">return</span> <span class="str">f"<{self.__class__.__name__} {self.extension}>"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="key">def</span> <span class="nam">effective_compression_level</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> <span class="nam">parsed_args</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">argparse</span><span class="op">.</span><span class="nam">Namespace</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="key">if</span> <span class="nam">parsed_args</span> <span class="key">and</span> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">compression_level</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">227 ↛ 228</span><span class="annotate long">line 227 didn't jump to line 228, because the condition on line 227 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="key">return</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"int"</span><span class="op">,</span> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">compression_level</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">default_compression_level</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="key">def</span> <span class="nam">as_cmdline</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">parsed_args</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">argparse</span><span class="op">.</span><span class="nam">Namespace</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">cmdline_builder</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">parsed_args</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="key">def</span> <span class="nam">with_extension</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">filename</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="key">return</span> <span class="nam">filename</span> <span class="op">+</span> <span class="nam">self</span><span class="op">.</span><span class="nam">extension</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"><span class="nam">COMPRESSIONS</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="str">"xz"</span><span class="op">:</span> <span class="nam">Compression</span><span class="op">(</span><span class="num">6</span><span class="op">,</span> <span class="str">".xz"</span><span class="op">,</span> <span class="nam">frozenset</span><span class="op">(</span><span class="op">{</span><span class="str">"none"</span><span class="op">,</span> <span class="str">"extreme"</span><span class="op">}</span><span class="op">)</span><span class="op">,</span> <span class="nam">_xz_cmdline</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="str">"gzip"</span><span class="op">:</span> <span class="nam">Compression</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="num">9</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="str">".gz"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="nam">frozenset</span><span class="op">(</span><span class="op">{</span><span class="str">"none"</span><span class="op">,</span> <span class="str">"filtered"</span><span class="op">,</span> <span class="str">"huffman"</span><span class="op">,</span> <span class="str">"rle"</span><span class="op">,</span> <span class="str">"fixed"</span><span class="op">}</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="nam">_gzip_cmdline</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="str">"none"</span><span class="op">:</span> <span class="nam">Compression</span><span class="op">(</span><span class="num">0</span><span class="op">,</span> <span class="str">""</span><span class="op">,</span> <span class="nam">frozenset</span><span class="op">(</span><span class="op">{</span><span class="str">"none"</span><span class="op">}</span><span class="op">)</span><span class="op">,</span> <span class="nam">_uncompressed_cmdline</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"><span class="key">def</span> <span class="nam">_normalize_compression_args</span><span class="op">(</span><span class="nam">parsed_args</span><span class="op">:</span> <span class="nam">argparse</span><span class="op">.</span><span class="nam">Namespace</span><span class="op">)</span> <span class="op">-></span> <span class="nam">argparse</span><span class="op">.</span><span class="nam">Namespace</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">compression_level</span> <span class="op">==</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="key">and</span> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">compression_algorithm</span> <span class="op">==</span> <span class="str">"gzip"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="str">"Note: Mapping compression algorithm to none for compatibility with dpkg-deb (due to -Zgzip -z0)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="nam">setattr</span><span class="op">(</span><span class="nam">parsed_args</span><span class="op">,</span> <span class="str">"compression_algorithm"</span><span class="op">,</span> <span class="str">"none"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="nam">compression</span> <span class="op">=</span> <span class="nam">COMPRESSIONS</span><span class="op">[</span><span class="nam">parsed_args</span><span class="op">.</span><span class="nam">compression_algorithm</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="nam">strategy</span> <span class="op">=</span> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">compression_strategy</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="key">if</span> <span class="nam">strategy</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">strategy</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">compression</span><span class="op">.</span><span class="nam">allowed_strategies</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="str">f'Compression algorithm "{parsed_args.compression_algorithm}" does not support compression strategy'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="str">f' "{strategy}". Allowed values: {", ".join(sorted(compression.allowed_strategies))}'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="key">return</span> <span class="nam">parsed_args</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"><span class="key">def</span> <span class="nam">parse_args</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="nam">argparse</span><span class="op">.</span><span class="nam">Namespace</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="nam">compression_level_default</span> <span class="op">=</span> <span class="nam">int</span><span class="op">(</span><span class="nam">os</span><span class="op">.</span><span class="nam">environ</span><span class="op">[</span><span class="str">"DPKG_DEB_COMPRESSOR_LEVEL"</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="key">except</span> <span class="op">(</span><span class="nam">KeyError</span><span class="op">,</span> <span class="nam">ValueError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="nam">compression_level_default</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="nam">compression_type</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">environ</span><span class="op">[</span><span class="str">"DPKG_DEB_COMPRESSOR_TYPE"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="key">except</span> <span class="op">(</span><span class="nam">KeyError</span><span class="op">,</span> <span class="nam">ValueError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="nam">compression_type</span> <span class="op">=</span> <span class="str">"xz"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="nam">threads_max</span> <span class="op">=</span> <span class="nam">int</span><span class="op">(</span><span class="nam">os</span><span class="op">.</span><span class="nam">environ</span><span class="op">[</span><span class="str">"DPKG_DEB_THREADS_MAX"</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="key">except</span> <span class="op">(</span><span class="nam">KeyError</span><span class="op">,</span> <span class="nam">ValueError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="nam">threads_max</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="nam">description</span> <span class="op">=</span> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"><span class="str"> THIS IS A PROTOTYPE "dpkg-deb -b" emulator with basic manifest support</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"><span class="str"> DO NOT USE THIS TOOL DIRECTLY. It has not stability guarantees and will be removed as</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"><span class="str"> soon as "dpkg-deb -b" grows support for the relevant features.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"><span class="str"> This tool is a prototype "dpkg-deb -b"-like interface for compiling a Debian package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"><span class="str"> without requiring root even for static ownership. It is a temporary stand-in for</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"><span class="str"> "dpkg-deb -b" until "dpkg-deb -b" will get support for a manifest.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"><span class="str"> The tool operates on an internal JSON based manifest for now, because it was faster</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"><span class="str"> than building an mtree parser (which is the format that dpkg will likely end up</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"><span class="str"> using).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"><span class="str"> As the tool is not meant to be used directly, it is full of annoying paper cuts that</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"><span class="str"> I refuse to fix or maintain. Use the high level tool instead.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="nam">parser</span> <span class="op">=</span> <span class="nam">ColorizedArgumentParser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">description</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="nam">formatter_class</span><span class="op">=</span><span class="nam">argparse</span><span class="op">.</span><span class="nam">RawDescriptionHelpFormatter</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="nam">allow_abbrev</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="nam">prog</span><span class="op">=</span><span class="nam">program_name</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="nam">parser</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span><span class="str">"--version"</span><span class="op">,</span> <span class="nam">action</span><span class="op">=</span><span class="str">"version"</span><span class="op">,</span> <span class="nam">version</span><span class="op">=</span><span class="nam">__version__</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="nam">parser</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="str">"package_root_dir"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="nam">metavar</span><span class="op">=</span><span class="str">"PACKAGE_ROOT_DIR"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Root directory of the package. Must contain a DEBIAN directory"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="nam">parser</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="str">"package_output_path"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="nam">metavar</span><span class="op">=</span><span class="str">"PATH"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Path where the package should be placed. If it is directory,"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> <span class="str">" the base name will be determined from the package metadata"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> <span class="nam">parser</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> <span class="str">"--intermediate-package-manifest"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> <span class="nam">dest</span><span class="op">=</span><span class="str">"package_manifest"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> <span class="nam">metavar</span><span class="op">=</span><span class="str">"JSON_FILE"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> <span class="nam">action</span><span class="op">=</span><span class="str">"store"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> <span class="nam">default</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"INTERMEDIATE package manifest (JSON!)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> <span class="nam">parser</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> <span class="str">"--root-owner-group"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> <span class="nam">dest</span><span class="op">=</span><span class="str">"root_owner_group"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> <span class="nam">action</span><span class="op">=</span><span class="str">"store_true"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Ignored. Accepted for compatibility with dpkg-deb -b"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> <span class="nam">parser</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"> <span class="str">"-b"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"> <span class="str">"--build"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"> <span class="nam">dest</span><span class="op">=</span><span class="str">"build_param"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> <span class="nam">action</span><span class="op">=</span><span class="str">"store_true"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Ignored. Accepted for compatibility with dpkg-deb"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"> <span class="nam">parser</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"> <span class="str">"--source-date-epoch"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"> <span class="nam">dest</span><span class="op">=</span><span class="str">"source_date_epoch"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"> <span class="nam">action</span><span class="op">=</span><span class="str">"store"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"> <span class="nam">type</span><span class="op">=</span><span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"> <span class="nam">default</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Source date epoch (can also be given via the SOURCE_DATE_EPOCH environ variable"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"> <span class="nam">parser</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"> <span class="str">"-Z"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"> <span class="nam">dest</span><span class="op">=</span><span class="str">"compression_algorithm"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"> <span class="nam">choices</span><span class="op">=</span><span class="nam">COMPRESSIONS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"> <span class="nam">default</span><span class="op">=</span><span class="nam">compression_type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"The compression algorithm to be used"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"> <span class="nam">parser</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"> <span class="str">"-z"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"> <span class="nam">dest</span><span class="op">=</span><span class="str">"compression_level"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"> <span class="nam">metavar</span><span class="op">=</span><span class="str">"{0-9}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"> <span class="nam">choices</span><span class="op">=</span><span class="op">[</span><span class="num">0</span><span class="op">,</span> <span class="num">1</span><span class="op">,</span> <span class="num">2</span><span class="op">,</span> <span class="num">3</span><span class="op">,</span> <span class="num">4</span><span class="op">,</span> <span class="num">5</span><span class="op">,</span> <span class="num">6</span><span class="op">,</span> <span class="num">7</span><span class="op">,</span> <span class="num">8</span><span class="op">,</span> <span class="num">9</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"> <span class="nam">default</span><span class="op">=</span><span class="nam">compression_level_default</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"> <span class="nam">type</span><span class="op">=</span><span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"The compression level to be used"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"> <span class="nam">parser</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"> <span class="str">"-S"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"> <span class="nam">dest</span><span class="op">=</span><span class="str">"compression_strategy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"> <span class="com"># We have a different default for xz when strategy is unset and we are building a udeb</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"> <span class="nam">action</span><span class="op">=</span><span class="str">"store"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"> <span class="nam">default</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"The compression algorithm to be used. Concrete values depend on the compression"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"> <span class="str">' algorithm, but the value "none" is always allowed'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"> <span class="nam">parser</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"> <span class="str">"--uniform-compression"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"> <span class="nam">dest</span><span class="op">=</span><span class="str">"uniform_compression"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"> <span class="nam">action</span><span class="op">=</span><span class="str">"store_true"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"> <span class="nam">default</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t385" href="#t385">385</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Whether to use the same compression for the control.tar and the data.tar."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t386" href="#t386">386</a></span><span class="t"> <span class="str">" The default is to use uniform compression."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t387" href="#t387">387</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t388" href="#t388">388</a></span><span class="t"> <span class="nam">parser</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t389" href="#t389">389</a></span><span class="t"> <span class="str">"--no-uniform-compression"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t390" href="#t390">390</a></span><span class="t"> <span class="nam">dest</span><span class="op">=</span><span class="str">"uniform_compression"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t391" href="#t391">391</a></span><span class="t"> <span class="nam">action</span><span class="op">=</span><span class="str">"store_false"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t392" href="#t392">392</a></span><span class="t"> <span class="nam">default</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t393" href="#t393">393</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Disable uniform compression (see --uniform-compression)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t394" href="#t394">394</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t395" href="#t395">395</a></span><span class="t"> <span class="nam">parser</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t396" href="#t396">396</a></span><span class="t"> <span class="str">"--threads-max"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t397" href="#t397">397</a></span><span class="t"> <span class="nam">dest</span><span class="op">=</span><span class="str">"threads_max"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t398" href="#t398">398</a></span><span class="t"> <span class="nam">default</span><span class="op">=</span><span class="nam">threads_max</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t399" href="#t399">399</a></span><span class="t"> <span class="com"># TODO: Support this properly</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t400" href="#t400">400</a></span><span class="t"> <span class="nam">type</span><span class="op">=</span><span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t401" href="#t401">401</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Ignored; accepted for compatibility"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t402" href="#t402">402</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t403" href="#t403">403</a></span><span class="t"> <span class="nam">parser</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t404" href="#t404">404</a></span><span class="t"> <span class="str">"-d"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t405" href="#t405">405</a></span><span class="t"> <span class="str">"--debug"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t406" href="#t406">406</a></span><span class="t"> <span class="nam">dest</span><span class="op">=</span><span class="str">"debug_mode"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t407" href="#t407">407</a></span><span class="t"> <span class="nam">action</span><span class="op">=</span><span class="str">"store_true"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t408" href="#t408">408</a></span><span class="t"> <span class="nam">default</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t409" href="#t409">409</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Enable debug logging and raw stack traces on errors"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t410" href="#t410">410</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t411" href="#t411">411</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t412" href="#t412">412</a></span><span class="t"> <span class="nam">parsed_args</span> <span class="op">=</span> <span class="nam">parser</span><span class="op">.</span><span class="nam">parse_args</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t413" href="#t413">413</a></span><span class="t"> <span class="nam">parsed_args</span> <span class="op">=</span> <span class="nam">_normalize_compression_args</span><span class="op">(</span><span class="nam">parsed_args</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t414" href="#t414">414</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t415" href="#t415">415</a></span><span class="t"> <span class="key">return</span> <span class="nam">parsed_args</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t416" href="#t416">416</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t417" href="#t417">417</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t418" href="#t418">418</a></span><span class="t"><span class="key">def</span> <span class="nam">_ctrl_member</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t419" href="#t419">419</a></span><span class="t"> <span class="nam">member_path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t420" href="#t420">420</a></span><span class="t"> <span class="nam">fs_path</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t421" href="#t421">421</a></span><span class="t"> <span class="nam">path_type</span><span class="op">:</span> <span class="nam">PathType</span> <span class="op">=</span> <span class="nam">PathType</span><span class="op">.</span><span class="nam">FILE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t422" href="#t422">422</a></span><span class="t"> <span class="nam">mode</span><span class="op">:</span> <span class="nam">int</span> <span class="op">=</span> <span class="num">0o644</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t423" href="#t423">423</a></span><span class="t"> <span class="nam">mtime</span><span class="op">:</span> <span class="nam">int</span> <span class="op">=</span> <span class="num">0</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t424" href="#t424">424</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">TarMember</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t425" href="#t425">425</a></span><span class="t"> <span class="key">if</span> <span class="nam">fs_path</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">425 ↛ 426</span><span class="annotate long">line 425 didn't jump to line 426, because the condition on line 425 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t426" href="#t426">426</a></span><span class="t"> <span class="key">assert</span> <span class="nam">member_path</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"./"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t427" href="#t427">427</a></span><span class="t"> <span class="nam">fs_path</span> <span class="op">=</span> <span class="str">"DEBIAN"</span> <span class="op">+</span> <span class="nam">member_path</span><span class="op">[</span><span class="num">1</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t428" href="#t428">428</a></span><span class="t"> <span class="key">return</span> <span class="nam">TarMember</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t429" href="#t429">429</a></span><span class="t"> <span class="nam">member_path</span><span class="op">=</span><span class="nam">member_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t430" href="#t430">430</a></span><span class="t"> <span class="nam">path_type</span><span class="op">=</span><span class="nam">path_type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t431" href="#t431">431</a></span><span class="t"> <span class="nam">fs_path</span><span class="op">=</span><span class="nam">fs_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t432" href="#t432">432</a></span><span class="t"> <span class="nam">mode</span><span class="op">=</span><span class="nam">mode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t433" href="#t433">433</a></span><span class="t"> <span class="nam">owner</span><span class="op">=</span><span class="str">"root"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t434" href="#t434">434</a></span><span class="t"> <span class="nam">uid</span><span class="op">=</span><span class="num">0</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t435" href="#t435">435</a></span><span class="t"> <span class="nam">group</span><span class="op">=</span><span class="str">"root"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t436" href="#t436">436</a></span><span class="t"> <span class="nam">gid</span><span class="op">=</span><span class="num">0</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t437" href="#t437">437</a></span><span class="t"> <span class="nam">mtime</span><span class="op">=</span><span class="nam">mtime</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t438" href="#t438">438</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t439" href="#t439">439</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t440" href="#t440">440</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t441" href="#t441">441</a></span><span class="t"><span class="nam">CTRL_MEMBER_SCRIPTS</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t442" href="#t442">442</a></span><span class="t"> <span class="str">"postinst"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t443" href="#t443">443</a></span><span class="t"> <span class="str">"preinst"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t444" href="#t444">444</a></span><span class="t"> <span class="str">"postrm"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t445" href="#t445">445</a></span><span class="t"> <span class="str">"prerm"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t446" href="#t446">446</a></span><span class="t"> <span class="str">"config"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t447" href="#t447">447</a></span><span class="t"> <span class="str">"isinstallable"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t448" href="#t448">448</a></span><span class="t"><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t449" href="#t449">449</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t450" href="#t450">450</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t451" href="#t451">451</a></span><span class="t"><span class="key">def</span> <span class="nam">_ctrl_tar_members</span><span class="op">(</span><span class="nam">package_root_dir</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">mtime</span><span class="op">:</span> <span class="nam">int</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">TarMember</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t452" href="#t452">452</a></span><span class="t"> <span class="nam">debian_root</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">package_root_dir</span><span class="op">,</span> <span class="str">"DEBIAN"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t453" href="#t453">453</a></span><span class="t"> <span class="nam">dir_st</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">stat</span><span class="op">(</span><span class="nam">debian_root</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t454" href="#t454">454</a></span><span class="t"> <span class="nam">dir_mtime</span> <span class="op">=</span> <span class="nam">int</span><span class="op">(</span><span class="nam">dir_st</span><span class="op">.</span><span class="nam">st_mtime</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t455" href="#t455">455</a></span><span class="t"> <span class="key">yield</span> <span class="nam">_ctrl_member</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t456" href="#t456">456</a></span><span class="t"> <span class="str">"./"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t457" href="#t457">457</a></span><span class="t"> <span class="nam">debian_root</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t458" href="#t458">458</a></span><span class="t"> <span class="nam">path_type</span><span class="op">=</span><span class="nam">PathType</span><span class="op">.</span><span class="nam">DIRECTORY</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t459" href="#t459">459</a></span><span class="t"> <span class="nam">mode</span><span class="op">=</span><span class="num">0o0755</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t460" href="#t460">460</a></span><span class="t"> <span class="nam">mtime</span><span class="op">=</span><span class="nam">min</span><span class="op">(</span><span class="nam">mtime</span><span class="op">,</span> <span class="nam">dir_mtime</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t461" href="#t461">461</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t462" href="#t462">462</a></span><span class="t"> <span class="key">with</span> <span class="nam">os</span><span class="op">.</span><span class="nam">scandir</span><span class="op">(</span><span class="nam">debian_root</span><span class="op">)</span> <span class="key">as</span> <span class="nam">dir_iter</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t463" href="#t463">463</a></span><span class="t"> <span class="key">for</span> <span class="nam">ctrl_member</span> <span class="key">in</span> <span class="nam">sorted</span><span class="op">(</span><span class="nam">dir_iter</span><span class="op">,</span> <span class="nam">key</span><span class="op">=</span><span class="nam">operator</span><span class="op">.</span><span class="nam">attrgetter</span><span class="op">(</span><span class="str">"name"</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t464" href="#t464">464</a></span><span class="t"> <span class="nam">st</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">stat</span><span class="op">(</span><span class="nam">ctrl_member</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t465" href="#t465">465</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">stat</span><span class="op">.</span><span class="nam">S_ISREG</span><span class="op">(</span><span class="nam">st</span><span class="op">.</span><span class="nam">st_mode</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">465 ↛ 466</span><span class="annotate long">line 465 didn't jump to line 466, because the condition on line 465 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t466" href="#t466">466</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t467" href="#t467">467</a></span><span class="t"> <span class="str">f"{ctrl_member.path} is not a file and all control.tar members ought to be files!"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t468" href="#t468">468</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t469" href="#t469">469</a></span><span class="t"> <span class="nam">file_mtime</span> <span class="op">=</span> <span class="nam">int</span><span class="op">(</span><span class="nam">st</span><span class="op">.</span><span class="nam">st_mtime</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t470" href="#t470">470</a></span><span class="t"> <span class="key">yield</span> <span class="nam">_ctrl_member</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t471" href="#t471">471</a></span><span class="t"> <span class="str">f"./{ctrl_member.name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t472" href="#t472">472</a></span><span class="t"> <span class="nam">path_type</span><span class="op">=</span><span class="nam">PathType</span><span class="op">.</span><span class="nam">FILE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t473" href="#t473">473</a></span><span class="t"> <span class="nam">fs_path</span><span class="op">=</span><span class="nam">ctrl_member</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t474" href="#t474">474</a></span><span class="t"> <span class="nam">mode</span><span class="op">=</span><span class="num">0o0755</span> <span class="key">if</span> <span class="nam">ctrl_member</span><span class="op">.</span><span class="nam">name</span> <span class="key">in</span> <span class="nam">CTRL_MEMBER_SCRIPTS</span> <span class="key">else</span> <span class="num">0o0644</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t475" href="#t475">475</a></span><span class="t"> <span class="nam">mtime</span><span class="op">=</span><span class="nam">min</span><span class="op">(</span><span class="nam">mtime</span><span class="op">,</span> <span class="nam">file_mtime</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t476" href="#t476">476</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t477" href="#t477">477</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t478" href="#t478">478</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t479" href="#t479">479</a></span><span class="t"><span class="key">def</span> <span class="nam">parse_manifest</span><span class="op">(</span><span class="nam">manifest_path</span><span class="op">:</span> <span class="str">"Optional[str]"</span><span class="op">)</span> <span class="op">-></span> <span class="str">"List[TarMember]"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t480" href="#t480">480</a></span><span class="t"> <span class="key">if</span> <span class="nam">manifest_path</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">480 ↛ 481</span><span class="annotate long">line 480 didn't jump to line 481, because the condition on line 480 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t481" href="#t481">481</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span><span class="str">f"--intermediate-package-manifest is mandatory for now"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t482" href="#t482">482</a></span><span class="t"> <span class="key">return</span> <span class="nam">TarMember</span><span class="op">.</span><span class="nam">parse_intermediate_manifest</span><span class="op">(</span><span class="nam">manifest_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t483" href="#t483">483</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t484" href="#t484">484</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t485" href="#t485">485</a></span><span class="t"><span class="key">def</span> <span class="nam">main</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t486" href="#t486">486</a></span><span class="t"> <span class="nam">setup_logging</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t487" href="#t487">487</a></span><span class="t"> <span class="nam">parsed_args</span> <span class="op">=</span> <span class="nam">parse_args</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t488" href="#t488">488</a></span><span class="t"> <span class="nam">root_dir</span><span class="op">:</span> <span class="nam">str</span> <span class="op">=</span> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">package_root_dir</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t489" href="#t489">489</a></span><span class="t"> <span class="nam">output_path</span><span class="op">:</span> <span class="nam">str</span> <span class="op">=</span> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">package_output_path</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t490" href="#t490">490</a></span><span class="t"> <span class="nam">mtime</span> <span class="op">=</span> <span class="nam">resolve_source_date_epoch</span><span class="op">(</span><span class="nam">parsed_args</span><span class="op">.</span><span class="nam">source_date_epoch</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t491" href="#t491">491</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t492" href="#t492">492</a></span><span class="t"> <span class="nam">data_compression</span><span class="op">:</span> <span class="nam">Compression</span> <span class="op">=</span> <span class="nam">COMPRESSIONS</span><span class="op">[</span><span class="nam">parsed_args</span><span class="op">.</span><span class="nam">compression_algorithm</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t493" href="#t493">493</a></span><span class="t"> <span class="nam">data_compression_cmd</span> <span class="op">=</span> <span class="nam">data_compression</span><span class="op">.</span><span class="nam">as_cmdline</span><span class="op">(</span><span class="nam">parsed_args</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t494" href="#t494">494</a></span><span class="t"> <span class="key">if</span> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">uniform_compression</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t495" href="#t495">495</a></span><span class="t"> <span class="nam">ctrl_compression</span> <span class="op">=</span> <span class="nam">data_compression</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t496" href="#t496">496</a></span><span class="t"> <span class="nam">ctrl_compression_cmd</span> <span class="op">=</span> <span class="nam">data_compression_cmd</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t497" href="#t497">497</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t498" href="#t498">498</a></span><span class="t"> <span class="nam">ctrl_compression</span> <span class="op">=</span> <span class="nam">COMPRESSIONS</span><span class="op">[</span><span class="str">"gzip"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t499" href="#t499">499</a></span><span class="t"> <span class="nam">ctrl_compression_cmd</span> <span class="op">=</span> <span class="nam">COMPRESSIONS</span><span class="op">[</span><span class="str">"gzip"</span><span class="op">]</span><span class="op">.</span><span class="nam">as_cmdline</span><span class="op">(</span><span class="key">None</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t500" href="#t500">500</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t501" href="#t501">501</a></span><span class="t"> <span class="key">if</span> <span class="nam">output_path</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span> <span class="key">or</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">isdir</span><span class="op">(</span><span class="nam">output_path</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t502" href="#t502">502</a></span><span class="t"> <span class="nam">deb_file</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t503" href="#t503">503</a></span><span class="t"> <span class="nam">output_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t504" href="#t504">504</a></span><span class="t"> <span class="nam">compute_output_filename</span><span class="op">(</span><span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">root_dir</span><span class="op">,</span> <span class="str">"DEBIAN"</span><span class="op">)</span><span class="op">,</span> <span class="key">False</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t505" href="#t505">505</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t506" href="#t506">506</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t507" href="#t507">507</a></span><span class="t"> <span class="nam">deb_file</span> <span class="op">=</span> <span class="nam">output_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t508" href="#t508">508</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t509" href="#t509">509</a></span><span class="t"> <span class="nam">pack</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t510" href="#t510">510</a></span><span class="t"> <span class="nam">deb_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t511" href="#t511">511</a></span><span class="t"> <span class="nam">ctrl_compression</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t512" href="#t512">512</a></span><span class="t"> <span class="nam">data_compression</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t513" href="#t513">513</a></span><span class="t"> <span class="nam">root_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t514" href="#t514">514</a></span><span class="t"> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">package_manifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t515" href="#t515">515</a></span><span class="t"> <span class="nam">mtime</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t516" href="#t516">516</a></span><span class="t"> <span class="nam">ctrl_compression_cmd</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t517" href="#t517">517</a></span><span class="t"> <span class="nam">data_compression_cmd</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t518" href="#t518">518</a></span><span class="t"> <span class="nam">prefer_raw_exceptions</span><span class="op">=</span><span class="key">not</span> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">debug_mode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t519" href="#t519">519</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t520" href="#t520">520</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t521" href="#t521">521</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t522" href="#t522">522</a></span><span class="t"><span class="key">def</span> <span class="nam">pack</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t523" href="#t523">523</a></span><span class="t"> <span class="nam">deb_file</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t524" href="#t524">524</a></span><span class="t"> <span class="nam">ctrl_compression</span><span class="op">:</span> <span class="nam">Compression</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t525" href="#t525">525</a></span><span class="t"> <span class="nam">data_compression</span><span class="op">:</span> <span class="nam">Compression</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t526" href="#t526">526</a></span><span class="t"> <span class="nam">root_dir</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t527" href="#t527">527</a></span><span class="t"> <span class="nam">package_manifest</span><span class="op">:</span> <span class="str">"Optional[str]"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t528" href="#t528">528</a></span><span class="t"> <span class="nam">mtime</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t529" href="#t529">529</a></span><span class="t"> <span class="nam">ctrl_compression_cmd</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t530" href="#t530">530</a></span><span class="t"> <span class="nam">data_compression_cmd</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t531" href="#t531">531</a></span><span class="t"> <span class="nam">prefer_raw_exceptions</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t532" href="#t532">532</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t533" href="#t533">533</a></span><span class="t"> <span class="nam">data_tar_members</span> <span class="op">=</span> <span class="nam">parse_manifest</span><span class="op">(</span><span class="nam">package_manifest</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t534" href="#t534">534</a></span><span class="t"> <span class="nam">members</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t535" href="#t535">535</a></span><span class="t"> <span class="nam">ArMember</span><span class="op">(</span><span class="str">"debian-binary"</span><span class="op">,</span> <span class="nam">mtime</span><span class="op">,</span> <span class="nam">fixed_binary</span><span class="op">=</span><span class="str">b"2.0\n"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t536" href="#t536">536</a></span><span class="t"> <span class="nam">ArMember</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t537" href="#t537">537</a></span><span class="t"> <span class="nam">ctrl_compression</span><span class="op">.</span><span class="nam">with_extension</span><span class="op">(</span><span class="str">"control.tar"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t538" href="#t538">538</a></span><span class="t"> <span class="nam">mtime</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t539" href="#t539">539</a></span><span class="t"> <span class="nam">write_to_impl</span><span class="op">=</span><span class="nam">generate_tar_file_member</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t540" href="#t540">540</a></span><span class="t"> <span class="nam">_ctrl_tar_members</span><span class="op">(</span><span class="nam">root_dir</span><span class="op">,</span> <span class="nam">mtime</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t541" href="#t541">541</a></span><span class="t"> <span class="nam">ctrl_compression_cmd</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t542" href="#t542">542</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t543" href="#t543">543</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t544" href="#t544">544</a></span><span class="t"> <span class="nam">ArMember</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t545" href="#t545">545</a></span><span class="t"> <span class="nam">data_compression</span><span class="op">.</span><span class="nam">with_extension</span><span class="op">(</span><span class="str">"data.tar"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t546" href="#t546">546</a></span><span class="t"> <span class="nam">mtime</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t547" href="#t547">547</a></span><span class="t"> <span class="nam">write_to_impl</span><span class="op">=</span><span class="nam">generate_tar_file_member</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t548" href="#t548">548</a></span><span class="t"> <span class="nam">data_tar_members</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t549" href="#t549">549</a></span><span class="t"> <span class="nam">data_compression_cmd</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t550" href="#t550">550</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t551" href="#t551">551</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t552" href="#t552">552</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t553" href="#t553">553</a></span><span class="t"> <span class="nam">generate_ar_archive</span><span class="op">(</span><span class="nam">deb_file</span><span class="op">,</span> <span class="nam">mtime</span><span class="op">,</span> <span class="nam">members</span><span class="op">,</span> <span class="nam">prefer_raw_exceptions</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t554" href="#t554">554</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t555" href="#t555">555</a></span><span class="t"> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t556" href="#t556">556</a></span><span class="t"><span class="key">if</span> <span class="nam">__name__</span> <span class="op">==</span> <span class="str">"__main__"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t557" href="#t557">557</a></span><span class="t"> <span class="nam">main</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_2882d0a735873825_deb_materialization_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_6e57078c9ef7177d___init___py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_36a196ce5f578895___init___py.html b/coverage-report/d_36a196ce5f578895___init___py.html deleted file mode 100644 index 08fe16e..0000000 --- a/coverage-report/d_36a196ce5f578895___init___py.html +++ /dev/null @@ -1,99 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/packaging/__init__.py: 100%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/packaging/__init__.py</b>: - <span class="pc_cov">100%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">0 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">0<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">0<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_packages_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_36a196ce5f578895_alternatives_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_packages_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_36a196ce5f578895_alternatives_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_36a196ce5f578895_alternatives_py.html b/coverage-report/d_36a196ce5f578895_alternatives_py.html deleted file mode 100644 index 4409759..0000000 --- a/coverage-report/d_36a196ce5f578895_alternatives_py.html +++ /dev/null @@ -1,324 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/packaging/alternatives.py: 74%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/packaging/alternatives.py</b>: - <span class="pc_cov">74%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">75 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">60<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">15<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">12<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_36a196ce5f578895___init___py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_36a196ce5f578895_debconf_templates_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">textwrap</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">List</span><span class="op">,</span> <span class="nam">Dict</span><span class="op">,</span> <span class="nam">Tuple</span><span class="op">,</span> <span class="nam">Mapping</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">from</span> <span class="nam">debian</span><span class="op">.</span><span class="nam">deb822</span> <span class="key">import</span> <span class="nam">Deb822</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">maintscript_snippet</span> <span class="key">import</span> <span class="nam">MaintscriptSnippetContainer</span><span class="op">,</span> <span class="nam">MaintscriptSnippet</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">packager_provided_files</span> <span class="key">import</span> <span class="nam">PackagerProvidedFile</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">packages</span> <span class="key">import</span> <span class="nam">BinaryPackage</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">packaging</span><span class="op">.</span><span class="nam">makeshlibs</span> <span class="key">import</span> <span class="nam">resolve_reserved_provided_file</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="nam">VirtualPath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">_error</span><span class="op">,</span> <span class="nam">escape_shell</span><span class="op">,</span> <span class="nam">POSTINST_DEFAULT_CONDITION</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"><span class="com"># Match debhelper (minus one space in each end, which comes</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"><span class="com"># via join).</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"><span class="nam">LINE_PREFIX</span> <span class="op">=</span> <span class="str">"\\\n "</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"><span class="key">def</span> <span class="nam">process_alternatives</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">reserved_packager_provided_files</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">PackagerProvidedFile</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">maintscript_snippets</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">MaintscriptSnippetContainer</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="key">if</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">is_udeb</span><span class="op">:</span> </span><span class="r"><span class="annotate short">24 ↛ 25</span><span class="annotate long">line 24 didn't jump to line 25, because the condition on line 24 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="nam">provided_alternatives_file</span> <span class="op">=</span> <span class="nam">resolve_reserved_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="str">"alternatives"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="nam">reserved_packager_provided_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="key">if</span> <span class="nam">provided_alternatives_file</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">31 ↛ 32</span><span class="annotate long">line 31 didn't jump to line 32, because the condition on line 31 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="key">with</span> <span class="nam">provided_alternatives_file</span><span class="op">.</span><span class="nam">open</span><span class="op">(</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="nam">alternatives</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">Deb822</span><span class="op">.</span><span class="nam">iter_paragraphs</span><span class="op">(</span><span class="nam">fd</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="key">for</span> <span class="nam">no</span><span class="op">,</span> <span class="nam">alternative</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">alternatives</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="nam">process_alternative</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">provided_alternatives_file</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="nam">alternative</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">no</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">maintscript_snippets</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"><span class="key">def</span> <span class="nam">process_alternative</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="nam">provided_alternatives_fs_path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="nam">alternative_deb822</span><span class="op">:</span> <span class="nam">Deb822</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="nam">no</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="nam">maintscript_snippets</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">MaintscriptSnippetContainer</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="nam">name</span> <span class="op">=</span> <span class="nam">_mandatory_key</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="str">"Name"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">alternative_deb822</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="nam">provided_alternatives_fs_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="str">f"Stanza number {no}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="nam">error_context</span> <span class="op">=</span> <span class="str">f"Alternative named {name}"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="nam">link_path</span> <span class="op">=</span> <span class="nam">_mandatory_key</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="str">"Link"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="nam">alternative_deb822</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="nam">provided_alternatives_fs_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="nam">error_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="nam">impl_path</span> <span class="op">=</span> <span class="nam">_mandatory_key</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="str">"Alternative"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="nam">alternative_deb822</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="nam">provided_alternatives_fs_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="nam">error_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="nam">priority</span> <span class="op">=</span> <span class="nam">_mandatory_key</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="str">"Priority"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="nam">alternative_deb822</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="nam">provided_alternatives_fs_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="nam">error_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="key">if</span> <span class="str">"/"</span> <span class="key">in</span> <span class="nam">name</span><span class="op">:</span> </span><span class="r"><span class="annotate short">79 ↛ 80</span><span class="annotate long">line 79 didn't jump to line 80, because the condition on line 79 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="str">f'The "Name" ({link_path}) key must be a basename and cannot contain slashes'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="str">f" ({error_context} in {provided_alternatives_fs_path})"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="key">if</span> <span class="nam">link_path</span> <span class="op">==</span> <span class="nam">impl_path</span><span class="op">:</span> </span><span class="r"><span class="annotate short">84 ↛ 85</span><span class="annotate long">line 84 didn't jump to line 85, because the condition on line 84 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="str">f'The "Link" key and the "Alternative" key must not have the same value'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="str">f" ({error_context} in {provided_alternatives_fs_path})"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="nam">impl</span> <span class="op">=</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="nam">impl_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="key">if</span> <span class="nam">impl</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">impl</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"><span class="annotate short">90 ↛ 91</span><span class="annotate long">line 90 didn't jump to line 91, because the condition on line 90 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="str">f'The path listed in "Alternative" ("{impl_path}") does not exist'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="str">f" in the package. ({error_context} in {provided_alternatives_fs_path})"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="key">for</span> <span class="nam">key</span> <span class="key">in</span> <span class="op">[</span><span class="str">"Slave"</span><span class="op">,</span> <span class="str">"Slaves"</span><span class="op">,</span> <span class="str">"Slave-Links"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="key">if</span> <span class="nam">key</span> <span class="key">in</span> <span class="nam">alternative_deb822</span><span class="op">:</span> </span><span class="r"><span class="annotate short">96 ↛ 97</span><span class="annotate long">line 96 didn't jump to line 97, because the condition on line 96 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="str">f'Please use "Dependents" instead of "{key}".'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="str">f" ({error_context} in {provided_alternatives_fs_path})"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="nam">dependents</span> <span class="op">=</span> <span class="nam">alternative_deb822</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"Dependents"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="nam">install_command</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="nam">escape_shell</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="str">"update-alternatives"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="str">"--install"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="nam">link_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="nam">name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="nam">impl_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="nam">priority</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="nam">remove_command</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="nam">escape_shell</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="str">"update-alternatives"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="str">"--remove"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="nam">name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="nam">impl_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="key">if</span> <span class="nam">dependents</span><span class="op">:</span> </span><span class="r"><span class="annotate short">120 ↛ 153</span><span class="annotate long">line 120 didn't jump to line 153, because the condition on line 120 was never false</span></span></p> - <p class="run"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="nam">seen_link_path</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="key">for</span> <span class="nam">line</span> <span class="key">in</span> <span class="nam">dependents</span><span class="op">.</span><span class="nam">splitlines</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="nam">line</span> <span class="op">=</span> <span class="nam">line</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">line</span><span class="op">:</span> <span class="com"># First line is usually empty</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="nam">dlink_path</span><span class="op">,</span> <span class="nam">dlink_name</span><span class="op">,</span> <span class="nam">dimpl_path</span> <span class="op">=</span> <span class="nam">parse_dependent_link</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="nam">line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="nam">error_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="nam">provided_alternatives_fs_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="key">if</span> <span class="nam">dlink_path</span> <span class="key">in</span> <span class="nam">seen_link_path</span><span class="op">:</span> </span><span class="r"><span class="annotate short">131 ↛ 132</span><span class="annotate long">line 131 didn't jump to line 132, because the condition on line 131 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="str">f'The Dependent link path "{dlink_path}" was used twice.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="str">f" ({error_context} in {provided_alternatives_fs_path})"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="nam">dimpl</span> <span class="op">=</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="nam">dimpl_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="key">if</span> <span class="nam">dimpl</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">dimpl</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"><span class="annotate short">137 ↛ 138</span><span class="annotate long">line 137 didn't jump to line 138, because the condition on line 137 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="str">f'The path listed in "Dependents" ("{dimpl_path}") does not exist'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="str">f" in the package. ({error_context} in {provided_alternatives_fs_path})"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="nam">seen_link_path</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">dlink_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="nam">install_command</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">LINE_PREFIX</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="nam">install_command</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="nam">escape_shell</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="com"># update-alternatives still uses this old option name :-/</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="str">"--slave"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="nam">dlink_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="nam">dlink_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="nam">dimpl_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="nam">postinst</span> <span class="op">=</span> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"><span class="str"> if {CONDITION}; then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"><span class="str"> {COMMAND}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"><span class="str"> fi</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="op">)</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="nam">CONDITION</span><span class="op">=</span><span class="nam">POSTINST_DEFAULT_CONDITION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="nam">COMMAND</span><span class="op">=</span><span class="str">" "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">install_command</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="nam">prerm</span> <span class="op">=</span> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"><span class="str"> if [ "$1" = "remove" ]; then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"><span class="str"> {COMMAND}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"><span class="str"> fi</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="op">)</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span><span class="nam">COMMAND</span><span class="op">=</span><span class="str">" "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">remove_command</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="nam">maintscript_snippets</span><span class="op">[</span><span class="str">"postinst"</span><span class="op">]</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="nam">MaintscriptSnippet</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="str">f"debputy (via {provided_alternatives_fs_path})"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="nam">snippet</span><span class="op">=</span><span class="nam">postinst</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="nam">maintscript_snippets</span><span class="op">[</span><span class="str">"prerm"</span><span class="op">]</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="nam">MaintscriptSnippet</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="str">f"debputy (via {provided_alternatives_fs_path})"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="nam">snippet</span><span class="op">=</span><span class="nam">prerm</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"><span class="key">def</span> <span class="nam">parse_dependent_link</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="nam">line</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="nam">error_context</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="nam">provided_alternatives_file</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="nam">parts</span> <span class="op">=</span> <span class="nam">line</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">parts</span><span class="op">)</span> <span class="op">!=</span> <span class="num">3</span><span class="op">:</span> </span><span class="r"><span class="annotate short">191 ↛ 192</span><span class="annotate long">line 191 didn't jump to line 192, because the condition on line 191 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">parts</span><span class="op">)</span> <span class="op">></span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="str">f"The each line in Dependents links must have exactly 3 space separated parts."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="str">f' The "{line}" split into {len(parts)} part(s).'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="str">f" ({error_context} in {provided_alternatives_file})"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="nam">dlink_path</span><span class="op">,</span> <span class="nam">dlink_name</span><span class="op">,</span> <span class="nam">dimpl_path</span> <span class="op">=</span> <span class="nam">parts</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="key">if</span> <span class="str">"/"</span> <span class="key">in</span> <span class="nam">dlink_name</span><span class="op">:</span> </span><span class="r"><span class="annotate short">201 ↛ 202</span><span class="annotate long">line 201 didn't jump to line 202, because the condition on line 201 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="str">f'The Dependent link name "{dlink_path}" must be a basename and cannot contain slashes'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="str">f" ({error_context} in {provided_alternatives_file})"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="key">if</span> <span class="nam">dlink_path</span> <span class="op">==</span> <span class="nam">dimpl_path</span><span class="op">:</span> </span><span class="r"><span class="annotate short">206 ↛ 207</span><span class="annotate long">line 206 didn't jump to line 207, because the condition on line 206 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="str">f'The Dependent Link path and Alternative must not have the same value ["{dlink_path}"]'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="str">f" ({error_context} in {provided_alternatives_file})"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="key">return</span> <span class="nam">dlink_path</span><span class="op">,</span> <span class="nam">dlink_name</span><span class="op">,</span> <span class="nam">dimpl_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"><span class="key">def</span> <span class="nam">_mandatory_key</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="nam">key</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="nam">alternative_deb822</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="nam">provided_alternatives_file</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="nam">error_context</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="key">return</span> <span class="nam">alternative_deb822</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="key">except</span> <span class="nam">KeyError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="str">f'Missing mandatory key "{key}" in {provided_alternatives_file} ({error_context})'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_36a196ce5f578895___init___py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_36a196ce5f578895_debconf_templates_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_36a196ce5f578895_debconf_templates_py.html b/coverage-report/d_36a196ce5f578895_debconf_templates_py.html deleted file mode 100644 index 9f17baa..0000000 --- a/coverage-report/d_36a196ce5f578895_debconf_templates_py.html +++ /dev/null @@ -1,176 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/packaging/debconf_templates.py: 32%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/packaging/debconf_templates.py</b>: - <span class="pc_cov">32%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">32 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">13<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">19<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_36a196ce5f578895_alternatives_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_36a196ce5f578895_makeshlibs_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">shutil</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">subprocess</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">import</span> <span class="nam">textwrap</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">List</span><span class="op">,</span> <span class="nam">Dict</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">maintscript_snippet</span> <span class="key">import</span> <span class="nam">MaintscriptSnippetContainer</span><span class="op">,</span> <span class="nam">MaintscriptSnippet</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">packager_provided_files</span> <span class="key">import</span> <span class="nam">PackagerProvidedFile</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">packages</span> <span class="key">import</span> <span class="nam">BinaryPackage</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">packaging</span><span class="op">.</span><span class="nam">makeshlibs</span> <span class="key">import</span> <span class="nam">resolve_reserved_provided_file</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">spec</span> <span class="key">import</span> <span class="nam">FlushableSubstvars</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">_error</span><span class="op">,</span> <span class="nam">escape_shell</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"><span class="com"># Match debhelper (minus one space in each end, which comes</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"><span class="com"># via join).</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"><span class="nam">LINE_PREFIX</span> <span class="op">=</span> <span class="str">"\\\n "</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"><span class="key">def</span> <span class="nam">process_debconf_templates</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">reserved_packager_provided_files</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">PackagerProvidedFile</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">maintscript_snippets</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">MaintscriptSnippetContainer</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="nam">substvars</span><span class="op">:</span> <span class="nam">FlushableSubstvars</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">control_output_dir</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="nam">provided_templates_file</span> <span class="op">=</span> <span class="nam">resolve_reserved_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="str">"templates"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="nam">reserved_packager_provided_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="key">if</span> <span class="nam">provided_templates_file</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="nam">templates_file</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">control_output_dir</span><span class="op">,</span> <span class="str">"templates"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="nam">debian_dir</span> <span class="op">=</span> <span class="nam">provided_templates_file</span><span class="op">.</span><span class="nam">parent_dir</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="nam">po_template_dir</span> <span class="op">=</span> <span class="nam">debian_dir</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"po"</span><span class="op">)</span> <span class="key">if</span> <span class="nam">debian_dir</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">else</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="key">if</span> <span class="nam">po_template_dir</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">po_template_dir</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="key">with</span> <span class="nam">open</span><span class="op">(</span><span class="nam">templates_file</span><span class="op">,</span> <span class="str">"wb"</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="nam">cmd</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="str">"po2debconf"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="nam">provided_templates_file</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">f" {escape_shell(*cmd)} > {templates_file}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_call</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="nam">cmd</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="nam">stdout</span><span class="op">=</span><span class="nam">fd</span><span class="op">.</span><span class="nam">fileno</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="key">except</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">CalledProcessError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="str">f"Failed to generate the templates files for {binary_package.name}. Please review "</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="str">f" the output of {escape_shell('po-debconf', provided_templates_file.fs_path)}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="str">" to understand the issue."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="nam">shutil</span><span class="op">.</span><span class="nam">copyfile</span><span class="op">(</span><span class="nam">provided_templates_file</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">,</span> <span class="nam">templates_file</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="nam">dependency</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="str">"cdebconf-udeb"</span> <span class="key">if</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">is_udeb</span> <span class="key">else</span> <span class="str">"debconf (>= 0.5) | debconf-2.0"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="nam">substvars</span><span class="op">.</span><span class="nam">add_dependency</span><span class="op">(</span><span class="str">"misc:Depends"</span><span class="op">,</span> <span class="nam">dependency</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">is_udeb</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="com"># udebs do not have `postrm` scripts</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="nam">maintscript_snippets</span><span class="op">[</span><span class="str">"postrm"</span><span class="op">]</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="nam">MaintscriptSnippet</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="str">f"debputy (due to {provided_templates_file.fs_path})"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="com"># FIXME: `debconf` sourcing should be an overarching feature</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="nam">snippet</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"><span class="str"> if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"><span class="str"> . /usr/share/debconf/confmodule</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"><span class="str"> db_purge</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"><span class="str"> db_stop</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"><span class="str"> fi</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_36a196ce5f578895_alternatives_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_36a196ce5f578895_makeshlibs_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_36a196ce5f578895_makeshlibs_py.html b/coverage-report/d_36a196ce5f578895_makeshlibs_py.html deleted file mode 100644 index 1411d28..0000000 --- a/coverage-report/d_36a196ce5f578895_makeshlibs_py.html +++ /dev/null @@ -1,413 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/packaging/makeshlibs.py: 18%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/packaging/makeshlibs.py</b>: - <span class="pc_cov">18%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">182 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">43<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">139<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">2<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">2<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_36a196ce5f578895_debconf_templates_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_path_matcher_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">collections</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">dataclasses</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">import</span> <span class="nam">re</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">import</span> <span class="nam">shutil</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">import</span> <span class="nam">stat</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">import</span> <span class="nam">subprocess</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="key">import</span> <span class="nam">tempfile</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="key">from</span> <span class="nam">contextlib</span> <span class="key">import</span> <span class="nam">suppress</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Optional</span><span class="op">,</span> <span class="nam">Set</span><span class="op">,</span> <span class="nam">List</span><span class="op">,</span> <span class="nam">Tuple</span><span class="op">,</span> <span class="nam">TYPE_CHECKING</span><span class="op">,</span> <span class="nam">Dict</span><span class="op">,</span> <span class="nam">IO</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span> <span class="key">import</span> <span class="nam">elf_util</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">elf_util</span> <span class="key">import</span> <span class="nam">ELF_LINKING_TYPE_DYNAMIC</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">exceptions</span> <span class="key">import</span> <span class="nam">DebputyDpkgGensymbolsError</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">packager_provided_files</span> <span class="key">import</span> <span class="nam">PackagerProvidedFile</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">packages</span> <span class="key">import</span> <span class="nam">BinaryPackage</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="nam">VirtualPath</span><span class="op">,</span> <span class="nam">PackageProcessingContext</span><span class="op">,</span> <span class="nam">BinaryCtrlAccessor</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">print_command</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">escape_shell</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">assume_not_none</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">_normalize_link_target</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="nam">_warn</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">_error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"><span class="key">if</span> <span class="nam">TYPE_CHECKING</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">highlevel_manifest</span> <span class="key">import</span> <span class="nam">HighLevelManifest</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"><span class="nam">HAS_SONAME</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r"\s+SONAME\s+(\S+)"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"><span class="nam">SHLIBS_LINE_READER</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r"^(?:(\S*):)?\s*(\S+)\s*(\S+)\s*(\S.+)$"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"><span class="nam">SONAME_FORMATS</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r"\s+SONAME\s+((.*)[.]so[.](.*))"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r"\s+SONAME\s+((.*)-(\d.*)[.]so)"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"><span class="key">class</span> <span class="nam">SONAMEInfo</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">full_soname</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">library</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="nam">major_version</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"><span class="key">class</span> <span class="nam">ShlibsContent</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_deb_lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_udeb_lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_seen</span><span class="op">:</span> <span class="nam">Set</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="key">def</span> <span class="nam">add_library</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="nam">library</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">major_version</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="nam">dependency</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="nam">udeb_dependency</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="nam">line</span> <span class="op">=</span> <span class="str">f"{library} {major_version} {dependency}\n"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="nam">seen_key</span> <span class="op">=</span> <span class="op">(</span><span class="str">"deb"</span><span class="op">,</span> <span class="nam">library</span><span class="op">,</span> <span class="nam">major_version</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="key">if</span> <span class="nam">seen_key</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_seen</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_deb_lines</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">line</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_seen</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">seen_key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="key">if</span> <span class="nam">udeb_dependency</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="nam">seen_key</span> <span class="op">=</span> <span class="op">(</span><span class="str">"udeb"</span><span class="op">,</span> <span class="nam">library</span><span class="op">,</span> <span class="nam">major_version</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="nam">udeb_line</span> <span class="op">=</span> <span class="str">f"udeb: {library} {major_version} {udeb_dependency}\n"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="key">if</span> <span class="nam">seen_key</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_seen</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_udeb_lines</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">udeb_line</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_seen</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">seen_key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="key">def</span> <span class="nam">__bool__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="key">return</span> <span class="nam">bool</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_deb_lines</span><span class="op">)</span> <span class="key">or</span> <span class="nam">bool</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_udeb_lines</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="key">def</span> <span class="nam">add_entries_from_shlibs_file</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">fd</span><span class="op">:</span> <span class="nam">IO</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="key">for</span> <span class="nam">line</span> <span class="key">in</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="key">if</span> <span class="nam">line</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"#"</span><span class="op">)</span> <span class="key">or</span> <span class="nam">line</span><span class="op">.</span><span class="nam">isspace</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="nam">SHLIBS_LINE_READER</span><span class="op">.</span><span class="nam">match</span><span class="op">(</span><span class="nam">line</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">m</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="nam">shtype</span><span class="op">,</span> <span class="nam">library</span><span class="op">,</span> <span class="nam">major_version</span><span class="op">,</span> <span class="nam">dependency</span> <span class="op">=</span> <span class="nam">m</span><span class="op">.</span><span class="nam">groups</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="key">if</span> <span class="nam">shtype</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">shtype</span> <span class="op">==</span> <span class="str">""</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="nam">shtype</span> <span class="op">=</span> <span class="str">"deb"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="nam">seen_key</span> <span class="op">=</span> <span class="op">(</span><span class="nam">shtype</span><span class="op">,</span> <span class="nam">library</span><span class="op">,</span> <span class="nam">major_version</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="key">if</span> <span class="nam">seen_key</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_seen</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_seen</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">seen_key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="key">if</span> <span class="nam">shtype</span> <span class="op">==</span> <span class="str">"udeb"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_udeb_lines</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">line</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_deb_lines</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">line</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="key">def</span> <span class="nam">write_to</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">fd</span><span class="op">:</span> <span class="nam">IO</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="nam">fd</span><span class="op">.</span><span class="nam">writelines</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_deb_lines</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="nam">fd</span><span class="op">.</span><span class="nam">writelines</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_udeb_lines</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"><span class="key">def</span> <span class="nam">extract_so_name</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">SONAMEInfo</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="nam">objdump</span> <span class="op">=</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">cross_command</span><span class="op">(</span><span class="str">"objdump"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="nam">output</span> <span class="op">=</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_output</span><span class="op">(</span><span class="op">[</span><span class="nam">objdump</span><span class="op">,</span> <span class="str">"-p"</span><span class="op">,</span> <span class="nam">path</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">]</span><span class="op">,</span> <span class="nam">encoding</span><span class="op">=</span><span class="str">"utf-8"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="key">for</span> <span class="nam">r</span> <span class="key">in</span> <span class="nam">SONAME_FORMATS</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="nam">r</span><span class="op">.</span><span class="nam">search</span><span class="op">(</span><span class="nam">output</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="key">if</span> <span class="nam">m</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="nam">full_soname</span><span class="op">,</span> <span class="nam">library</span><span class="op">,</span> <span class="nam">major_version</span> <span class="op">=</span> <span class="nam">m</span><span class="op">.</span><span class="nam">groups</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="key">return</span> <span class="nam">SONAMEInfo</span><span class="op">(</span><span class="nam">path</span><span class="op">,</span> <span class="nam">full_soname</span><span class="op">,</span> <span class="nam">library</span><span class="op">,</span> <span class="nam">major_version</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="nam">HAS_SONAME</span><span class="op">.</span><span class="nam">search</span><span class="op">(</span><span class="nam">output</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">m</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="nam">full_soname</span> <span class="op">=</span> <span class="nam">m</span><span class="op">.</span><span class="nam">group</span><span class="op">(</span><span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="key">return</span> <span class="nam">SONAMEInfo</span><span class="op">(</span><span class="nam">path</span><span class="op">,</span> <span class="nam">full_soname</span><span class="op">,</span> <span class="nam">full_soname</span><span class="op">,</span> <span class="key">None</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"><span class="key">def</span> <span class="nam">extract_soname_info</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">List</span><span class="op">[</span><span class="nam">SONAMEInfo</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="nam">so_files</span> <span class="op">=</span> <span class="nam">elf_util</span><span class="op">.</span><span class="nam">find_all_elf_files</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="nam">with_linking_type</span><span class="op">=</span><span class="nam">ELF_LINKING_TYPE_DYNAMIC</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="nam">result</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="key">for</span> <span class="nam">so_file</span> <span class="key">in</span> <span class="nam">so_files</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="nam">soname_info</span> <span class="op">=</span> <span class="nam">extract_so_name</span><span class="op">(</span><span class="nam">binary_package</span><span class="op">,</span> <span class="nam">so_file</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">soname_info</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="nam">result</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">soname_info</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="key">return</span> <span class="nam">result</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"><span class="key">def</span> <span class="nam">_compute_shlibs_content</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="nam">manifest</span><span class="op">:</span> <span class="str">"HighLevelManifest"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="nam">soname_info_list</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">SONAMEInfo</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="nam">udeb_package_name</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="nam">combined_shlibs</span><span class="op">:</span> <span class="nam">ShlibsContent</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">ShlibsContent</span><span class="op">,</span> <span class="nam">bool</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="nam">shlibs_file_contents</span> <span class="op">=</span> <span class="nam">ShlibsContent</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="nam">unversioned_so_seen</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="nam">strict_version</span> <span class="op">=</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">package_state_for</span><span class="op">(</span><span class="nam">binary_package</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span><span class="op">.</span><span class="nam">binary_version</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="key">if</span> <span class="nam">strict_version</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="nam">upstream_version</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">sub</span><span class="op">(</span><span class="str">r"-[^-]+$"</span><span class="op">,</span> <span class="str">""</span><span class="op">,</span> <span class="nam">strict_version</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="nam">strict_version</span> <span class="op">=</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">substitution</span><span class="op">.</span><span class="nam">substitute</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="str">"{{DEB_VERSION}}"</span><span class="op">,</span> <span class="str">"<internal-usage>"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="nam">upstream_version</span> <span class="op">=</span> <span class="nam">manifest</span><span class="op">.</span><span class="nam">substitution</span><span class="op">.</span><span class="nam">substitute</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="str">"{{DEB_VERSION_EPOCH_UPSTREAM}}"</span><span class="op">,</span> <span class="str">"<internal-usage>"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="nam">dependency</span> <span class="op">=</span> <span class="str">f"{binary_package.name} (>= {upstream_version})"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="nam">strict_dependency</span> <span class="op">=</span> <span class="str">f"{binary_package.name} (= {strict_version})"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="nam">udeb_dependency</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="key">if</span> <span class="nam">udeb_package_name</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="nam">udeb_dependency</span> <span class="op">=</span> <span class="str">f"{udeb_package_name} (>= {upstream_version})"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="key">for</span> <span class="nam">soname_info</span> <span class="key">in</span> <span class="nam">soname_info_list</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="key">if</span> <span class="nam">soname_info</span><span class="op">.</span><span class="nam">major_version</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="nam">unversioned_so_seen</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="nam">shlibs_file_contents</span><span class="op">.</span><span class="nam">add_library</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="nam">soname_info</span><span class="op">.</span><span class="nam">library</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="nam">soname_info</span><span class="op">.</span><span class="nam">major_version</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="nam">dependency</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="nam">udeb_dependency</span><span class="op">=</span><span class="nam">udeb_dependency</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="nam">combined_shlibs</span><span class="op">.</span><span class="nam">add_library</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">soname_info</span><span class="op">.</span><span class="nam">library</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="nam">soname_info</span><span class="op">.</span><span class="nam">major_version</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="nam">strict_dependency</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="nam">udeb_dependency</span><span class="op">=</span><span class="nam">udeb_dependency</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="key">return</span> <span class="nam">shlibs_file_contents</span><span class="op">,</span> <span class="nam">unversioned_so_seen</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"><span class="key">def</span> <span class="nam">resolve_reserved_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="nam">basename</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="nam">reserved_packager_provided_files</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">PackagerProvidedFile</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="nam">matches</span> <span class="op">=</span> <span class="nam">reserved_packager_provided_files</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">basename</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="key">if</span> <span class="nam">matches</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">187 ↛ 188</span><span class="annotate long">line 187 didn't jump to line 188, because the condition on line 187 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="key">assert</span> <span class="nam">len</span><span class="op">(</span><span class="nam">matches</span><span class="op">)</span> <span class="op"><</span> <span class="num">2</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="key">if</span> <span class="nam">matches</span><span class="op">:</span> </span><span class="r"><span class="annotate short">190 ↛ 192</span><span class="annotate long">line 190 didn't jump to line 192, because the condition on line 190 was never false</span></span></p> - <p class="run"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="key">return</span> <span class="nam">matches</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"><span class="key">def</span> <span class="nam">generate_shlib_dirs</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="nam">pkg</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="nam">root_dir</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="nam">soname_info_list</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">SONAMEInfo</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="nam">materialized_dirs</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="nam">dir_scanned</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="nam">dirs</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="key">for</span> <span class="nam">soname_info</span> <span class="key">in</span> <span class="nam">soname_info_list</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="nam">elf_binary</span> <span class="op">=</span> <span class="nam">soname_info</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="nam">p</span> <span class="op">=</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">elf_binary</span><span class="op">.</span><span class="nam">parent_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="nam">matches</span> <span class="op">=</span> <span class="nam">dir_scanned</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">p</span><span class="op">.</span><span class="nam">absolute</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="nam">materialized_dir</span> <span class="op">=</span> <span class="nam">dirs</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">p</span><span class="op">.</span><span class="nam">absolute</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="key">if</span> <span class="nam">matches</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="nam">matches</span> <span class="op">=</span> <span class="nam">collections</span><span class="op">.</span><span class="nam">defaultdict</span><span class="op">(</span><span class="nam">set</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="key">for</span> <span class="nam">child</span> <span class="key">in</span> <span class="nam">p</span><span class="op">.</span><span class="nam">iterdir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">child</span><span class="op">.</span><span class="nam">is_symlink</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="nam">target</span> <span class="op">=</span> <span class="nam">_normalize_link_target</span><span class="op">(</span><span class="nam">child</span><span class="op">.</span><span class="nam">readlink</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="key">if</span> <span class="str">"/"</span> <span class="key">in</span> <span class="nam">target</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="com"># The shlib symlinks (we are interested in) are relative to the same folder</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="nam">matches</span><span class="op">[</span><span class="nam">target</span><span class="op">]</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">child</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="nam">dir_scanned</span><span class="op">[</span><span class="nam">p</span><span class="op">.</span><span class="nam">absolute</span><span class="op">]</span> <span class="op">=</span> <span class="nam">matches</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="nam">symlinks</span> <span class="op">=</span> <span class="nam">matches</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">elf_binary</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">symlinks</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="str">f"Could not find any SO symlinks pointing to {elf_binary.absolute} in {pkg.name} !?"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="key">if</span> <span class="nam">materialized_dir</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="nam">materialized_dir</span> <span class="op">=</span> <span class="nam">tempfile</span><span class="op">.</span><span class="nam">mkdtemp</span><span class="op">(</span><span class="nam">prefix</span><span class="op">=</span><span class="str">f"{pkg.name}_"</span><span class="op">,</span> <span class="nam">dir</span><span class="op">=</span><span class="nam">root_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="nam">materialized_dirs</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">materialized_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="nam">dirs</span><span class="op">[</span><span class="nam">p</span><span class="op">.</span><span class="nam">absolute</span><span class="op">]</span> <span class="op">=</span> <span class="nam">materialized_dir</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">symlink</span><span class="op">(</span><span class="nam">elf_binary</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">,</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">materialized_dir</span><span class="op">,</span> <span class="nam">elf_binary</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="key">for</span> <span class="nam">link</span> <span class="key">in</span> <span class="nam">symlinks</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">symlink</span><span class="op">(</span><span class="nam">elf_binary</span><span class="op">.</span><span class="nam">name</span><span class="op">,</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">materialized_dir</span><span class="op">,</span> <span class="nam">link</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"><span class="key">def</span> <span class="nam">compute_shlibs</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="nam">control_output_dir</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="nam">manifest</span><span class="op">:</span> <span class="str">"HighLevelManifest"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="nam">udeb_package_name</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">:</span> <span class="nam">BinaryCtrlAccessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="nam">reserved_packager_provided_files</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">PackagerProvidedFile</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="nam">combined_shlibs</span><span class="op">:</span> <span class="nam">ShlibsContent</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">List</span><span class="op">[</span><span class="nam">SONAMEInfo</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="key">assert</span> <span class="key">not</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">is_udeb</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="nam">shlibs_file</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">control_output_dir</span><span class="op">,</span> <span class="str">"shlibs"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="nam">need_ldconfig</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="nam">so_files</span> <span class="op">=</span> <span class="nam">elf_util</span><span class="op">.</span><span class="nam">find_all_elf_files</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="nam">with_linking_type</span><span class="op">=</span><span class="nam">ELF_LINKING_TYPE_DYNAMIC</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="nam">sonames</span> <span class="op">=</span> <span class="nam">extract_soname_info</span><span class="op">(</span><span class="nam">binary_package</span><span class="op">,</span> <span class="nam">fs_root</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="nam">provided_shlibs_file</span> <span class="op">=</span> <span class="nam">resolve_reserved_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="str">"shlibs"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="nam">reserved_packager_provided_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="nam">symbols_template_file</span> <span class="op">=</span> <span class="nam">resolve_reserved_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="str">"symbols"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="nam">reserved_packager_provided_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="key">if</span> <span class="nam">provided_shlibs_file</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="nam">need_ldconfig</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="nam">unversioned_so_seen</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="nam">shutil</span><span class="op">.</span><span class="nam">copyfile</span><span class="op">(</span><span class="nam">provided_shlibs_file</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">,</span> <span class="nam">shlibs_file</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="key">with</span> <span class="nam">open</span><span class="op">(</span><span class="nam">shlibs_file</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="nam">combined_shlibs</span><span class="op">.</span><span class="nam">add_entries_from_shlibs_file</span><span class="op">(</span><span class="nam">fd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="nam">shlibs_file_contents</span><span class="op">,</span> <span class="nam">unversioned_so_seen</span> <span class="op">=</span> <span class="nam">_compute_shlibs_content</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="nam">manifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="nam">sonames</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="nam">udeb_package_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="nam">combined_shlibs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="key">if</span> <span class="nam">shlibs_file_contents</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="nam">need_ldconfig</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="key">with</span> <span class="nam">open</span><span class="op">(</span><span class="nam">shlibs_file</span><span class="op">,</span> <span class="str">"wt"</span><span class="op">,</span> <span class="nam">encoding</span><span class="op">=</span><span class="str">"utf-8"</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="nam">shlibs_file_contents</span><span class="op">.</span><span class="nam">write_to</span><span class="op">(</span><span class="nam">fd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="key">if</span> <span class="nam">symbols_template_file</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="nam">symbols_file</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">control_output_dir</span><span class="op">,</span> <span class="str">"symbols"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="nam">symbols_cmd</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="str">"dpkg-gensymbols"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="str">f"-p{binary_package.name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="str">f"-I{symbols_template_file.fs_path}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="str">f"-P{control_output_dir}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="str">f"-O{symbols_file}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="key">if</span> <span class="nam">so_files</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> <span class="nam">symbols_cmd</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="str">f"-e{x.fs_path}"</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">so_files</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="nam">print_command</span><span class="op">(</span><span class="op">*</span><span class="nam">symbols_cmd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_call</span><span class="op">(</span><span class="nam">symbols_cmd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="key">except</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">CalledProcessError</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="com"># Wrap in a special error, so debputy can run the other packages.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="com"># The kde symbols helper relies on this behaviour</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="key">raise</span> <span class="nam">DebputyDpkgGensymbolsError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="str">f"Error while running command for {binary_package.name}: {escape_shell(*symbols_cmd)}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="op">)</span> <span class="key">from</span> <span class="nam">e</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="key">with</span> <span class="nam">suppress</span><span class="op">(</span><span class="nam">FileNotFoundError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> <span class="nam">st</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">stat</span><span class="op">(</span><span class="nam">symbols_file</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="key">if</span> <span class="nam">stat</span><span class="op">.</span><span class="nam">S_ISREG</span><span class="op">(</span><span class="nam">st</span><span class="op">.</span><span class="nam">st_mode</span><span class="op">)</span> <span class="key">and</span> <span class="nam">st</span><span class="op">.</span><span class="nam">st_size</span> <span class="op">==</span> <span class="num">0</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">unlink</span><span class="op">(</span><span class="nam">symbols_file</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="key">elif</span> <span class="nam">unversioned_so_seen</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="nam">need_ldconfig</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="key">if</span> <span class="nam">need_ldconfig</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">dpkg_trigger</span><span class="op">(</span><span class="str">"activate-noawait"</span><span class="op">,</span> <span class="str">"ldconfig"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="key">return</span> <span class="nam">sonames</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_36a196ce5f578895_debconf_templates_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_path_matcher_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_4b9be07fb6071cd2___init___py.html b/coverage-report/d_4b9be07fb6071cd2___init___py.html deleted file mode 100644 index e69e477..0000000 --- a/coverage-report/d_4b9be07fb6071cd2___init___py.html +++ /dev/null @@ -1,120 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/plugin/api/test_api/__init__.py: 100%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/plugin/api/test_api/__init__.py</b>: - <span class="pc_cov">100%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">3 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">3<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">0<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_64287305fe0c6642_spec_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_4b9be07fb6071cd2_test_impl_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">test_api</span><span class="op">.</span><span class="nam">test_impl</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"> <span class="nam">package_metadata_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"> <span class="nam">initialize_plugin_under_test</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> <span class="nam">manifest_variable_resolution_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">test_api</span><span class="op">.</span><span class="nam">test_spec</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">RegisteredPackagerProvidedFile</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">build_virtual_file_system</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">InitializedPluginUnderTest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">DEBPUTY_TEST_AGAINST_INSTALLED_PLUGINS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"><span class="nam">__all__</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="str">"initialize_plugin_under_test"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="str">"RegisteredPackagerProvidedFile"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="str">"build_virtual_file_system"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="str">"InitializedPluginUnderTest"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="str">"package_metadata_context"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="str">"manifest_variable_resolution_context"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="str">"DEBPUTY_TEST_AGAINST_INSTALLED_PLUGINS"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_64287305fe0c6642_spec_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_4b9be07fb6071cd2_test_impl_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_4b9be07fb6071cd2_test_impl_py.html b/coverage-report/d_4b9be07fb6071cd2_test_impl_py.html deleted file mode 100644 index 3e1b2fc..0000000 --- a/coverage-report/d_4b9be07fb6071cd2_test_impl_py.html +++ /dev/null @@ -1,902 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/plugin/api/test_api/test_impl.py: 82%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/plugin/api/test_api/test_impl.py</b>: - <span class="pc_cov">82%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">296 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">253<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">43<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">25<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_4b9be07fb6071cd2___init___py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_4b9be07fb6071cd2_test_spec_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">contextlib</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">dataclasses</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">inspect</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">from</span> <span class="nam">io</span> <span class="key">import</span> <span class="nam">BytesIO</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">Mapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">Dict</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">List</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">cast</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">FrozenSet</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">Sequence</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">Type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">Iterator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">Set</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">KeysView</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">Callable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"><span class="key">from</span> <span class="nam">debian</span><span class="op">.</span><span class="nam">deb822</span> <span class="key">import</span> <span class="nam">Deb822</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"><span class="key">from</span> <span class="nam">debian</span><span class="op">.</span><span class="nam">substvars</span> <span class="key">import</span> <span class="nam">Substvars</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span> <span class="key">import</span> <span class="nam">DEBPUTY_PLUGIN_ROOT_DIR</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">architecture_support</span> <span class="key">import</span> <span class="nam">faked_arch_table</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">filesystem_scan</span> <span class="key">import</span> <span class="nam">FSROOverlay</span><span class="op">,</span> <span class="nam">FSRootDir</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">packages</span> <span class="key">import</span> <span class="nam">BinaryPackage</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="nam">PluginInitializationEntryPoint</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="nam">DpkgTriggerType</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="nam">Maintscript</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">example_processing</span> <span class="key">import</span> <span class="nam">process_discard_rule_example</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">impl</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">plugin_metadata_for_debputys_own_plugin</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="nam">DebputyPluginInitializerProvider</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="nam">parse_json_plugin_desc</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">MaintscriptAccessorProviderBase</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">BinaryCtrlAccessorProviderBase</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="nam">PLUGIN_TEST_SUFFIX</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="nam">find_json_plugin</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="nam">ServiceDefinitionImpl</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">impl_types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="nam">PackagerProvidedFileClassSpec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="nam">DebputyPluginMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="nam">PluginProvidedTrigger</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="nam">ServiceManagerDetails</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">feature_set</span> <span class="key">import</span> <span class="nam">PluginProvidedFeatureSet</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">spec</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">MaintscriptAccessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="nam">FlushableSubstvars</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="nam">ServiceRegistry</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="nam">DSD</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="nam">ServiceUpgradeRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">test_api</span><span class="op">.</span><span class="nam">test_spec</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="nam">InitializedPluginUnderTest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="nam">RegisteredPackagerProvidedFile</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="nam">RegisteredTrigger</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="nam">RegisteredMaintscript</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="nam">DEBPUTY_TEST_AGAINST_INSTALLED_PLUGINS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="nam">ADRExampleIssue</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="nam">DetectedService</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="nam">RegisteredMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">debputy</span><span class="op">.</span><span class="nam">debputy_plugin</span> <span class="key">import</span> <span class="nam">initialize_debputy_features</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">substitution</span> <span class="key">import</span> <span class="nam">SubstitutionImpl</span><span class="op">,</span> <span class="nam">VariableContext</span><span class="op">,</span> <span class="nam">Substitution</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">package_cross_check_precheck</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"><span class="nam">RegisteredPackagerProvidedFile</span><span class="op">.</span><span class="nam">register</span><span class="op">(</span><span class="nam">PackagerProvidedFileClassSpec</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"><span class="key">class</span> <span class="nam">PackageProcessingContextTestProvider</span><span class="op">(</span><span class="nam">PackageProcessingContext</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">:</span> <span class="nam">BinaryPackage</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="nam">binary_package_version</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="nam">related_udeb_package</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="nam">related_udeb_package_version</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="nam">accessible_package_roots</span><span class="op">:</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="op">]</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">,</span> <span class="nam">VirtualPath</span><span class="op">]</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"><span class="key">def</span> <span class="nam">_initialize_plugin_under_test</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">:</span> <span class="nam">DebputyPluginMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="nam">load_debputy_plugin</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="str">"InitializedPluginUnderTest"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="nam">feature_set</span> <span class="op">=</span> <span class="nam">PluginProvidedFeatureSet</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="nam">substitution</span> <span class="op">=</span> <span class="nam">SubstitutionImpl</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="nam">unresolvable_substitutions</span><span class="op">=</span><span class="nam">frozenset</span><span class="op">(</span><span class="op">[</span><span class="str">"SOURCE_DATE_EPOCH"</span><span class="op">,</span> <span class="str">"PACKAGE"</span><span class="op">]</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="nam">variable_context</span><span class="op">=</span><span class="nam">VariableContext</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="nam">FSROOverlay</span><span class="op">.</span><span class="nam">create_root_dir</span><span class="op">(</span><span class="str">"debian"</span><span class="op">,</span> <span class="str">"debian"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="nam">plugin_feature_set</span><span class="op">=</span><span class="nam">feature_set</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="key">if</span> <span class="nam">load_debputy_plugin</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="nam">debputy_plugin_metadata</span> <span class="op">=</span> <span class="nam">plugin_metadata_for_debputys_own_plugin</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="nam">initialize_debputy_features</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="com"># Load debputy's own plugin first, so conflicts with debputy's plugin are detected early</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="nam">debputy_provider</span> <span class="op">=</span> <span class="nam">DebputyPluginInitializerProvider</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="nam">debputy_plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="nam">feature_set</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="nam">substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="nam">debputy_provider</span><span class="op">.</span><span class="nam">load_plugin</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="nam">plugin_under_test_provider</span> <span class="op">=</span> <span class="nam">DebputyPluginInitializerProvider</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="nam">feature_set</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="nam">substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="nam">plugin_under_test_provider</span><span class="op">.</span><span class="nam">load_plugin</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="key">return</span> <span class="nam">InitializedPluginUnderTestImpl</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">.</span><span class="nam">plugin_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="nam">feature_set</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="nam">substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"><span class="key">def</span> <span class="nam">_auto_load_plugin_from_filename</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="nam">py_test_filename</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="str">"InitializedPluginUnderTest"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="nam">dirname</span><span class="op">,</span> <span class="nam">basename</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="nam">py_test_filename</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="nam">plugin_name</span> <span class="op">=</span> <span class="nam">PLUGIN_TEST_SUFFIX</span><span class="op">.</span><span class="nam">sub</span><span class="op">(</span><span class="str">""</span><span class="op">,</span> <span class="nam">basename</span><span class="op">)</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">"_"</span><span class="op">,</span> <span class="str">"-"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="nam">test_location</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">environ</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"DEBPUTY_TEST_PLUGIN_LOCATION"</span><span class="op">,</span> <span class="str">"uninstalled"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="key">if</span> <span class="nam">test_location</span> <span class="op">==</span> <span class="str">"uninstalled"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="nam">json_basename</span> <span class="op">=</span> <span class="str">f"{plugin_name}.json"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="nam">json_desc_file</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">dirname</span><span class="op">,</span> <span class="nam">json_basename</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="key">if</span> <span class="str">"/"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">json_desc_file</span><span class="op">:</span> </span><span class="r"><span class="annotate short">137 ↛ 138</span><span class="annotate long">line 137 didn't jump to line 138, because the condition on line 137 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="nam">json_desc_file</span> <span class="op">=</span> <span class="str">f"./{json_desc_file}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="key">if</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">isfile</span><span class="op">(</span><span class="nam">json_desc_file</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">140 ↛ 143</span><span class="annotate long">line 140 didn't jump to line 143, because the condition on line 140 was never false</span></span></p> - <p class="run"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="key">return</span> <span class="nam">_initialize_plugin_from_desc</span><span class="op">(</span><span class="nam">json_desc_file</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="nam">json_desc_file_in</span> <span class="op">=</span> <span class="str">f"{json_desc_file}.in"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="key">if</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">isfile</span><span class="op">(</span><span class="nam">json_desc_file_in</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="key">return</span> <span class="nam">_initialize_plugin_from_desc</span><span class="op">(</span><span class="nam">json_desc_file</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="key">raise</span> <span class="nam">FileNotFoundError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="str">f"Cannot determine the plugin JSON metadata descriptor: Expected it to be"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="str">f" {json_desc_file} or {json_desc_file_in}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="key">if</span> <span class="nam">test_location</span> <span class="op">==</span> <span class="str">"installed"</span><span class="op">:</span> </span><span class="r"><span class="annotate short">151 ↛ 155</span><span class="annotate long">line 151 didn't jump to line 155, because the condition on line 151 was never false</span></span></p> - <p class="run"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="nam">plugin_metadata</span> <span class="op">=</span> <span class="nam">find_json_plugin</span><span class="op">(</span><span class="op">[</span><span class="nam">str</span><span class="op">(</span><span class="nam">DEBPUTY_PLUGIN_ROOT_DIR</span><span class="op">)</span><span class="op">]</span><span class="op">,</span> <span class="nam">plugin_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="key">return</span> <span class="nam">_initialize_plugin_under_test</span><span class="op">(</span><span class="nam">plugin_metadata</span><span class="op">,</span> <span class="nam">load_debputy_plugin</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="str">'Invalid or unsupported "DEBPUTY_TEST_PLUGIN_LOCATION" environment variable. It must be either'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="str">' unset OR one of "installed", "uninstalled".'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"><span class="key">def</span> <span class="nam">initialize_plugin_under_test</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="nam">plugin_desc_file</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="str">"InitializedPluginUnderTest"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="str">"""Load and initialize a plugin for testing it</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"><span class="str"> This method will load the plugin via plugin description, which is the method that `debputy` does at</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"><span class="str"> run-time (in contrast to `initialize_plugin_under_test_preloaded`, which bypasses this concrete part</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"><span class="str"> of the flow).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"><span class="str"> :param plugin_desc_file: The plugin description file (`.json`) that describes how to load the plugin.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"><span class="str"> If omitted, `debputy` will attempt to attempt the plugin description file based on the test itself.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"><span class="str"> This works for "single-file" plugins, where the description file and the test are right next to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"><span class="str"> each other.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"><span class="str"> Note that the description file is *not* required to a valid version at this stage (e.g., "N/A" or</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"><span class="str"> "@PLACEHOLDER@") is fine. So you still use this method if you substitute in the version during</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"><span class="str"> build after running the tests. To support this flow, the file name can also end with `.json.in`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"><span class="str"> (instead of `.json`).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"><span class="str"> :return: The loaded plugin for testing</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="key">if</span> <span class="nam">plugin_desc_file</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="nam">caller_file</span> <span class="op">=</span> <span class="nam">inspect</span><span class="op">.</span><span class="nam">stack</span><span class="op">(</span><span class="op">)</span><span class="op">[</span><span class="num">1</span><span class="op">]</span><span class="op">.</span><span class="nam">filename</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="key">return</span> <span class="nam">_auto_load_plugin_from_filename</span><span class="op">(</span><span class="nam">caller_file</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="key">if</span> <span class="nam">DEBPUTY_TEST_AGAINST_INSTALLED_PLUGINS</span><span class="op">:</span> </span><span class="r"><span class="annotate short">185 ↛ 186</span><span class="annotate long">line 185 didn't jump to line 186, because the condition on line 185 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="key">raise</span> <span class="nam">RuntimeError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="str">"Running the test against an installed plugin does not work when"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="str">" plugin_desc_file is provided. Please skip this test. You can "</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="str">" import DEBPUTY_TEST_AGAINST_INSTALLED_PLUGINS and use that as"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="str">" conditional for this purpose."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="key">return</span> <span class="nam">_initialize_plugin_from_desc</span><span class="op">(</span><span class="nam">plugin_desc_file</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"><span class="key">def</span> <span class="nam">_initialize_plugin_from_desc</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="nam">desc_file</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="str">"InitializedPluginUnderTest"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">desc_file</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="op">(</span><span class="str">".json"</span><span class="op">,</span> <span class="str">".json.in"</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">198 ↛ 199</span><span class="annotate long">line 198 didn't jump to line 199, because the condition on line 198 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"The plugin file must end with .json or .json.in"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="nam">plugin_metadata</span> <span class="op">=</span> <span class="nam">parse_json_plugin_desc</span><span class="op">(</span><span class="nam">desc_file</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="key">return</span> <span class="nam">_initialize_plugin_under_test</span><span class="op">(</span><span class="nam">plugin_metadata</span><span class="op">,</span> <span class="nam">load_debputy_plugin</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"><span class="key">def</span> <span class="nam">initialize_plugin_under_test_from_inline_json</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="nam">plugin_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="nam">json_content</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="str">"InitializedPluginUnderTest"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="key">with</span> <span class="nam">BytesIO</span><span class="op">(</span><span class="nam">json_content</span><span class="op">.</span><span class="nam">encode</span><span class="op">(</span><span class="str">"utf-8"</span><span class="op">)</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="nam">plugin_metadata</span> <span class="op">=</span> <span class="nam">parse_json_plugin_desc</span><span class="op">(</span><span class="nam">plugin_name</span><span class="op">,</span> <span class="nam">fd</span><span class="op">=</span><span class="nam">fd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="key">return</span> <span class="nam">_initialize_plugin_under_test</span><span class="op">(</span><span class="nam">plugin_metadata</span><span class="op">,</span> <span class="nam">load_debputy_plugin</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"><span class="key">def</span> <span class="nam">initialize_plugin_under_test_preloaded</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="nam">api_compat_version</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="nam">plugin_initializer</span><span class="op">:</span> <span class="nam">PluginInitializationEntryPoint</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="op">/</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="nam">plugin_name</span><span class="op">:</span> <span class="nam">str</span> <span class="op">=</span> <span class="str">"plugin-under-test"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="nam">load_debputy_plugin</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="str">"InitializedPluginUnderTest"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="str">"""Internal API: Initialize a plugin for testing without loading it from a file</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"><span class="str"> This method by-passes the standard loading mechanism, meaning you will not test that your plugin</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"><span class="str"> description file is correct. Notably, any feature provided via the JSON description file will</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"><span class="str"> **NOT** be visible for the test.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"><span class="str"> This API is mostly useful for testing parts of debputy itself.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"><span class="str"> :param api_compat_version: The API version the plugin was written for. Use the same version as the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"><span class="str"> version from the entry point (The `v1` part of `debputy.plugins.v1.initialize` translate into `1`).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"><span class="str"> :param plugin_initializer: The entry point of the plugin</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"><span class="str"> :param plugin_name: Normally, debputy would derive this from the entry point. In the test, it will</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"><span class="str"> use a test name and version. However, you can explicitly set if you want the real name/version.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"><span class="str"> :param load_debputy_plugin: Whether to load debputy's own plugin first. Doing so provides a more</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"><span class="str"> realistic test and enables the test to detect conflicts with debputy's own plugins (de facto making</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"><span class="str"> the plugin unloadable in practice if such a conflict is present). This option is mostly provided</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"><span class="str"> to enable debputy to use this method for self testing.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"><span class="str"> :return: The loaded plugin for testing</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="key">if</span> <span class="nam">DEBPUTY_TEST_AGAINST_INSTALLED_PLUGINS</span><span class="op">:</span> </span><span class="r"><span class="annotate short">243 ↛ 244</span><span class="annotate long">line 243 didn't jump to line 244, because the condition on line 243 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="key">raise</span> <span class="nam">RuntimeError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="str">"Running the test against an installed plugin does not work when"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="str">" the plugin is preload. Please skip this test. You can "</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="str">" import DEBPUTY_TEST_AGAINST_INSTALLED_PLUGINS and use that as"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="str">" conditional for this purpose."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="nam">plugin_metadata</span> <span class="op">=</span> <span class="nam">DebputyPluginMetadata</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="nam">plugin_name</span><span class="op">=</span><span class="nam">plugin_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="nam">api_compat_version</span><span class="op">=</span><span class="nam">api_compat_version</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="nam">plugin_initializer</span><span class="op">=</span><span class="nam">plugin_initializer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="nam">plugin_loader</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="nam">plugin_path</span><span class="op">=</span><span class="str">"<loaded-via-test>"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="key">return</span> <span class="nam">_initialize_plugin_under_test</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="nam">load_debputy_plugin</span><span class="op">=</span><span class="nam">load_debputy_plugin</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"><span class="key">class</span> <span class="nam">_MockArchTable</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="op">@</span><span class="nam">staticmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="key">def</span> <span class="nam">matches_architecture</span><span class="op">(</span><span class="nam">_a</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">_b</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"><span class="nam">FAKE_DPKG_QUERY_TABLE</span> <span class="op">=</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"DpkgArchTable"</span><span class="op">,</span> <span class="nam">_MockArchTable</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"><span class="key">del</span> <span class="nam">_MockArchTable</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"><span class="key">def</span> <span class="nam">package_metadata_context</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="nam">host_arch</span><span class="op">:</span> <span class="nam">str</span> <span class="op">=</span> <span class="str">"amd64"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="nam">package_fields</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="nam">related_udeb_package_fields</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="nam">binary_package_version</span><span class="op">:</span> <span class="nam">str</span> <span class="op">=</span> <span class="str">"1.0-1"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="nam">related_udeb_package_version</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="nam">should_be_acted_on</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="nam">related_udeb_fs_root</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="nam">accessible_package_roots</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">VirtualPath</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="nam">tuple</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">PackageProcessingContext</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="nam">process_table</span> <span class="op">=</span> <span class="nam">faked_arch_table</span><span class="op">(</span><span class="nam">host_arch</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="nam">f</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="str">"Package"</span><span class="op">:</span> <span class="str">"foo"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="str">"Architecture"</span><span class="op">:</span> <span class="str">"any"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="key">if</span> <span class="nam">package_fields</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> <span class="nam">f</span><span class="op">.</span><span class="nam">update</span><span class="op">(</span><span class="nam">package_fields</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> <span class="nam">bin_package</span> <span class="op">=</span> <span class="nam">BinaryPackage</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="nam">Deb822</span><span class="op">(</span><span class="nam">f</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> <span class="nam">process_table</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="nam">FAKE_DPKG_QUERY_TABLE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="nam">is_main_package</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="nam">should_be_acted_on</span><span class="op">=</span><span class="nam">should_be_acted_on</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="nam">udeb_package</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="key">if</span> <span class="nam">related_udeb_package_fields</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">302 ↛ 303</span><span class="annotate long">line 302 didn't jump to line 303, because the condition on line 302 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="nam">uf</span> <span class="op">=</span> <span class="nam">dict</span><span class="op">(</span><span class="nam">related_udeb_package_fields</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> <span class="nam">uf</span><span class="op">.</span><span class="nam">setdefault</span><span class="op">(</span><span class="str">"Package"</span><span class="op">,</span> <span class="str">f'{f["Package"]}-udeb'</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="nam">uf</span><span class="op">.</span><span class="nam">setdefault</span><span class="op">(</span><span class="str">"Architecture"</span><span class="op">,</span> <span class="nam">f</span><span class="op">[</span><span class="str">"Architecture"</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> <span class="nam">uf</span><span class="op">.</span><span class="nam">setdefault</span><span class="op">(</span><span class="str">"Package-Type"</span><span class="op">,</span> <span class="str">"udeb"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="nam">udeb_package</span> <span class="op">=</span> <span class="nam">BinaryPackage</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="nam">Deb822</span><span class="op">(</span><span class="nam">uf</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="nam">process_table</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="nam">FAKE_DPKG_QUERY_TABLE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="nam">is_main_package</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="nam">should_be_acted_on</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="key">if</span> <span class="nam">related_udeb_package_version</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="nam">related_udeb_package_version</span> <span class="op">=</span> <span class="nam">binary_package_version</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="key">if</span> <span class="nam">accessible_package_roots</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="nam">apr</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="key">for</span> <span class="nam">fields</span><span class="op">,</span> <span class="nam">apr_fs_root</span> <span class="key">in</span> <span class="nam">accessible_package_roots</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="nam">apr_fields</span> <span class="op">=</span> <span class="nam">Deb822</span><span class="op">(</span><span class="nam">dict</span><span class="op">(</span><span class="nam">fields</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="key">if</span> <span class="str">"Package"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">apr_fields</span><span class="op">:</span> </span><span class="r"><span class="annotate short">320 ↛ 321</span><span class="annotate long">line 320 didn't jump to line 321, because the condition on line 320 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="str">"Missing mandatory Package field in member of accessible_package_roots"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> <span class="key">if</span> <span class="str">"Architecture"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">apr_fields</span><span class="op">:</span> </span><span class="r"><span class="annotate short">324 ↛ 325</span><span class="annotate long">line 324 didn't jump to line 325, because the condition on line 324 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> <span class="str">"Missing mandatory Architecture field in member of accessible_package_roots"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> <span class="nam">apr_package</span> <span class="op">=</span> <span class="nam">BinaryPackage</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> <span class="nam">apr_fields</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> <span class="nam">process_table</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> <span class="nam">FAKE_DPKG_QUERY_TABLE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> <span class="nam">is_main_package</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> <span class="nam">should_be_acted_on</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> <span class="nam">r</span> <span class="op">=</span> <span class="nam">package_cross_check_precheck</span><span class="op">(</span><span class="nam">bin_package</span><span class="op">,</span> <span class="nam">apr_package</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">r</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">:</span> </span><span class="r"><span class="annotate short">336 ↛ 337</span><span class="annotate long">line 336 didn't jump to line 337, because the condition on line 336 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> <span class="str">f"{apr_package.name} would not be accessible for {bin_package.name}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> <span class="nam">apr</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="op">(</span><span class="nam">apr_package</span><span class="op">,</span> <span class="nam">apr_fs_root</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"> <span class="key">if</span> <span class="nam">related_udeb_fs_root</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">342 ↛ 343</span><span class="annotate long">line 342 didn't jump to line 343, because the condition on line 342 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"> <span class="key">if</span> <span class="nam">udeb_package</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"> <span class="str">"related_udeb_package_fields must be given when related_udeb_fs_root is given"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"> <span class="nam">r</span> <span class="op">=</span> <span class="nam">package_cross_check_precheck</span><span class="op">(</span><span class="nam">bin_package</span><span class="op">,</span> <span class="nam">udeb_package</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">r</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"> <span class="str">f"{udeb_package.name} would not be accessible for {bin_package.name}, so providing"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"> <span class="str">" related_udeb_fs_root is irrelevant"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"> <span class="nam">apr</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">udeb_package</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"> <span class="nam">apr</span> <span class="op">=</span> <span class="nam">tuple</span><span class="op">(</span><span class="nam">apr</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"> <span class="nam">apr</span> <span class="op">=</span> <span class="nam">tuple</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"> <span class="key">return</span> <span class="nam">PackageProcessingContextTestProvider</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">=</span><span class="nam">bin_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"> <span class="nam">related_udeb_package</span><span class="op">=</span><span class="nam">udeb_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"> <span class="nam">binary_package_version</span><span class="op">=</span><span class="nam">binary_package_version</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"> <span class="nam">related_udeb_package_version</span><span class="op">=</span><span class="nam">related_udeb_package_version</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"> <span class="nam">accessible_package_roots</span><span class="op">=</span><span class="key">lambda</span><span class="op">:</span> <span class="nam">apr</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"><span class="key">def</span> <span class="nam">manifest_variable_resolution_context</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">VariableContext</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"> <span class="key">if</span> <span class="nam">debian_dir</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"> <span class="nam">debian_dir</span> <span class="op">=</span> <span class="nam">FSRootDir</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"> <span class="key">return</span> <span class="nam">VariableContext</span><span class="op">(</span><span class="nam">debian_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"><span class="key">class</span> <span class="nam">MaintscriptAccessorTestProvider</span><span class="op">(</span><span class="nam">MaintscriptAccessorProviderBase</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"_plugin_metadata"</span><span class="op">,</span> <span class="str">"_plugin_source_id"</span><span class="op">,</span> <span class="str">"_maintscript_container"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">:</span> <span class="nam">DebputyPluginMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"> <span class="nam">plugin_source_id</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"> <span class="nam">maintscript_container</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">RegisteredMaintscript</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t385" href="#t385">385</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t386" href="#t386">386</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_metadata</span> <span class="op">=</span> <span class="nam">plugin_metadata</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t387" href="#t387">387</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_source_id</span> <span class="op">=</span> <span class="nam">plugin_source_id</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t388" href="#t388">388</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_maintscript_container</span> <span class="op">=</span> <span class="nam">maintscript_container</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t389" href="#t389">389</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t390" href="#t390">390</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t391" href="#t391">391</a></span><span class="t"> <span class="key">def</span> <span class="nam">_apply_condition_to_script</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t392" href="#t392">392</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> <span class="nam">condition</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">run_snippet</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="op">/</span><span class="op">,</span> <span class="nam">indent</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t393" href="#t393">393</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t394" href="#t394">394</a></span><span class="t"> <span class="key">return</span> <span class="nam">run_snippet</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t395" href="#t395">395</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t396" href="#t396">396</a></span><span class="t"> <span class="key">def</span> <span class="nam">_append_script</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t397" href="#t397">397</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t398" href="#t398">398</a></span><span class="t"> <span class="nam">caller_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t399" href="#t399">399</a></span><span class="t"> <span class="nam">maintscript</span><span class="op">:</span> <span class="nam">Maintscript</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t400" href="#t400">400</a></span><span class="t"> <span class="nam">full_script</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t401" href="#t401">401</a></span><span class="t"> <span class="op">/</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t402" href="#t402">402</a></span><span class="t"> <span class="nam">perform_substitution</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t403" href="#t403">403</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t404" href="#t404">404</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_source_id</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_maintscript_container</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t405" href="#t405">405</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_maintscript_container</span><span class="op">[</span><span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_source_id</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t406" href="#t406">406</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_maintscript_container</span><span class="op">[</span><span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_source_id</span><span class="op">]</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t407" href="#t407">407</a></span><span class="t"> <span class="nam">RegisteredMaintscript</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t408" href="#t408">408</a></span><span class="t"> <span class="nam">maintscript</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t409" href="#t409">409</a></span><span class="t"> <span class="nam">caller_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t410" href="#t410">410</a></span><span class="t"> <span class="nam">full_script</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t411" href="#t411">411</a></span><span class="t"> <span class="nam">perform_substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t412" href="#t412">412</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t413" href="#t413">413</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t414" href="#t414">414</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t415" href="#t415">415</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t416" href="#t416">416</a></span><span class="t"><span class="key">class</span> <span class="nam">RegisteredMetadataImpl</span><span class="op">(</span><span class="nam">RegisteredMetadata</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t417" href="#t417">417</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t418" href="#t418">418</a></span><span class="t"> <span class="str">"_substvars"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t419" href="#t419">419</a></span><span class="t"> <span class="str">"_triggers"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t420" href="#t420">420</a></span><span class="t"> <span class="str">"_maintscripts"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t421" href="#t421">421</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t422" href="#t422">422</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t423" href="#t423">423</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t424" href="#t424">424</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t425" href="#t425">425</a></span><span class="t"> <span class="nam">substvars</span><span class="op">:</span> <span class="nam">Substvars</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t426" href="#t426">426</a></span><span class="t"> <span class="nam">triggers</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">RegisteredTrigger</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t427" href="#t427">427</a></span><span class="t"> <span class="nam">maintscripts</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">RegisteredMaintscript</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t428" href="#t428">428</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t429" href="#t429">429</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_substvars</span> <span class="op">=</span> <span class="nam">substvars</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t430" href="#t430">430</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_triggers</span> <span class="op">=</span> <span class="nam">triggers</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t431" href="#t431">431</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_maintscripts</span> <span class="op">=</span> <span class="nam">maintscripts</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t432" href="#t432">432</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t433" href="#t433">433</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t434" href="#t434">434</a></span><span class="t"> <span class="key">def</span> <span class="nam">substvars</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Substvars</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t435" href="#t435">435</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_substvars</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t436" href="#t436">436</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t437" href="#t437">437</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t438" href="#t438">438</a></span><span class="t"> <span class="key">def</span> <span class="nam">triggers</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">List</span><span class="op">[</span><span class="nam">RegisteredTrigger</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t439" href="#t439">439</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_triggers</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t440" href="#t440">440</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t441" href="#t441">441</a></span><span class="t"> <span class="key">def</span> <span class="nam">maintscripts</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t442" href="#t442">442</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t443" href="#t443">443</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t444" href="#t444">444</a></span><span class="t"> <span class="nam">maintscript</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Maintscript</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t445" href="#t445">445</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">List</span><span class="op">[</span><span class="nam">RegisteredMaintscript</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t446" href="#t446">446</a></span><span class="t"> <span class="key">if</span> <span class="nam">maintscript</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t447" href="#t447">447</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_maintscripts</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t448" href="#t448">448</a></span><span class="t"> <span class="key">return</span> <span class="op">[</span><span class="nam">m</span> <span class="key">for</span> <span class="nam">m</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_maintscripts</span> <span class="key">if</span> <span class="nam">m</span><span class="op">.</span><span class="nam">maintscript</span> <span class="op">==</span> <span class="nam">maintscript</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t449" href="#t449">449</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t450" href="#t450">450</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t451" href="#t451">451</a></span><span class="t"><span class="key">class</span> <span class="nam">BinaryCtrlAccessorTestProvider</span><span class="op">(</span><span class="nam">BinaryCtrlAccessorProviderBase</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t452" href="#t452">452</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"_maintscript_container"</span><span class="op">,</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t453" href="#t453">453</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t454" href="#t454">454</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t455" href="#t455">455</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t456" href="#t456">456</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">:</span> <span class="nam">DebputyPluginMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t457" href="#t457">457</a></span><span class="t"> <span class="nam">plugin_source_id</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t458" href="#t458">458</a></span><span class="t"> <span class="nam">context</span><span class="op">:</span> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t459" href="#t459">459</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t460" href="#t460">460</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t461" href="#t461">461</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t462" href="#t462">462</a></span><span class="t"> <span class="nam">plugin_source_id</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t463" href="#t463">463</a></span><span class="t"> <span class="nam">context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t464" href="#t464">464</a></span><span class="t"> <span class="op">{</span><span class="op">}</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t465" href="#t465">465</a></span><span class="t"> <span class="nam">FlushableSubstvars</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t466" href="#t466">466</a></span><span class="t"> <span class="op">(</span><span class="key">None</span><span class="op">,</span> <span class="key">None</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t467" href="#t467">467</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t468" href="#t468">468</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_maintscript_container</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">RegisteredMaintscript</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t469" href="#t469">469</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t470" href="#t470">470</a></span><span class="t"> <span class="key">def</span> <span class="nam">_create_maintscript_accessor</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">MaintscriptAccessor</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t471" href="#t471">471</a></span><span class="t"> <span class="key">return</span> <span class="nam">MaintscriptAccessorTestProvider</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t472" href="#t472">472</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t473" href="#t473">473</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_source_id</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t474" href="#t474">474</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_maintscript_container</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t475" href="#t475">475</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t476" href="#t476">476</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t477" href="#t477">477</a></span><span class="t"> <span class="key">def</span> <span class="nam">registered_metadata</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">RegisteredMetadata</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t478" href="#t478">478</a></span><span class="t"> <span class="key">return</span> <span class="nam">RegisteredMetadataImpl</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t479" href="#t479">479</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_substvars</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t480" href="#t480">480</a></span><span class="t"> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t481" href="#t481">481</a></span><span class="t"> <span class="nam">RegisteredTrigger</span><span class="op">.</span><span class="nam">from_plugin_provided_trigger</span><span class="op">(</span><span class="nam">t</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t482" href="#t482">482</a></span><span class="t"> <span class="key">for</span> <span class="nam">t</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_triggers</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t483" href="#t483">483</a></span><span class="t"> <span class="key">if</span> <span class="nam">t</span><span class="op">.</span><span class="nam">provider_source_id</span> <span class="op">==</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_source_id</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t484" href="#t484">484</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t485" href="#t485">485</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_maintscript_container</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_source_id</span><span class="op">,</span> <span class="op">[</span><span class="op">]</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t486" href="#t486">486</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t487" href="#t487">487</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t488" href="#t488">488</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t489" href="#t489">489</a></span><span class="t"><span class="key">class</span> <span class="nam">ServiceRegistryTestImpl</span><span class="op">(</span><span class="nam">ServiceRegistry</span><span class="op">[</span><span class="nam">DSD</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t490" href="#t490">490</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"_service_manager_details"</span><span class="op">,</span> <span class="str">"_service_definitions"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t491" href="#t491">491</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t492" href="#t492">492</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t493" href="#t493">493</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t494" href="#t494">494</a></span><span class="t"> <span class="nam">service_manager_details</span><span class="op">:</span> <span class="nam">ServiceManagerDetails</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t495" href="#t495">495</a></span><span class="t"> <span class="nam">detected_services</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">DetectedService</span><span class="op">[</span><span class="nam">DSD</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t496" href="#t496">496</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t497" href="#t497">497</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_service_manager_details</span> <span class="op">=</span> <span class="nam">service_manager_details</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t498" href="#t498">498</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_service_definitions</span> <span class="op">=</span> <span class="nam">detected_services</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t499" href="#t499">499</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t500" href="#t500">500</a></span><span class="t"> <span class="key">def</span> <span class="nam">register_service</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t501" href="#t501">501</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t502" href="#t502">502</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t503" href="#t503">503</a></span><span class="t"> <span class="nam">name</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t504" href="#t504">504</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t505" href="#t505">505</a></span><span class="t"> <span class="nam">type_of_service</span><span class="op">:</span> <span class="nam">str</span> <span class="op">=</span> <span class="str">"service"</span><span class="op">,</span> <span class="com"># "timer", etc.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t506" href="#t506">506</a></span><span class="t"> <span class="nam">service_scope</span><span class="op">:</span> <span class="nam">str</span> <span class="op">=</span> <span class="str">"system"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t507" href="#t507">507</a></span><span class="t"> <span class="nam">enable_by_default</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t508" href="#t508">508</a></span><span class="t"> <span class="nam">start_by_default</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t509" href="#t509">509</a></span><span class="t"> <span class="nam">default_upgrade_rule</span><span class="op">:</span> <span class="nam">ServiceUpgradeRule</span> <span class="op">=</span> <span class="str">"restart"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t510" href="#t510">510</a></span><span class="t"> <span class="nam">service_context</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">DSD</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t511" href="#t511">511</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t512" href="#t512">512</a></span><span class="t"> <span class="nam">names</span> <span class="op">=</span> <span class="nam">name</span> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">name</span><span class="op">,</span> <span class="nam">list</span><span class="op">)</span> <span class="key">else</span> <span class="op">[</span><span class="nam">name</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t513" href="#t513">513</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">names</span><span class="op">)</span> <span class="op"><</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"><span class="annotate short">513 ↛ 514</span><span class="annotate long">line 513 didn't jump to line 514, because the condition on line 513 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t514" href="#t514">514</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t515" href="#t515">515</a></span><span class="t"> <span class="str">f"The service must have at least one name - {path.absolute} did not have any"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t516" href="#t516">516</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t517" href="#t517">517</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_service_definitions</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t518" href="#t518">518</a></span><span class="t"> <span class="nam">DetectedService</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t519" href="#t519">519</a></span><span class="t"> <span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t520" href="#t520">520</a></span><span class="t"> <span class="nam">names</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t521" href="#t521">521</a></span><span class="t"> <span class="nam">type_of_service</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t522" href="#t522">522</a></span><span class="t"> <span class="nam">service_scope</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t523" href="#t523">523</a></span><span class="t"> <span class="nam">enable_by_default</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t524" href="#t524">524</a></span><span class="t"> <span class="nam">start_by_default</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t525" href="#t525">525</a></span><span class="t"> <span class="nam">default_upgrade_rule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t526" href="#t526">526</a></span><span class="t"> <span class="nam">service_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t527" href="#t527">527</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t528" href="#t528">528</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t529" href="#t529">529</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t530" href="#t530">530</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t531" href="#t531">531</a></span><span class="t"><span class="op">@</span><span class="nam">contextlib</span><span class="op">.</span><span class="nam">contextmanager</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t532" href="#t532">532</a></span><span class="t"><span class="key">def</span> <span class="nam">_read_only_fs_root</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t533" href="#t533">533</a></span><span class="t"> <span class="key">if</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">is_read_write</span><span class="op">:</span> </span><span class="r"><span class="annotate short">533 ↛ 539</span><span class="annotate long">line 533 didn't jump to line 539, because the condition on line 533 was never false</span></span></p> - <p class="run"><span class="n"><a id="t534" href="#t534">534</a></span><span class="t"> <span class="key">assert</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">,</span> <span class="nam">FSRootDir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t535" href="#t535">535</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">is_read_write</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t536" href="#t536">536</a></span><span class="t"> <span class="key">yield</span> <span class="nam">fs_root</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t537" href="#t537">537</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">is_read_write</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t538" href="#t538">538</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t539" href="#t539">539</a></span><span class="t"> <span class="key">yield</span> <span class="nam">fs_root</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t540" href="#t540">540</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t541" href="#t541">541</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t542" href="#t542">542</a></span><span class="t"><span class="key">class</span> <span class="nam">InitializedPluginUnderTestImpl</span><span class="op">(</span><span class="nam">InitializedPluginUnderTest</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t543" href="#t543">543</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t544" href="#t544">544</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t545" href="#t545">545</a></span><span class="t"> <span class="nam">plugin_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t546" href="#t546">546</a></span><span class="t"> <span class="nam">feature_set</span><span class="op">:</span> <span class="nam">PluginProvidedFeatureSet</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t547" href="#t547">547</a></span><span class="t"> <span class="nam">substitution</span><span class="op">:</span> <span class="nam">SubstitutionImpl</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t548" href="#t548">548</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t549" href="#t549">549</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_feature_set</span> <span class="op">=</span> <span class="nam">feature_set</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t550" href="#t550">550</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_name</span> <span class="op">=</span> <span class="nam">plugin_name</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t551" href="#t551">551</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_packager_provided_files</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t552" href="#t552">552</a></span><span class="t"> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">RegisteredPackagerProvidedFile</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t553" href="#t553">553</a></span><span class="t"> <span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t554" href="#t554">554</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_triggers</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">DpkgTriggerType</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">PluginProvidedTrigger</span><span class="op">]</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t555" href="#t555">555</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_maintscript_container</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">RegisteredMaintscript</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t556" href="#t556">556</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_substitution</span> <span class="op">=</span> <span class="nam">substitution</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t557" href="#t557">557</a></span><span class="t"> <span class="key">assert</span> <span class="nam">plugin_name</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_feature_set</span><span class="op">.</span><span class="nam">plugin_data</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t558" href="#t558">558</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t559" href="#t559">559</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t560" href="#t560">560</a></span><span class="t"> <span class="key">def</span> <span class="nam">_plugin_metadata</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">DebputyPluginMetadata</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t561" href="#t561">561</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_feature_set</span><span class="op">.</span><span class="nam">plugin_data</span><span class="op">[</span><span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_name</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t562" href="#t562">562</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t563" href="#t563">563</a></span><span class="t"> <span class="key">def</span> <span class="nam">packager_provided_files_by_stem</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t564" href="#t564">564</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t565" href="#t565">565</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">RegisteredPackagerProvidedFile</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t566" href="#t566">566</a></span><span class="t"> <span class="nam">ppf</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_packager_provided_files</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t567" href="#t567">567</a></span><span class="t"> <span class="key">if</span> <span class="nam">ppf</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t568" href="#t568">568</a></span><span class="t"> <span class="nam">result</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">RegisteredPackagerProvidedFile</span><span class="op">]</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t569" href="#t569">569</a></span><span class="t"> <span class="key">for</span> <span class="nam">spec</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_feature_set</span><span class="op">.</span><span class="nam">packager_provided_files</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t570" href="#t570">570</a></span><span class="t"> <span class="key">if</span> <span class="nam">spec</span><span class="op">.</span><span class="nam">debputy_plugin_metadata</span><span class="op">.</span><span class="nam">plugin_name</span> <span class="op">!=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_name</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t571" href="#t571">571</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t572" href="#t572">572</a></span><span class="t"> <span class="com"># Registered as a virtual subclass, so this should always be True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t573" href="#t573">573</a></span><span class="t"> <span class="key">assert</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">spec</span><span class="op">,</span> <span class="nam">RegisteredPackagerProvidedFile</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t574" href="#t574">574</a></span><span class="t"> <span class="nam">result</span><span class="op">[</span><span class="nam">spec</span><span class="op">.</span><span class="nam">stem</span><span class="op">]</span> <span class="op">=</span> <span class="nam">spec</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t575" href="#t575">575</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_packager_provided_files</span> <span class="op">=</span> <span class="nam">result</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t576" href="#t576">576</a></span><span class="t"> <span class="nam">ppf</span> <span class="op">=</span> <span class="nam">result</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t577" href="#t577">577</a></span><span class="t"> <span class="key">return</span> <span class="nam">ppf</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t578" href="#t578">578</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t579" href="#t579">579</a></span><span class="t"> <span class="key">def</span> <span class="nam">run_metadata_detector</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t580" href="#t580">580</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t581" href="#t581">581</a></span><span class="t"> <span class="nam">metadata_detector_id</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t582" href="#t582">582</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t583" href="#t583">583</a></span><span class="t"> <span class="nam">context</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">PackageProcessingContext</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t584" href="#t584">584</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">RegisteredMetadata</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t585" href="#t585">585</a></span><span class="t"> <span class="key">if</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">parent_dir</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">585 ↛ 586</span><span class="annotate long">line 585 didn't jump to line 586, because the condition on line 585 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t586" href="#t586">586</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"Provided path must be the file system root."</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t587" href="#t587">587</a></span><span class="t"> <span class="nam">detectors</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_feature_set</span><span class="op">.</span><span class="nam">metadata_maintscript_detectors</span><span class="op">[</span><span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_name</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t588" href="#t588">588</a></span><span class="t"> <span class="nam">matching_detectors</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t589" href="#t589">589</a></span><span class="t"> <span class="nam">d</span> <span class="key">for</span> <span class="nam">d</span> <span class="key">in</span> <span class="nam">detectors</span> <span class="key">if</span> <span class="nam">d</span><span class="op">.</span><span class="nam">detector_id</span> <span class="op">==</span> <span class="nam">metadata_detector_id</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t590" href="#t590">590</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t591" href="#t591">591</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">matching_detectors</span><span class="op">)</span> <span class="op">!=</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"><span class="annotate short">591 ↛ 592</span><span class="annotate long">line 591 didn't jump to line 592, because the condition on line 591 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t592" href="#t592">592</a></span><span class="t"> <span class="key">assert</span> <span class="key">not</span> <span class="nam">matching_detectors</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t593" href="#t593">593</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t594" href="#t594">594</a></span><span class="t"> <span class="str">f"The plugin {self._plugin_name} did not provide a metadata detector with ID"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t595" href="#t595">595</a></span><span class="t"> <span class="str">f' "{metadata_detector_id}"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t596" href="#t596">596</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t597" href="#t597">597</a></span><span class="t"> <span class="key">if</span> <span class="nam">context</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t598" href="#t598">598</a></span><span class="t"> <span class="nam">context</span> <span class="op">=</span> <span class="nam">package_metadata_context</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t599" href="#t599">599</a></span><span class="t"> <span class="nam">detector</span> <span class="op">=</span> <span class="nam">matching_detectors</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t600" href="#t600">600</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">detector</span><span class="op">.</span><span class="nam">applies_to</span><span class="op">(</span><span class="nam">context</span><span class="op">.</span><span class="nam">binary_package</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t601" href="#t601">601</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t602" href="#t602">602</a></span><span class="t"> <span class="str">f'The detector "{metadata_detector_id}" from {self._plugin_name} does not apply to the'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t603" href="#t603">603</a></span><span class="t"> <span class="str">" given package. Consider using `package_metadata_context()` to emulate a binary package"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t604" href="#t604">604</a></span><span class="t"> <span class="str">" with the correct specification. As an example: "</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t605" href="#t605">605</a></span><span class="t"> <span class="str">'`package_metadata_context(package_fields={"Package-Type": "udeb"})` would emulate a udeb'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t606" href="#t606">606</a></span><span class="t"> <span class="str">" package."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t607" href="#t607">607</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t608" href="#t608">608</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t609" href="#t609">609</a></span><span class="t"> <span class="nam">ctrl</span> <span class="op">=</span> <span class="nam">BinaryCtrlAccessorTestProvider</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t610" href="#t610">610</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t611" href="#t611">611</a></span><span class="t"> <span class="nam">metadata_detector_id</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t612" href="#t612">612</a></span><span class="t"> <span class="nam">context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t613" href="#t613">613</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t614" href="#t614">614</a></span><span class="t"> <span class="key">with</span> <span class="nam">_read_only_fs_root</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">)</span> <span class="key">as</span> <span class="nam">ro_root</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t615" href="#t615">615</a></span><span class="t"> <span class="nam">detector</span><span class="op">.</span><span class="nam">run_detector</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t616" href="#t616">616</a></span><span class="t"> <span class="nam">ro_root</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t617" href="#t617">617</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t618" href="#t618">618</a></span><span class="t"> <span class="nam">context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t619" href="#t619">619</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t620" href="#t620">620</a></span><span class="t"> <span class="key">return</span> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">registered_metadata</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t621" href="#t621">621</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t622" href="#t622">622</a></span><span class="t"> <span class="key">def</span> <span class="nam">run_package_processor</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t623" href="#t623">623</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t624" href="#t624">624</a></span><span class="t"> <span class="nam">package_processor_id</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t625" href="#t625">625</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t626" href="#t626">626</a></span><span class="t"> <span class="nam">context</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">PackageProcessingContext</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t627" href="#t627">627</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t628" href="#t628">628</a></span><span class="t"> <span class="key">if</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">parent_dir</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">628 ↛ 629</span><span class="annotate long">line 628 didn't jump to line 629, because the condition on line 628 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t629" href="#t629">629</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"Provided path must be the file system root."</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t630" href="#t630">630</a></span><span class="t"> <span class="nam">pp_key</span> <span class="op">=</span> <span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_name</span><span class="op">,</span> <span class="nam">package_processor_id</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t631" href="#t631">631</a></span><span class="t"> <span class="nam">package_processor</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_feature_set</span><span class="op">.</span><span class="nam">all_package_processors</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">pp_key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t632" href="#t632">632</a></span><span class="t"> <span class="key">if</span> <span class="nam">package_processor</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">632 ↛ 633</span><span class="annotate long">line 632 didn't jump to line 633, because the condition on line 632 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t633" href="#t633">633</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t634" href="#t634">634</a></span><span class="t"> <span class="str">f"The plugin {self._plugin_name} did not provide a package processor with ID"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t635" href="#t635">635</a></span><span class="t"> <span class="str">f' "{package_processor_id}"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t636" href="#t636">636</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t637" href="#t637">637</a></span><span class="t"> <span class="key">if</span> <span class="nam">context</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">637 ↛ 639</span><span class="annotate long">line 637 didn't jump to line 639, because the condition on line 637 was never false</span></span></p> - <p class="run"><span class="n"><a id="t638" href="#t638">638</a></span><span class="t"> <span class="nam">context</span> <span class="op">=</span> <span class="nam">package_metadata_context</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t639" href="#t639">639</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">is_read_write</span><span class="op">:</span> </span><span class="r"><span class="annotate short">639 ↛ 640</span><span class="annotate long">line 639 didn't jump to line 640, because the condition on line 639 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t640" href="#t640">640</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t641" href="#t641">641</a></span><span class="t"> <span class="str">"The provided fs_root is read-only and it must be read-write for package processor"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t642" href="#t642">642</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t643" href="#t643">643</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">package_processor</span><span class="op">.</span><span class="nam">applies_to</span><span class="op">(</span><span class="nam">context</span><span class="op">.</span><span class="nam">binary_package</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">643 ↛ 644</span><span class="annotate long">line 643 didn't jump to line 644, because the condition on line 643 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t644" href="#t644">644</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t645" href="#t645">645</a></span><span class="t"> <span class="str">f'The package processor "{package_processor_id}" from {self._plugin_name} does not apply'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t646" href="#t646">646</a></span><span class="t"> <span class="str">" to the given package. Consider using `package_metadata_context()` to emulate a binary"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t647" href="#t647">647</a></span><span class="t"> <span class="str">" package with the correct specification. As an example: "</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t648" href="#t648">648</a></span><span class="t"> <span class="str">'`package_metadata_context(package_fields={"Package-Type": "udeb"})` would emulate a udeb'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t649" href="#t649">649</a></span><span class="t"> <span class="str">" package."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t650" href="#t650">650</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t651" href="#t651">651</a></span><span class="t"> <span class="nam">package_processor</span><span class="op">.</span><span class="nam">run_package_processor</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t652" href="#t652">652</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t653" href="#t653">653</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t654" href="#t654">654</a></span><span class="t"> <span class="nam">context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t655" href="#t655">655</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t656" href="#t656">656</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t657" href="#t657">657</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t658" href="#t658">658</a></span><span class="t"> <span class="key">def</span> <span class="nam">declared_manifest_variables</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t659" href="#t659">659</a></span><span class="t"> <span class="key">return</span> <span class="nam">frozenset</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t660" href="#t660">660</a></span><span class="t"> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t661" href="#t661">661</a></span><span class="t"> <span class="nam">k</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t662" href="#t662">662</a></span><span class="t"> <span class="key">for</span> <span class="nam">k</span><span class="op">,</span> <span class="nam">v</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_feature_set</span><span class="op">.</span><span class="nam">manifest_variables</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t663" href="#t663">663</a></span><span class="t"> <span class="key">if</span> <span class="nam">v</span><span class="op">.</span><span class="nam">plugin_metadata</span><span class="op">.</span><span class="nam">plugin_name</span> <span class="op">==</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t664" href="#t664">664</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t665" href="#t665">665</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t666" href="#t666">666</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t667" href="#t667">667</a></span><span class="t"> <span class="key">def</span> <span class="nam">automatic_discard_rules_examples_with_issues</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">ADRExampleIssue</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t668" href="#t668">668</a></span><span class="t"> <span class="nam">issues</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t669" href="#t669">669</a></span><span class="t"> <span class="key">for</span> <span class="nam">adr</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_feature_set</span><span class="op">.</span><span class="nam">auto_discard_rules</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t670" href="#t670">670</a></span><span class="t"> <span class="key">if</span> <span class="nam">adr</span><span class="op">.</span><span class="nam">plugin_metadata</span><span class="op">.</span><span class="nam">plugin_name</span> <span class="op">!=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_name</span><span class="op">:</span> </span><span class="r"><span class="annotate short">670 ↛ 671</span><span class="annotate long">line 670 didn't jump to line 671, because the condition on line 670 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t671" href="#t671">671</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t672" href="#t672">672</a></span><span class="t"> <span class="key">for</span> <span class="nam">idx</span><span class="op">,</span> <span class="nam">example</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">adr</span><span class="op">.</span><span class="nam">examples</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t673" href="#t673">673</a></span><span class="t"> <span class="nam">result</span> <span class="op">=</span> <span class="nam">process_discard_rule_example</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t674" href="#t674">674</a></span><span class="t"> <span class="nam">adr</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t675" href="#t675">675</a></span><span class="t"> <span class="nam">example</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t676" href="#t676">676</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t677" href="#t677">677</a></span><span class="t"> <span class="key">if</span> <span class="nam">result</span><span class="op">.</span><span class="nam">inconsistent_paths</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t678" href="#t678">678</a></span><span class="t"> <span class="nam">issues</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t679" href="#t679">679</a></span><span class="t"> <span class="nam">ADRExampleIssue</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t680" href="#t680">680</a></span><span class="t"> <span class="nam">adr</span><span class="op">.</span><span class="nam">name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t681" href="#t681">681</a></span><span class="t"> <span class="nam">idx</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t682" href="#t682">682</a></span><span class="t"> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t683" href="#t683">683</a></span><span class="t"> <span class="nam">x</span><span class="op">.</span><span class="nam">absolute</span> <span class="op">+</span> <span class="op">(</span><span class="str">"/"</span> <span class="key">if</span> <span class="nam">x</span><span class="op">.</span><span class="nam">is_dir</span> <span class="key">else</span> <span class="str">""</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t684" href="#t684">684</a></span><span class="t"> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">result</span><span class="op">.</span><span class="nam">inconsistent_paths</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t685" href="#t685">685</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t686" href="#t686">686</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t687" href="#t687">687</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t688" href="#t688">688</a></span><span class="t"> <span class="key">return</span> <span class="nam">issues</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t689" href="#t689">689</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t690" href="#t690">690</a></span><span class="t"> <span class="key">def</span> <span class="nam">run_service_detection_and_integrations</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t691" href="#t691">691</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t692" href="#t692">692</a></span><span class="t"> <span class="nam">service_manager</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t693" href="#t693">693</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t694" href="#t694">694</a></span><span class="t"> <span class="nam">context</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">PackageProcessingContext</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t695" href="#t695">695</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t696" href="#t696">696</a></span><span class="t"> <span class="nam">service_context_type_hint</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Type</span><span class="op">[</span><span class="nam">DSD</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t697" href="#t697">697</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">DetectedService</span><span class="op">[</span><span class="nam">DSD</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> <span class="nam">RegisteredMetadata</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t698" href="#t698">698</a></span><span class="t"> <span class="key">if</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">parent_dir</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">698 ↛ 699</span><span class="annotate long">line 698 didn't jump to line 699, because the condition on line 698 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t699" href="#t699">699</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"Provided path must be the file system root."</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t700" href="#t700">700</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t701" href="#t701">701</a></span><span class="t"> <span class="nam">service_manager_details</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_feature_set</span><span class="op">.</span><span class="nam">service_managers</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t702" href="#t702">702</a></span><span class="t"> <span class="nam">service_manager</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t703" href="#t703">703</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t704" href="#t704">704</a></span><span class="t"> <span class="key">if</span> <span class="nam">service_manager_details</span><span class="op">.</span><span class="nam">plugin_metadata</span><span class="op">.</span><span class="nam">plugin_name</span> <span class="op">!=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_name</span><span class="op">:</span> </span><span class="r"><span class="annotate short">704 ↛ 705</span><span class="annotate long">line 704 didn't jump to line 705, because the condition on line 704 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t705" href="#t705">705</a></span><span class="t"> <span class="key">raise</span> <span class="nam">KeyError</span><span class="op">(</span><span class="nam">service_manager</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t706" href="#t706">706</a></span><span class="t"> <span class="key">except</span> <span class="nam">KeyError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t707" href="#t707">707</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t708" href="#t708">708</a></span><span class="t"> <span class="str">f"The plugin {self._plugin_name} does not provide a"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t709" href="#t709">709</a></span><span class="t"> <span class="str">f" service manager called {service_manager}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t710" href="#t710">710</a></span><span class="t"> <span class="op">)</span> <span class="key">from</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t711" href="#t711">711</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t712" href="#t712">712</a></span><span class="t"> <span class="key">if</span> <span class="nam">context</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">712 ↛ 714</span><span class="annotate long">line 712 didn't jump to line 714, because the condition on line 712 was never false</span></span></p> - <p class="run"><span class="n"><a id="t713" href="#t713">713</a></span><span class="t"> <span class="nam">context</span> <span class="op">=</span> <span class="nam">package_metadata_context</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t714" href="#t714">714</a></span><span class="t"> <span class="nam">detected_services</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">DetectedService</span><span class="op">[</span><span class="nam">DSD</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t715" href="#t715">715</a></span><span class="t"> <span class="nam">registry</span> <span class="op">=</span> <span class="nam">ServiceRegistryTestImpl</span><span class="op">(</span><span class="nam">service_manager_details</span><span class="op">,</span> <span class="nam">detected_services</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t716" href="#t716">716</a></span><span class="t"> <span class="nam">service_manager_details</span><span class="op">.</span><span class="nam">service_detector</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t717" href="#t717">717</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t718" href="#t718">718</a></span><span class="t"> <span class="nam">registry</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t719" href="#t719">719</a></span><span class="t"> <span class="nam">context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t720" href="#t720">720</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t721" href="#t721">721</a></span><span class="t"> <span class="nam">ctrl</span> <span class="op">=</span> <span class="nam">BinaryCtrlAccessorTestProvider</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t722" href="#t722">722</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t723" href="#t723">723</a></span><span class="t"> <span class="nam">service_manager_details</span><span class="op">.</span><span class="nam">service_manager</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t724" href="#t724">724</a></span><span class="t"> <span class="nam">context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t725" href="#t725">725</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t726" href="#t726">726</a></span><span class="t"> <span class="key">if</span> <span class="nam">detected_services</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t727" href="#t727">727</a></span><span class="t"> <span class="nam">service_definitions</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t728" href="#t728">728</a></span><span class="t"> <span class="nam">ServiceDefinitionImpl</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t729" href="#t729">729</a></span><span class="t"> <span class="nam">ds</span><span class="op">.</span><span class="nam">names</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t730" href="#t730">730</a></span><span class="t"> <span class="nam">ds</span><span class="op">.</span><span class="nam">names</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t731" href="#t731">731</a></span><span class="t"> <span class="nam">ds</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t732" href="#t732">732</a></span><span class="t"> <span class="nam">ds</span><span class="op">.</span><span class="nam">type_of_service</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t733" href="#t733">733</a></span><span class="t"> <span class="nam">ds</span><span class="op">.</span><span class="nam">service_scope</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t734" href="#t734">734</a></span><span class="t"> <span class="nam">ds</span><span class="op">.</span><span class="nam">enable_by_default</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t735" href="#t735">735</a></span><span class="t"> <span class="nam">ds</span><span class="op">.</span><span class="nam">start_by_default</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t736" href="#t736">736</a></span><span class="t"> <span class="nam">ds</span><span class="op">.</span><span class="nam">default_upgrade_rule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t737" href="#t737">737</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t738" href="#t738">738</a></span><span class="t"> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t739" href="#t739">739</a></span><span class="t"> <span class="nam">ds</span><span class="op">.</span><span class="nam">service_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t740" href="#t740">740</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t741" href="#t741">741</a></span><span class="t"> <span class="key">for</span> <span class="nam">ds</span> <span class="key">in</span> <span class="nam">detected_services</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t742" href="#t742">742</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t743" href="#t743">743</a></span><span class="t"> <span class="nam">service_manager_details</span><span class="op">.</span><span class="nam">service_integrator</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t744" href="#t744">744</a></span><span class="t"> <span class="nam">service_definitions</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t745" href="#t745">745</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t746" href="#t746">746</a></span><span class="t"> <span class="nam">context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t747" href="#t747">747</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t748" href="#t748">748</a></span><span class="t"> <span class="key">return</span> <span class="nam">detected_services</span><span class="op">,</span> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">registered_metadata</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t749" href="#t749">749</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t750" href="#t750">750</a></span><span class="t"> <span class="key">def</span> <span class="nam">manifest_variables</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t751" href="#t751">751</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t752" href="#t752">752</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t753" href="#t753">753</a></span><span class="t"> <span class="nam">resolution_context</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">VariableContext</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t754" href="#t754">754</a></span><span class="t"> <span class="nam">mocked_variables</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t755" href="#t755">755</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t756" href="#t756">756</a></span><span class="t"> <span class="nam">valid_manifest_variables</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t757" href="#t757">757</a></span><span class="t"> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t758" href="#t758">758</a></span><span class="t"> <span class="nam">n</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t759" href="#t759">759</a></span><span class="t"> <span class="key">for</span> <span class="nam">n</span><span class="op">,</span> <span class="nam">v</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_feature_set</span><span class="op">.</span><span class="nam">manifest_variables</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t760" href="#t760">760</a></span><span class="t"> <span class="key">if</span> <span class="nam">v</span><span class="op">.</span><span class="nam">plugin_metadata</span><span class="op">.</span><span class="nam">plugin_name</span> <span class="op">==</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t761" href="#t761">761</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t762" href="#t762">762</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t763" href="#t763">763</a></span><span class="t"> <span class="key">if</span> <span class="nam">resolution_context</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t764" href="#t764">764</a></span><span class="t"> <span class="nam">resolution_context</span> <span class="op">=</span> <span class="nam">manifest_variable_resolution_context</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t765" href="#t765">765</a></span><span class="t"> <span class="nam">substitution</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_substitution</span><span class="op">.</span><span class="nam">copy_for_subst_test</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t766" href="#t766">766</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_feature_set</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t767" href="#t767">767</a></span><span class="t"> <span class="nam">resolution_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t768" href="#t768">768</a></span><span class="t"> <span class="nam">extra_substitutions</span><span class="op">=</span><span class="nam">mocked_variables</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t769" href="#t769">769</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t770" href="#t770">770</a></span><span class="t"> <span class="key">return</span> <span class="nam">SubstitutionTable</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t771" href="#t771">771</a></span><span class="t"> <span class="nam">valid_manifest_variables</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t772" href="#t772">772</a></span><span class="t"> <span class="nam">substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t773" href="#t773">773</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t774" href="#t774">774</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t775" href="#t775">775</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t776" href="#t776">776</a></span><span class="t"><span class="key">class</span> <span class="nam">SubstitutionTable</span><span class="op">(</span><span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t777" href="#t777">777</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t778" href="#t778">778</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> <span class="nam">valid_manifest_variables</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">substitution</span><span class="op">:</span> <span class="nam">Substitution</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t779" href="#t779">779</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t780" href="#t780">780</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_valid_manifest_variables</span> <span class="op">=</span> <span class="nam">valid_manifest_variables</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t781" href="#t781">781</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_resolved</span><span class="op">:</span> <span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t782" href="#t782">782</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_substitution</span> <span class="op">=</span> <span class="nam">substitution</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t783" href="#t783">783</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t784" href="#t784">784</a></span><span class="t"> <span class="key">def</span> <span class="nam">__contains__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">item</span><span class="op">:</span> <span class="nam">object</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t785" href="#t785">785</a></span><span class="t"> <span class="key">return</span> <span class="nam">item</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_valid_manifest_variables</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t786" href="#t786">786</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t787" href="#t787">787</a></span><span class="t"> <span class="key">def</span> <span class="nam">__getitem__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">key</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t788" href="#t788">788</a></span><span class="t"> <span class="key">if</span> <span class="nam">key</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_valid_manifest_variables</span><span class="op">:</span> </span><span class="r"><span class="annotate short">788 ↛ 789</span><span class="annotate long">line 788 didn't jump to line 789, because the condition on line 788 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t789" href="#t789">789</a></span><span class="t"> <span class="key">raise</span> <span class="nam">KeyError</span><span class="op">(</span><span class="nam">key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t790" href="#t790">790</a></span><span class="t"> <span class="nam">v</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_substitution</span><span class="op">.</span><span class="nam">substitute</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t791" href="#t791">791</a></span><span class="t"> <span class="str">"{{"</span> <span class="op">+</span> <span class="nam">key</span> <span class="op">+</span> <span class="str">"}}"</span><span class="op">,</span> <span class="str">f"test of manifest variable `{key}`"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t792" href="#t792">792</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t793" href="#t793">793</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_resolved</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t794" href="#t794">794</a></span><span class="t"> <span class="key">return</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t795" href="#t795">795</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t796" href="#t796">796</a></span><span class="t"> <span class="key">def</span> <span class="nam">__len__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t797" href="#t797">797</a></span><span class="t"> <span class="key">return</span> <span class="nam">len</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_valid_manifest_variables</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t798" href="#t798">798</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t799" href="#t799">799</a></span><span class="t"> <span class="key">def</span> <span class="nam">__iter__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t800" href="#t800">800</a></span><span class="t"> <span class="key">return</span> <span class="nam">iter</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_valid_manifest_variables</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t801" href="#t801">801</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t802" href="#t802">802</a></span><span class="t"> <span class="key">def</span> <span class="nam">keys</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">KeysView</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t803" href="#t803">803</a></span><span class="t"> <span class="key">return</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"KeysView[str]"</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_valid_manifest_variables</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_4b9be07fb6071cd2___init___py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_4b9be07fb6071cd2_test_spec_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_4b9be07fb6071cd2_test_spec_py.html b/coverage-report/d_4b9be07fb6071cd2_test_spec_py.html deleted file mode 100644 index 4c0ed29..0000000 --- a/coverage-report/d_4b9be07fb6071cd2_test_spec_py.html +++ /dev/null @@ -1,463 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/plugin/api/test_api/test_spec.py: 100%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/plugin/api/test_api/test_spec.py</b>: - <span class="pc_cov">100%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">79 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">79<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">0<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">11<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_4b9be07fb6071cd2_test_impl_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_d5d6843b45eec01e___init___py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">dataclasses</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">from</span> <span class="nam">abc</span> <span class="key">import</span> <span class="nam">ABCMeta</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> <span class="nam">Iterable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="nam">Mapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">Callable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">List</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">Set</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">Sequence</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">Generic</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">Type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">Self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">FrozenSet</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"><span class="key">from</span> <span class="nam">debian</span><span class="op">.</span><span class="nam">substvars</span> <span class="key">import</span> <span class="nam">Substvars</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span> <span class="key">import</span> <span class="nam">filesystem_scan</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="nam">DpkgTriggerType</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="nam">Maintscript</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">impl_types</span> <span class="key">import</span> <span class="nam">PluginProvidedTrigger</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">spec</span> <span class="key">import</span> <span class="nam">DSD</span><span class="op">,</span> <span class="nam">ServiceUpgradeRule</span><span class="op">,</span> <span class="nam">PathDef</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">substitution</span> <span class="key">import</span> <span class="nam">VariableContext</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"><span class="nam">DEBPUTY_TEST_AGAINST_INSTALLED_PLUGINS</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">environ</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"DEBPUTY_TEST_PLUGIN_LOCATION"</span><span class="op">,</span> <span class="str">"uninstalled"</span><span class="op">)</span> <span class="op">==</span> <span class="str">"installed"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"><span class="key">class</span> <span class="nam">ADRExampleIssue</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="nam">name</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="nam">example_index</span><span class="op">:</span> <span class="nam">int</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">inconsistent_paths</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"><span class="key">def</span> <span class="nam">build_virtual_file_system</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="nam">paths</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">PathDef</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="nam">read_write_fs</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">VirtualPath</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="str">"""Create a pure-virtual file system for use with metadata detectors</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"><span class="str"> This method will generate a virtual file system a list of path names or virtual path definitions. It will</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"><span class="str"> also insert any implicit path required to make the file system connected. As an example:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"><span class="str"> >>> fs_root = build_virtual_file_system(['./usr/share/doc/package/copyright'])</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"><span class="str"> >>> # The file we explicitly requested is obviously there</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"><span class="str"> >>> fs_root.lookup('./usr/share/doc/package/copyright') is not None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"><span class="str"> True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"><span class="str"> >>> # but so is every directory up to that point</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"><span class="str"> >>> all(fs_root.lookup(d).is_dir</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"><span class="str"> ... for d in ['./usr', './usr/share', './usr/share/doc', './usr/share/doc/package']</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"><span class="str"> ... )</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"><span class="str"> True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"><span class="str"> Any string provided will be passed to `virtual_path` using all defaults for other parameters, making `str`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"><span class="str"> arguments a nice easy shorthand if you just want a path to exist, but do not really care about it otherwise</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"><span class="str"> (or `virtual_path_def` defaults happens to work for you).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"><span class="str"> Here is a very small example of how to create some basic file system objects to get you started:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"><span class="str"> >>> from debputy.plugin.api import virtual_path_def</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"><span class="str"> >>> path_defs = [</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"><span class="str"> ... './usr/share/doc/', # Create a directory</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"><span class="str"> ... virtual_path_def("./bin/zcat", link_target="/bin/gzip"), # Create a symlink</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"><span class="str"> ... virtual_path_def("./bin/gzip", mode=0o755), # Create a file (with a custom mode)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"><span class="str"> ... ]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"><span class="str"> >>> fs_root = build_virtual_file_system(path_defs)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"><span class="str"> >>> fs_root.lookup('./usr/share/doc').is_dir</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"><span class="str"> True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"><span class="str"> >>> fs_root.lookup('./bin/zcat').is_symlink</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"><span class="str"> True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"><span class="str"> >>> fs_root.lookup('./bin/zcat').readlink() == '/bin/gzip'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"><span class="str"> True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"><span class="str"> >>> fs_root.lookup('./bin/gzip').is_file</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"><span class="str"> True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"><span class="str"> >>> fs_root.lookup('./bin/gzip').mode == 0o755</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"><span class="str"> True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"><span class="str"> :param paths: An iterable any mix of path names (str) and virtual_path_def definitions</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"><span class="str"> (results from `virtual_path_def`).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"><span class="str"> :param read_write_fs: Whether the file system is read-write (True) or read-only (False).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"><span class="str"> Note that this is the default permission; the plugin test API may temporarily turn a</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"><span class="str"> read-write to read-only temporarily (when running a metadata detector, etc.).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"><span class="str"> :return: The root of the generated file system</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="key">return</span> <span class="nam">filesystem_scan</span><span class="op">.</span><span class="nam">build_virtual_fs</span><span class="op">(</span><span class="nam">paths</span><span class="op">,</span> <span class="nam">read_write_fs</span><span class="op">=</span><span class="nam">read_write_fs</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"><span class="key">class</span> <span class="nam">RegisteredTrigger</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="nam">dpkg_trigger_type</span><span class="op">:</span> <span class="nam">DpkgTriggerType</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="nam">dpkg_trigger_target</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="key">def</span> <span class="nam">serialized_format</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="str">"""The semantic contents of the DEBIAN/triggers file"""</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="key">return</span> <span class="str">f"{self.dpkg_trigger_type} {self.dpkg_trigger_target}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="key">def</span> <span class="nam">from_plugin_provided_trigger</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="nam">plugin_provided_trigger</span><span class="op">:</span> <span class="nam">PluginProvidedTrigger</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"Self"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="key">return</span> <span class="nam">cls</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="nam">plugin_provided_trigger</span><span class="op">.</span><span class="nam">dpkg_trigger_type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="nam">plugin_provided_trigger</span><span class="op">.</span><span class="nam">dpkg_trigger_target</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"><span class="key">class</span> <span class="nam">RegisteredMaintscript</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="str">"""Details about a maintscript registered by a plugin"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="str">"""Which maintscript is applies to (e.g., "postinst")"""</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="nam">maintscript</span><span class="op">:</span> <span class="nam">Maintscript</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="str">"""Which method was used to trigger the script (e.g., "on_configure")"""</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="nam">registration_method</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="str">"""The snippet provided by the plugin as it was provided</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"><span class="str"> That is, no indentation/conditions/substitutions have been applied to this text</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="nam">plugin_provided_script</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="str">"""Whether substitutions would have been applied in a production run"""</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="nam">requested_substitution</span><span class="op">:</span> <span class="nam">bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"><span class="key">class</span> <span class="nam">DetectedService</span><span class="op">(</span><span class="nam">Generic</span><span class="op">[</span><span class="nam">DSD</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="nam">names</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="nam">type_of_service</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="nam">service_scope</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="nam">enable_by_default</span><span class="op">:</span> <span class="nam">bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="nam">start_by_default</span><span class="op">:</span> <span class="nam">bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="nam">default_upgrade_rule</span><span class="op">:</span> <span class="nam">ServiceUpgradeRule</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="nam">service_context</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">DSD</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"><span class="key">class</span> <span class="nam">RegisteredPackagerProvidedFile</span><span class="op">(</span><span class="nam">metaclass</span><span class="op">=</span><span class="nam">ABCMeta</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="str">"""Record of a registered packager provided file - No instantiation</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"><span class="str"> New "mandatory" attributes may be added in minor versions, which means instantiation will break tests.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"><span class="str"> Plugin providers should therefore not create instances of this dataclass. It is visible only to aid</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"><span class="str"> test writing by providing type-safety / auto-completion.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="str">"""The name stem used for generating the file"""</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="nam">stem</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="str">"""The recorded directory these file should be installed into"""</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="nam">installed_path</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="str">"""The mode that debputy will give these files when installed (unless overridden)"""</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="nam">default_mode</span><span class="op">:</span> <span class="nam">int</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="str">"""The default priority assigned to files unless overridden (if priories are assigned at all)"""</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="nam">default_priority</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="str">"""The filename format to be used"""</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="nam">filename_format</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="str">"""The formatting correcting callback"""</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="nam">post_formatting_rewrite</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="key">def</span> <span class="nam">compute_dest</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="nam">assigned_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="nam">assigned_priority</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">owning_package</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="str">"""Determine the basename of this packager provided file</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"><span class="str"> This method is useful for verifying that the `installed_path` and `post_formatting_rewrite` works</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"><span class="str"> as intended. As example, some programs do not support "." in their configuration files, so you might</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"><span class="str"> have a post_formatting_rewrite à la `lambda x: x.replace(".", "_")`. Then you can test it by</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"><span class="str"> calling `assert rppf.compute_dest("python3.11")[1] == "python3_11"` to verify that if a package like</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"><span class="str"> `python3.11` were to use this packager provided file, it would still generate a supported file name.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"><span class="str"> For the `assigned_name` parameter, then this is normally derived from the filename. Examples for</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"><span class="str"> how to derive it:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"><span class="str"> * `debian/my-pkg.stem` => `my-pkg`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"><span class="str"> * `debian/my-pkg.my-custom-name.stem` => `my-custom-name`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"><span class="str"> Note that all parts (`my-pkg`, `my-custom-name` and `stem`) can contain periods (".") despite</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"><span class="str"> also being a delimiter. Additionally, `my-custom-name` is not restricted to being a valid package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"><span class="str"> name, so it can have any file-system valid character in it.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"><span class="str"> For the 0.01% case, where the plugin is using *both* `{name}` *and* `{owning_package}` in the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"><span class="str"> installed_path, then you can separately *also* set the `owning_package` attribute. However, by</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"><span class="str"> default the `assigned_named` is used for both when `owning_package` is not provided.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"><span class="str"> :param assigned_name: The name assigned. Usually this is the name of the package containing the file.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"><span class="str"> :param assigned_priority: Optionally a priority override for the file (if priority is supported). Must be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"><span class="str"> omitted/None if priorities are not supported.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"><span class="str"> :param owning_package: Optionally the name of the owning package. It is only needed for those exceedingly</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"><span class="str"> rare cases where the `installed_path` contains both `{owning_package}` (usually in addition to `{name}`).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"><span class="str"> :param path: Special-case param, only needed for when testing a special `debputy` PPF..</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"><span class="str"> :return: A tuple of the directory name and the basename (in that order) that combined makes up that path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"><span class="str"> that debputy would use.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"><span class="key">class</span> <span class="nam">RegisteredMetadata</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="key">def</span> <span class="nam">substvars</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Substvars</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="str">"""Returns the Substvars</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"><span class="str"> :return: The substvars in their current state.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="key">def</span> <span class="nam">triggers</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">List</span><span class="op">[</span><span class="nam">RegisteredTrigger</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="key">def</span> <span class="nam">maintscripts</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="nam">maintscript</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Maintscript</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">List</span><span class="op">[</span><span class="nam">RegisteredMaintscript</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="str">"""Extract the maintscript provided by the given metadata detector</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"><span class="str"> :param maintscript: If provided, only snippet registered for the given maintscript is returned. Can be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"><span class="str"> used to say "Give me all the 'postinst' snippets by this metadata detector", which can simplify</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"><span class="str"> verification in some cases.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"><span class="str"> :return: A list of all matching maintscript registered by the metadata detector. If the detector has</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"><span class="str"> not been run, then the list will be empty. If the metadata detector has been run multiple times,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"><span class="str"> then this is the aggregation of all the runs.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"><span class="key">class</span> <span class="nam">InitializedPluginUnderTest</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="key">def</span> <span class="nam">packager_provided_files</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">RegisteredPackagerProvidedFile</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="str">"""An iterable of all packager provided files registered by the plugin under test</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"><span class="str"> If you want a particular order, please sort the result.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">packager_provided_files_by_stem</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="key">def</span> <span class="nam">packager_provided_files_by_stem</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">RegisteredPackagerProvidedFile</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="str">"""All packager provided files registered by the plugin under test grouped by name stem"""</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="key">def</span> <span class="nam">run_metadata_detector</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="nam">metadata_detector_id</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="nam">context</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">PackageProcessingContext</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">RegisteredMetadata</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="str">"""Run a metadata detector (by its ID) against a given file system</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"><span class="str"> :param metadata_detector_id: The ID of the metadata detector to run</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"><span class="str"> :param fs_root: The file system the metadata detector should see (must be the root of the file system)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"><span class="str"> :param context: The context the metadata detector should see. If not provided, one will be mock will be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"><span class="str"> provided to the extent possible.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"><span class="str"> :return: The metadata registered by the metadata detector</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="key">def</span> <span class="nam">run_package_processor</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="nam">package_processor_id</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="nam">context</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">PackageProcessingContext</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="str">"""Run a package processor (by its ID) against a given file system</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"><span class="str"> Note: Dependency processors are *not* run first.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"><span class="str"> :param package_processor_id: The ID of the package processor to run</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"><span class="str"> :param fs_root: The file system the package processor should see (must be the root of the file system)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"><span class="str"> :param context: The context the package processor should see. If not provided, one will be mock will be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"><span class="str"> provided to the extent possible.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="key">def</span> <span class="nam">declared_manifest_variables</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Union</span><span class="op">[</span><span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="str">"""Extract the manifest variables declared by the plugin</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"><span class="str"> :return: All manifest variables declared by the plugin</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="key">def</span> <span class="nam">automatic_discard_rules_examples_with_issues</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">ADRExampleIssue</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="str">"""Validate examples of the automatic discard rules</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"><span class="str"> For any failed example, use `debputy plugin show automatic-discard-rules <name>` to see</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"><span class="str"> the failed example in full.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"><span class="str"> :return: If any examples have issues, this will return a non-empty sequence with an</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"><span class="str"> entry with each issue.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="key">def</span> <span class="nam">run_service_detection_and_integrations</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="nam">service_manager</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="nam">context</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">PackageProcessingContext</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="nam">service_context_type_hint</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Type</span><span class="op">[</span><span class="nam">DSD</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">DetectedService</span><span class="op">[</span><span class="nam">DSD</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> <span class="nam">RegisteredMetadata</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="str">"""Run the service manager's detection logic and return the results</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"><span class="str"> This method can be used to validate the service detection and integration logic of a plugin</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"><span class="str"> for a given service manager.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"><span class="str"> First the service detector is run and if it finds any services, the integrator code is then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"><span class="str"> run on those services with their default values.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"><span class="str"> :param service_manager: The name of the service manager as provided during the initialization</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"><span class="str"> :param fs_root: The file system the system detector should see (must be the root of</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"><span class="str"> the file system)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"><span class="str"> :param context: The context the service detector should see. If not provided, one will be mock</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"><span class="str"> will be provided to the extent possible.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"><span class="str"> :param service_context_type_hint: Unused; but can be used as a type hint for `mypy` (etc.)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"><span class="str"> to align the return type.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"><span class="str"> :return: A tuple of the list of all detected services in the provided file system and the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"><span class="str"> metadata generated by the integrator (if any services were detected).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> <span class="key">def</span> <span class="nam">manifest_variables</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"> <span class="nam">resolution_context</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">VariableContext</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> <span class="nam">mocked_variables</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"> <span class="str">"""Provide a table of the manifest variables registered by the plugin</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"><span class="str"> Each key is a manifest variable and the value of said key is the value of the manifest</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"><span class="str"> variable. Lazy loaded variables are resolved when accessed for the first time and may</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"><span class="str"> raise exceptions if the preconditions are not correct.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"><span class="str"> Note this method can be called multiple times with different parameters to provide</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"><span class="str"> different contexts. Lazy loaded variables are resolved at most once per context.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"><span class="str"> :param resolution_context: An optional context for lazy loaded manifest variables.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"><span class="str"> Create an instance of it via `manifest_variable_resolution_context`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"><span class="str"> :param mocked_variables: An optional mapping that provides values for certain manifest</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"><span class="str"> variables. This can be used if you want a certain variable to have a certain value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"><span class="str"> for the test to be stable (or because the manifest variable you are mocking is from</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"><span class="str"> another plugin, and you do not want to deal with the implementation details of how</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"><span class="str"> it is set). Any variable that depends on the mocked variable will use the mocked</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"><span class="str"> variable in the given context.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"><span class="str"> :return: A table of the manifest variables provided by the plugin. Note this table</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"><span class="str"> only contains manifest variables registered by the plugin. Attempting to resolve</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"><span class="str"> other variables (directly), such as mocked variables or from other plugins, will</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"><span class="str"> trigger a `KeyError`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_4b9be07fb6071cd2_test_impl_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_d5d6843b45eec01e___init___py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_4f754ff76d8638bb___init___py.html b/coverage-report/d_4f754ff76d8638bb___init___py.html deleted file mode 100644 index 012583e..0000000 --- a/coverage-report/d_4f754ff76d8638bb___init___py.html +++ /dev/null @@ -1,99 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/manifest_parser/__init__.py: 100%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/manifest_parser/__init__.py</b>: - <span class="pc_cov">100%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">0 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">0<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">0<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_manifest_conditions_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_4f754ff76d8638bb_base_types_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_manifest_conditions_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_4f754ff76d8638bb_base_types_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_4f754ff76d8638bb_base_types_py.html b/coverage-report/d_4f754ff76d8638bb_base_types_py.html deleted file mode 100644 index 2c319ef..0000000 --- a/coverage-report/d_4f754ff76d8638bb_base_types_py.html +++ /dev/null @@ -1,539 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/manifest_parser/base_types.py: 84%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/manifest_parser/base_types.py</b>: - <span class="pc_cov">84%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">213 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">180<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">33<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">9<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">7<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_4f754ff76d8638bb___init___py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_4f754ff76d8638bb_declarative_parser_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">dataclasses</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">from</span> <span class="nam">functools</span> <span class="key">import</span> <span class="nam">lru_cache</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> <span class="nam">TypedDict</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="nam">NotRequired</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">Sequence</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">Literal</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">Mapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">Iterable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">TYPE_CHECKING</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">Callable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">Type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">Generic</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">exceptions</span> <span class="key">import</span> <span class="nam">ManifestParseException</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="nam">_SymbolicModeSegment</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">parse_symbolic_mode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">path_matcher</span> <span class="key">import</span> <span class="nam">MatchRule</span><span class="op">,</span> <span class="nam">ExactFileSystemPath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">substitution</span> <span class="key">import</span> <span class="nam">Substitution</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">types</span> <span class="key">import</span> <span class="nam">S</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">_normalize_path</span><span class="op">,</span> <span class="nam">T</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"><span class="key">if</span> <span class="nam">TYPE_CHECKING</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_conditions</span> <span class="key">import</span> <span class="nam">ManifestCondition</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">parser_data</span> <span class="key">import</span> <span class="nam">ParserContextData</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"><span class="key">class</span> <span class="nam">DebputyParsedContent</span><span class="op">(</span><span class="nam">TypedDict</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"><span class="key">class</span> <span class="nam">DebputyDispatchableType</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"><span class="key">class</span> <span class="nam">DebputyParsedContentStandardConditional</span><span class="op">(</span><span class="nam">DebputyParsedContent</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="nam">when</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="str">"ManifestCondition"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"><span class="key">class</span> <span class="nam">OwnershipDefinition</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="nam">entity_name</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="nam">entity_id</span><span class="op">:</span> <span class="nam">int</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"><span class="key">class</span> <span class="nam">TypeMapping</span><span class="op">(</span><span class="nam">Generic</span><span class="op">[</span><span class="nam">S</span><span class="op">,</span> <span class="nam">T</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">target_type</span><span class="op">:</span> <span class="nam">Type</span><span class="op">[</span><span class="nam">T</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="nam">source_type</span><span class="op">:</span> <span class="nam">Type</span><span class="op">[</span><span class="nam">S</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="nam">mapper</span><span class="op">:</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">S</span><span class="op">,</span> <span class="nam">AttributePath</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"ParserContextData"</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> <span class="nam">T</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"><span class="nam">ROOT_DEFINITION</span> <span class="op">=</span> <span class="nam">OwnershipDefinition</span><span class="op">(</span><span class="str">"root"</span><span class="op">,</span> <span class="num">0</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"><span class="nam">BAD_OWNER_NAMES</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="str">"_apt"</span><span class="op">,</span> <span class="com"># All things owned by _apt are generated by apt after installation</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="str">"nogroup"</span><span class="op">,</span> <span class="com"># It is not supposed to own anything as it is an entity used for dropping permissions</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="str">"nobody"</span><span class="op">,</span> <span class="com"># It is not supposed to own anything as it is an entity used for dropping permissions</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"><span class="nam">BAD_OWNER_IDS</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="num">65534</span><span class="op">,</span> <span class="com"># ID of nobody / nogroup</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"><span class="key">def</span> <span class="nam">_parse_ownership</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="nam">v</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">int</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span> <span class="key">and</span> <span class="str">":"</span> <span class="key">in</span> <span class="nam">v</span><span class="op">:</span> </span><span class="r"><span class="annotate short">78 ↛ 79</span><span class="annotate long">line 78 didn't jump to line 79, because the condition on line 78 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="key">if</span> <span class="nam">v</span> <span class="op">==</span> <span class="str">":"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="str">f'Invalid ownership value "{v}" at {attribute_path.path}: Ownership is redundant if it is ":"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="str">f" (blank name and blank id). Please provide non-default values or remove the definition."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="nam">entity_name</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="nam">entity_id</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="nam">entity_name</span><span class="op">,</span> <span class="nam">entity_id_str</span> <span class="op">=</span> <span class="nam">v</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="str">":"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="key">if</span> <span class="nam">entity_name</span> <span class="op">==</span> <span class="str">""</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="nam">entity_name</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="key">if</span> <span class="nam">entity_id_str</span> <span class="op">!=</span> <span class="str">""</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="nam">entity_id</span> <span class="op">=</span> <span class="nam">int</span><span class="op">(</span><span class="nam">entity_id_str</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="nam">entity_id</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="key">return</span> <span class="nam">entity_name</span><span class="op">,</span> <span class="nam">entity_id</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">int</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span><span class="op">,</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="key">if</span> <span class="nam">v</span><span class="op">.</span><span class="nam">isdigit</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">97 ↛ 98</span><span class="annotate long">line 97 didn't jump to line 98, because the condition on line 97 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="str">f'Invalid ownership value "{v}" at {attribute_path.path}: The provided value "{v}" is a string (implying'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="str">" name lookup), but it contains an integer (implying id lookup). Please use a regular int for id lookup"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="str">f' (removing the quotes) or add a ":" in the end ("{v}:") as a disambiguation if you are *really* looking'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="str">" for an entity with that name."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="key">return</span> <span class="nam">v</span><span class="op">,</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"><span class="op">@</span><span class="nam">lru_cache</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"><span class="key">def</span> <span class="nam">_load_ownership_table_from_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="nam">name</span><span class="op">:</span> <span class="nam">Literal</span><span class="op">[</span><span class="str">"passwd.master"</span><span class="op">,</span> <span class="str">"group.master"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">OwnershipDefinition</span><span class="op">]</span><span class="op">,</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">int</span><span class="op">,</span> <span class="nam">OwnershipDefinition</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="nam">filename</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="str">"/usr/share/base-passwd"</span><span class="op">,</span> <span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="nam">name_table</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="nam">uid_table</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="key">for</span> <span class="nam">owner_def</span> <span class="key">in</span> <span class="nam">_read_ownership_def_from_base_password_template</span><span class="op">(</span><span class="nam">filename</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="com"># Could happen if base-passwd template has two users with the same ID. We assume this will not occur.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="key">assert</span> <span class="nam">owner_def</span><span class="op">.</span><span class="nam">entity_name</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">name_table</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="key">assert</span> <span class="nam">owner_def</span><span class="op">.</span><span class="nam">entity_id</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">uid_table</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="nam">name_table</span><span class="op">[</span><span class="nam">owner_def</span><span class="op">.</span><span class="nam">entity_name</span><span class="op">]</span> <span class="op">=</span> <span class="nam">owner_def</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="nam">uid_table</span><span class="op">[</span><span class="nam">owner_def</span><span class="op">.</span><span class="nam">entity_id</span><span class="op">]</span> <span class="op">=</span> <span class="nam">owner_def</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="key">return</span> <span class="nam">name_table</span><span class="op">,</span> <span class="nam">uid_table</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"><span class="key">def</span> <span class="nam">_read_ownership_def_from_base_password_template</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="nam">template_file</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">OwnershipDefinition</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="key">with</span> <span class="nam">open</span><span class="op">(</span><span class="nam">template_file</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="key">for</span> <span class="nam">line</span> <span class="key">in</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="nam">entity_name</span><span class="op">,</span> <span class="nam">_star</span><span class="op">,</span> <span class="nam">entity_id</span><span class="op">,</span> <span class="nam">_remainder</span> <span class="op">=</span> <span class="nam">line</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="str">":"</span><span class="op">,</span> <span class="num">3</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="key">if</span> <span class="nam">entity_id</span> <span class="op">==</span> <span class="str">"0"</span> <span class="key">and</span> <span class="nam">entity_name</span> <span class="op">==</span> <span class="str">"root"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="key">yield</span> <span class="nam">ROOT_DEFINITION</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="key">yield</span> <span class="nam">OwnershipDefinition</span><span class="op">(</span><span class="nam">entity_name</span><span class="op">,</span> <span class="nam">int</span><span class="op">(</span><span class="nam">entity_id</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"><span class="key">class</span> <span class="nam">FileSystemMode</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="key">def</span> <span class="nam">parse_filesystem_mode</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="nam">mode_raw</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"FileSystemMode"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="key">if</span> <span class="nam">mode_raw</span> <span class="key">and</span> <span class="nam">mode_raw</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">.</span><span class="nam">isdigit</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="key">return</span> <span class="nam">OctalMode</span><span class="op">.</span><span class="nam">parse_filesystem_mode</span><span class="op">(</span><span class="nam">mode_raw</span><span class="op">,</span> <span class="nam">attribute_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="key">return</span> <span class="nam">SymbolicMode</span><span class="op">.</span><span class="nam">parse_filesystem_mode</span><span class="op">(</span><span class="nam">mode_raw</span><span class="op">,</span> <span class="nam">attribute_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="key">def</span> <span class="nam">compute_mode</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">current_mode</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> <span class="nam">is_dir</span><span class="op">:</span> <span class="nam">bool</span><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"><span class="key">class</span> <span class="nam">SymbolicMode</span><span class="op">(</span><span class="nam">FileSystemMode</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="nam">provided_mode</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="nam">segments</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">_SymbolicModeSegment</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="key">def</span> <span class="nam">parse_filesystem_mode</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="nam">mode_raw</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"SymbolicMode"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="nam">segments</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">parse_symbolic_mode</span><span class="op">(</span><span class="nam">mode_raw</span><span class="op">,</span> <span class="nam">attribute_path</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="key">return</span> <span class="nam">SymbolicMode</span><span class="op">(</span><span class="nam">mode_raw</span><span class="op">,</span> <span class="nam">segments</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="key">def</span> <span class="nam">__str__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">symbolic_mode</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_symbolic_mode</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="key">def</span> <span class="nam">symbolic_mode</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">provided_mode</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="key">def</span> <span class="nam">compute_mode</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">current_mode</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> <span class="nam">is_dir</span><span class="op">:</span> <span class="nam">bool</span><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="nam">final_mode</span> <span class="op">=</span> <span class="nam">current_mode</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="key">for</span> <span class="nam">segment</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">segments</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="nam">final_mode</span> <span class="op">=</span> <span class="nam">segment</span><span class="op">.</span><span class="nam">apply</span><span class="op">(</span><span class="nam">final_mode</span><span class="op">,</span> <span class="nam">is_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="key">return</span> <span class="nam">final_mode</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"><span class="key">class</span> <span class="nam">OctalMode</span><span class="op">(</span><span class="nam">FileSystemMode</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="nam">octal_mode</span><span class="op">:</span> <span class="nam">int</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="key">def</span> <span class="nam">parse_filesystem_mode</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="nam">mode_raw</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"FileSystemMode"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="nam">mode</span> <span class="op">=</span> <span class="nam">int</span><span class="op">(</span><span class="nam">mode_raw</span><span class="op">,</span> <span class="nam">base</span><span class="op">=</span><span class="num">8</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="key">except</span> <span class="nam">ValueError</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="nam">error_msg</span> <span class="op">=</span> <span class="str">'An octal mode must be all digits between 0-7 (such as "644")'</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="str">f"Cannot parse {attribute_path.path} as an octal mode: {error_msg}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="op">)</span> <span class="key">from</span> <span class="nam">e</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="key">return</span> <span class="nam">OctalMode</span><span class="op">(</span><span class="nam">mode</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_octal_mode</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="key">def</span> <span class="nam">compute_mode</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">_current_mode</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> <span class="nam">_is_dir</span><span class="op">:</span> <span class="nam">bool</span><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">octal_mode</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="key">def</span> <span class="nam">__str__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="key">return</span> <span class="str">f"0{oct(self.octal_mode)[2:]}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"><span class="key">class</span> <span class="nam">_StaticFileSystemOwnerGroup</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="nam">ownership_definition</span><span class="op">:</span> <span class="nam">OwnershipDefinition</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="key">def</span> <span class="nam">entity_name</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">ownership_definition</span><span class="op">.</span><span class="nam">entity_name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="key">def</span> <span class="nam">entity_id</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">ownership_definition</span><span class="op">.</span><span class="nam">entity_id</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="key">def</span> <span class="nam">from_manifest_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="nam">raw_input</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">int</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"_StaticFileSystemOwnerGroup"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="nam">provided_name</span><span class="op">,</span> <span class="nam">provided_id</span> <span class="op">=</span> <span class="nam">_parse_ownership</span><span class="op">(</span><span class="nam">raw_input</span><span class="op">,</span> <span class="nam">attribute_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="nam">owner_def</span> <span class="op">=</span> <span class="nam">cls</span><span class="op">.</span><span class="nam">_resolve</span><span class="op">(</span><span class="nam">raw_input</span><span class="op">,</span> <span class="nam">provided_name</span><span class="op">,</span> <span class="nam">provided_id</span><span class="op">,</span> <span class="nam">attribute_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"><span class="annotate short">232 ↛ 236</span><span class="annotate long">line 232 didn't jump to line 236</span></span></p> - <p class="pln"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="nam">owner_def</span><span class="op">.</span><span class="nam">entity_name</span> <span class="key">in</span> <span class="nam">BAD_OWNER_NAMES</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="key">or</span> <span class="nam">owner_def</span><span class="op">.</span><span class="nam">entity_id</span> <span class="key">in</span> <span class="nam">BAD_OWNER_IDS</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="str">f'Refusing to use "{raw_input}" as {cls._owner_type()} (defined at {attribute_path.path})'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="str">f' as it resolves to "{owner_def.entity_name}:{owner_def.entity_id}" and no path should have this'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="str">f" entity as {cls._owner_type()} as it is unsafe."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="key">return</span> <span class="nam">cls</span><span class="op">(</span><span class="nam">owner_def</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="key">def</span> <span class="nam">_resolve</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="nam">raw_input</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">int</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="nam">provided_name</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="nam">provided_id</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">OwnershipDefinition</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="nam">table_name</span> <span class="op">=</span> <span class="nam">cls</span><span class="op">.</span><span class="nam">_ownership_table_name</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="nam">name_table</span><span class="op">,</span> <span class="nam">id_table</span> <span class="op">=</span> <span class="nam">_load_ownership_table_from_file</span><span class="op">(</span><span class="nam">table_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="nam">name_match</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="nam">name_table</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">provided_name</span><span class="op">)</span> <span class="key">if</span> <span class="nam">provided_name</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">else</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="nam">id_match</span> <span class="op">=</span> <span class="nam">id_table</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">provided_id</span><span class="op">)</span> <span class="key">if</span> <span class="nam">provided_id</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">else</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="key">if</span> <span class="nam">id_match</span> <span class="key">is</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">name_match</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">257 ↛ 258</span><span class="annotate long">line 257 didn't jump to line 258, because the condition on line 257 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="nam">name_part</span> <span class="op">=</span> <span class="nam">provided_name</span> <span class="key">if</span> <span class="nam">provided_name</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">else</span> <span class="str">"N/A"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="nam">id_part</span> <span class="op">=</span> <span class="nam">provided_id</span> <span class="key">if</span> <span class="nam">provided_id</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">else</span> <span class="str">"N/A"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="str">f'Cannot resolve "{raw_input}" as {cls._owner_type()} (from {attribute_path.path}):'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="str">f" It is not known to be a static {cls._owner_type()} from base-passwd."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="str">f' The value was interpreted as name: "{name_part}" and id: {id_part}'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="key">if</span> <span class="nam">id_match</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="key">assert</span> <span class="nam">name_match</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="key">return</span> <span class="nam">name_match</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="key">if</span> <span class="nam">name_match</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">268 ↛ 271</span><span class="annotate long">line 268 didn't jump to line 271, because the condition on line 268 was never false</span></span></p> - <p class="run"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="key">assert</span> <span class="nam">id_match</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="key">return</span> <span class="nam">id_match</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="key">if</span> <span class="nam">provided_name</span> <span class="op">!=</span> <span class="nam">id_match</span><span class="op">.</span><span class="nam">entity_name</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="str">f"Bad {cls._owner_type()} declaration: The id {provided_id} resolves to {id_match.entity_name}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="str">f" according to base-passwd, but the packager declared to should have been {provided_name}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="str">f" at {attribute_path.path}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="key">if</span> <span class="nam">provided_id</span> <span class="op">!=</span> <span class="nam">name_match</span><span class="op">.</span><span class="nam">entity_id</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="str">f"Bad {cls._owner_type} declaration: The name {provided_name} resolves to {name_match.entity_id}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="str">f" according to base-passwd, but the packager declared to should have been {provided_id}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="str">f" at {attribute_path.path}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="key">return</span> <span class="nam">id_match</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="key">def</span> <span class="nam">_owner_type</span><span class="op">(</span><span class="nam">cls</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Literal</span><span class="op">[</span><span class="str">"owner"</span><span class="op">,</span> <span class="str">"group"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="key">def</span> <span class="nam">_ownership_table_name</span><span class="op">(</span><span class="nam">cls</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Literal</span><span class="op">[</span><span class="str">"passwd.master"</span><span class="op">,</span> <span class="str">"group.master"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"><span class="key">class</span> <span class="nam">StaticFileSystemOwner</span><span class="op">(</span><span class="nam">_StaticFileSystemOwnerGroup</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> <span class="key">def</span> <span class="nam">_owner_type</span><span class="op">(</span><span class="nam">cls</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Literal</span><span class="op">[</span><span class="str">"owner"</span><span class="op">,</span> <span class="str">"group"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="key">return</span> <span class="str">"owner"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="key">def</span> <span class="nam">_ownership_table_name</span><span class="op">(</span><span class="nam">cls</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Literal</span><span class="op">[</span><span class="str">"passwd.master"</span><span class="op">,</span> <span class="str">"group.master"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="key">return</span> <span class="str">"passwd.master"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"><span class="key">class</span> <span class="nam">StaticFileSystemGroup</span><span class="op">(</span><span class="nam">_StaticFileSystemOwnerGroup</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> <span class="key">def</span> <span class="nam">_owner_type</span><span class="op">(</span><span class="nam">cls</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Literal</span><span class="op">[</span><span class="str">"owner"</span><span class="op">,</span> <span class="str">"group"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="key">return</span> <span class="str">"group"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="key">def</span> <span class="nam">_ownership_table_name</span><span class="op">(</span><span class="nam">cls</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Literal</span><span class="op">[</span><span class="str">"passwd.master"</span><span class="op">,</span> <span class="str">"group.master"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="key">return</span> <span class="str">"group.master"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"><span class="key">class</span> <span class="nam">SymlinkTarget</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="nam">raw_symlink_target</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="nam">symlink_target</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="key">def</span> <span class="nam">parse_symlink_target</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> <span class="nam">raw_symlink_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> <span class="nam">substitution</span><span class="op">:</span> <span class="nam">Substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"SymlinkTarget"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> <span class="key">return</span> <span class="nam">SymlinkTarget</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> <span class="nam">raw_symlink_target</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> <span class="nam">substitution</span><span class="op">.</span><span class="nam">substitute</span><span class="op">(</span><span class="nam">raw_symlink_target</span><span class="op">,</span> <span class="nam">attribute_path</span><span class="op">.</span><span class="nam">path</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"><span class="key">class</span> <span class="nam">FileSystemMatchRule</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> <span class="key">def</span> <span class="nam">raw_match_rule</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> <span class="key">def</span> <span class="nam">attribute_path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">AttributePath</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> <span class="key">def</span> <span class="nam">match_rule</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">MatchRule</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"> <span class="key">def</span> <span class="nam">parse_path_match</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"> <span class="nam">raw_match_rule</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"> <span class="nam">parser_context</span><span class="op">:</span> <span class="str">"ParserContextData"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"FileSystemMatchRule"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"> <span class="key">return</span> <span class="nam">cls</span><span class="op">.</span><span class="nam">from_path_match</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"> <span class="nam">raw_match_rule</span><span class="op">,</span> <span class="nam">attribute_path</span><span class="op">,</span> <span class="nam">parser_context</span><span class="op">.</span><span class="nam">substitution</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"> <span class="key">def</span> <span class="nam">from_path_match</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"> <span class="nam">raw_match_rule</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"> <span class="nam">substitution</span><span class="op">:</span> <span class="str">"Substitution"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"FileSystemMatchRule"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"> <span class="nam">mr</span> <span class="op">=</span> <span class="nam">MatchRule</span><span class="op">.</span><span class="nam">from_path_or_glob</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"> <span class="nam">raw_match_rule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"> <span class="nam">substitution</span><span class="op">=</span><span class="nam">substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"> <span class="key">except</span> <span class="nam">ValueError</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"> <span class="str">f'Could not parse "{raw_match_rule}" (defined at {attribute_path.path})'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"> <span class="str">f" as a path or a glob: {e.args[0]}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">mr</span><span class="op">,</span> <span class="nam">ExactFileSystemPath</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"> <span class="key">return</span> <span class="nam">FileSystemExactMatchRule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"> <span class="nam">raw_match_rule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"> <span class="nam">mr</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"> <span class="key">return</span> <span class="nam">FileSystemGenericMatch</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"> <span class="nam">raw_match_rule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t385" href="#t385">385</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t386" href="#t386">386</a></span><span class="t"> <span class="nam">mr</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t387" href="#t387">387</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t388" href="#t388">388</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t389" href="#t389">389</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t390" href="#t390">390</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t391" href="#t391">391</a></span><span class="t"><span class="key">class</span> <span class="nam">FileSystemGenericMatch</span><span class="op">(</span><span class="nam">FileSystemMatchRule</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t392" href="#t392">392</a></span><span class="t"> <span class="nam">raw_match_rule</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t393" href="#t393">393</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t394" href="#t394">394</a></span><span class="t"> <span class="nam">match_rule</span><span class="op">:</span> <span class="nam">MatchRule</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t395" href="#t395">395</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t396" href="#t396">396</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t397" href="#t397">397</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t398" href="#t398">398</a></span><span class="t"><span class="key">class</span> <span class="nam">FileSystemExactMatchRule</span><span class="op">(</span><span class="nam">FileSystemMatchRule</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t399" href="#t399">399</a></span><span class="t"> <span class="nam">raw_match_rule</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t400" href="#t400">400</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t401" href="#t401">401</a></span><span class="t"> <span class="nam">match_rule</span><span class="op">:</span> <span class="nam">ExactFileSystemPath</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t402" href="#t402">402</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t403" href="#t403">403</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t404" href="#t404">404</a></span><span class="t"> <span class="key">def</span> <span class="nam">from_path_match</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t405" href="#t405">405</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t406" href="#t406">406</a></span><span class="t"> <span class="nam">raw_match_rule</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t407" href="#t407">407</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t408" href="#t408">408</a></span><span class="t"> <span class="nam">substitution</span><span class="op">:</span> <span class="str">"Substitution"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t409" href="#t409">409</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"FileSystemExactMatchRule"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t410" href="#t410">410</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t411" href="#t411">411</a></span><span class="t"> <span class="nam">normalized</span> <span class="op">=</span> <span class="nam">_normalize_path</span><span class="op">(</span><span class="nam">raw_match_rule</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t412" href="#t412">412</a></span><span class="t"> <span class="key">except</span> <span class="nam">ValueError</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t413" href="#t413">413</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t414" href="#t414">414</a></span><span class="t"> <span class="str">f'The path "{raw_match_rule}" provided in {attribute_path.path} should be relative to the'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t415" href="#t415">415</a></span><span class="t"> <span class="str">' root of the package and not use any ".." or "." segments.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t416" href="#t416">416</a></span><span class="t"> <span class="op">)</span> <span class="key">from</span> <span class="nam">e</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t417" href="#t417">417</a></span><span class="t"> <span class="key">if</span> <span class="nam">normalized</span> <span class="op">==</span> <span class="str">"."</span><span class="op">:</span> </span><span class="r"><span class="annotate short">417 ↛ 418</span><span class="annotate long">line 417 didn't jump to line 418, because the condition on line 417 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t418" href="#t418">418</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t419" href="#t419">419</a></span><span class="t"> <span class="str">f'The path "{raw_match_rule}" matches a file system root and that is not a valid match'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t420" href="#t420">420</a></span><span class="t"> <span class="str">f' at "{attribute_path.path}". Please narrow the provided path.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t421" href="#t421">421</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t422" href="#t422">422</a></span><span class="t"> <span class="nam">mr</span> <span class="op">=</span> <span class="nam">ExactFileSystemPath</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t423" href="#t423">423</a></span><span class="t"> <span class="nam">substitution</span><span class="op">.</span><span class="nam">substitute</span><span class="op">(</span><span class="nam">normalized</span><span class="op">,</span> <span class="nam">attribute_path</span><span class="op">.</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t424" href="#t424">424</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t425" href="#t425">425</a></span><span class="t"> <span class="key">if</span> <span class="nam">mr</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span> <span class="key">and</span> <span class="nam">issubclass</span><span class="op">(</span><span class="nam">cls</span><span class="op">,</span> <span class="nam">FileSystemExactNonDirMatchRule</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">425 ↛ 426</span><span class="annotate long">line 425 didn't jump to line 426, because the condition on line 425 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t426" href="#t426">426</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t427" href="#t427">427</a></span><span class="t"> <span class="str">f'The path "{raw_match_rule}" at {attribute_path.path} resolved to'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t428" href="#t428">428</a></span><span class="t"> <span class="str">f' "{mr.path}". Since the resolved path ends with a slash ("/"), this'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t429" href="#t429">429</a></span><span class="t"> <span class="str">" means only a directory can match. However, this attribute should"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t430" href="#t430">430</a></span><span class="t"> <span class="str">" match a *non*-directory"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t431" href="#t431">431</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t432" href="#t432">432</a></span><span class="t"> <span class="key">return</span> <span class="nam">cls</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t433" href="#t433">433</a></span><span class="t"> <span class="nam">raw_match_rule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t434" href="#t434">434</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t435" href="#t435">435</a></span><span class="t"> <span class="nam">mr</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t436" href="#t436">436</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t437" href="#t437">437</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t438" href="#t438">438</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t439" href="#t439">439</a></span><span class="t"><span class="key">class</span> <span class="nam">FileSystemExactNonDirMatchRule</span><span class="op">(</span><span class="nam">FileSystemExactMatchRule</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t440" href="#t440">440</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_4f754ff76d8638bb___init___py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_4f754ff76d8638bb_declarative_parser_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_4f754ff76d8638bb_declarative_parser_py.html b/coverage-report/d_4f754ff76d8638bb_declarative_parser_py.html deleted file mode 100644 index 79bc071..0000000 --- a/coverage-report/d_4f754ff76d8638bb_declarative_parser_py.html +++ /dev/null @@ -1,2102 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/manifest_parser/declarative_parser.py: 76%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/manifest_parser/declarative_parser.py</b>: - <span class="pc_cov">76%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">781 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">620<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">161<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">70<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_4f754ff76d8638bb_base_types_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_4f754ff76d8638bb_exceptions_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">collections</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">dataclasses</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> <span class="nam">Callable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">TypedDict</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">Dict</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">get_type_hints</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">Annotated</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">get_args</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">get_origin</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">TypeVar</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">Generic</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">FrozenSet</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">Mapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">cast</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">is_typeddict</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">Type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">List</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="nam">Collection</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">NotRequired</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="nam">Iterable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="nam">Literal</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="nam">Sequence</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="nam">Container</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">base_types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="nam">DebputyParsedContent</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="nam">FileSystemMatchRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="nam">FileSystemExactMatchRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="nam">DebputyDispatchableType</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="nam">TypeMapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">exceptions</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">ManifestParseException</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">mapper_code</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">normalize_into_list</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">wrap_into_list</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="nam">map_each_element</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">parser_data</span> <span class="key">import</span> <span class="nam">ParserContextData</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">AttributePath</span><span class="op">,</span> <span class="nam">unpack_type</span><span class="op">,</span> <span class="nam">find_annotation</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">impl_types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="nam">DeclarativeInputParser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="nam">TD</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="nam">_ALL_PACKAGE_TYPES</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="nam">resolve_package_type_selectors</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="nam">ListWrappedDeclarativeInputParser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="nam">DispatchingObjectParser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="nam">DispatchingTableParser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">TTP</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="nam">TP</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="nam">InPackageContextParser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">spec</span> <span class="key">import</span> <span class="nam">ParserDocumentation</span><span class="op">,</span> <span class="nam">PackageTypeSelector</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">_info</span><span class="op">,</span> <span class="nam">_warn</span><span class="op">,</span> <span class="nam">assume_not_none</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"><span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="key">from</span> <span class="nam">Levenshtein</span> <span class="key">import</span> <span class="nam">distance</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"><span class="key">except</span> <span class="nam">ImportError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="nam">_WARN_ONCE</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="key">def</span> <span class="nam">_detect_possible_typo</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="nam">_key</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="nam">_value</span><span class="op">:</span> <span class="nam">object</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="nam">_manifest_attributes</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="str">"AttributeDescription"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="nam">_path</span><span class="op">:</span> <span class="str">"AttributePath"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="key">global</span> <span class="nam">_WARN_ONCE</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">_WARN_ONCE</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="nam">_WARN_ONCE</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="str">"Install python3-levenshtein to have debputy try to detect typos in the manifest."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"><span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="key">def</span> <span class="nam">_detect_possible_typo</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="nam">key</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="nam">value</span><span class="op">:</span> <span class="nam">object</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="nam">manifest_attributes</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="str">"AttributeDescription"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="str">"AttributePath"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="nam">k_len</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="nam">key_path</span> <span class="op">=</span> <span class="nam">path</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="nam">matches</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="nam">current_match_strength</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="key">for</span> <span class="nam">acceptable_key</span><span class="op">,</span> <span class="nam">attr</span> <span class="key">in</span> <span class="nam">manifest_attributes</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="key">if</span> <span class="nam">abs</span><span class="op">(</span><span class="nam">k_len</span> <span class="op">-</span> <span class="nam">len</span><span class="op">(</span><span class="nam">acceptable_key</span><span class="op">)</span><span class="op">)</span> <span class="op">></span> <span class="num">2</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="nam">d</span> <span class="op">=</span> <span class="nam">distance</span><span class="op">(</span><span class="nam">key</span><span class="op">,</span> <span class="nam">acceptable_key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="key">if</span> <span class="nam">d</span> <span class="op">></span> <span class="num">2</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="nam">attr</span><span class="op">.</span><span class="nam">type_validator</span><span class="op">.</span><span class="nam">ensure_type</span><span class="op">(</span><span class="nam">value</span><span class="op">,</span> <span class="nam">key_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="key">except</span> <span class="nam">ManifestParseException</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="key">if</span> <span class="nam">attr</span><span class="op">.</span><span class="nam">type_validator</span><span class="op">.</span><span class="nam">base_type_match</span><span class="op">(</span><span class="nam">value</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="nam">match_strength</span> <span class="op">=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="nam">match_strength</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="nam">match_strength</span> <span class="op">=</span> <span class="num">2</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="key">if</span> <span class="nam">match_strength</span> <span class="op"><</span> <span class="nam">current_match_strength</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="key">if</span> <span class="nam">match_strength</span> <span class="op">></span> <span class="nam">current_match_strength</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="nam">current_match_strength</span> <span class="op">=</span> <span class="nam">match_strength</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="nam">matches</span><span class="op">.</span><span class="nam">clear</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="nam">matches</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">acceptable_key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">matches</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="nam">ref</span> <span class="op">=</span> <span class="str">f'at "{path.path}"'</span> <span class="key">if</span> <span class="nam">path</span> <span class="key">else</span> <span class="str">"at the manifest root level"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">matches</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="nam">possible_match</span> <span class="op">=</span> <span class="nam">repr</span><span class="op">(</span><span class="nam">matches</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="str">f'Possible typo: The key "{key}" {ref} should probably have been {possible_match}'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="nam">matches</span><span class="op">.</span><span class="nam">sort</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="nam">possible_matches</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">repr</span><span class="op">(</span><span class="nam">a</span><span class="op">)</span> <span class="key">for</span> <span class="nam">a</span> <span class="key">in</span> <span class="nam">matches</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="str">f'Possible typo: The key "{key}" {ref} should probably have been one of {possible_matches}'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"><span class="nam">SF</span> <span class="op">=</span> <span class="nam">TypeVar</span><span class="op">(</span><span class="str">"SF"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"><span class="nam">T</span> <span class="op">=</span> <span class="nam">TypeVar</span><span class="op">(</span><span class="str">"T"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"><span class="nam">S</span> <span class="op">=</span> <span class="nam">TypeVar</span><span class="op">(</span><span class="str">"S"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"><span class="nam">_NONE_TYPE</span> <span class="op">=</span> <span class="nam">type</span><span class="op">(</span><span class="key">None</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"><span class="com"># These must be able to appear in an "isinstance" check and must be builtin types.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"><span class="nam">BASIC_SIMPLE_TYPES</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="nam">str</span><span class="op">:</span> <span class="str">"string"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="nam">int</span><span class="op">:</span> <span class="str">"integer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="nam">bool</span><span class="op">:</span> <span class="str">"boolean"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"><span class="key">class</span> <span class="nam">AttributeTypeHandler</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"_description"</span><span class="op">,</span> <span class="str">"_ensure_type"</span><span class="op">,</span> <span class="str">"base_type"</span><span class="op">,</span> <span class="str">"mapper"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="nam">description</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="nam">ensure_type</span><span class="op">:</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">Any</span><span class="op">,</span> <span class="nam">AttributePath</span><span class="op">]</span><span class="op">,</span> <span class="key">None</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="nam">base_type</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Type</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="nam">mapper</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">Any</span><span class="op">,</span> <span class="nam">AttributePath</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"ParserContextData"</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_description</span> <span class="op">=</span> <span class="nam">description</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_ensure_type</span> <span class="op">=</span> <span class="nam">ensure_type</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">base_type</span> <span class="op">=</span> <span class="nam">base_type</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">mapper</span> <span class="op">=</span> <span class="nam">mapper</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="key">def</span> <span class="nam">describe_type</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_description</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="key">def</span> <span class="nam">ensure_type</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">obj</span><span class="op">:</span> <span class="nam">object</span><span class="op">,</span> <span class="nam">path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_ensure_type</span><span class="op">(</span><span class="nam">obj</span><span class="op">,</span> <span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="key">def</span> <span class="nam">base_type_match</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">obj</span><span class="op">:</span> <span class="nam">object</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">base_type</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">base_type</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="key">return</span> <span class="nam">base_type</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">obj</span><span class="op">,</span> <span class="nam">base_type</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="key">def</span> <span class="nam">map_type</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="nam">value</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="nam">parser_context</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"ParserContextData"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Any</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="nam">mapper</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">mapper</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="key">if</span> <span class="nam">mapper</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="key">return</span> <span class="nam">mapper</span><span class="op">(</span><span class="nam">value</span><span class="op">,</span> <span class="nam">path</span><span class="op">,</span> <span class="nam">parser_context</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="key">return</span> <span class="nam">value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="key">def</span> <span class="nam">combine_mapper</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="nam">mapper</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">Any</span><span class="op">,</span> <span class="nam">AttributePath</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"ParserContextData"</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"AttributeTypeHandler"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="key">if</span> <span class="nam">mapper</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">mapper</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">mapper</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="key">def</span> <span class="nam">_combined_mapper</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="nam">value</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="nam">parser_context</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"ParserContextData"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Any</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="key">return</span> <span class="nam">mapper</span><span class="op">(</span><span class="nam">m</span><span class="op">(</span><span class="nam">value</span><span class="op">,</span> <span class="nam">path</span><span class="op">,</span> <span class="nam">parser_context</span><span class="op">)</span><span class="op">,</span> <span class="nam">path</span><span class="op">,</span> <span class="nam">parser_context</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="nam">_combined_mapper</span> <span class="op">=</span> <span class="nam">mapper</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="key">return</span> <span class="nam">AttributeTypeHandler</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_description</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_ensure_type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="nam">base_type</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">base_type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="nam">mapper</span><span class="op">=</span><span class="nam">_combined_mapper</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"><span class="key">class</span> <span class="nam">AttributeDescription</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="nam">source_attribute_name</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="nam">target_attribute</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="nam">attribute_type</span><span class="op">:</span> <span class="nam">Any</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="nam">type_validator</span><span class="op">:</span> <span class="nam">AttributeTypeHandler</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="nam">annotations</span><span class="op">:</span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">Any</span><span class="op">,</span> <span class="op">...</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="nam">conflicting_attributes</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="nam">conditional_required</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"ConditionalRequired"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="nam">parse_hints</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"DetectedDebputyParseHint"</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="nam">is_optional</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"><span class="key">def</span> <span class="nam">_extract_path_hint</span><span class="op">(</span><span class="nam">v</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="key">if</span> <span class="nam">attribute_path</span><span class="op">.</span><span class="nam">path_hint</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">230 ↛ 231</span><span class="annotate long">line 230 didn't jump to line 231, because the condition on line 230 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">.</span><span class="nam">path_hint</span> <span class="op">=</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="key">elif</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">list</span><span class="op">)</span> <span class="key">and</span> <span class="nam">len</span><span class="op">(</span><span class="nam">v</span><span class="op">)</span> <span class="op">></span> <span class="num">0</span> <span class="key">and</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">v</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">.</span><span class="nam">path_hint</span> <span class="op">=</span> <span class="nam">v</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"><span class="key">class</span> <span class="nam">DeclarativeNonMappingInputParser</span><span class="op">(</span><span class="nam">DeclarativeInputParser</span><span class="op">[</span><span class="nam">TD</span><span class="op">]</span><span class="op">,</span> <span class="nam">Generic</span><span class="op">[</span><span class="nam">TD</span><span class="op">,</span> <span class="nam">SF</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="nam">alt_form_parser</span><span class="op">:</span> <span class="nam">AttributeDescription</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ParserDocumentation</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="key">def</span> <span class="nam">parse_input</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="nam">value</span><span class="op">:</span> <span class="nam">object</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="nam">parser_context</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"ParserContextData"</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">TD</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">reference_documentation_url</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="nam">doc_ref</span> <span class="op">=</span> <span class="str">f" (Documentation: {self.reference_documentation_url})"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="nam">doc_ref</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="nam">alt_form_parser</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">alt_form_parser</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="key">if</span> <span class="nam">value</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">259 ↛ 260</span><span class="annotate long">line 259 didn't jump to line 260, because the condition on line 259 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="nam">form_note</span> <span class="op">=</span> <span class="str">f" The value must have type: {alt_form_parser.type_validator.describe_type()}"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">reference_documentation_url</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="nam">doc_ref</span> <span class="op">=</span> <span class="str">f" Please see {self.reference_documentation_url} for the documentation."</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="str">f"The attribute {path.path} was missing a value. {form_note}{doc_ref}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="nam">_extract_path_hint</span><span class="op">(</span><span class="nam">value</span><span class="op">,</span> <span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="nam">alt_form_parser</span><span class="op">.</span><span class="nam">type_validator</span><span class="op">.</span><span class="nam">ensure_type</span><span class="op">(</span><span class="nam">value</span><span class="op">,</span> <span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="nam">attribute</span> <span class="op">=</span> <span class="nam">alt_form_parser</span><span class="op">.</span><span class="nam">target_attribute</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="nam">alias_mapping</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="nam">attribute</span><span class="op">:</span> <span class="op">(</span><span class="str">""</span><span class="op">,</span> <span class="key">None</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="nam">v</span> <span class="op">=</span> <span class="nam">alt_form_parser</span><span class="op">.</span><span class="nam">type_validator</span><span class="op">.</span><span class="nam">map_type</span><span class="op">(</span><span class="nam">value</span><span class="op">,</span> <span class="nam">path</span><span class="op">,</span> <span class="nam">parser_context</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="nam">path</span><span class="op">.</span><span class="nam">alias_mapping</span> <span class="op">=</span> <span class="nam">alias_mapping</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="key">return</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"TD"</span><span class="op">,</span> <span class="op">{</span><span class="nam">attribute</span><span class="op">:</span> <span class="nam">v</span><span class="op">}</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"><span class="key">class</span> <span class="nam">DeclarativeMappingInputParser</span><span class="op">(</span><span class="nam">DeclarativeInputParser</span><span class="op">[</span><span class="nam">TD</span><span class="op">]</span><span class="op">,</span> <span class="nam">Generic</span><span class="op">[</span><span class="nam">TD</span><span class="op">,</span> <span class="nam">SF</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="nam">input_time_required_parameters</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="nam">all_parameters</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="nam">manifest_attributes</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="str">"AttributeDescription"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="nam">source_attributes</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="str">"AttributeDescription"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="nam">at_least_one_of</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="nam">alt_form_parser</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">AttributeDescription</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="nam">mutually_exclusive_attributes</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="nam">_per_attribute_conflicts_cache</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ParserDocumentation</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="nam">path_hint_source_attributes</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="nam">tuple</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="key">def</span> <span class="nam">_parse_alt_form</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> <span class="nam">value</span><span class="op">:</span> <span class="nam">object</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="nam">parser_context</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"ParserContextData"</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">TD</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="nam">alt_form_parser</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">alt_form_parser</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="key">if</span> <span class="nam">alt_form_parser</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">298 ↛ 299</span><span class="annotate long">line 298 didn't jump to line 299, because the condition on line 298 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="str">f"The attribute {path.path} must be a mapping.{self._doc_url_error_suffix()}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="nam">_extract_path_hint</span><span class="op">(</span><span class="nam">value</span><span class="op">,</span> <span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="nam">alt_form_parser</span><span class="op">.</span><span class="nam">type_validator</span><span class="op">.</span><span class="nam">ensure_type</span><span class="op">(</span><span class="nam">value</span><span class="op">,</span> <span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> <span class="key">assert</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="nam">value</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> <span class="str">"The alternative form was None, but the parser should have rejected None earlier."</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="nam">attribute</span> <span class="op">=</span> <span class="nam">alt_form_parser</span><span class="op">.</span><span class="nam">target_attribute</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="nam">alias_mapping</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="nam">attribute</span><span class="op">:</span> <span class="op">(</span><span class="str">""</span><span class="op">,</span> <span class="key">None</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="nam">v</span> <span class="op">=</span> <span class="nam">alt_form_parser</span><span class="op">.</span><span class="nam">type_validator</span><span class="op">.</span><span class="nam">map_type</span><span class="op">(</span><span class="nam">value</span><span class="op">,</span> <span class="nam">path</span><span class="op">,</span> <span class="nam">parser_context</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="nam">path</span><span class="op">.</span><span class="nam">alias_mapping</span> <span class="op">=</span> <span class="nam">alias_mapping</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="key">return</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"TD"</span><span class="op">,</span> <span class="op">{</span><span class="nam">attribute</span><span class="op">:</span> <span class="nam">v</span><span class="op">}</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="key">def</span> <span class="nam">_validate_expected_keys</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="nam">value</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">Any</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="nam">parser_context</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"ParserContextData"</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="nam">unknown_keys</span> <span class="op">=</span> <span class="nam">value</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span> <span class="op">-</span> <span class="nam">self</span><span class="op">.</span><span class="nam">all_parameters</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> <span class="nam">doc_ref</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_doc_url_error_suffix</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> <span class="key">if</span> <span class="nam">unknown_keys</span><span class="op">:</span> </span><span class="r"><span class="annotate short">324 ↛ 325</span><span class="annotate long">line 324 didn't jump to line 325, because the condition on line 324 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> <span class="key">for</span> <span class="nam">k</span> <span class="key">in</span> <span class="nam">unknown_keys</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">k</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> <span class="nam">_detect_possible_typo</span><span class="op">(</span><span class="nam">k</span><span class="op">,</span> <span class="nam">value</span><span class="op">[</span><span class="nam">k</span><span class="op">]</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">manifest_attributes</span><span class="op">,</span> <span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> <span class="nam">unused_keys</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">all_parameters</span> <span class="op">-</span> <span class="nam">value</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> <span class="key">if</span> <span class="nam">unused_keys</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> <span class="nam">k</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">unused_keys</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> <span class="str">f'Unknown keys "{unknown_keys}" at {path.path}". Keys that could be used here are: {k}.{doc_ref}'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> <span class="str">f'Unknown keys "{unknown_keys}" at {path.path}". Please remove them.{doc_ref}'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> <span class="nam">missing_keys</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">input_time_required_parameters</span> <span class="op">-</span> <span class="nam">value</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> <span class="key">if</span> <span class="nam">missing_keys</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"> <span class="nam">required</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">repr</span><span class="op">(</span><span class="nam">k</span><span class="op">)</span> <span class="key">for</span> <span class="nam">k</span> <span class="key">in</span> <span class="nam">sorted</span><span class="op">(</span><span class="nam">missing_keys</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"> <span class="str">f"The following keys were required but not present at {path.path}: {required}{doc_ref}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"> <span class="key">for</span> <span class="nam">maybe_required</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">all_parameters</span> <span class="op">-</span> <span class="nam">value</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> <span class="nam">attr</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">manifest_attributes</span><span class="op">[</span><span class="nam">maybe_required</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"> <span class="key">assert</span> <span class="nam">attr</span><span class="op">.</span><span class="nam">conditional_required</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">parser_context</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"><span class="annotate short">346 ↛ 352</span><span class="annotate long">line 346 didn't jump to line 352</span></span></p> - <p class="pln"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"> <span class="nam">attr</span><span class="op">.</span><span class="nam">conditional_required</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"> <span class="key">and</span> <span class="nam">attr</span><span class="op">.</span><span class="nam">conditional_required</span><span class="op">.</span><span class="nam">condition_applies</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">parser_context</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"> <span class="nam">reason</span> <span class="op">=</span> <span class="nam">attr</span><span class="op">.</span><span class="nam">conditional_required</span><span class="op">.</span><span class="nam">reason</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"> <span class="str">f'Missing the *conditionally* required attribute "{maybe_required}" at {path.path}. {reason}{doc_ref}'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"> <span class="key">for</span> <span class="nam">keyset</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">at_least_one_of</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"> <span class="nam">matched_keys</span> <span class="op">=</span> <span class="nam">value</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span> <span class="op">&</span> <span class="nam">keyset</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">matched_keys</span><span class="op">:</span> </span><span class="r"><span class="annotate short">358 ↛ 359</span><span class="annotate long">line 358 didn't jump to line 359, because the condition on line 358 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"> <span class="nam">conditionally_required</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">repr</span><span class="op">(</span><span class="nam">k</span><span class="op">)</span> <span class="key">for</span> <span class="nam">k</span> <span class="key">in</span> <span class="nam">sorted</span><span class="op">(</span><span class="nam">keyset</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"> <span class="str">f"At least one of the following keys must be present at {path.path}:"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"> <span class="str">f" {conditionally_required}{doc_ref}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"> <span class="key">for</span> <span class="nam">group</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">mutually_exclusive_attributes</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"> <span class="nam">matched</span> <span class="op">=</span> <span class="nam">value</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span> <span class="op">&</span> <span class="nam">group</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">matched</span><span class="op">)</span> <span class="op">></span> <span class="num">1</span><span class="op">:</span> </span><span class="r"><span class="annotate short">366 ↛ 367</span><span class="annotate long">line 366 didn't jump to line 367, because the condition on line 366 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"> <span class="nam">ck</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">repr</span><span class="op">(</span><span class="nam">k</span><span class="op">)</span> <span class="key">for</span> <span class="nam">k</span> <span class="key">in</span> <span class="nam">sorted</span><span class="op">(</span><span class="nam">matched</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"> <span class="str">f"Could not parse {path.path}: The following attributes are"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"> <span class="str">f" mutually exclusive: {ck}{doc_ref}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"> <span class="key">def</span> <span class="nam">_parse_typed_dict_form</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"> <span class="nam">value</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">Any</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"> <span class="nam">parser_context</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"ParserContextData"</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">TD</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_validate_expected_keys</span><span class="op">(</span><span class="nam">value</span><span class="op">,</span> <span class="nam">path</span><span class="op">,</span> <span class="nam">parser_context</span><span class="op">=</span><span class="nam">parser_context</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"> <span class="nam">result</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"> <span class="nam">per_attribute_conflicts</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_per_attribute_conflicts</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"> <span class="nam">alias_mapping</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"> <span class="key">for</span> <span class="nam">path_hint_source_attributes</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">path_hint_source_attributes</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t385" href="#t385">385</a></span><span class="t"> <span class="nam">v</span> <span class="op">=</span> <span class="nam">value</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">path_hint_source_attributes</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t386" href="#t386">386</a></span><span class="t"> <span class="key">if</span> <span class="nam">v</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">_extract_path_hint</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">path</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t387" href="#t387">387</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t388" href="#t388">388</a></span><span class="t"> <span class="key">for</span> <span class="nam">k</span><span class="op">,</span> <span class="nam">v</span> <span class="key">in</span> <span class="nam">value</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t389" href="#t389">389</a></span><span class="t"> <span class="nam">attr</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">manifest_attributes</span><span class="op">[</span><span class="nam">k</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t390" href="#t390">390</a></span><span class="t"> <span class="nam">matched</span> <span class="op">=</span> <span class="nam">value</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span> <span class="op">&</span> <span class="nam">per_attribute_conflicts</span><span class="op">[</span><span class="nam">k</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t391" href="#t391">391</a></span><span class="t"> <span class="key">if</span> <span class="nam">matched</span><span class="op">:</span> </span><span class="r"><span class="annotate short">391 ↛ 392</span><span class="annotate long">line 391 didn't jump to line 392, because the condition on line 391 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t392" href="#t392">392</a></span><span class="t"> <span class="nam">ck</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">repr</span><span class="op">(</span><span class="nam">k</span><span class="op">)</span> <span class="key">for</span> <span class="nam">k</span> <span class="key">in</span> <span class="nam">sorted</span><span class="op">(</span><span class="nam">matched</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t393" href="#t393">393</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t394" href="#t394">394</a></span><span class="t"> <span class="str">f'The attribute "{k}" at {path.path} cannot be used with the following'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t395" href="#t395">395</a></span><span class="t"> <span class="str">f" attributes: {ck}{self._doc_url_error_suffix()}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t396" href="#t396">396</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t397" href="#t397">397</a></span><span class="t"> <span class="nam">nk</span> <span class="op">=</span> <span class="nam">attr</span><span class="op">.</span><span class="nam">target_attribute</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t398" href="#t398">398</a></span><span class="t"> <span class="nam">key_path</span> <span class="op">=</span> <span class="nam">path</span><span class="op">[</span><span class="nam">k</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t399" href="#t399">399</a></span><span class="t"> <span class="nam">attr</span><span class="op">.</span><span class="nam">type_validator</span><span class="op">.</span><span class="nam">ensure_type</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">key_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t400" href="#t400">400</a></span><span class="t"> <span class="key">if</span> <span class="nam">v</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">400 ↛ 401</span><span class="annotate long">line 400 didn't jump to line 401, because the condition on line 400 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t401" href="#t401">401</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t402" href="#t402">402</a></span><span class="t"> <span class="key">if</span> <span class="nam">k</span> <span class="op">!=</span> <span class="nam">nk</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t403" href="#t403">403</a></span><span class="t"> <span class="nam">alias_mapping</span><span class="op">[</span><span class="nam">nk</span><span class="op">]</span> <span class="op">=</span> <span class="nam">k</span><span class="op">,</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t404" href="#t404">404</a></span><span class="t"> <span class="nam">v</span> <span class="op">=</span> <span class="nam">attr</span><span class="op">.</span><span class="nam">type_validator</span><span class="op">.</span><span class="nam">map_type</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">key_path</span><span class="op">,</span> <span class="nam">parser_context</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t405" href="#t405">405</a></span><span class="t"> <span class="nam">result</span><span class="op">[</span><span class="nam">nk</span><span class="op">]</span> <span class="op">=</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t406" href="#t406">406</a></span><span class="t"> <span class="key">if</span> <span class="nam">alias_mapping</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t407" href="#t407">407</a></span><span class="t"> <span class="nam">path</span><span class="op">.</span><span class="nam">alias_mapping</span> <span class="op">=</span> <span class="nam">alias_mapping</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t408" href="#t408">408</a></span><span class="t"> <span class="key">return</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"TD"</span><span class="op">,</span> <span class="nam">result</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t409" href="#t409">409</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t410" href="#t410">410</a></span><span class="t"> <span class="key">def</span> <span class="nam">_doc_url_error_suffix</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">see_url_version</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t411" href="#t411">411</a></span><span class="t"> <span class="nam">doc_url</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">reference_documentation_url</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t412" href="#t412">412</a></span><span class="t"> <span class="key">if</span> <span class="nam">doc_url</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t413" href="#t413">413</a></span><span class="t"> <span class="key">if</span> <span class="nam">see_url_version</span><span class="op">:</span> </span><span class="r"><span class="annotate short">413 ↛ 414</span><span class="annotate long">line 413 didn't jump to line 414, because the condition on line 413 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t414" href="#t414">414</a></span><span class="t"> <span class="key">return</span> <span class="str">f" Please see {doc_url} for the documentation."</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t415" href="#t415">415</a></span><span class="t"> <span class="key">return</span> <span class="str">f" (Documentation: {doc_url})"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t416" href="#t416">416</a></span><span class="t"> <span class="key">return</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t417" href="#t417">417</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t418" href="#t418">418</a></span><span class="t"> <span class="key">def</span> <span class="nam">parse_input</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t419" href="#t419">419</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t420" href="#t420">420</a></span><span class="t"> <span class="nam">value</span><span class="op">:</span> <span class="nam">object</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t421" href="#t421">421</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t422" href="#t422">422</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t423" href="#t423">423</a></span><span class="t"> <span class="nam">parser_context</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"ParserContextData"</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t424" href="#t424">424</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">TD</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t425" href="#t425">425</a></span><span class="t"> <span class="key">if</span> <span class="nam">value</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">425 ↛ 426</span><span class="annotate long">line 425 didn't jump to line 426, because the condition on line 425 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t426" href="#t426">426</a></span><span class="t"> <span class="nam">form_note</span> <span class="op">=</span> <span class="str">" The attribute must be a mapping."</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t427" href="#t427">427</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">alt_form_parser</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t428" href="#t428">428</a></span><span class="t"> <span class="nam">form_note</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t429" href="#t429">429</a></span><span class="t"> <span class="str">" The attribute can be a mapping or a non-mapping format"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t430" href="#t430">430</a></span><span class="t"> <span class="str">' (usually, "non-mapping format" means a string or a list of strings).'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t431" href="#t431">431</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t432" href="#t432">432</a></span><span class="t"> <span class="nam">doc_ref</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_doc_url_error_suffix</span><span class="op">(</span><span class="nam">see_url_version</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t433" href="#t433">433</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t434" href="#t434">434</a></span><span class="t"> <span class="str">f"The attribute {path.path} was missing a value. {form_note}{doc_ref}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t435" href="#t435">435</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t436" href="#t436">436</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t437" href="#t437">437</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">value</span><span class="op">,</span> <span class="nam">dict</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t438" href="#t438">438</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parse_alt_form</span><span class="op">(</span><span class="nam">value</span><span class="op">,</span> <span class="nam">path</span><span class="op">,</span> <span class="nam">parser_context</span><span class="op">=</span><span class="nam">parser_context</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t439" href="#t439">439</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parse_typed_dict_form</span><span class="op">(</span><span class="nam">value</span><span class="op">,</span> <span class="nam">path</span><span class="op">,</span> <span class="nam">parser_context</span><span class="op">=</span><span class="nam">parser_context</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t440" href="#t440">440</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t441" href="#t441">441</a></span><span class="t"> <span class="key">def</span> <span class="nam">_per_attribute_conflicts</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t442" href="#t442">442</a></span><span class="t"> <span class="nam">conflicts</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_per_attribute_conflicts_cache</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t443" href="#t443">443</a></span><span class="t"> <span class="key">if</span> <span class="nam">conflicts</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t444" href="#t444">444</a></span><span class="t"> <span class="key">return</span> <span class="nam">conflicts</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t445" href="#t445">445</a></span><span class="t"> <span class="nam">attrs</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">source_attributes</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t446" href="#t446">446</a></span><span class="t"> <span class="nam">conflicts</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t447" href="#t447">447</a></span><span class="t"> <span class="nam">a</span><span class="op">.</span><span class="nam">source_attribute_name</span><span class="op">:</span> <span class="nam">frozenset</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t448" href="#t448">448</a></span><span class="t"> <span class="nam">attrs</span><span class="op">[</span><span class="nam">ca</span><span class="op">]</span><span class="op">.</span><span class="nam">source_attribute_name</span> <span class="key">for</span> <span class="nam">ca</span> <span class="key">in</span> <span class="nam">a</span><span class="op">.</span><span class="nam">conflicting_attributes</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t449" href="#t449">449</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t450" href="#t450">450</a></span><span class="t"> <span class="key">for</span> <span class="nam">a</span> <span class="key">in</span> <span class="nam">attrs</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t451" href="#t451">451</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t452" href="#t452">452</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_per_attribute_conflicts_cache</span> <span class="op">=</span> <span class="nam">conflicts</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t453" href="#t453">453</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_per_attribute_conflicts_cache</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t454" href="#t454">454</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t455" href="#t455">455</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t456" href="#t456">456</a></span><span class="t"><span class="key">class</span> <span class="nam">DebputyParseHint</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t457" href="#t457">457</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t458" href="#t458">458</a></span><span class="t"> <span class="key">def</span> <span class="nam">target_attribute</span><span class="op">(</span><span class="nam">cls</span><span class="op">,</span> <span class="nam">target_attribute</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="str">"DebputyParseHint"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t459" href="#t459">459</a></span><span class="t"> <span class="str">"""Define this source attribute to have a different target attribute name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t460" href="#t460">460</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t461" href="#t461">461</a></span><span class="t"><span class="str"> As an example:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t462" href="#t462">462</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t463" href="#t463">463</a></span><span class="t"><span class="str"> >>> class SourceType(TypedDict):</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t464" href="#t464">464</a></span><span class="t"><span class="str"> ... source: Annotated[NotRequired[str], DebputyParseHint.target_attribute("sources")]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t465" href="#t465">465</a></span><span class="t"><span class="str"> ... sources: NotRequired[List[str]]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t466" href="#t466">466</a></span><span class="t"><span class="str"> >>> class TargetType(TypedDict):</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t467" href="#t467">467</a></span><span class="t"><span class="str"> ... sources: List[str]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t468" href="#t468">468</a></span><span class="t"><span class="str"> >>> pg = ParserGenerator()</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t469" href="#t469">469</a></span><span class="t"><span class="str"> >>> parser = pg.generate_parser(TargetType, source_content=SourceType)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t470" href="#t470">470</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t471" href="#t471">471</a></span><span class="t"><span class="str"> In this example, the user can provide either `source` or `sources` and the parser will</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t472" href="#t472">472</a></span><span class="t"><span class="str"> map them to the `sources` attribute in the `TargetType`. Note this example relies on</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t473" href="#t473">473</a></span><span class="t"><span class="str"> the builtin mapping of `str` to `List[str]` to align the types between `source` (from</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t474" href="#t474">474</a></span><span class="t"><span class="str"> SourceType) and `sources` (from TargetType).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t475" href="#t475">475</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t476" href="#t476">476</a></span><span class="t"><span class="str"> The following rules apply:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t477" href="#t477">477</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t478" href="#t478">478</a></span><span class="t"><span class="str"> * All source attributes that map to the same target attribute will be mutually exclusive</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t479" href="#t479">479</a></span><span class="t"><span class="str"> (that is, the user cannot give `source` *and* `sources` as input).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t480" href="#t480">480</a></span><span class="t"><span class="str"> * When the target attribute is required, the source attributes are conditionally</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t481" href="#t481">481</a></span><span class="t"><span class="str"> mandatory requiring the user to provide exactly one of them.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t482" href="#t482">482</a></span><span class="t"><span class="str"> * When multiple source attributes point to a single target attribute, none of the source</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t483" href="#t483">483</a></span><span class="t"><span class="str"> attributes can be Required.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t484" href="#t484">484</a></span><span class="t"><span class="str"> * The annotation can only be used for the source type specification and the source type</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t485" href="#t485">485</a></span><span class="t"><span class="str"> specification must be different from the target type specification.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t486" href="#t486">486</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t487" href="#t487">487</a></span><span class="t"><span class="str"> The `target_attribute` annotation can be used without having multiple source attributes. This</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t488" href="#t488">488</a></span><span class="t"><span class="str"> can be useful if the source attribute name is not valid as a python variable identifier to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t489" href="#t489">489</a></span><span class="t"><span class="str"> rename it to a valid python identifier.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t490" href="#t490">490</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t491" href="#t491">491</a></span><span class="t"><span class="str"> :param target_attribute: The attribute name in the target content</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t492" href="#t492">492</a></span><span class="t"><span class="str"> :return: The annotation.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t493" href="#t493">493</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t494" href="#t494">494</a></span><span class="t"> <span class="key">return</span> <span class="nam">TargetAttribute</span><span class="op">(</span><span class="nam">target_attribute</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t495" href="#t495">495</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t496" href="#t496">496</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t497" href="#t497">497</a></span><span class="t"> <span class="key">def</span> <span class="nam">conflicts_with_source_attributes</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t498" href="#t498">498</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t499" href="#t499">499</a></span><span class="t"> <span class="op">*</span><span class="nam">conflicting_source_attributes</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t500" href="#t500">500</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"DebputyParseHint"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t501" href="#t501">501</a></span><span class="t"> <span class="str">"""Declare a conflict with one or more source attributes</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t502" href="#t502">502</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t503" href="#t503">503</a></span><span class="t"><span class="str"> Example:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t504" href="#t504">504</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t505" href="#t505">505</a></span><span class="t"><span class="str"> >>> class SourceType(TypedDict):</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t506" href="#t506">506</a></span><span class="t"><span class="str"> ... source: Annotated[NotRequired[str], DebputyParseHint.target_attribute("sources")]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t507" href="#t507">507</a></span><span class="t"><span class="str"> ... sources: NotRequired[List[str]]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t508" href="#t508">508</a></span><span class="t"><span class="str"> ... into_dir: NotRequired[str]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t509" href="#t509">509</a></span><span class="t"><span class="str"> ... renamed_to: Annotated[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t510" href="#t510">510</a></span><span class="t"><span class="str"> ... NotRequired[str],</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t511" href="#t511">511</a></span><span class="t"><span class="str"> ... DebputyParseHint.conflicts_with_source_attributes("sources", "into_dir")</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t512" href="#t512">512</a></span><span class="t"><span class="str"> ... ]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t513" href="#t513">513</a></span><span class="t"><span class="str"> >>> class TargetType(TypedDict):</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t514" href="#t514">514</a></span><span class="t"><span class="str"> ... sources: List[str]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t515" href="#t515">515</a></span><span class="t"><span class="str"> ... into_dir: NotRequired[str]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t516" href="#t516">516</a></span><span class="t"><span class="str"> ... renamed_to: NotRequired[str]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t517" href="#t517">517</a></span><span class="t"><span class="str"> >>> pg = ParserGenerator()</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t518" href="#t518">518</a></span><span class="t"><span class="str"> >>> parser = pg.generate_parser(TargetType, source_content=SourceType)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t519" href="#t519">519</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t520" href="#t520">520</a></span><span class="t"><span class="str"> In this example, if the user was to provide `renamed_to` with `sources` or `into_dir` the parser would report</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t521" href="#t521">521</a></span><span class="t"><span class="str"> an error. However, the parser will allow `renamed_to` with `source` as the conflict is considered only for</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t522" href="#t522">522</a></span><span class="t"><span class="str"> the input source. That is, it is irrelevant that `sources` and `source´ happens to "map" to the same target</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t523" href="#t523">523</a></span><span class="t"><span class="str"> attribute.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t524" href="#t524">524</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t525" href="#t525">525</a></span><span class="t"><span class="str"> The following rules apply:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t526" href="#t526">526</a></span><span class="t"><span class="str"> * It is not possible for a target attribute to declare conflicts unless the target type spec is reused as</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t527" href="#t527">527</a></span><span class="t"><span class="str"> source type spec.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t528" href="#t528">528</a></span><span class="t"><span class="str"> * All attributes involved in a conflict must be NotRequired. If any of the attributes are Required, then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t529" href="#t529">529</a></span><span class="t"><span class="str"> the parser generator will reject the input.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t530" href="#t530">530</a></span><span class="t"><span class="str"> * All attributes listed in the conflict must be valid attributes in the source type spec.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t531" href="#t531">531</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t532" href="#t532">532</a></span><span class="t"><span class="str"> Note you do not have to specify conflicts between two attributes with the same target attribute name. The</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t533" href="#t533">533</a></span><span class="t"><span class="str"> `target_attribute` annotation will handle that for you.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t534" href="#t534">534</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t535" href="#t535">535</a></span><span class="t"><span class="str"> :param conflicting_source_attributes: All source attributes that cannot be used with this attribute.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t536" href="#t536">536</a></span><span class="t"><span class="str"> :return: The annotation.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t537" href="#t537">537</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t538" href="#t538">538</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">conflicting_source_attributes</span><span class="op">)</span> <span class="op"><</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"><span class="annotate short">538 ↛ 539</span><span class="annotate long">line 538 didn't jump to line 539, because the condition on line 538 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t539" href="#t539">539</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t540" href="#t540">540</a></span><span class="t"> <span class="str">"DebputyParseHint.conflicts_with_source_attributes requires at least one attribute as input"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t541" href="#t541">541</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t542" href="#t542">542</a></span><span class="t"> <span class="key">return</span> <span class="nam">ConflictWithSourceAttribute</span><span class="op">(</span><span class="nam">frozenset</span><span class="op">(</span><span class="nam">conflicting_source_attributes</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t543" href="#t543">543</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t544" href="#t544">544</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t545" href="#t545">545</a></span><span class="t"> <span class="key">def</span> <span class="nam">required_when_single_binary</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t546" href="#t546">546</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t547" href="#t547">547</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t548" href="#t548">548</a></span><span class="t"> <span class="nam">package_type</span><span class="op">:</span> <span class="nam">PackageTypeSelector</span> <span class="op">=</span> <span class="nam">_ALL_PACKAGE_TYPES</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t549" href="#t549">549</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"DebputyParseHint"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t550" href="#t550">550</a></span><span class="t"> <span class="str">"""Declare a source attribute as required when the source package produces exactly one binary package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t551" href="#t551">551</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t552" href="#t552">552</a></span><span class="t"><span class="str"> The attribute in question must always be declared as `NotRequired` in the TypedDict and this condition</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t553" href="#t553">553</a></span><span class="t"><span class="str"> can only be used for source attributes.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t554" href="#t554">554</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t555" href="#t555">555</a></span><span class="t"> <span class="nam">resolved_package_types</span> <span class="op">=</span> <span class="nam">resolve_package_type_selectors</span><span class="op">(</span><span class="nam">package_type</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t556" href="#t556">556</a></span><span class="t"> <span class="nam">reason</span> <span class="op">=</span> <span class="str">"The field is required for source packages producing exactly one binary package"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t557" href="#t557">557</a></span><span class="t"> <span class="key">if</span> <span class="nam">resolved_package_types</span> <span class="op">!=</span> <span class="nam">_ALL_PACKAGE_TYPES</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t558" href="#t558">558</a></span><span class="t"> <span class="nam">types</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">sorted</span><span class="op">(</span><span class="nam">resolved_package_types</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t559" href="#t559">559</a></span><span class="t"> <span class="nam">reason</span> <span class="op">+=</span> <span class="str">f" of type {types}"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t560" href="#t560">560</a></span><span class="t"> <span class="key">return</span> <span class="nam">ConditionalRequired</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t561" href="#t561">561</a></span><span class="t"> <span class="nam">reason</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t562" href="#t562">562</a></span><span class="t"> <span class="key">lambda</span> <span class="nam">c</span><span class="op">:</span> <span class="nam">len</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t563" href="#t563">563</a></span><span class="t"> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t564" href="#t564">564</a></span><span class="t"> <span class="nam">p</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t565" href="#t565">565</a></span><span class="t"> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">c</span><span class="op">.</span><span class="nam">binary_packages</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t566" href="#t566">566</a></span><span class="t"> <span class="key">if</span> <span class="nam">p</span><span class="op">.</span><span class="nam">package_type</span> <span class="key">in</span> <span class="nam">package_type</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t567" href="#t567">567</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t568" href="#t568">568</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t569" href="#t569">569</a></span><span class="t"> <span class="op">==</span> <span class="num">1</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t570" href="#t570">570</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t571" href="#t571">571</a></span><span class="t"> <span class="key">return</span> <span class="nam">ConditionalRequired</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t572" href="#t572">572</a></span><span class="t"> <span class="nam">reason</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t573" href="#t573">573</a></span><span class="t"> <span class="key">lambda</span> <span class="nam">c</span><span class="op">:</span> <span class="nam">c</span><span class="op">.</span><span class="nam">is_single_binary_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t574" href="#t574">574</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t575" href="#t575">575</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t576" href="#t576">576</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t577" href="#t577">577</a></span><span class="t"> <span class="key">def</span> <span class="nam">required_when_multi_binary</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t578" href="#t578">578</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t579" href="#t579">579</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t580" href="#t580">580</a></span><span class="t"> <span class="nam">package_type</span><span class="op">:</span> <span class="nam">PackageTypeSelector</span> <span class="op">=</span> <span class="nam">_ALL_PACKAGE_TYPES</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t581" href="#t581">581</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"DebputyParseHint"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t582" href="#t582">582</a></span><span class="t"> <span class="str">"""Declare a source attribute as required when the source package produces two or more binary package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t583" href="#t583">583</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t584" href="#t584">584</a></span><span class="t"><span class="str"> The attribute in question must always be declared as `NotRequired` in the TypedDict and this condition</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t585" href="#t585">585</a></span><span class="t"><span class="str"> can only be used for source attributes.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t586" href="#t586">586</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t587" href="#t587">587</a></span><span class="t"> <span class="nam">resolved_package_types</span> <span class="op">=</span> <span class="nam">resolve_package_type_selectors</span><span class="op">(</span><span class="nam">package_type</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t588" href="#t588">588</a></span><span class="t"> <span class="nam">reason</span> <span class="op">=</span> <span class="str">"The field is required for source packages producing two or more binary packages"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t589" href="#t589">589</a></span><span class="t"> <span class="key">if</span> <span class="nam">resolved_package_types</span> <span class="op">!=</span> <span class="nam">_ALL_PACKAGE_TYPES</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t590" href="#t590">590</a></span><span class="t"> <span class="nam">types</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">sorted</span><span class="op">(</span><span class="nam">resolved_package_types</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t591" href="#t591">591</a></span><span class="t"> <span class="nam">reason</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t592" href="#t592">592</a></span><span class="t"> <span class="str">"The field is required for source packages producing not producing exactly one binary packages"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t593" href="#t593">593</a></span><span class="t"> <span class="str">f" of type {types}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t594" href="#t594">594</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t595" href="#t595">595</a></span><span class="t"> <span class="key">return</span> <span class="nam">ConditionalRequired</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t596" href="#t596">596</a></span><span class="t"> <span class="nam">reason</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t597" href="#t597">597</a></span><span class="t"> <span class="key">lambda</span> <span class="nam">c</span><span class="op">:</span> <span class="nam">len</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t598" href="#t598">598</a></span><span class="t"> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t599" href="#t599">599</a></span><span class="t"> <span class="nam">p</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t600" href="#t600">600</a></span><span class="t"> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">c</span><span class="op">.</span><span class="nam">binary_packages</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t601" href="#t601">601</a></span><span class="t"> <span class="key">if</span> <span class="nam">p</span><span class="op">.</span><span class="nam">package_type</span> <span class="key">in</span> <span class="nam">package_type</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t602" href="#t602">602</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t603" href="#t603">603</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t604" href="#t604">604</a></span><span class="t"> <span class="op">!=</span> <span class="num">1</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t605" href="#t605">605</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t606" href="#t606">606</a></span><span class="t"> <span class="key">return</span> <span class="nam">ConditionalRequired</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t607" href="#t607">607</a></span><span class="t"> <span class="nam">reason</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t608" href="#t608">608</a></span><span class="t"> <span class="key">lambda</span> <span class="nam">c</span><span class="op">:</span> <span class="key">not</span> <span class="nam">c</span><span class="op">.</span><span class="nam">is_single_binary_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t609" href="#t609">609</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t610" href="#t610">610</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t611" href="#t611">611</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t612" href="#t612">612</a></span><span class="t"> <span class="key">def</span> <span class="nam">manifest_attribute</span><span class="op">(</span><span class="nam">cls</span><span class="op">,</span> <span class="nam">attribute</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="str">"DebputyParseHint"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t613" href="#t613">613</a></span><span class="t"> <span class="str">"""Declare what the attribute name (as written in the manifest) should be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t614" href="#t614">614</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t615" href="#t615">615</a></span><span class="t"><span class="str"> By default, debputy will do an attribute normalizing that will take valid python identifiers such</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t616" href="#t616">616</a></span><span class="t"><span class="str"> as `dest_dir` and remap it to the manifest variant (such as `dest-dir`) automatically. If you have</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t617" href="#t617">617</a></span><span class="t"><span class="str"> a special case, where this built-in normalization is insufficient or the python name is considerably</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t618" href="#t618">618</a></span><span class="t"><span class="str"> different from what the user would write in the manifest, you can use this parse hint to set the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t619" href="#t619">619</a></span><span class="t"><span class="str"> name that the user would have to write in the manifest for this attribute.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t620" href="#t620">620</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t621" href="#t621">621</a></span><span class="t"><span class="str"> >>> class SourceType(TypedDict):</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t622" href="#t622">622</a></span><span class="t"><span class="str"> ... source: List[FileSystemMatchRule]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t623" href="#t623">623</a></span><span class="t"><span class="str"> ... # Use "as" in the manifest because "as_" was not pretty enough</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t624" href="#t624">624</a></span><span class="t"><span class="str"> ... install_as: Annotated[NotRequired[FileSystemExactMatchRule], DebputyParseHint.manifest_attribute("as")]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t625" href="#t625">625</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t626" href="#t626">626</a></span><span class="t"><span class="str"> In this example, we use the parse hint to use "as" as the name in the manifest, because we cannot</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t627" href="#t627">627</a></span><span class="t"><span class="str"> use "as" a valid python identifier (it is a keyword). While debputy would map `as_` to `as` for us,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t628" href="#t628">628</a></span><span class="t"><span class="str"> we have chosen to use `install_as` as a python identifier.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t629" href="#t629">629</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t630" href="#t630">630</a></span><span class="t"> <span class="key">return</span> <span class="nam">ManifestAttribute</span><span class="op">(</span><span class="nam">attribute</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t631" href="#t631">631</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t632" href="#t632">632</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t633" href="#t633">633</a></span><span class="t"> <span class="key">def</span> <span class="nam">not_path_error_hint</span><span class="op">(</span><span class="nam">cls</span><span class="op">)</span> <span class="op">-></span> <span class="str">"DebputyParseHint"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t634" href="#t634">634</a></span><span class="t"> <span class="str">"""Mark this attribute as not a "path hint" when it comes to reporting errors</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t635" href="#t635">635</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t636" href="#t636">636</a></span><span class="t"><span class="str"> By default, `debputy` will pick up attributes that uses path names (FileSystemMatchRule) as</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t637" href="#t637">637</a></span><span class="t"><span class="str"> candidates for parse error hints (the little "<Search for: VALUE>" in error messages).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t638" href="#t638">638</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t639" href="#t639">639</a></span><span class="t"><span class="str"> Most rules only have one active path-based attribute and paths tends to be unique enough</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t640" href="#t640">640</a></span><span class="t"><span class="str"> that it helps people spot the issue faster. However, in rare cases, you can have multiple</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t641" href="#t641">641</a></span><span class="t"><span class="str"> attributes that fit the bill. In this case, this hint can be used to "hide" the suboptimal</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t642" href="#t642">642</a></span><span class="t"><span class="str"> choice. As an example:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t643" href="#t643">643</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t644" href="#t644">644</a></span><span class="t"><span class="str"> >>> class SourceType(TypedDict):</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t645" href="#t645">645</a></span><span class="t"><span class="str"> ... source: List[FileSystemMatchRule]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t646" href="#t646">646</a></span><span class="t"><span class="str"> ... install_as: Annotated[NotRequired[FileSystemExactMatchRule], DebputyParseHint.not_path_error_hint()]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t647" href="#t647">647</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t648" href="#t648">648</a></span><span class="t"><span class="str"> In this case, without the hint, `debputy` might pick up `install_as` as the attribute to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t649" href="#t649">649</a></span><span class="t"><span class="str"> use as hint for error reporting. However, here we have decided that we never want `install_as`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t650" href="#t650">650</a></span><span class="t"><span class="str"> leaving `source` as the only option.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t651" href="#t651">651</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t652" href="#t652">652</a></span><span class="t"><span class="str"> Generally, this type hint must be placed on the **source** format. Any source attribute matching</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t653" href="#t653">653</a></span><span class="t"><span class="str"> the parsed format will be ignored.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t654" href="#t654">654</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t655" href="#t655">655</a></span><span class="t"><span class="str"> Mind the asymmetry: The annotation is placed in the **source** format while `debputy` looks at</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t656" href="#t656">656</a></span><span class="t"><span class="str"> the type of the target attribute to determine if it counts as path.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t657" href="#t657">657</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t658" href="#t658">658</a></span><span class="t"> <span class="key">return</span> <span class="nam">NOT_PATH_HINT</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t659" href="#t659">659</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t660" href="#t660">660</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t661" href="#t661">661</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t662" href="#t662">662</a></span><span class="t"><span class="key">class</span> <span class="nam">TargetAttribute</span><span class="op">(</span><span class="nam">DebputyParseHint</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t663" href="#t663">663</a></span><span class="t"> <span class="nam">attribute</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t664" href="#t664">664</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t665" href="#t665">665</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t666" href="#t666">666</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t667" href="#t667">667</a></span><span class="t"><span class="key">class</span> <span class="nam">ConflictWithSourceAttribute</span><span class="op">(</span><span class="nam">DebputyParseHint</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t668" href="#t668">668</a></span><span class="t"> <span class="nam">conflicting_attributes</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t669" href="#t669">669</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t670" href="#t670">670</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t671" href="#t671">671</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t672" href="#t672">672</a></span><span class="t"><span class="key">class</span> <span class="nam">ConditionalRequired</span><span class="op">(</span><span class="nam">DebputyParseHint</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t673" href="#t673">673</a></span><span class="t"> <span class="nam">reason</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t674" href="#t674">674</a></span><span class="t"> <span class="nam">condition</span><span class="op">:</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="str">"ParserContextData"</span><span class="op">]</span><span class="op">,</span> <span class="nam">bool</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t675" href="#t675">675</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t676" href="#t676">676</a></span><span class="t"> <span class="key">def</span> <span class="nam">condition_applies</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">context</span><span class="op">:</span> <span class="str">"ParserContextData"</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t677" href="#t677">677</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">condition</span><span class="op">(</span><span class="nam">context</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t678" href="#t678">678</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t679" href="#t679">679</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t680" href="#t680">680</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t681" href="#t681">681</a></span><span class="t"><span class="key">class</span> <span class="nam">ManifestAttribute</span><span class="op">(</span><span class="nam">DebputyParseHint</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t682" href="#t682">682</a></span><span class="t"> <span class="nam">attribute</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t683" href="#t683">683</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t684" href="#t684">684</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t685" href="#t685">685</a></span><span class="t"><span class="key">class</span> <span class="nam">NotPathHint</span><span class="op">(</span><span class="nam">DebputyParseHint</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t686" href="#t686">686</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t687" href="#t687">687</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t688" href="#t688">688</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t689" href="#t689">689</a></span><span class="t"><span class="nam">NOT_PATH_HINT</span> <span class="op">=</span> <span class="nam">NotPathHint</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t690" href="#t690">690</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t691" href="#t691">691</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t692" href="#t692">692</a></span><span class="t"><span class="key">def</span> <span class="nam">_is_path_attribute_candidate</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t693" href="#t693">693</a></span><span class="t"> <span class="nam">source_attribute</span><span class="op">:</span> <span class="nam">AttributeDescription</span><span class="op">,</span> <span class="nam">target_attribute</span><span class="op">:</span> <span class="nam">AttributeDescription</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t694" href="#t694">694</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t695" href="#t695">695</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t696" href="#t696">696</a></span><span class="t"> <span class="nam">source_attribute</span><span class="op">.</span><span class="nam">parse_hints</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t697" href="#t697">697</a></span><span class="t"> <span class="key">and</span> <span class="key">not</span> <span class="nam">source_attribute</span><span class="op">.</span><span class="nam">parse_hints</span><span class="op">.</span><span class="nam">applicable_as_path_hint</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t698" href="#t698">698</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t699" href="#t699">699</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t700" href="#t700">700</a></span><span class="t"> <span class="nam">target_type</span> <span class="op">=</span> <span class="nam">target_attribute</span><span class="op">.</span><span class="nam">attribute_type</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t701" href="#t701">701</a></span><span class="t"> <span class="nam">_</span><span class="op">,</span> <span class="nam">origin</span><span class="op">,</span> <span class="nam">args</span> <span class="op">=</span> <span class="nam">unpack_type</span><span class="op">(</span><span class="nam">target_type</span><span class="op">,</span> <span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t702" href="#t702">702</a></span><span class="t"> <span class="nam">match_type</span> <span class="op">=</span> <span class="nam">target_type</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t703" href="#t703">703</a></span><span class="t"> <span class="key">if</span> <span class="nam">origin</span> <span class="op">==</span> <span class="nam">list</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t704" href="#t704">704</a></span><span class="t"> <span class="nam">match_type</span> <span class="op">=</span> <span class="nam">args</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t705" href="#t705">705</a></span><span class="t"> <span class="key">return</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">match_type</span><span class="op">,</span> <span class="nam">type</span><span class="op">)</span> <span class="key">and</span> <span class="nam">issubclass</span><span class="op">(</span><span class="nam">match_type</span><span class="op">,</span> <span class="nam">FileSystemMatchRule</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t706" href="#t706">706</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t707" href="#t707">707</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t708" href="#t708">708</a></span><span class="t"><span class="key">class</span> <span class="nam">ParserGenerator</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t709" href="#t709">709</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t710" href="#t710">710</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_registered_types</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">Any</span><span class="op">,</span> <span class="nam">TypeMapping</span><span class="op">[</span><span class="nam">Any</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t711" href="#t711">711</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_object_parsers</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">DispatchingObjectParser</span><span class="op">]</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t712" href="#t712">712</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_table_parsers</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t713" href="#t713">713</a></span><span class="t"> <span class="nam">Type</span><span class="op">[</span><span class="nam">DebputyDispatchableType</span><span class="op">]</span><span class="op">,</span> <span class="nam">DispatchingTableParser</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t714" href="#t714">714</a></span><span class="t"> <span class="op">]</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t715" href="#t715">715</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_in_package_context_parser</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t716" href="#t716">716</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t717" href="#t717">717</a></span><span class="t"> <span class="key">def</span> <span class="nam">register_mapped_type</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">mapped_type</span><span class="op">:</span> <span class="nam">TypeMapping</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t718" href="#t718">718</a></span><span class="t"> <span class="nam">existing</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_registered_types</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">mapped_type</span><span class="op">.</span><span class="nam">target_type</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t719" href="#t719">719</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">719 ↛ 720</span><span class="annotate long">line 719 didn't jump to line 720, because the condition on line 719 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t720" href="#t720">720</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">f"The type {existing} is already registered"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t721" href="#t721">721</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_registered_types</span><span class="op">[</span><span class="nam">mapped_type</span><span class="op">.</span><span class="nam">target_type</span><span class="op">]</span> <span class="op">=</span> <span class="nam">mapped_type</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t722" href="#t722">722</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t723" href="#t723">723</a></span><span class="t"> <span class="key">def</span> <span class="nam">discard_mapped_type</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">mapped_type</span><span class="op">:</span> <span class="nam">Type</span><span class="op">[</span><span class="nam">T</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t724" href="#t724">724</a></span><span class="t"> <span class="key">del</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_registered_types</span><span class="op">[</span><span class="nam">mapped_type</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t725" href="#t725">725</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t726" href="#t726">726</a></span><span class="t"> <span class="key">def</span> <span class="nam">add_table_parser</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">rt</span><span class="op">:</span> <span class="nam">Type</span><span class="op">[</span><span class="nam">DebputyDispatchableType</span><span class="op">]</span><span class="op">,</span> <span class="nam">path</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t727" href="#t727">727</a></span><span class="t"> <span class="key">assert</span> <span class="nam">rt</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_table_parsers</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t728" href="#t728">728</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_table_parsers</span><span class="op">[</span><span class="nam">rt</span><span class="op">]</span> <span class="op">=</span> <span class="nam">DispatchingTableParser</span><span class="op">(</span><span class="nam">rt</span><span class="op">,</span> <span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t729" href="#t729">729</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t730" href="#t730">730</a></span><span class="t"> <span class="key">def</span> <span class="nam">add_object_parser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t731" href="#t731">731</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t732" href="#t732">732</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t733" href="#t733">733</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t734" href="#t734">734</a></span><span class="t"> <span class="nam">parser_documentation</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ParserDocumentation</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t735" href="#t735">735</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t736" href="#t736">736</a></span><span class="t"> <span class="key">assert</span> <span class="nam">path</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_in_package_context_parser</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t737" href="#t737">737</a></span><span class="t"> <span class="key">assert</span> <span class="nam">path</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_object_parsers</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t738" href="#t738">738</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_object_parsers</span><span class="op">[</span><span class="nam">path</span><span class="op">]</span> <span class="op">=</span> <span class="nam">DispatchingObjectParser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t739" href="#t739">739</a></span><span class="t"> <span class="nam">path</span><span class="op">,</span> <span class="nam">parser_documentation</span><span class="op">=</span><span class="nam">parser_documentation</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t740" href="#t740">740</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t741" href="#t741">741</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t742" href="#t742">742</a></span><span class="t"> <span class="key">def</span> <span class="nam">add_in_package_context_parser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t743" href="#t743">743</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t744" href="#t744">744</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t745" href="#t745">745</a></span><span class="t"> <span class="nam">delegate</span><span class="op">:</span> <span class="nam">DeclarativeInputParser</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t746" href="#t746">746</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t747" href="#t747">747</a></span><span class="t"> <span class="key">assert</span> <span class="nam">path</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_in_package_context_parser</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t748" href="#t748">748</a></span><span class="t"> <span class="key">assert</span> <span class="nam">path</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_object_parsers</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t749" href="#t749">749</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_in_package_context_parser</span><span class="op">[</span><span class="nam">path</span><span class="op">]</span> <span class="op">=</span> <span class="nam">InPackageContextParser</span><span class="op">(</span><span class="nam">path</span><span class="op">,</span> <span class="nam">delegate</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t750" href="#t750">750</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t751" href="#t751">751</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t752" href="#t752">752</a></span><span class="t"> <span class="key">def</span> <span class="nam">dispatchable_table_parsers</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t753" href="#t753">753</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t754" href="#t754">754</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">Type</span><span class="op">[</span><span class="nam">DebputyDispatchableType</span><span class="op">]</span><span class="op">,</span> <span class="nam">DispatchingTableParser</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t755" href="#t755">755</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_table_parsers</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t756" href="#t756">756</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t757" href="#t757">757</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t758" href="#t758">758</a></span><span class="t"> <span class="key">def</span> <span class="nam">dispatchable_object_parsers</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">DispatchingObjectParser</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t759" href="#t759">759</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_object_parsers</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t760" href="#t760">760</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t761" href="#t761">761</a></span><span class="t"> <span class="key">def</span> <span class="nam">dispatch_parser_table_for</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t762" href="#t762">762</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> <span class="nam">rule_type</span><span class="op">:</span> <span class="nam">TTP</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t763" href="#t763">763</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">DispatchingTableParser</span><span class="op">[</span><span class="nam">TP</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t764" href="#t764">764</a></span><span class="t"> <span class="key">return</span> <span class="nam">cast</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t765" href="#t765">765</a></span><span class="t"> <span class="str">"Optional[DispatchingTableParser[TP]]"</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_table_parsers</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">rule_type</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t766" href="#t766">766</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t767" href="#t767">767</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t768" href="#t768">768</a></span><span class="t"> <span class="key">def</span> <span class="nam">generate_parser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t769" href="#t769">769</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t770" href="#t770">770</a></span><span class="t"> <span class="nam">parsed_content</span><span class="op">:</span> <span class="nam">Type</span><span class="op">[</span><span class="nam">TD</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t771" href="#t771">771</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t772" href="#t772">772</a></span><span class="t"> <span class="nam">source_content</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">SF</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t773" href="#t773">773</a></span><span class="t"> <span class="nam">allow_optional</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t774" href="#t774">774</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ParserDocumentation</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t775" href="#t775">775</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">DeclarativeInputParser</span><span class="op">[</span><span class="nam">TD</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t776" href="#t776">776</a></span><span class="t"> <span class="str">"""Derive a parser from a TypedDict</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t777" href="#t777">777</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t778" href="#t778">778</a></span><span class="t"><span class="str"> Generates a parser for a segment of the manifest (think the `install-docs` snippet) from a TypedDict</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t779" href="#t779">779</a></span><span class="t"><span class="str"> or two that are used as a description.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t780" href="#t780">780</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t781" href="#t781">781</a></span><span class="t"><span class="str"> In its most simple use-case, the caller provides a TypedDict of the expected attributed along with</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t782" href="#t782">782</a></span><span class="t"><span class="str"> their types. As an example:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t783" href="#t783">783</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t784" href="#t784">784</a></span><span class="t"><span class="str"> >>> class InstallDocsRule(DebputyParsedContent):</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t785" href="#t785">785</a></span><span class="t"><span class="str"> ... sources: List[str]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t786" href="#t786">786</a></span><span class="t"><span class="str"> ... into: List[str]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t787" href="#t787">787</a></span><span class="t"><span class="str"> >>> pg = ParserGenerator()</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t788" href="#t788">788</a></span><span class="t"><span class="str"> >>> simple_parser = pg.generate_parser(InstallDocsRule)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t789" href="#t789">789</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t790" href="#t790">790</a></span><span class="t"><span class="str"> This will create a parser that would be able to interpret something like:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t791" href="#t791">791</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t792" href="#t792">792</a></span><span class="t"><span class="str"> ```yaml</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t793" href="#t793">793</a></span><span class="t"><span class="str"> install-docs:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t794" href="#t794">794</a></span><span class="t"><span class="str"> sources: ["docs/*"]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t795" href="#t795">795</a></span><span class="t"><span class="str"> into: ["my-pkg"]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t796" href="#t796">796</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t797" href="#t797">797</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t798" href="#t798">798</a></span><span class="t"><span class="str"> While this is sufficient for programmers, it is a bit rigid for the packager writing the manifest. Therefore,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t799" href="#t799">799</a></span><span class="t"><span class="str"> you can also provide a TypedDict describing the input, enabling more flexibility:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t800" href="#t800">800</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t801" href="#t801">801</a></span><span class="t"><span class="str"> >>> class InstallDocsRule(DebputyParsedContent):</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t802" href="#t802">802</a></span><span class="t"><span class="str"> ... sources: List[str]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t803" href="#t803">803</a></span><span class="t"><span class="str"> ... into: List[str]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t804" href="#t804">804</a></span><span class="t"><span class="str"> >>> class InputDocsRuleInputFormat(TypedDict):</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t805" href="#t805">805</a></span><span class="t"><span class="str"> ... source: NotRequired[Annotated[str, DebputyParseHint.target_attribute("sources")]]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t806" href="#t806">806</a></span><span class="t"><span class="str"> ... sources: NotRequired[List[str]]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t807" href="#t807">807</a></span><span class="t"><span class="str"> ... into: Union[str, List[str]]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t808" href="#t808">808</a></span><span class="t"><span class="str"> >>> pg = ParserGenerator()</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t809" href="#t809">809</a></span><span class="t"><span class="str"> >>> flexible_parser = pg.generate_parser(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t810" href="#t810">810</a></span><span class="t"><span class="str"> ... InstallDocsRule,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t811" href="#t811">811</a></span><span class="t"><span class="str"> ... source_content=InputDocsRuleInputFormat,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t812" href="#t812">812</a></span><span class="t"><span class="str"> ... )</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t813" href="#t813">813</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t814" href="#t814">814</a></span><span class="t"><span class="str"> In this case, the `sources` field can either come from a single `source` in the manifest (which must be a string)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t815" href="#t815">815</a></span><span class="t"><span class="str"> or `sources` (which must be a list of strings). The parser also ensures that only one of `source` or `sources`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t816" href="#t816">816</a></span><span class="t"><span class="str"> is used to ensure the input is not ambiguous. For the `into` parameter, the parser will accept it being a str</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t817" href="#t817">817</a></span><span class="t"><span class="str"> or a list of strings. Regardless of how the input was provided, the parser will normalize the input such that</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t818" href="#t818">818</a></span><span class="t"><span class="str"> both `sources` and `into` in the result is a list of strings. As an example, this parser can accept</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t819" href="#t819">819</a></span><span class="t"><span class="str"> both the previous input but also the following input:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t820" href="#t820">820</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t821" href="#t821">821</a></span><span class="t"><span class="str"> ```yaml</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t822" href="#t822">822</a></span><span class="t"><span class="str"> install-docs:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t823" href="#t823">823</a></span><span class="t"><span class="str"> source: "docs/*"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t824" href="#t824">824</a></span><span class="t"><span class="str"> into: "my-pkg"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t825" href="#t825">825</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t826" href="#t826">826</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t827" href="#t827">827</a></span><span class="t"><span class="str"> The `source` and `into` attributes are then normalized to lists as if the user had written them as lists</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t828" href="#t828">828</a></span><span class="t"><span class="str"> with a single string in them. As noted above, the name of the `source` attribute will also be normalized</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t829" href="#t829">829</a></span><span class="t"><span class="str"> while parsing.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t830" href="#t830">830</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t831" href="#t831">831</a></span><span class="t"><span class="str"> In the cases where only one field is required by the user, it can sometimes make sense to allow a non-dict</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t832" href="#t832">832</a></span><span class="t"><span class="str"> as part of the input. Example:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t833" href="#t833">833</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t834" href="#t834">834</a></span><span class="t"><span class="str"> >>> class DiscardRule(DebputyParsedContent):</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t835" href="#t835">835</a></span><span class="t"><span class="str"> ... paths: List[str]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t836" href="#t836">836</a></span><span class="t"><span class="str"> >>> class DiscardRuleInputDictFormat(TypedDict):</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t837" href="#t837">837</a></span><span class="t"><span class="str"> ... path: NotRequired[Annotated[str, DebputyParseHint.target_attribute("paths")]]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t838" href="#t838">838</a></span><span class="t"><span class="str"> ... paths: NotRequired[List[str]]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t839" href="#t839">839</a></span><span class="t"><span class="str"> >>> # This format relies on DiscardRule having exactly one Required attribute</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t840" href="#t840">840</a></span><span class="t"><span class="str"> >>> DiscardRuleInputWithAltFormat = Union[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t841" href="#t841">841</a></span><span class="t"><span class="str"> ... DiscardRuleInputDictFormat,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t842" href="#t842">842</a></span><span class="t"><span class="str"> ... str,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t843" href="#t843">843</a></span><span class="t"><span class="str"> ... List[str],</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t844" href="#t844">844</a></span><span class="t"><span class="str"> ... ]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t845" href="#t845">845</a></span><span class="t"><span class="str"> >>> pg = ParserGenerator()</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t846" href="#t846">846</a></span><span class="t"><span class="str"> >>> flexible_parser = pg.generate_parser(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t847" href="#t847">847</a></span><span class="t"><span class="str"> ... DiscardRule,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t848" href="#t848">848</a></span><span class="t"><span class="str"> ... source_content=DiscardRuleInputWithAltFormat,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t849" href="#t849">849</a></span><span class="t"><span class="str"> ... )</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t850" href="#t850">850</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t851" href="#t851">851</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t852" href="#t852">852</a></span><span class="t"><span class="str"> Supported types:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t853" href="#t853">853</a></span><span class="t"><span class="str"> * `List` - must have a fixed type argument (such as `List[str]`)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t854" href="#t854">854</a></span><span class="t"><span class="str"> * `str`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t855" href="#t855">855</a></span><span class="t"><span class="str"> * `int`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t856" href="#t856">856</a></span><span class="t"><span class="str"> * `BinaryPackage` - When provided (or required), the user must provide a package name listed</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t857" href="#t857">857</a></span><span class="t"><span class="str"> in the debian/control file. The code receives the BinaryPackage instance</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t858" href="#t858">858</a></span><span class="t"><span class="str"> matching that input.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t859" href="#t859">859</a></span><span class="t"><span class="str"> * `FileSystemMode` - When provided (or required), the user must provide a file system mode in any</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t860" href="#t860">860</a></span><span class="t"><span class="str"> format that `debputy' provides (such as `0644` or `a=rw,go=rw`).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t861" href="#t861">861</a></span><span class="t"><span class="str"> * `FileSystemOwner` - When provided (or required), the user must a file system owner that is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t862" href="#t862">862</a></span><span class="t"><span class="str"> available statically on all Debian systems (must be in `base-passwd`).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t863" href="#t863">863</a></span><span class="t"><span class="str"> The user has multiple options for how to specify it (either via name or id).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t864" href="#t864">864</a></span><span class="t"><span class="str"> * `FileSystemGroup` - When provided (or required), the user must a file system group that is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t865" href="#t865">865</a></span><span class="t"><span class="str"> available statically on all Debian systems (must be in `base-passwd`).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t866" href="#t866">866</a></span><span class="t"><span class="str"> The user has multiple options for how to specify it (either via name or id).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t867" href="#t867">867</a></span><span class="t"><span class="str"> * `ManifestCondition` - When provided (or required), the user must specify a conditional rule to apply.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t868" href="#t868">868</a></span><span class="t"><span class="str"> Usually, it is better to extend `DebputyParsedContentStandardConditional`, which</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t869" href="#t869">869</a></span><span class="t"><span class="str"> provides the `debputy' default `when` parameter for conditionals.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t870" href="#t870">870</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t871" href="#t871">871</a></span><span class="t"><span class="str"> Supported special type-like parameters:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t872" href="#t872">872</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t873" href="#t873">873</a></span><span class="t"><span class="str"> * `Required` / `NotRequired` to mark a field as `Required` or `NotRequired`. Must be provided at the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t874" href="#t874">874</a></span><span class="t"><span class="str"> outermost level. Cannot vary between `parsed_content` and `source_content`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t875" href="#t875">875</a></span><span class="t"><span class="str"> * `Annotated`. Accepted at the outermost level (inside Required/NotRequired) but ignored at the moment.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t876" href="#t876">876</a></span><span class="t"><span class="str"> * `Union`. Must be the outermost level (inside `Annotated` or/and `Required`/`NotRequired` if these are present).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t877" href="#t877">877</a></span><span class="t"><span class="str"> Automapping (see below) is restricted to two members in the Union.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t878" href="#t878">878</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t879" href="#t879">879</a></span><span class="t"><span class="str"> Notable non-supported types:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t880" href="#t880">880</a></span><span class="t"><span class="str"> * `Mapping` and all variants therefore (such as `dict`). In the future, nested `TypedDict`s may be allowed.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t881" href="#t881">881</a></span><span class="t"><span class="str"> * `Optional` (or `Union[..., None]`): Use `NotRequired` for optional fields.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t882" href="#t882">882</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t883" href="#t883">883</a></span><span class="t"><span class="str"> Automatic mapping rules from `source_content` to `parsed_content`:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t884" href="#t884">884</a></span><span class="t"><span class="str"> - `Union[T, List[T]]` can be narrowed automatically to `List[T]`. Transformation is basically:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t885" href="#t885">885</a></span><span class="t"><span class="str"> `lambda value: value if isinstance(value, list) else [value]`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t886" href="#t886">886</a></span><span class="t"><span class="str"> - `T` can be mapped automatically to `List[T]`, Transformation being: `lambda value: [value]`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t887" href="#t887">887</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t888" href="#t888">888</a></span><span class="t"><span class="str"> Additionally, types can be annotated (`Annotated[str, ...]`) with `DebputyParseHint`s. Check its classmethod</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t889" href="#t889">889</a></span><span class="t"><span class="str"> for concrete features that may be useful to you.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t890" href="#t890">890</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t891" href="#t891">891</a></span><span class="t"><span class="str"> :param parsed_content: A DebputyParsedContent / TypedDict describing the desired model of the input once parsed.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t892" href="#t892">892</a></span><span class="t"><span class="str"> (DebputyParsedContent is a TypedDict subclass that work around some inadequate type checkers).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t893" href="#t893">893</a></span><span class="t"><span class="str"> It can also be a `List[DebputyParsedContent]`. In that case, `source_content` must be a</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t894" href="#t894">894</a></span><span class="t"><span class="str"> `List[TypedDict[...]]`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t895" href="#t895">895</a></span><span class="t"><span class="str"> :param source_content: Optionally, a TypedDict describing the input allowed by the user. This can be useful</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t896" href="#t896">896</a></span><span class="t"><span class="str"> to describe more variations than in `parsed_content` that the parser will normalize for you. If omitted,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t897" href="#t897">897</a></span><span class="t"><span class="str"> the parsed_content is also considered the source_content (which affects what annotations are allowed in it).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t898" href="#t898">898</a></span><span class="t"><span class="str"> Note you should never pass the parsed_content as source_content directly.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t899" href="#t899">899</a></span><span class="t"><span class="str"> :param allow_optional: In rare cases, you want to support explicitly provided vs. optional. In this case, you</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t900" href="#t900">900</a></span><span class="t"><span class="str"> should set this to True. Though, in 99.9% of all cases, you want `NotRequired` rather than `Optional` (and</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t901" href="#t901">901</a></span><span class="t"><span class="str"> can keep this False).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t902" href="#t902">902</a></span><span class="t"><span class="str"> :param inline_reference_documentation: Optionally, programmatic documentation</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t903" href="#t903">903</a></span><span class="t"><span class="str"> :return: An input parser capable of reading input matching the TypedDict(s) used as reference.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t904" href="#t904">904</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t905" href="#t905">905</a></span><span class="t"> <span class="nam">orig_parsed_content</span> <span class="op">=</span> <span class="nam">parsed_content</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t906" href="#t906">906</a></span><span class="t"> <span class="key">if</span> <span class="nam">source_content</span> <span class="key">is</span> <span class="nam">parsed_content</span><span class="op">:</span> </span><span class="r"><span class="annotate short">906 ↛ 907</span><span class="annotate long">line 906 didn't jump to line 907, because the condition on line 906 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t907" href="#t907">907</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t908" href="#t908">908</a></span><span class="t"> <span class="str">"Do not provide source_content if it is the same as parsed_content"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t909" href="#t909">909</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t910" href="#t910">910</a></span><span class="t"> <span class="nam">is_list_wrapped</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t911" href="#t911">911</a></span><span class="t"> <span class="key">if</span> <span class="nam">get_origin</span><span class="op">(</span><span class="nam">orig_parsed_content</span><span class="op">)</span> <span class="op">==</span> <span class="nam">list</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t912" href="#t912">912</a></span><span class="t"> <span class="nam">parsed_content</span> <span class="op">=</span> <span class="nam">get_args</span><span class="op">(</span><span class="nam">orig_parsed_content</span><span class="op">)</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t913" href="#t913">913</a></span><span class="t"> <span class="nam">is_list_wrapped</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t914" href="#t914">914</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t915" href="#t915">915</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">parsed_content</span><span class="op">,</span> <span class="nam">type</span><span class="op">)</span> <span class="key">and</span> <span class="nam">issubclass</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t916" href="#t916">916</a></span><span class="t"> <span class="nam">parsed_content</span><span class="op">,</span> <span class="nam">DebputyDispatchableType</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t917" href="#t917">917</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t918" href="#t918">918</a></span><span class="t"> <span class="nam">parser</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">dispatch_parser_table_for</span><span class="op">(</span><span class="nam">parsed_content</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t919" href="#t919">919</a></span><span class="t"> <span class="key">if</span> <span class="nam">parser</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">919 ↛ 920</span><span class="annotate long">line 919 didn't jump to line 920, because the condition on line 919 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t920" href="#t920">920</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t921" href="#t921">921</a></span><span class="t"> <span class="str">f"Unsupported parsed_content descriptor: {parsed_content.__qualname__}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t922" href="#t922">922</a></span><span class="t"> <span class="str">f" The class {parsed_content.__qualname__} is not a pre-registered type."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t923" href="#t923">923</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t924" href="#t924">924</a></span><span class="t"> <span class="com"># FIXME: Only the list wrapped version has documentation.</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t925" href="#t925">925</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_list_wrapped</span><span class="op">:</span> </span><span class="r"><span class="annotate short">925 ↛ 930</span><span class="annotate long">line 925 didn't jump to line 930, because the condition on line 925 was never false</span></span></p> - <p class="run"><span class="n"><a id="t926" href="#t926">926</a></span><span class="t"> <span class="nam">parser</span> <span class="op">=</span> <span class="nam">ListWrappedDeclarativeInputParser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t927" href="#t927">927</a></span><span class="t"> <span class="nam">parser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t928" href="#t928">928</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">inline_reference_documentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t929" href="#t929">929</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t930" href="#t930">930</a></span><span class="t"> <span class="key">return</span> <span class="nam">parser</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t931" href="#t931">931</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t932" href="#t932">932</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">is_typeddict</span><span class="op">(</span><span class="nam">parsed_content</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">932 ↛ 933</span><span class="annotate long">line 932 didn't jump to line 933, because the condition on line 932 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t933" href="#t933">933</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t934" href="#t934">934</a></span><span class="t"> <span class="str">f"Unsupported parsed_content descriptor: {parsed_content.__qualname__}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t935" href="#t935">935</a></span><span class="t"> <span class="str">' Only "TypedDict"-based types and a subset of "DebputyDispatchableType" are supported.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t936" href="#t936">936</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t937" href="#t937">937</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_list_wrapped</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t938" href="#t938">938</a></span><span class="t"> <span class="key">if</span> <span class="nam">get_origin</span><span class="op">(</span><span class="nam">source_content</span><span class="op">)</span> <span class="op">!=</span> <span class="nam">list</span><span class="op">:</span> </span><span class="r"><span class="annotate short">938 ↛ 939</span><span class="annotate long">line 938 didn't jump to line 939, because the condition on line 938 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t939" href="#t939">939</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t940" href="#t940">940</a></span><span class="t"> <span class="str">"If the parsed_content is a List type, then source_format must be a List type as well."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t941" href="#t941">941</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t942" href="#t942">942</a></span><span class="t"> <span class="nam">source_content</span> <span class="op">=</span> <span class="nam">get_args</span><span class="op">(</span><span class="nam">source_content</span><span class="op">)</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t943" href="#t943">943</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t944" href="#t944">944</a></span><span class="t"> <span class="nam">target_attributes</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parse_types</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t945" href="#t945">945</a></span><span class="t"> <span class="nam">parsed_content</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t946" href="#t946">946</a></span><span class="t"> <span class="nam">allow_source_attribute_annotations</span><span class="op">=</span><span class="nam">source_content</span> <span class="key">is</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t947" href="#t947">947</a></span><span class="t"> <span class="nam">forbid_optional</span><span class="op">=</span><span class="key">not</span> <span class="nam">allow_optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t948" href="#t948">948</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t949" href="#t949">949</a></span><span class="t"> <span class="nam">required_target_parameters</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span><span class="nam">parsed_content</span><span class="op">.</span><span class="nam">__required_keys__</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t950" href="#t950">950</a></span><span class="t"> <span class="nam">parsed_alt_form</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t951" href="#t951">951</a></span><span class="t"> <span class="nam">non_mapping_source_only</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t952" href="#t952">952</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t953" href="#t953">953</a></span><span class="t"> <span class="key">if</span> <span class="nam">source_content</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t954" href="#t954">954</a></span><span class="t"> <span class="nam">default_target_attribute</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t955" href="#t955">955</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">required_target_parameters</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t956" href="#t956">956</a></span><span class="t"> <span class="nam">default_target_attribute</span> <span class="op">=</span> <span class="nam">next</span><span class="op">(</span><span class="nam">iter</span><span class="op">(</span><span class="nam">required_target_parameters</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t957" href="#t957">957</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t958" href="#t958">958</a></span><span class="t"> <span class="nam">source_typed_dict</span><span class="op">,</span> <span class="nam">alt_source_forms</span> <span class="op">=</span> <span class="nam">_extract_typed_dict</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t959" href="#t959">959</a></span><span class="t"> <span class="nam">source_content</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t960" href="#t960">960</a></span><span class="t"> <span class="nam">default_target_attribute</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t961" href="#t961">961</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t962" href="#t962">962</a></span><span class="t"> <span class="key">if</span> <span class="nam">alt_source_forms</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t963" href="#t963">963</a></span><span class="t"> <span class="nam">parsed_alt_form</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parse_alt_form</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t964" href="#t964">964</a></span><span class="t"> <span class="nam">alt_source_forms</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t965" href="#t965">965</a></span><span class="t"> <span class="nam">default_target_attribute</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t966" href="#t966">966</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t967" href="#t967">967</a></span><span class="t"> <span class="key">if</span> <span class="nam">source_typed_dict</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t968" href="#t968">968</a></span><span class="t"> <span class="nam">source_content_attributes</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parse_types</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t969" href="#t969">969</a></span><span class="t"> <span class="nam">source_typed_dict</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t970" href="#t970">970</a></span><span class="t"> <span class="nam">allow_target_attribute_annotation</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t971" href="#t971">971</a></span><span class="t"> <span class="nam">allow_source_attribute_annotations</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t972" href="#t972">972</a></span><span class="t"> <span class="nam">forbid_optional</span><span class="op">=</span><span class="key">not</span> <span class="nam">allow_optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t973" href="#t973">973</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t974" href="#t974">974</a></span><span class="t"> <span class="nam">source_content_parameter</span> <span class="op">=</span> <span class="str">"source_content"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t975" href="#t975">975</a></span><span class="t"> <span class="nam">source_and_parsed_differs</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t976" href="#t976">976</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t977" href="#t977">977</a></span><span class="t"> <span class="nam">source_typed_dict</span> <span class="op">=</span> <span class="nam">parsed_content</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t978" href="#t978">978</a></span><span class="t"> <span class="nam">source_content_attributes</span> <span class="op">=</span> <span class="nam">target_attributes</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t979" href="#t979">979</a></span><span class="t"> <span class="nam">source_content_parameter</span> <span class="op">=</span> <span class="str">"parsed_content"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t980" href="#t980">980</a></span><span class="t"> <span class="nam">source_and_parsed_differs</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t981" href="#t981">981</a></span><span class="t"> <span class="nam">non_mapping_source_only</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t982" href="#t982">982</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t983" href="#t983">983</a></span><span class="t"> <span class="nam">source_typed_dict</span> <span class="op">=</span> <span class="nam">parsed_content</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t984" href="#t984">984</a></span><span class="t"> <span class="nam">source_content_attributes</span> <span class="op">=</span> <span class="nam">target_attributes</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t985" href="#t985">985</a></span><span class="t"> <span class="nam">source_content_parameter</span> <span class="op">=</span> <span class="str">"parsed_content"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t986" href="#t986">986</a></span><span class="t"> <span class="nam">source_and_parsed_differs</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t987" href="#t987">987</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t988" href="#t988">988</a></span><span class="t"> <span class="nam">sources</span> <span class="op">=</span> <span class="nam">collections</span><span class="op">.</span><span class="nam">defaultdict</span><span class="op">(</span><span class="nam">set</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t989" href="#t989">989</a></span><span class="t"> <span class="nam">seen_targets</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t990" href="#t990">990</a></span><span class="t"> <span class="nam">seen_source_names</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t991" href="#t991">991</a></span><span class="t"> <span class="nam">source_attributes</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">AttributeDescription</span><span class="op">]</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t992" href="#t992">992</a></span><span class="t"> <span class="nam">path_hint_source_attributes</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t993" href="#t993">993</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t994" href="#t994">994</a></span><span class="t"> <span class="key">for</span> <span class="nam">k</span> <span class="key">in</span> <span class="nam">source_content_attributes</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t995" href="#t995">995</a></span><span class="t"> <span class="nam">ia</span> <span class="op">=</span> <span class="nam">source_content_attributes</span><span class="op">[</span><span class="nam">k</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t996" href="#t996">996</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t997" href="#t997">997</a></span><span class="t"> <span class="nam">ta</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t998" href="#t998">998</a></span><span class="t"> <span class="nam">target_attributes</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">ia</span><span class="op">.</span><span class="nam">target_attribute</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t999" href="#t999">999</a></span><span class="t"> <span class="key">if</span> <span class="nam">source_and_parsed_differs</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1000" href="#t1000">1000</a></span><span class="t"> <span class="key">else</span> <span class="nam">ia</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1001" href="#t1001">1001</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1002" href="#t1002">1002</a></span><span class="t"> <span class="key">if</span> <span class="nam">ta</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1002 ↛ 1004</span><span class="annotate long">line 1002 didn't jump to line 1004, because the condition on line 1002 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t1003" href="#t1003">1003</a></span><span class="t"> <span class="com"># Error message would be wrong if this assertion is false.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1004" href="#t1004">1004</a></span><span class="t"> <span class="key">assert</span> <span class="nam">source_and_parsed_differs</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1005" href="#t1005">1005</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1006" href="#t1006">1006</a></span><span class="t"> <span class="str">f'The attribute "{k}" from the "source_content" parameter should have mapped'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1007" href="#t1007">1007</a></span><span class="t"> <span class="str">f' to "{ia.target_attribute}", but that parameter does not exist in "parsed_content"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1008" href="#t1008">1008</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1009" href="#t1009">1009</a></span><span class="t"> <span class="key">if</span> <span class="nam">_is_path_attribute_candidate</span><span class="op">(</span><span class="nam">ia</span><span class="op">,</span> <span class="nam">ta</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1010" href="#t1010">1010</a></span><span class="t"> <span class="nam">path_hint_source_attributes</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">ia</span><span class="op">.</span><span class="nam">source_attribute_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1011" href="#t1011">1011</a></span><span class="t"> <span class="nam">existing_source_name</span> <span class="op">=</span> <span class="nam">seen_source_names</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">ia</span><span class="op">.</span><span class="nam">source_attribute_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1012" href="#t1012">1012</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing_source_name</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1012 ↛ 1013</span><span class="annotate long">line 1012 didn't jump to line 1013, because the condition on line 1012 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1013" href="#t1013">1013</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1014" href="#t1014">1014</a></span><span class="t"> <span class="str">f'The attribute "{k}" and "{existing_source_name}" both share the source name'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1015" href="#t1015">1015</a></span><span class="t"> <span class="str">f' "{ia.source_attribute_name}". Please change the {source_content_parameter} parameter,'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1016" href="#t1016">1016</a></span><span class="t"> <span class="str">f' so only one attribute use "{ia.source_attribute_name}".'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1017" href="#t1017">1017</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1018" href="#t1018">1018</a></span><span class="t"> <span class="nam">seen_source_names</span><span class="op">[</span><span class="nam">ia</span><span class="op">.</span><span class="nam">source_attribute_name</span><span class="op">]</span> <span class="op">=</span> <span class="nam">k</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1019" href="#t1019">1019</a></span><span class="t"> <span class="nam">seen_targets</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">ta</span><span class="op">.</span><span class="nam">target_attribute</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1020" href="#t1020">1020</a></span><span class="t"> <span class="nam">sources</span><span class="op">[</span><span class="nam">ia</span><span class="op">.</span><span class="nam">target_attribute</span><span class="op">]</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">k</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1021" href="#t1021">1021</a></span><span class="t"> <span class="key">if</span> <span class="nam">source_and_parsed_differs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1022" href="#t1022">1022</a></span><span class="t"> <span class="nam">bridge_mapper</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_type_normalize</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1023" href="#t1023">1023</a></span><span class="t"> <span class="nam">k</span><span class="op">,</span> <span class="nam">ia</span><span class="op">.</span><span class="nam">attribute_type</span><span class="op">,</span> <span class="nam">ta</span><span class="op">.</span><span class="nam">attribute_type</span><span class="op">,</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1024" href="#t1024">1024</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1025" href="#t1025">1025</a></span><span class="t"> <span class="nam">ia</span><span class="op">.</span><span class="nam">type_validator</span> <span class="op">=</span> <span class="nam">ia</span><span class="op">.</span><span class="nam">type_validator</span><span class="op">.</span><span class="nam">combine_mapper</span><span class="op">(</span><span class="nam">bridge_mapper</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1026" href="#t1026">1026</a></span><span class="t"> <span class="nam">source_attributes</span><span class="op">[</span><span class="nam">k</span><span class="op">]</span> <span class="op">=</span> <span class="nam">ia</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1027" href="#t1027">1027</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1028" href="#t1028">1028</a></span><span class="t"> <span class="key">def</span> <span class="nam">_as_attr_names</span><span class="op">(</span><span class="nam">td_name</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1029" href="#t1029">1029</a></span><span class="t"> <span class="key">return</span> <span class="nam">frozenset</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1030" href="#t1030">1030</a></span><span class="t"> <span class="nam">source_content_attributes</span><span class="op">[</span><span class="nam">a</span><span class="op">]</span><span class="op">.</span><span class="nam">source_attribute_name</span> <span class="key">for</span> <span class="nam">a</span> <span class="key">in</span> <span class="nam">td_name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1031" href="#t1031">1031</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1032" href="#t1032">1032</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1033" href="#t1033">1033</a></span><span class="t"> <span class="nam">_check_attributes</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1034" href="#t1034">1034</a></span><span class="t"> <span class="nam">parsed_content</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1035" href="#t1035">1035</a></span><span class="t"> <span class="nam">source_typed_dict</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1036" href="#t1036">1036</a></span><span class="t"> <span class="nam">source_content_attributes</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1037" href="#t1037">1037</a></span><span class="t"> <span class="nam">sources</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1038" href="#t1038">1038</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1039" href="#t1039">1039</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1040" href="#t1040">1040</a></span><span class="t"> <span class="nam">at_least_one_of</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1041" href="#t1041">1041</a></span><span class="t"> <span class="nam">_as_attr_names</span><span class="op">(</span><span class="nam">g</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1042" href="#t1042">1042</a></span><span class="t"> <span class="key">for</span> <span class="nam">k</span><span class="op">,</span> <span class="nam">g</span> <span class="key">in</span> <span class="nam">sources</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1043" href="#t1043">1043</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">g</span><span class="op">)</span> <span class="op">></span> <span class="num">1</span> <span class="key">and</span> <span class="nam">k</span> <span class="key">in</span> <span class="nam">required_target_parameters</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1044" href="#t1044">1044</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1045" href="#t1045">1045</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1046" href="#t1046">1046</a></span><span class="t"> <span class="key">if</span> <span class="nam">source_and_parsed_differs</span> <span class="key">and</span> <span class="nam">seen_targets</span> <span class="op">!=</span> <span class="nam">target_attributes</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1046 ↛ 1047</span><span class="annotate long">line 1046 didn't jump to line 1047, because the condition on line 1046 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1047" href="#t1047">1047</a></span><span class="t"> <span class="nam">missing</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1048" href="#t1048">1048</a></span><span class="t"> <span class="nam">repr</span><span class="op">(</span><span class="nam">k</span><span class="op">)</span> <span class="key">for</span> <span class="nam">k</span> <span class="key">in</span> <span class="op">(</span><span class="nam">target_attributes</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span> <span class="op">-</span> <span class="nam">seen_targets</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1049" href="#t1049">1049</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1050" href="#t1050">1050</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1051" href="#t1051">1051</a></span><span class="t"> <span class="str">'The following attributes in "parsed_content" did not have a source field in "source_content":'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1052" href="#t1052">1052</a></span><span class="t"> <span class="str">f" {missing}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1053" href="#t1053">1053</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1054" href="#t1054">1054</a></span><span class="t"> <span class="nam">all_mutually_exclusive_fields</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1055" href="#t1055">1055</a></span><span class="t"> <span class="nam">_as_attr_names</span><span class="op">(</span><span class="nam">g</span><span class="op">)</span> <span class="key">for</span> <span class="nam">g</span> <span class="key">in</span> <span class="nam">sources</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">g</span><span class="op">)</span> <span class="op">></span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1056" href="#t1056">1056</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1057" href="#t1057">1057</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1058" href="#t1058">1058</a></span><span class="t"> <span class="nam">all_parameters</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1059" href="#t1059">1059</a></span><span class="t"> <span class="nam">source_typed_dict</span><span class="op">.</span><span class="nam">__required_keys__</span> <span class="op">|</span> <span class="nam">source_typed_dict</span><span class="op">.</span><span class="nam">__optional_keys__</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1060" href="#t1060">1060</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1061" href="#t1061">1061</a></span><span class="t"> <span class="nam">_check_conflicts</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1062" href="#t1062">1062</a></span><span class="t"> <span class="nam">source_content_attributes</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1063" href="#t1063">1063</a></span><span class="t"> <span class="nam">source_typed_dict</span><span class="op">.</span><span class="nam">__required_keys__</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1064" href="#t1064">1064</a></span><span class="t"> <span class="nam">all_parameters</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1065" href="#t1065">1065</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1066" href="#t1066">1066</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1067" href="#t1067">1067</a></span><span class="t"> <span class="nam">manifest_attributes</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1068" href="#t1068">1068</a></span><span class="t"> <span class="nam">a</span><span class="op">.</span><span class="nam">source_attribute_name</span><span class="op">:</span> <span class="nam">a</span> <span class="key">for</span> <span class="nam">a</span> <span class="key">in</span> <span class="nam">source_content_attributes</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1069" href="#t1069">1069</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1070" href="#t1070">1070</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1071" href="#t1071">1071</a></span><span class="t"> <span class="key">if</span> <span class="nam">parsed_alt_form</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1072" href="#t1072">1072</a></span><span class="t"> <span class="nam">target_attribute</span> <span class="op">=</span> <span class="nam">parsed_alt_form</span><span class="op">.</span><span class="nam">target_attribute</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1073" href="#t1073">1073</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"><span class="annotate short">1073 ↛ 1078</span><span class="annotate long">line 1073 didn't jump to line 1078</span></span></p> - <p class="pln"><span class="n"><a id="t1074" href="#t1074">1074</a></span><span class="t"> <span class="nam">target_attribute</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">required_target_parameters</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1075" href="#t1075">1075</a></span><span class="t"> <span class="key">and</span> <span class="nam">required_target_parameters</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1076" href="#t1076">1076</a></span><span class="t"> <span class="key">or</span> <span class="nam">len</span><span class="op">(</span><span class="nam">required_target_parameters</span><span class="op">)</span> <span class="op">></span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1077" href="#t1077">1077</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1078" href="#t1078">1078</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1079" href="#t1079">1079</a></span><span class="t"> <span class="str">"When using alternative source formats (Union[TypedDict, ...]), then the"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1080" href="#t1080">1080</a></span><span class="t"> <span class="str">" target must have at most one require parameter"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1081" href="#t1081">1081</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1082" href="#t1082">1082</a></span><span class="t"> <span class="nam">bridge_mapper</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_type_normalize</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1083" href="#t1083">1083</a></span><span class="t"> <span class="nam">target_attribute</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1084" href="#t1084">1084</a></span><span class="t"> <span class="nam">parsed_alt_form</span><span class="op">.</span><span class="nam">attribute_type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1085" href="#t1085">1085</a></span><span class="t"> <span class="nam">target_attributes</span><span class="op">[</span><span class="nam">target_attribute</span><span class="op">]</span><span class="op">.</span><span class="nam">attribute_type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1086" href="#t1086">1086</a></span><span class="t"> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1087" href="#t1087">1087</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1088" href="#t1088">1088</a></span><span class="t"> <span class="nam">parsed_alt_form</span><span class="op">.</span><span class="nam">type_validator</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1089" href="#t1089">1089</a></span><span class="t"> <span class="nam">parsed_alt_form</span><span class="op">.</span><span class="nam">type_validator</span><span class="op">.</span><span class="nam">combine_mapper</span><span class="op">(</span><span class="nam">bridge_mapper</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1090" href="#t1090">1090</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1091" href="#t1091">1091</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1092" href="#t1092">1092</a></span><span class="t"> <span class="nam">_verify_inline_reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1093" href="#t1093">1093</a></span><span class="t"> <span class="nam">source_content_attributes</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1094" href="#t1094">1094</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1095" href="#t1095">1095</a></span><span class="t"> <span class="nam">parsed_alt_form</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1096" href="#t1096">1096</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1097" href="#t1097">1097</a></span><span class="t"> <span class="key">if</span> <span class="nam">non_mapping_source_only</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1098" href="#t1098">1098</a></span><span class="t"> <span class="nam">parser</span> <span class="op">=</span> <span class="nam">DeclarativeNonMappingInputParser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1099" href="#t1099">1099</a></span><span class="t"> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">parsed_alt_form</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1100" href="#t1100">1100</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">inline_reference_documentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1101" href="#t1101">1101</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1102" href="#t1102">1102</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1103" href="#t1103">1103</a></span><span class="t"> <span class="nam">parser</span> <span class="op">=</span> <span class="nam">DeclarativeMappingInputParser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1104" href="#t1104">1104</a></span><span class="t"> <span class="nam">_as_attr_names</span><span class="op">(</span><span class="nam">source_typed_dict</span><span class="op">.</span><span class="nam">__required_keys__</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1105" href="#t1105">1105</a></span><span class="t"> <span class="nam">_as_attr_names</span><span class="op">(</span><span class="nam">all_parameters</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1106" href="#t1106">1106</a></span><span class="t"> <span class="nam">manifest_attributes</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1107" href="#t1107">1107</a></span><span class="t"> <span class="nam">source_attributes</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1108" href="#t1108">1108</a></span><span class="t"> <span class="nam">mutually_exclusive_attributes</span><span class="op">=</span><span class="nam">all_mutually_exclusive_fields</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1109" href="#t1109">1109</a></span><span class="t"> <span class="nam">alt_form_parser</span><span class="op">=</span><span class="nam">parsed_alt_form</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1110" href="#t1110">1110</a></span><span class="t"> <span class="nam">at_least_one_of</span><span class="op">=</span><span class="nam">at_least_one_of</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1111" href="#t1111">1111</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">inline_reference_documentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1112" href="#t1112">1112</a></span><span class="t"> <span class="nam">path_hint_source_attributes</span><span class="op">=</span><span class="nam">tuple</span><span class="op">(</span><span class="nam">path_hint_source_attributes</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1113" href="#t1113">1113</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1114" href="#t1114">1114</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_list_wrapped</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1115" href="#t1115">1115</a></span><span class="t"> <span class="nam">parser</span> <span class="op">=</span> <span class="nam">ListWrappedDeclarativeInputParser</span><span class="op">(</span><span class="nam">parser</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1116" href="#t1116">1116</a></span><span class="t"> <span class="key">return</span> <span class="nam">parser</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1117" href="#t1117">1117</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1118" href="#t1118">1118</a></span><span class="t"> <span class="key">def</span> <span class="nam">_as_type_validator</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1119" href="#t1119">1119</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1120" href="#t1120">1120</a></span><span class="t"> <span class="nam">attribute</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1121" href="#t1121">1121</a></span><span class="t"> <span class="nam">provided_type</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1122" href="#t1122">1122</a></span><span class="t"> <span class="nam">parsing_typed_dict_attribute</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1123" href="#t1123">1123</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">AttributeTypeHandler</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1124" href="#t1124">1124</a></span><span class="t"> <span class="key">assert</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">provided_type</span><span class="op">,</span> <span class="nam">tuple</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1125" href="#t1125">1125</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1126" href="#t1126">1126</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">provided_type</span><span class="op">,</span> <span class="nam">type</span><span class="op">)</span> <span class="key">and</span> <span class="nam">issubclass</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1127" href="#t1127">1127</a></span><span class="t"> <span class="nam">provided_type</span><span class="op">,</span> <span class="nam">DebputyDispatchableType</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1128" href="#t1128">1128</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1129" href="#t1129">1129</a></span><span class="t"> <span class="key">return</span> <span class="nam">_dispatch_parser</span><span class="op">(</span><span class="nam">provided_type</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1130" href="#t1130">1130</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1131" href="#t1131">1131</a></span><span class="t"> <span class="nam">unmapped_type</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_strip_mapped_types</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1132" href="#t1132">1132</a></span><span class="t"> <span class="nam">provided_type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1133" href="#t1133">1133</a></span><span class="t"> <span class="nam">parsing_typed_dict_attribute</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1134" href="#t1134">1134</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1135" href="#t1135">1135</a></span><span class="t"> <span class="nam">type_normalizer</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_type_normalize</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1136" href="#t1136">1136</a></span><span class="t"> <span class="nam">attribute</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1137" href="#t1137">1137</a></span><span class="t"> <span class="nam">unmapped_type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1138" href="#t1138">1138</a></span><span class="t"> <span class="nam">provided_type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1139" href="#t1139">1139</a></span><span class="t"> <span class="nam">parsing_typed_dict_attribute</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1140" href="#t1140">1140</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1141" href="#t1141">1141</a></span><span class="t"> <span class="nam">t_unmapped</span><span class="op">,</span> <span class="nam">t_orig</span><span class="op">,</span> <span class="nam">t_args</span> <span class="op">=</span> <span class="nam">unpack_type</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1142" href="#t1142">1142</a></span><span class="t"> <span class="nam">unmapped_type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1143" href="#t1143">1143</a></span><span class="t"> <span class="nam">parsing_typed_dict_attribute</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1144" href="#t1144">1144</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1145" href="#t1145">1145</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1146" href="#t1146">1146</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"><span class="annotate short">1146 ↛ 1152</span><span class="annotate long">line 1146 didn't jump to line 1152</span></span></p> - <p class="pln"><span class="n"><a id="t1147" href="#t1147">1147</a></span><span class="t"> <span class="nam">t_orig</span> <span class="op">==</span> <span class="nam">Union</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1148" href="#t1148">1148</a></span><span class="t"> <span class="key">and</span> <span class="nam">t_args</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1149" href="#t1149">1149</a></span><span class="t"> <span class="key">and</span> <span class="nam">len</span><span class="op">(</span><span class="nam">t_args</span><span class="op">)</span> <span class="op">==</span> <span class="num">2</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1150" href="#t1150">1150</a></span><span class="t"> <span class="key">and</span> <span class="nam">any</span><span class="op">(</span><span class="nam">v</span> <span class="key">is</span> <span class="nam">_NONE_TYPE</span> <span class="key">for</span> <span class="nam">v</span> <span class="key">in</span> <span class="nam">t_args</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1151" href="#t1151">1151</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1152" href="#t1152">1152</a></span><span class="t"> <span class="nam">_</span><span class="op">,</span> <span class="nam">_</span><span class="op">,</span> <span class="nam">args</span> <span class="op">=</span> <span class="nam">unpack_type</span><span class="op">(</span><span class="nam">provided_type</span><span class="op">,</span> <span class="nam">parsing_typed_dict_attribute</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1153" href="#t1153">1153</a></span><span class="t"> <span class="nam">actual_type</span> <span class="op">=</span> <span class="op">[</span><span class="nam">a</span> <span class="key">for</span> <span class="nam">a</span> <span class="key">in</span> <span class="nam">args</span> <span class="key">if</span> <span class="nam">a</span> <span class="key">is</span> <span class="key">not</span> <span class="nam">_NONE_TYPE</span><span class="op">]</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1154" href="#t1154">1154</a></span><span class="t"> <span class="nam">validator</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_as_type_validator</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1155" href="#t1155">1155</a></span><span class="t"> <span class="nam">attribute</span><span class="op">,</span> <span class="nam">actual_type</span><span class="op">,</span> <span class="nam">parsing_typed_dict_attribute</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1156" href="#t1156">1156</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1157" href="#t1157">1157</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1158" href="#t1158">1158</a></span><span class="t"> <span class="key">def</span> <span class="nam">_validator</span><span class="op">(</span><span class="nam">v</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> <span class="nam">path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1159" href="#t1159">1159</a></span><span class="t"> <span class="key">if</span> <span class="nam">v</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1160" href="#t1160">1160</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1161" href="#t1161">1161</a></span><span class="t"> <span class="nam">validator</span><span class="op">.</span><span class="nam">ensure_type</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1162" href="#t1162">1162</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1163" href="#t1163">1163</a></span><span class="t"> <span class="key">return</span> <span class="nam">AttributeTypeHandler</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1164" href="#t1164">1164</a></span><span class="t"> <span class="nam">validator</span><span class="op">.</span><span class="nam">describe_type</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1165" href="#t1165">1165</a></span><span class="t"> <span class="nam">_validator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1166" href="#t1166">1166</a></span><span class="t"> <span class="nam">base_type</span><span class="op">=</span><span class="nam">validator</span><span class="op">.</span><span class="nam">base_type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1167" href="#t1167">1167</a></span><span class="t"> <span class="nam">mapper</span><span class="op">=</span><span class="nam">type_normalizer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1168" href="#t1168">1168</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1169" href="#t1169">1169</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1170" href="#t1170">1170</a></span><span class="t"> <span class="key">if</span> <span class="nam">unmapped_type</span> <span class="key">in</span> <span class="nam">BASIC_SIMPLE_TYPES</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1171" href="#t1171">1171</a></span><span class="t"> <span class="nam">type_name</span> <span class="op">=</span> <span class="nam">BASIC_SIMPLE_TYPES</span><span class="op">[</span><span class="nam">unmapped_type</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1172" href="#t1172">1172</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1173" href="#t1173">1173</a></span><span class="t"> <span class="nam">type_mapping</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_registered_types</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">provided_type</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1174" href="#t1174">1174</a></span><span class="t"> <span class="key">if</span> <span class="nam">type_mapping</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1175" href="#t1175">1175</a></span><span class="t"> <span class="nam">simple_type</span> <span class="op">=</span> <span class="str">f" ({type_name})"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1176" href="#t1176">1176</a></span><span class="t"> <span class="nam">type_name</span> <span class="op">=</span> <span class="nam">type_mapping</span><span class="op">.</span><span class="nam">target_type</span><span class="op">.</span><span class="nam">__name__</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1177" href="#t1177">1177</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1178" href="#t1178">1178</a></span><span class="t"> <span class="nam">simple_type</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1179" href="#t1179">1179</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1180" href="#t1180">1180</a></span><span class="t"> <span class="key">def</span> <span class="nam">_validator</span><span class="op">(</span><span class="nam">v</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> <span class="nam">path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1181" href="#t1181">1181</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">unmapped_type</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1182" href="#t1182">1182</a></span><span class="t"> <span class="nam">_validation_type_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1183" href="#t1183">1183</a></span><span class="t"> <span class="nam">path</span><span class="op">,</span> <span class="str">f"The attribute must be a {type_name}{simple_type}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1184" href="#t1184">1184</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1185" href="#t1185">1185</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1186" href="#t1186">1186</a></span><span class="t"> <span class="key">return</span> <span class="nam">AttributeTypeHandler</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1187" href="#t1187">1187</a></span><span class="t"> <span class="nam">type_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1188" href="#t1188">1188</a></span><span class="t"> <span class="nam">_validator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1189" href="#t1189">1189</a></span><span class="t"> <span class="nam">base_type</span><span class="op">=</span><span class="nam">unmapped_type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1190" href="#t1190">1190</a></span><span class="t"> <span class="nam">mapper</span><span class="op">=</span><span class="nam">type_normalizer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1191" href="#t1191">1191</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1192" href="#t1192">1192</a></span><span class="t"> <span class="key">if</span> <span class="nam">t_orig</span> <span class="op">==</span> <span class="nam">list</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1193" href="#t1193">1193</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">t_args</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1193 ↛ 1194</span><span class="annotate long">line 1193 didn't jump to line 1194, because the condition on line 1193 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1194" href="#t1194">1194</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1195" href="#t1195">1195</a></span><span class="t"> <span class="str">f'The attribute "{attribute}" is List but does not have Generics (Must use List[X])'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1196" href="#t1196">1196</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1197" href="#t1197">1197</a></span><span class="t"> <span class="nam">_</span><span class="op">,</span> <span class="nam">t_provided_orig</span><span class="op">,</span> <span class="nam">t_provided_args</span> <span class="op">=</span> <span class="nam">unpack_type</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1198" href="#t1198">1198</a></span><span class="t"> <span class="nam">provided_type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1199" href="#t1199">1199</a></span><span class="t"> <span class="nam">parsing_typed_dict_attribute</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1200" href="#t1200">1200</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1201" href="#t1201">1201</a></span><span class="t"> <span class="nam">genetic_type</span> <span class="op">=</span> <span class="nam">t_args</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1202" href="#t1202">1202</a></span><span class="t"> <span class="nam">key_mapper</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_as_type_validator</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1203" href="#t1203">1203</a></span><span class="t"> <span class="nam">attribute</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1204" href="#t1204">1204</a></span><span class="t"> <span class="nam">genetic_type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1205" href="#t1205">1205</a></span><span class="t"> <span class="nam">parsing_typed_dict_attribute</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1206" href="#t1206">1206</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1207" href="#t1207">1207</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1208" href="#t1208">1208</a></span><span class="t"> <span class="key">def</span> <span class="nam">_validator</span><span class="op">(</span><span class="nam">v</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> <span class="nam">path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1209" href="#t1209">1209</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">list</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1209 ↛ 1210</span><span class="annotate long">line 1209 didn't jump to line 1210, because the condition on line 1209 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1210" href="#t1210">1210</a></span><span class="t"> <span class="nam">_validation_type_error</span><span class="op">(</span><span class="nam">path</span><span class="op">,</span> <span class="str">"The attribute must be a list"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1211" href="#t1211">1211</a></span><span class="t"> <span class="key">for</span> <span class="nam">i</span><span class="op">,</span> <span class="nam">v</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">v</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1212" href="#t1212">1212</a></span><span class="t"> <span class="nam">key_mapper</span><span class="op">.</span><span class="nam">ensure_type</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">path</span><span class="op">[</span><span class="nam">i</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1213" href="#t1213">1213</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1214" href="#t1214">1214</a></span><span class="t"> <span class="nam">list_mapper</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1215" href="#t1215">1215</a></span><span class="t"> <span class="nam">map_each_element</span><span class="op">(</span><span class="nam">key_mapper</span><span class="op">.</span><span class="nam">mapper</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1216" href="#t1216">1216</a></span><span class="t"> <span class="key">if</span> <span class="nam">key_mapper</span><span class="op">.</span><span class="nam">mapper</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1217" href="#t1217">1217</a></span><span class="t"> <span class="key">else</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1218" href="#t1218">1218</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1219" href="#t1219">1219</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1220" href="#t1220">1220</a></span><span class="t"> <span class="key">return</span> <span class="nam">AttributeTypeHandler</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1221" href="#t1221">1221</a></span><span class="t"> <span class="str">f"List of {key_mapper.describe_type()}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1222" href="#t1222">1222</a></span><span class="t"> <span class="nam">_validator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1223" href="#t1223">1223</a></span><span class="t"> <span class="nam">base_type</span><span class="op">=</span><span class="nam">list</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1224" href="#t1224">1224</a></span><span class="t"> <span class="nam">mapper</span><span class="op">=</span><span class="nam">type_normalizer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1225" href="#t1225">1225</a></span><span class="t"> <span class="op">)</span><span class="op">.</span><span class="nam">combine_mapper</span><span class="op">(</span><span class="nam">list_mapper</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1226" href="#t1226">1226</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_typeddict</span><span class="op">(</span><span class="nam">provided_type</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1227" href="#t1227">1227</a></span><span class="t"> <span class="nam">subparser</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">generate_parser</span><span class="op">(</span><span class="nam">cast</span><span class="op">(</span><span class="str">"Type[TD]"</span><span class="op">,</span> <span class="nam">provided_type</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1228" href="#t1228">1228</a></span><span class="t"> <span class="key">return</span> <span class="nam">AttributeTypeHandler</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1229" href="#t1229">1229</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="str">f"{provided_type.__name__} (Typed Mapping)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1230" href="#t1230">1230</a></span><span class="t"> <span class="nam">ensure_type</span><span class="op">=</span><span class="key">lambda</span> <span class="nam">v</span><span class="op">,</span> <span class="nam">ap</span><span class="op">:</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1231" href="#t1231">1231</a></span><span class="t"> <span class="nam">base_type</span><span class="op">=</span><span class="nam">dict</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1232" href="#t1232">1232</a></span><span class="t"> <span class="nam">mapper</span><span class="op">=</span><span class="key">lambda</span> <span class="nam">v</span><span class="op">,</span> <span class="nam">ap</span><span class="op">,</span> <span class="nam">cv</span><span class="op">:</span> <span class="nam">subparser</span><span class="op">.</span><span class="nam">parse_input</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1233" href="#t1233">1233</a></span><span class="t"> <span class="nam">v</span><span class="op">,</span> <span class="nam">ap</span><span class="op">,</span> <span class="nam">parser_context</span><span class="op">=</span><span class="nam">cv</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1234" href="#t1234">1234</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1235" href="#t1235">1235</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1236" href="#t1236">1236</a></span><span class="t"> <span class="key">if</span> <span class="nam">t_orig</span> <span class="op">==</span> <span class="nam">dict</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1237" href="#t1237">1237</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">t_args</span> <span class="key">or</span> <span class="nam">len</span><span class="op">(</span><span class="nam">t_args</span><span class="op">)</span> <span class="op">!=</span> <span class="num">2</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1237 ↛ 1238</span><span class="annotate long">line 1237 didn't jump to line 1238, because the condition on line 1237 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1238" href="#t1238">1238</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1239" href="#t1239">1239</a></span><span class="t"> <span class="str">f'The attribute "{attribute}" is Dict but does not have Generics (Must use Dict[str, Y])'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1240" href="#t1240">1240</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1241" href="#t1241">1241</a></span><span class="t"> <span class="key">if</span> <span class="nam">t_args</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="op">!=</span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1241 ↛ 1242</span><span class="annotate long">line 1241 didn't jump to line 1242, because the condition on line 1241 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1242" href="#t1242">1242</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1243" href="#t1243">1243</a></span><span class="t"> <span class="str">f'The attribute "{attribute}" is Dict and has a non-str type as key.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1244" href="#t1244">1244</a></span><span class="t"> <span class="str">" Currently, only `str` is supported (Dict[str, Y])"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1245" href="#t1245">1245</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1246" href="#t1246">1246</a></span><span class="t"> <span class="nam">key_mapper</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_as_type_validator</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1247" href="#t1247">1247</a></span><span class="t"> <span class="nam">attribute</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1248" href="#t1248">1248</a></span><span class="t"> <span class="nam">t_args</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1249" href="#t1249">1249</a></span><span class="t"> <span class="nam">parsing_typed_dict_attribute</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1250" href="#t1250">1250</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1251" href="#t1251">1251</a></span><span class="t"> <span class="nam">value_mapper</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_as_type_validator</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1252" href="#t1252">1252</a></span><span class="t"> <span class="nam">attribute</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1253" href="#t1253">1253</a></span><span class="t"> <span class="nam">t_args</span><span class="op">[</span><span class="num">1</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1254" href="#t1254">1254</a></span><span class="t"> <span class="nam">parsing_typed_dict_attribute</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1255" href="#t1255">1255</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1256" href="#t1256">1256</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1257" href="#t1257">1257</a></span><span class="t"> <span class="key">if</span> <span class="nam">key_mapper</span><span class="op">.</span><span class="nam">base_type</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1257 ↛ 1258</span><span class="annotate long">line 1257 didn't jump to line 1258, because the condition on line 1257 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1258" href="#t1258">1258</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1259" href="#t1259">1259</a></span><span class="t"> <span class="str">f'The attribute "{attribute}" is Dict and the key did not have a trivial base type. Key types'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1260" href="#t1260">1260</a></span><span class="t"> <span class="str">f" without trivial base types (such as `str`) are not supported at the moment."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1261" href="#t1261">1261</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1262" href="#t1262">1262</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1263" href="#t1263">1263</a></span><span class="t"> <span class="key">if</span> <span class="nam">value_mapper</span><span class="op">.</span><span class="nam">mapper</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1263 ↛ 1264</span><span class="annotate long">line 1263 didn't jump to line 1264, because the condition on line 1263 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1264" href="#t1264">1264</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1265" href="#t1265">1265</a></span><span class="t"> <span class="str">f'The attribute "{attribute}" is Dict and the value requires mapping.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1266" href="#t1266">1266</a></span><span class="t"> <span class="str">" Currently, this is not supported. Consider a simpler type (such as Dict[str, str] or Dict[str, Any])."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1267" href="#t1267">1267</a></span><span class="t"> <span class="str">" Better typing may come later"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1268" href="#t1268">1268</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1269" href="#t1269">1269</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1270" href="#t1270">1270</a></span><span class="t"> <span class="key">def</span> <span class="nam">_validator</span><span class="op">(</span><span class="nam">uv</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> <span class="nam">path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1271" href="#t1271">1271</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">uv</span><span class="op">,</span> <span class="nam">dict</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1271 ↛ 1272</span><span class="annotate long">line 1271 didn't jump to line 1272, because the condition on line 1271 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1272" href="#t1272">1272</a></span><span class="t"> <span class="nam">_validation_type_error</span><span class="op">(</span><span class="nam">path</span><span class="op">,</span> <span class="str">"The attribute must be a mapping"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1273" href="#t1273">1273</a></span><span class="t"> <span class="nam">key_name</span> <span class="op">=</span> <span class="str">"the first key in the mapping"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1274" href="#t1274">1274</a></span><span class="t"> <span class="key">for</span> <span class="nam">i</span><span class="op">,</span> <span class="op">(</span><span class="nam">k</span><span class="op">,</span> <span class="nam">v</span><span class="op">)</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">uv</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1275" href="#t1275">1275</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">key_mapper</span><span class="op">.</span><span class="nam">base_type_match</span><span class="op">(</span><span class="nam">k</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1275 ↛ 1276</span><span class="annotate long">line 1275 didn't jump to line 1276, because the condition on line 1275 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1276" href="#t1276">1276</a></span><span class="t"> <span class="nam">kp</span> <span class="op">=</span> <span class="nam">path</span><span class="op">.</span><span class="nam">copy_with_path_hint</span><span class="op">(</span><span class="nam">key_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1277" href="#t1277">1277</a></span><span class="t"> <span class="nam">_validation_type_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1278" href="#t1278">1278</a></span><span class="t"> <span class="nam">kp</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1279" href="#t1279">1279</a></span><span class="t"> <span class="str">f'The key number {i + 1} in attribute "{kp}" must be a {key_mapper.describe_type()}'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1280" href="#t1280">1280</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1281" href="#t1281">1281</a></span><span class="t"> <span class="nam">key_name</span> <span class="op">=</span> <span class="str">f"the key after {k}"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1282" href="#t1282">1282</a></span><span class="t"> <span class="nam">value_mapper</span><span class="op">.</span><span class="nam">ensure_type</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">path</span><span class="op">[</span><span class="nam">k</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1283" href="#t1283">1283</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1284" href="#t1284">1284</a></span><span class="t"> <span class="key">return</span> <span class="nam">AttributeTypeHandler</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1285" href="#t1285">1285</a></span><span class="t"> <span class="str">f"Mapping of {value_mapper.describe_type()}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1286" href="#t1286">1286</a></span><span class="t"> <span class="nam">_validator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1287" href="#t1287">1287</a></span><span class="t"> <span class="nam">base_type</span><span class="op">=</span><span class="nam">dict</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1288" href="#t1288">1288</a></span><span class="t"> <span class="nam">mapper</span><span class="op">=</span><span class="nam">type_normalizer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1289" href="#t1289">1289</a></span><span class="t"> <span class="op">)</span><span class="op">.</span><span class="nam">combine_mapper</span><span class="op">(</span><span class="nam">key_mapper</span><span class="op">.</span><span class="nam">mapper</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1290" href="#t1290">1290</a></span><span class="t"> <span class="key">if</span> <span class="nam">t_orig</span> <span class="op">==</span> <span class="nam">Union</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1291" href="#t1291">1291</a></span><span class="t"> <span class="key">if</span> <span class="nam">_is_two_arg_x_list_x</span><span class="op">(</span><span class="nam">t_args</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1292" href="#t1292">1292</a></span><span class="t"> <span class="com"># Force the order to be "X, List[X]" as it simplifies the code</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1293" href="#t1293">1293</a></span><span class="t"> <span class="nam">x_list_x</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1294" href="#t1294">1294</a></span><span class="t"> <span class="nam">t_args</span> <span class="key">if</span> <span class="nam">get_origin</span><span class="op">(</span><span class="nam">t_args</span><span class="op">[</span><span class="num">1</span><span class="op">]</span><span class="op">)</span> <span class="op">==</span> <span class="nam">list</span> <span class="key">else</span> <span class="op">(</span><span class="nam">t_args</span><span class="op">[</span><span class="num">1</span><span class="op">]</span><span class="op">,</span> <span class="nam">t_args</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1295" href="#t1295">1295</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1296" href="#t1296">1296</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1297" href="#t1297">1297</a></span><span class="t"> <span class="com"># X, List[X] could match if X was List[Y]. However, our code below assumes</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1298" href="#t1298">1298</a></span><span class="t"> <span class="com"># that X is a non-list. The `_is_two_arg_x_list_x` returns False for this</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1299" href="#t1299">1299</a></span><span class="t"> <span class="com"># case to avoid this assert and fall into the "generic case".</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1300" href="#t1300">1300</a></span><span class="t"> <span class="key">assert</span> <span class="nam">get_origin</span><span class="op">(</span><span class="nam">x_list_x</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">)</span> <span class="op">!=</span> <span class="nam">list</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1301" href="#t1301">1301</a></span><span class="t"> <span class="nam">x_subtype_checker</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_as_type_validator</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1302" href="#t1302">1302</a></span><span class="t"> <span class="nam">attribute</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1303" href="#t1303">1303</a></span><span class="t"> <span class="nam">x_list_x</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1304" href="#t1304">1304</a></span><span class="t"> <span class="nam">parsing_typed_dict_attribute</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1305" href="#t1305">1305</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1306" href="#t1306">1306</a></span><span class="t"> <span class="nam">list_x_subtype_checker</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_as_type_validator</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1307" href="#t1307">1307</a></span><span class="t"> <span class="nam">attribute</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1308" href="#t1308">1308</a></span><span class="t"> <span class="nam">x_list_x</span><span class="op">[</span><span class="num">1</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1309" href="#t1309">1309</a></span><span class="t"> <span class="nam">parsing_typed_dict_attribute</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1310" href="#t1310">1310</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1311" href="#t1311">1311</a></span><span class="t"> <span class="nam">type_description</span> <span class="op">=</span> <span class="nam">x_subtype_checker</span><span class="op">.</span><span class="nam">describe_type</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1312" href="#t1312">1312</a></span><span class="t"> <span class="nam">type_description</span> <span class="op">=</span> <span class="str">f"{type_description} or a list of {type_description}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1313" href="#t1313">1313</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1314" href="#t1314">1314</a></span><span class="t"> <span class="key">def</span> <span class="nam">_validator</span><span class="op">(</span><span class="nam">v</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> <span class="nam">path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1315" href="#t1315">1315</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">list</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1316" href="#t1316">1316</a></span><span class="t"> <span class="nam">list_x_subtype_checker</span><span class="op">.</span><span class="nam">ensure_type</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1317" href="#t1317">1317</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1318" href="#t1318">1318</a></span><span class="t"> <span class="nam">x_subtype_checker</span><span class="op">.</span><span class="nam">ensure_type</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1319" href="#t1319">1319</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1320" href="#t1320">1320</a></span><span class="t"> <span class="key">return</span> <span class="nam">AttributeTypeHandler</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1321" href="#t1321">1321</a></span><span class="t"> <span class="nam">type_description</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1322" href="#t1322">1322</a></span><span class="t"> <span class="nam">_validator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1323" href="#t1323">1323</a></span><span class="t"> <span class="nam">mapper</span><span class="op">=</span><span class="nam">type_normalizer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1324" href="#t1324">1324</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1325" href="#t1325">1325</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1326" href="#t1326">1326</a></span><span class="t"> <span class="nam">subtype_checker</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1327" href="#t1327">1327</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_as_type_validator</span><span class="op">(</span><span class="nam">attribute</span><span class="op">,</span> <span class="nam">a</span><span class="op">,</span> <span class="nam">parsing_typed_dict_attribute</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1328" href="#t1328">1328</a></span><span class="t"> <span class="key">for</span> <span class="nam">a</span> <span class="key">in</span> <span class="nam">t_args</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1329" href="#t1329">1329</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1330" href="#t1330">1330</a></span><span class="t"> <span class="nam">type_description</span> <span class="op">=</span> <span class="str">"one-of: "</span> <span class="op">+</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1331" href="#t1331">1331</a></span><span class="t"> <span class="str">f"{sc.describe_type()}"</span> <span class="key">for</span> <span class="nam">sc</span> <span class="key">in</span> <span class="nam">subtype_checker</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1332" href="#t1332">1332</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1333" href="#t1333">1333</a></span><span class="t"> <span class="nam">mapper</span> <span class="op">=</span> <span class="nam">subtype_checker</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">.</span><span class="nam">mapper</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1334" href="#t1334">1334</a></span><span class="t"> <span class="key">if</span> <span class="nam">any</span><span class="op">(</span><span class="nam">mapper</span> <span class="op">!=</span> <span class="nam">sc</span><span class="op">.</span><span class="nam">mapper</span> <span class="key">for</span> <span class="nam">sc</span> <span class="key">in</span> <span class="nam">subtype_checker</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1334 ↛ 1335</span><span class="annotate long">line 1334 didn't jump to line 1335, because the condition on line 1334 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1335" href="#t1335">1335</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1336" href="#t1336">1336</a></span><span class="t"> <span class="str">f'Cannot handle the union "{provided_type}" as the target types need different'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1337" href="#t1337">1337</a></span><span class="t"> <span class="str">" type normalization/mapping logic. Unions are generally limited to Union[X, List[X]]"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1338" href="#t1338">1338</a></span><span class="t"> <span class="str">" where X is a non-collection type."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1339" href="#t1339">1339</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1340" href="#t1340">1340</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1341" href="#t1341">1341</a></span><span class="t"> <span class="key">def</span> <span class="nam">_validator</span><span class="op">(</span><span class="nam">v</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> <span class="nam">path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1342" href="#t1342">1342</a></span><span class="t"> <span class="nam">partial_matches</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1343" href="#t1343">1343</a></span><span class="t"> <span class="key">for</span> <span class="nam">sc</span> <span class="key">in</span> <span class="nam">subtype_checker</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1343 ↛ 1351</span><span class="annotate long">line 1343 didn't jump to line 1351, because the loop on line 1343 didn't complete</span></span></p> - <p class="run"><span class="n"><a id="t1344" href="#t1344">1344</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1345" href="#t1345">1345</a></span><span class="t"> <span class="nam">sc</span><span class="op">.</span><span class="nam">ensure_type</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1346" href="#t1346">1346</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1347" href="#t1347">1347</a></span><span class="t"> <span class="key">except</span> <span class="nam">ManifestParseException</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1348" href="#t1348">1348</a></span><span class="t"> <span class="key">if</span> <span class="nam">sc</span><span class="op">.</span><span class="nam">base_type_match</span><span class="op">(</span><span class="nam">v</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1348 ↛ 1349</span><span class="annotate long">line 1348 didn't jump to line 1349, because the condition on line 1348 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1349" href="#t1349">1349</a></span><span class="t"> <span class="nam">partial_matches</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="op">(</span><span class="nam">sc</span><span class="op">,</span> <span class="nam">e</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1350" href="#t1350">1350</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1351" href="#t1351">1351</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">partial_matches</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1352" href="#t1352">1352</a></span><span class="t"> <span class="key">raise</span> <span class="nam">partial_matches</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">[</span><span class="num">1</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1353" href="#t1353">1353</a></span><span class="t"> <span class="nam">_validation_type_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1354" href="#t1354">1354</a></span><span class="t"> <span class="nam">path</span><span class="op">,</span> <span class="str">f"Could not match against: {type_description}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1355" href="#t1355">1355</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1356" href="#t1356">1356</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1357" href="#t1357">1357</a></span><span class="t"> <span class="key">return</span> <span class="nam">AttributeTypeHandler</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1358" href="#t1358">1358</a></span><span class="t"> <span class="nam">type_description</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1359" href="#t1359">1359</a></span><span class="t"> <span class="nam">_validator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1360" href="#t1360">1360</a></span><span class="t"> <span class="nam">mapper</span><span class="op">=</span><span class="nam">type_normalizer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1361" href="#t1361">1361</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1362" href="#t1362">1362</a></span><span class="t"> <span class="key">if</span> <span class="nam">t_orig</span> <span class="op">==</span> <span class="nam">Literal</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1363" href="#t1363">1363</a></span><span class="t"> <span class="com"># We want "x" for string values; repr provides 'x'</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1364" href="#t1364">1364</a></span><span class="t"> <span class="nam">pretty</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1365" href="#t1365">1365</a></span><span class="t"> <span class="str">f'"{v}"'</span> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span> <span class="key">else</span> <span class="nam">str</span><span class="op">(</span><span class="nam">v</span><span class="op">)</span> <span class="key">for</span> <span class="nam">v</span> <span class="key">in</span> <span class="nam">t_args</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1366" href="#t1366">1366</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1367" href="#t1367">1367</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1368" href="#t1368">1368</a></span><span class="t"> <span class="key">def</span> <span class="nam">_validator</span><span class="op">(</span><span class="nam">v</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> <span class="nam">path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1369" href="#t1369">1369</a></span><span class="t"> <span class="key">if</span> <span class="nam">v</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">t_args</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1370" href="#t1370">1370</a></span><span class="t"> <span class="nam">value_hint</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1371" href="#t1371">1371</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1371 ↛ 1373</span><span class="annotate long">line 1371 didn't jump to line 1373, because the condition on line 1371 was never false</span></span></p> - <p class="run"><span class="n"><a id="t1372" href="#t1372">1372</a></span><span class="t"> <span class="nam">value_hint</span> <span class="op">=</span> <span class="str">f"({v}) "</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1373" href="#t1373">1373</a></span><span class="t"> <span class="nam">_validation_type_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1374" href="#t1374">1374</a></span><span class="t"> <span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1375" href="#t1375">1375</a></span><span class="t"> <span class="str">f"Value {value_hint}must be one of the following literal values: {pretty}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1376" href="#t1376">1376</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1377" href="#t1377">1377</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1378" href="#t1378">1378</a></span><span class="t"> <span class="key">return</span> <span class="nam">AttributeTypeHandler</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1379" href="#t1379">1379</a></span><span class="t"> <span class="str">f"One of the following literal values: {pretty}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1380" href="#t1380">1380</a></span><span class="t"> <span class="nam">_validator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1381" href="#t1381">1381</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1382" href="#t1382">1382</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1383" href="#t1383">1383</a></span><span class="t"> <span class="key">if</span> <span class="nam">provided_type</span> <span class="op">==</span> <span class="nam">Any</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1383 ↛ 1388</span><span class="annotate long">line 1383 didn't jump to line 1388, because the condition on line 1383 was never false</span></span></p> - <p class="run"><span class="n"><a id="t1384" href="#t1384">1384</a></span><span class="t"> <span class="key">return</span> <span class="nam">AttributeTypeHandler</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1385" href="#t1385">1385</a></span><span class="t"> <span class="str">"any (unvalidated)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1386" href="#t1386">1386</a></span><span class="t"> <span class="key">lambda</span> <span class="op">*</span><span class="nam">a</span><span class="op">:</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1387" href="#t1387">1387</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1388" href="#t1388">1388</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1389" href="#t1389">1389</a></span><span class="t"> <span class="str">f'The attribute "{attribute}" had/contained a type {provided_type}, which is not supported'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1390" href="#t1390">1390</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1391" href="#t1391">1391</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1392" href="#t1392">1392</a></span><span class="t"> <span class="key">def</span> <span class="nam">_parse_types</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1393" href="#t1393">1393</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1394" href="#t1394">1394</a></span><span class="t"> <span class="nam">spec</span><span class="op">:</span> <span class="nam">Type</span><span class="op">[</span><span class="nam">TypedDict</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1395" href="#t1395">1395</a></span><span class="t"> <span class="nam">allow_target_attribute_annotation</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1396" href="#t1396">1396</a></span><span class="t"> <span class="nam">allow_source_attribute_annotations</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1397" href="#t1397">1397</a></span><span class="t"> <span class="nam">forbid_optional</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1398" href="#t1398">1398</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">AttributeDescription</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1399" href="#t1399">1399</a></span><span class="t"> <span class="nam">annotations</span> <span class="op">=</span> <span class="nam">get_type_hints</span><span class="op">(</span><span class="nam">spec</span><span class="op">,</span> <span class="nam">include_extras</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1400" href="#t1400">1400</a></span><span class="t"> <span class="key">return</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1401" href="#t1401">1401</a></span><span class="t"> <span class="nam">k</span><span class="op">:</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_attribute_description</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1402" href="#t1402">1402</a></span><span class="t"> <span class="nam">k</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1403" href="#t1403">1403</a></span><span class="t"> <span class="nam">t</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1404" href="#t1404">1404</a></span><span class="t"> <span class="nam">k</span> <span class="key">in</span> <span class="nam">spec</span><span class="op">.</span><span class="nam">__required_keys__</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1405" href="#t1405">1405</a></span><span class="t"> <span class="nam">allow_target_attribute_annotation</span><span class="op">=</span><span class="nam">allow_target_attribute_annotation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1406" href="#t1406">1406</a></span><span class="t"> <span class="nam">allow_source_attribute_annotations</span><span class="op">=</span><span class="nam">allow_source_attribute_annotations</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1407" href="#t1407">1407</a></span><span class="t"> <span class="nam">forbid_optional</span><span class="op">=</span><span class="nam">forbid_optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1408" href="#t1408">1408</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1409" href="#t1409">1409</a></span><span class="t"> <span class="key">for</span> <span class="nam">k</span><span class="op">,</span> <span class="nam">t</span> <span class="key">in</span> <span class="nam">annotations</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1410" href="#t1410">1410</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1411" href="#t1411">1411</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1412" href="#t1412">1412</a></span><span class="t"> <span class="key">def</span> <span class="nam">_attribute_description</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1413" href="#t1413">1413</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1414" href="#t1414">1414</a></span><span class="t"> <span class="nam">attribute</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1415" href="#t1415">1415</a></span><span class="t"> <span class="nam">orig_td</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1416" href="#t1416">1416</a></span><span class="t"> <span class="nam">is_required</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1417" href="#t1417">1417</a></span><span class="t"> <span class="nam">forbid_optional</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1418" href="#t1418">1418</a></span><span class="t"> <span class="nam">allow_target_attribute_annotation</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1419" href="#t1419">1419</a></span><span class="t"> <span class="nam">allow_source_attribute_annotations</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1420" href="#t1420">1420</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">AttributeDescription</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1421" href="#t1421">1421</a></span><span class="t"> <span class="nam">td</span><span class="op">,</span> <span class="nam">anno</span><span class="op">,</span> <span class="nam">is_optional</span> <span class="op">=</span> <span class="nam">_parse_type</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1422" href="#t1422">1422</a></span><span class="t"> <span class="nam">attribute</span><span class="op">,</span> <span class="nam">orig_td</span><span class="op">,</span> <span class="nam">forbid_optional</span><span class="op">=</span><span class="nam">forbid_optional</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1423" href="#t1423">1423</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1424" href="#t1424">1424</a></span><span class="t"> <span class="nam">type_validator</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_as_type_validator</span><span class="op">(</span><span class="nam">attribute</span><span class="op">,</span> <span class="nam">td</span><span class="op">,</span> <span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1425" href="#t1425">1425</a></span><span class="t"> <span class="nam">parsed_annotations</span> <span class="op">=</span> <span class="nam">DetectedDebputyParseHint</span><span class="op">.</span><span class="nam">parse_annotations</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1426" href="#t1426">1426</a></span><span class="t"> <span class="nam">anno</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1427" href="#t1427">1427</a></span><span class="t"> <span class="str">f' Seen with attribute "{attribute}".'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1428" href="#t1428">1428</a></span><span class="t"> <span class="nam">attribute</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1429" href="#t1429">1429</a></span><span class="t"> <span class="nam">is_required</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1430" href="#t1430">1430</a></span><span class="t"> <span class="nam">allow_target_attribute_annotation</span><span class="op">=</span><span class="nam">allow_target_attribute_annotation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1431" href="#t1431">1431</a></span><span class="t"> <span class="nam">allow_source_attribute_annotations</span><span class="op">=</span><span class="nam">allow_source_attribute_annotations</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1432" href="#t1432">1432</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1433" href="#t1433">1433</a></span><span class="t"> <span class="key">return</span> <span class="nam">AttributeDescription</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1434" href="#t1434">1434</a></span><span class="t"> <span class="nam">target_attribute</span><span class="op">=</span><span class="nam">parsed_annotations</span><span class="op">.</span><span class="nam">target_attribute</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1435" href="#t1435">1435</a></span><span class="t"> <span class="nam">attribute_type</span><span class="op">=</span><span class="nam">td</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1436" href="#t1436">1436</a></span><span class="t"> <span class="nam">type_validator</span><span class="op">=</span><span class="nam">type_validator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1437" href="#t1437">1437</a></span><span class="t"> <span class="nam">annotations</span><span class="op">=</span><span class="nam">anno</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1438" href="#t1438">1438</a></span><span class="t"> <span class="nam">is_optional</span><span class="op">=</span><span class="nam">is_optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1439" href="#t1439">1439</a></span><span class="t"> <span class="nam">conflicting_attributes</span><span class="op">=</span><span class="nam">parsed_annotations</span><span class="op">.</span><span class="nam">conflict_with_source_attributes</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1440" href="#t1440">1440</a></span><span class="t"> <span class="nam">conditional_required</span><span class="op">=</span><span class="nam">parsed_annotations</span><span class="op">.</span><span class="nam">conditional_required</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1441" href="#t1441">1441</a></span><span class="t"> <span class="nam">source_attribute_name</span><span class="op">=</span><span class="nam">assume_not_none</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1442" href="#t1442">1442</a></span><span class="t"> <span class="nam">parsed_annotations</span><span class="op">.</span><span class="nam">source_manifest_attribute</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1443" href="#t1443">1443</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1444" href="#t1444">1444</a></span><span class="t"> <span class="nam">parse_hints</span><span class="op">=</span><span class="nam">parsed_annotations</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1445" href="#t1445">1445</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1446" href="#t1446">1446</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1447" href="#t1447">1447</a></span><span class="t"> <span class="key">def</span> <span class="nam">_parse_alt_form</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1448" href="#t1448">1448</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1449" href="#t1449">1449</a></span><span class="t"> <span class="nam">alt_form</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1450" href="#t1450">1450</a></span><span class="t"> <span class="nam">default_target_attribute</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1451" href="#t1451">1451</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">AttributeDescription</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1452" href="#t1452">1452</a></span><span class="t"> <span class="nam">td</span><span class="op">,</span> <span class="nam">anno</span><span class="op">,</span> <span class="nam">is_optional</span> <span class="op">=</span> <span class="nam">_parse_type</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1453" href="#t1453">1453</a></span><span class="t"> <span class="str">"source_format alternative form"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1454" href="#t1454">1454</a></span><span class="t"> <span class="nam">alt_form</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1455" href="#t1455">1455</a></span><span class="t"> <span class="nam">forbid_optional</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1456" href="#t1456">1456</a></span><span class="t"> <span class="nam">parsing_typed_dict_attribute</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1457" href="#t1457">1457</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1458" href="#t1458">1458</a></span><span class="t"> <span class="nam">type_validator</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_as_type_validator</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1459" href="#t1459">1459</a></span><span class="t"> <span class="str">"source_format alternative form"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1460" href="#t1460">1460</a></span><span class="t"> <span class="nam">td</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1461" href="#t1461">1461</a></span><span class="t"> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1462" href="#t1462">1462</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1463" href="#t1463">1463</a></span><span class="t"> <span class="nam">parsed_annotations</span> <span class="op">=</span> <span class="nam">DetectedDebputyParseHint</span><span class="op">.</span><span class="nam">parse_annotations</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1464" href="#t1464">1464</a></span><span class="t"> <span class="nam">anno</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1465" href="#t1465">1465</a></span><span class="t"> <span class="str">" The alternative for source_format."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1466" href="#t1466">1466</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1467" href="#t1467">1467</a></span><span class="t"> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1468" href="#t1468">1468</a></span><span class="t"> <span class="nam">default_target_attribute</span><span class="op">=</span><span class="nam">default_target_attribute</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1469" href="#t1469">1469</a></span><span class="t"> <span class="nam">allow_target_attribute_annotation</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1470" href="#t1470">1470</a></span><span class="t"> <span class="nam">allow_source_attribute_annotations</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1471" href="#t1471">1471</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1472" href="#t1472">1472</a></span><span class="t"> <span class="key">return</span> <span class="nam">AttributeDescription</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1473" href="#t1473">1473</a></span><span class="t"> <span class="nam">target_attribute</span><span class="op">=</span><span class="nam">parsed_annotations</span><span class="op">.</span><span class="nam">target_attribute</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1474" href="#t1474">1474</a></span><span class="t"> <span class="nam">attribute_type</span><span class="op">=</span><span class="nam">td</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1475" href="#t1475">1475</a></span><span class="t"> <span class="nam">type_validator</span><span class="op">=</span><span class="nam">type_validator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1476" href="#t1476">1476</a></span><span class="t"> <span class="nam">annotations</span><span class="op">=</span><span class="nam">anno</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1477" href="#t1477">1477</a></span><span class="t"> <span class="nam">is_optional</span><span class="op">=</span><span class="nam">is_optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1478" href="#t1478">1478</a></span><span class="t"> <span class="nam">conflicting_attributes</span><span class="op">=</span><span class="nam">parsed_annotations</span><span class="op">.</span><span class="nam">conflict_with_source_attributes</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1479" href="#t1479">1479</a></span><span class="t"> <span class="nam">conditional_required</span><span class="op">=</span><span class="nam">parsed_annotations</span><span class="op">.</span><span class="nam">conditional_required</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1480" href="#t1480">1480</a></span><span class="t"> <span class="nam">source_attribute_name</span><span class="op">=</span><span class="str">"Alt form of the source_format"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1481" href="#t1481">1481</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1482" href="#t1482">1482</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1483" href="#t1483">1483</a></span><span class="t"> <span class="key">def</span> <span class="nam">_union_narrowing</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1484" href="#t1484">1484</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1485" href="#t1485">1485</a></span><span class="t"> <span class="nam">input_type</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1486" href="#t1486">1486</a></span><span class="t"> <span class="nam">target_type</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1487" href="#t1487">1487</a></span><span class="t"> <span class="nam">parsing_typed_dict_attribute</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1488" href="#t1488">1488</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">Any</span><span class="op">,</span> <span class="nam">AttributePath</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"ParserContextData"</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1489" href="#t1489">1489</a></span><span class="t"> <span class="nam">_</span><span class="op">,</span> <span class="nam">input_orig</span><span class="op">,</span> <span class="nam">input_args</span> <span class="op">=</span> <span class="nam">unpack_type</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1490" href="#t1490">1490</a></span><span class="t"> <span class="nam">input_type</span><span class="op">,</span> <span class="nam">parsing_typed_dict_attribute</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1491" href="#t1491">1491</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1492" href="#t1492">1492</a></span><span class="t"> <span class="nam">_</span><span class="op">,</span> <span class="nam">target_orig</span><span class="op">,</span> <span class="nam">target_args</span> <span class="op">=</span> <span class="nam">unpack_type</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1493" href="#t1493">1493</a></span><span class="t"> <span class="nam">target_type</span><span class="op">,</span> <span class="nam">parsing_typed_dict_attribute</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1494" href="#t1494">1494</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1495" href="#t1495">1495</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1496" href="#t1496">1496</a></span><span class="t"> <span class="key">if</span> <span class="nam">input_orig</span> <span class="op">!=</span> <span class="nam">Union</span> <span class="key">or</span> <span class="key">not</span> <span class="nam">input_args</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1496 ↛ 1497</span><span class="annotate long">line 1496 didn't jump to line 1497, because the condition on line 1496 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1497" href="#t1497">1497</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"input_type must be a Union[...] with non-empty args"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1498" href="#t1498">1498</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1499" href="#t1499">1499</a></span><span class="t"> <span class="com"># Currently, we only support Union[X, List[X]] -> List[Y] narrowing or Union[X, List[X]] -> Union[Y, Union[Y]]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1500" href="#t1500">1500</a></span><span class="t"> <span class="com"># - Where X = Y or there is a simple standard transformation from X to Y.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1501" href="#t1501">1501</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1502" href="#t1502">1502</a></span><span class="t"> <span class="key">if</span> <span class="nam">target_orig</span> <span class="key">not</span> <span class="key">in</span> <span class="op">(</span><span class="nam">Union</span><span class="op">,</span> <span class="nam">list</span><span class="op">)</span> <span class="key">or</span> <span class="key">not</span> <span class="nam">target_args</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1503" href="#t1503">1503</a></span><span class="t"> <span class="com"># Not supported</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1504" href="#t1504">1504</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1505" href="#t1505">1505</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1506" href="#t1506">1506</a></span><span class="t"> <span class="key">if</span> <span class="nam">target_orig</span> <span class="op">==</span> <span class="nam">Union</span> <span class="key">and</span> <span class="nam">set</span><span class="op">(</span><span class="nam">input_args</span><span class="op">)</span> <span class="op">==</span> <span class="nam">set</span><span class="op">(</span><span class="nam">target_args</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1506 ↛ 1508</span><span class="annotate long">line 1506 didn't jump to line 1508, because the condition on line 1506 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t1507" href="#t1507">1507</a></span><span class="t"> <span class="com"># Not needed (identity mapping)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1508" href="#t1508">1508</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1509" href="#t1509">1509</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1510" href="#t1510">1510</a></span><span class="t"> <span class="key">if</span> <span class="nam">target_orig</span> <span class="op">==</span> <span class="nam">list</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">any</span><span class="op">(</span><span class="nam">get_origin</span><span class="op">(</span><span class="nam">a</span><span class="op">)</span> <span class="op">==</span> <span class="nam">list</span> <span class="key">for</span> <span class="nam">a</span> <span class="key">in</span> <span class="nam">input_args</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1510 ↛ exit, 1510 ↛ 1512</span><span class="annotate long">2 missed branches: 1) line 1510 didn't finish the generator expression on line 1510, 2) line 1510 didn't jump to line 1512, because the condition on line 1510 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t1511" href="#t1511">1511</a></span><span class="t"> <span class="com"># Not supported</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1512" href="#t1512">1512</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1513" href="#t1513">1513</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1514" href="#t1514">1514</a></span><span class="t"> <span class="nam">target_arg</span> <span class="op">=</span> <span class="nam">target_args</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1515" href="#t1515">1515</a></span><span class="t"> <span class="nam">simplified_type</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_strip_mapped_types</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1516" href="#t1516">1516</a></span><span class="t"> <span class="nam">target_arg</span><span class="op">,</span> <span class="nam">parsing_typed_dict_attribute</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1517" href="#t1517">1517</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1518" href="#t1518">1518</a></span><span class="t"> <span class="nam">acceptable_types</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1519" href="#t1519">1519</a></span><span class="t"> <span class="nam">target_arg</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1520" href="#t1520">1520</a></span><span class="t"> <span class="nam">List</span><span class="op">[</span><span class="nam">target_arg</span><span class="op">]</span><span class="op">,</span> <span class="com"># type: ignore</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1521" href="#t1521">1521</a></span><span class="t"> <span class="nam">simplified_type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1522" href="#t1522">1522</a></span><span class="t"> <span class="nam">List</span><span class="op">[</span><span class="nam">simplified_type</span><span class="op">]</span><span class="op">,</span> <span class="com"># type: ignore</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1523" href="#t1523">1523</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1524" href="#t1524">1524</a></span><span class="t"> <span class="nam">target_format</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1525" href="#t1525">1525</a></span><span class="t"> <span class="nam">target_arg</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1526" href="#t1526">1526</a></span><span class="t"> <span class="nam">List</span><span class="op">[</span><span class="nam">target_arg</span><span class="op">]</span><span class="op">,</span> <span class="com"># type: ignore</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1527" href="#t1527">1527</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1528" href="#t1528">1528</a></span><span class="t"> <span class="nam">in_target_format</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1529" href="#t1529">1529</a></span><span class="t"> <span class="nam">in_simple_format</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1530" href="#t1530">1530</a></span><span class="t"> <span class="key">for</span> <span class="nam">input_arg</span> <span class="key">in</span> <span class="nam">input_args</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1531" href="#t1531">1531</a></span><span class="t"> <span class="key">if</span> <span class="nam">input_arg</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">acceptable_types</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1531 ↛ 1533</span><span class="annotate long">line 1531 didn't jump to line 1533, because the condition on line 1531 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t1532" href="#t1532">1532</a></span><span class="t"> <span class="com"># Not supported</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1533" href="#t1533">1533</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1534" href="#t1534">1534</a></span><span class="t"> <span class="key">if</span> <span class="nam">input_arg</span> <span class="key">in</span> <span class="nam">target_format</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1535" href="#t1535">1535</a></span><span class="t"> <span class="nam">in_target_format</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1536" href="#t1536">1536</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1537" href="#t1537">1537</a></span><span class="t"> <span class="nam">in_simple_format</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1538" href="#t1538">1538</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1539" href="#t1539">1539</a></span><span class="t"> <span class="key">assert</span> <span class="nam">in_simple_format</span> <span class="key">or</span> <span class="nam">in_target_format</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1540" href="#t1540">1540</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1541" href="#t1541">1541</a></span><span class="t"> <span class="key">if</span> <span class="nam">in_target_format</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">in_simple_format</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1542" href="#t1542">1542</a></span><span class="t"> <span class="com"># Union[X, List[X]] -> List[X]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1543" href="#t1543">1543</a></span><span class="t"> <span class="key">return</span> <span class="nam">normalize_into_list</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1544" href="#t1544">1544</a></span><span class="t"> <span class="nam">mapped</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_registered_types</span><span class="op">[</span><span class="nam">target_arg</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1545" href="#t1545">1545</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">in_target_format</span> <span class="key">and</span> <span class="nam">in_simple_format</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1545 ↛ 1560</span><span class="annotate long">line 1545 didn't jump to line 1560, because the condition on line 1545 was never false</span></span></p> - <p class="pln"><span class="n"><a id="t1546" href="#t1546">1546</a></span><span class="t"> <span class="com"># Union[X, List[X]] -> List[Y]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1547" href="#t1547">1547</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1548" href="#t1548">1548</a></span><span class="t"> <span class="key">def</span> <span class="nam">_mapper_x_list_y</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1549" href="#t1549">1549</a></span><span class="t"> <span class="nam">x</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">Any</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1550" href="#t1550">1550</a></span><span class="t"> <span class="nam">ap</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1551" href="#t1551">1551</a></span><span class="t"> <span class="nam">pc</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"ParserContextData"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1552" href="#t1552">1552</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">List</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1553" href="#t1553">1553</a></span><span class="t"> <span class="nam">in_list_form</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span> <span class="op">=</span> <span class="nam">normalize_into_list</span><span class="op">(</span><span class="nam">x</span><span class="op">,</span> <span class="nam">ap</span><span class="op">,</span> <span class="nam">pc</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1554" href="#t1554">1554</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1555" href="#t1555">1555</a></span><span class="t"> <span class="key">return</span> <span class="op">[</span><span class="nam">mapped</span><span class="op">.</span><span class="nam">mapper</span><span class="op">(</span><span class="nam">x</span><span class="op">,</span> <span class="nam">ap</span><span class="op">,</span> <span class="nam">pc</span><span class="op">)</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">in_list_form</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1556" href="#t1556">1556</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1557" href="#t1557">1557</a></span><span class="t"> <span class="key">return</span> <span class="nam">_mapper_x_list_y</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1558" href="#t1558">1558</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1559" href="#t1559">1559</a></span><span class="t"> <span class="com"># Union[Y, List[X]] -> List[Y]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1560" href="#t1560">1560</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">target_arg</span><span class="op">,</span> <span class="nam">type</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1561" href="#t1561">1561</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1562" href="#t1562">1562</a></span><span class="t"> <span class="str">f"Cannot narrow {input_type} -> {target_type}: The automatic conversion does"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1563" href="#t1563">1563</a></span><span class="t"> <span class="str">f" not support mixed types. Please use either {simplified_type} or {target_arg}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1564" href="#t1564">1564</a></span><span class="t"> <span class="str">f" in the source content (but both a mix of both)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1565" href="#t1565">1565</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1566" href="#t1566">1566</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1567" href="#t1567">1567</a></span><span class="t"> <span class="key">def</span> <span class="nam">_mapper_mixed_list_y</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1568" href="#t1568">1568</a></span><span class="t"> <span class="nam">x</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">Any</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1569" href="#t1569">1569</a></span><span class="t"> <span class="nam">ap</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1570" href="#t1570">1570</a></span><span class="t"> <span class="nam">pc</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"ParserContextData"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1571" href="#t1571">1571</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">List</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1572" href="#t1572">1572</a></span><span class="t"> <span class="nam">in_list_form</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span> <span class="op">=</span> <span class="nam">normalize_into_list</span><span class="op">(</span><span class="nam">x</span><span class="op">,</span> <span class="nam">ap</span><span class="op">,</span> <span class="nam">pc</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1573" href="#t1573">1573</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1574" href="#t1574">1574</a></span><span class="t"> <span class="key">return</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1575" href="#t1575">1575</a></span><span class="t"> <span class="nam">x</span> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">x</span><span class="op">,</span> <span class="nam">target_arg</span><span class="op">)</span> <span class="key">else</span> <span class="nam">mapped</span><span class="op">.</span><span class="nam">mapper</span><span class="op">(</span><span class="nam">x</span><span class="op">,</span> <span class="nam">ap</span><span class="op">,</span> <span class="nam">pc</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1576" href="#t1576">1576</a></span><span class="t"> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">in_list_form</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1577" href="#t1577">1577</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1578" href="#t1578">1578</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1579" href="#t1579">1579</a></span><span class="t"> <span class="key">return</span> <span class="nam">_mapper_mixed_list_y</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1580" href="#t1580">1580</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1581" href="#t1581">1581</a></span><span class="t"> <span class="key">def</span> <span class="nam">_type_normalize</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1582" href="#t1582">1582</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1583" href="#t1583">1583</a></span><span class="t"> <span class="nam">attribute</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1584" href="#t1584">1584</a></span><span class="t"> <span class="nam">input_type</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1585" href="#t1585">1585</a></span><span class="t"> <span class="nam">target_type</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1586" href="#t1586">1586</a></span><span class="t"> <span class="nam">parsing_typed_dict_attribute</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1587" href="#t1587">1587</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">Any</span><span class="op">,</span> <span class="nam">AttributePath</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"ParserContextData"</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1588" href="#t1588">1588</a></span><span class="t"> <span class="key">if</span> <span class="nam">input_type</span> <span class="op">==</span> <span class="nam">target_type</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1589" href="#t1589">1589</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1590" href="#t1590">1590</a></span><span class="t"> <span class="nam">_</span><span class="op">,</span> <span class="nam">input_orig</span><span class="op">,</span> <span class="nam">input_args</span> <span class="op">=</span> <span class="nam">unpack_type</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1591" href="#t1591">1591</a></span><span class="t"> <span class="nam">input_type</span><span class="op">,</span> <span class="nam">parsing_typed_dict_attribute</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1592" href="#t1592">1592</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1593" href="#t1593">1593</a></span><span class="t"> <span class="nam">_</span><span class="op">,</span> <span class="nam">target_orig</span><span class="op">,</span> <span class="nam">target_args</span> <span class="op">=</span> <span class="nam">unpack_type</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1594" href="#t1594">1594</a></span><span class="t"> <span class="nam">target_type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1595" href="#t1595">1595</a></span><span class="t"> <span class="nam">parsing_typed_dict_attribute</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1596" href="#t1596">1596</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1597" href="#t1597">1597</a></span><span class="t"> <span class="key">if</span> <span class="nam">input_orig</span> <span class="op">==</span> <span class="nam">Union</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1598" href="#t1598">1598</a></span><span class="t"> <span class="nam">result</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_union_narrowing</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1599" href="#t1599">1599</a></span><span class="t"> <span class="nam">input_type</span><span class="op">,</span> <span class="nam">target_type</span><span class="op">,</span> <span class="nam">parsing_typed_dict_attribute</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1600" href="#t1600">1600</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1601" href="#t1601">1601</a></span><span class="t"> <span class="key">if</span> <span class="nam">result</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1602" href="#t1602">1602</a></span><span class="t"> <span class="key">return</span> <span class="nam">result</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1603" href="#t1603">1603</a></span><span class="t"> <span class="key">elif</span> <span class="nam">target_orig</span> <span class="op">==</span> <span class="nam">list</span> <span class="key">and</span> <span class="nam">target_args</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="op">==</span> <span class="nam">input_type</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1604" href="#t1604">1604</a></span><span class="t"> <span class="key">return</span> <span class="nam">wrap_into_list</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1605" href="#t1605">1605</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1606" href="#t1606">1606</a></span><span class="t"> <span class="nam">mapped</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_registered_types</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">target_type</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1607" href="#t1607">1607</a></span><span class="t"> <span class="key">if</span> <span class="nam">mapped</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">input_type</span> <span class="op">==</span> <span class="nam">mapped</span><span class="op">.</span><span class="nam">source_type</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1608" href="#t1608">1608</a></span><span class="t"> <span class="com"># Source -> Target</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1609" href="#t1609">1609</a></span><span class="t"> <span class="key">return</span> <span class="nam">mapped</span><span class="op">.</span><span class="nam">mapper</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1610" href="#t1610">1610</a></span><span class="t"> <span class="key">if</span> <span class="nam">target_orig</span> <span class="op">==</span> <span class="nam">list</span> <span class="key">and</span> <span class="nam">target_args</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1610 ↛ 1628</span><span class="annotate long">line 1610 didn't jump to line 1628, because the condition on line 1610 was never false</span></span></p> - <p class="run"><span class="n"><a id="t1611" href="#t1611">1611</a></span><span class="t"> <span class="nam">mapped</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_registered_types</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">target_args</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1612" href="#t1612">1612</a></span><span class="t"> <span class="key">if</span> <span class="nam">mapped</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1612 ↛ 1628</span><span class="annotate long">line 1612 didn't jump to line 1628, because the condition on line 1612 was never false</span></span></p> - <p class="pln"><span class="n"><a id="t1613" href="#t1613">1613</a></span><span class="t"> <span class="com"># mypy is dense and forgot `mapped` cannot be optional in the comprehensions.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1614" href="#t1614">1614</a></span><span class="t"> <span class="nam">mapped_type</span><span class="op">:</span> <span class="nam">TypeMapping</span> <span class="op">=</span> <span class="nam">mapped</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1615" href="#t1615">1615</a></span><span class="t"> <span class="key">if</span> <span class="nam">input_type</span> <span class="op">==</span> <span class="nam">mapped</span><span class="op">.</span><span class="nam">source_type</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1615 ↛ 1617</span><span class="annotate long">line 1615 didn't jump to line 1617, because the condition on line 1615 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t1616" href="#t1616">1616</a></span><span class="t"> <span class="com"># Source -> List[Target]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1617" href="#t1617">1617</a></span><span class="t"> <span class="key">return</span> <span class="key">lambda</span> <span class="nam">x</span><span class="op">,</span> <span class="nam">ap</span><span class="op">,</span> <span class="nam">pc</span><span class="op">:</span> <span class="op">[</span><span class="nam">mapped_type</span><span class="op">.</span><span class="nam">mapper</span><span class="op">(</span><span class="nam">x</span><span class="op">,</span> <span class="nam">ap</span><span class="op">,</span> <span class="nam">pc</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1618" href="#t1618">1618</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"><span class="annotate short">1618 ↛ 1628</span><span class="annotate long">line 1618 didn't jump to line 1628</span></span></p> - <p class="pln"><span class="n"><a id="t1619" href="#t1619">1619</a></span><span class="t"> <span class="nam">input_orig</span> <span class="op">==</span> <span class="nam">list</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1620" href="#t1620">1620</a></span><span class="t"> <span class="key">and</span> <span class="nam">input_args</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1621" href="#t1621">1621</a></span><span class="t"> <span class="key">and</span> <span class="nam">input_args</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="op">==</span> <span class="nam">mapped_type</span><span class="op">.</span><span class="nam">source_type</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1622" href="#t1622">1622</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1623" href="#t1623">1623</a></span><span class="t"> <span class="com"># List[Source] -> List[Target]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1624" href="#t1624">1624</a></span><span class="t"> <span class="key">return</span> <span class="key">lambda</span> <span class="nam">xs</span><span class="op">,</span> <span class="nam">ap</span><span class="op">,</span> <span class="nam">pc</span><span class="op">:</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1625" href="#t1625">1625</a></span><span class="t"> <span class="nam">mapped_type</span><span class="op">.</span><span class="nam">mapper</span><span class="op">(</span><span class="nam">x</span><span class="op">,</span> <span class="nam">ap</span><span class="op">,</span> <span class="nam">pc</span><span class="op">)</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">xs</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1626" href="#t1626">1626</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1627" href="#t1627">1627</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1628" href="#t1628">1628</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1629" href="#t1629">1629</a></span><span class="t"> <span class="str">f'Unsupported type normalization for "{attribute}": Cannot automatically map/narrow'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1630" href="#t1630">1630</a></span><span class="t"> <span class="str">f" {input_type} to {target_type}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1631" href="#t1631">1631</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1632" href="#t1632">1632</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1633" href="#t1633">1633</a></span><span class="t"> <span class="key">def</span> <span class="nam">_strip_mapped_types</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1634" href="#t1634">1634</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> <span class="nam">orig_td</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> <span class="nam">parsing_typed_dict_attribute</span><span class="op">:</span> <span class="nam">bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1635" href="#t1635">1635</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Any</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1636" href="#t1636">1636</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_registered_types</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">orig_td</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1637" href="#t1637">1637</a></span><span class="t"> <span class="key">if</span> <span class="nam">m</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1638" href="#t1638">1638</a></span><span class="t"> <span class="key">return</span> <span class="nam">m</span><span class="op">.</span><span class="nam">source_type</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1639" href="#t1639">1639</a></span><span class="t"> <span class="nam">_</span><span class="op">,</span> <span class="nam">v</span><span class="op">,</span> <span class="nam">args</span> <span class="op">=</span> <span class="nam">unpack_type</span><span class="op">(</span><span class="nam">orig_td</span><span class="op">,</span> <span class="nam">parsing_typed_dict_attribute</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1640" href="#t1640">1640</a></span><span class="t"> <span class="key">if</span> <span class="nam">v</span> <span class="op">==</span> <span class="nam">list</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1641" href="#t1641">1641</a></span><span class="t"> <span class="nam">arg</span> <span class="op">=</span> <span class="nam">args</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1642" href="#t1642">1642</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_registered_types</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">arg</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1643" href="#t1643">1643</a></span><span class="t"> <span class="key">if</span> <span class="nam">m</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1644" href="#t1644">1644</a></span><span class="t"> <span class="key">return</span> <span class="nam">List</span><span class="op">[</span><span class="nam">m</span><span class="op">.</span><span class="nam">source_type</span><span class="op">]</span> <span class="com"># type: ignore</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1645" href="#t1645">1645</a></span><span class="t"> <span class="key">if</span> <span class="nam">v</span> <span class="op">==</span> <span class="nam">Union</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1646" href="#t1646">1646</a></span><span class="t"> <span class="nam">stripped_args</span> <span class="op">=</span> <span class="nam">tuple</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1647" href="#t1647">1647</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_strip_mapped_types</span><span class="op">(</span><span class="nam">x</span><span class="op">,</span> <span class="nam">parsing_typed_dict_attribute</span><span class="op">)</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">args</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1648" href="#t1648">1648</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1649" href="#t1649">1649</a></span><span class="t"> <span class="key">if</span> <span class="nam">stripped_args</span> <span class="op">!=</span> <span class="nam">args</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1650" href="#t1650">1650</a></span><span class="t"> <span class="key">return</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">stripped_args</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1651" href="#t1651">1651</a></span><span class="t"> <span class="key">return</span> <span class="nam">orig_td</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1652" href="#t1652">1652</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1653" href="#t1653">1653</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1654" href="#t1654">1654</a></span><span class="t"><span class="key">def</span> <span class="nam">_verify_inline_reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1655" href="#t1655">1655</a></span><span class="t"> <span class="nam">source_content_attributes</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">AttributeDescription</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1656" href="#t1656">1656</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ParserDocumentation</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1657" href="#t1657">1657</a></span><span class="t"> <span class="nam">has_alt_form</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1658" href="#t1658">1658</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1659" href="#t1659">1659</a></span><span class="t"> <span class="key">if</span> <span class="nam">inline_reference_documentation</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1660" href="#t1660">1660</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1661" href="#t1661">1661</a></span><span class="t"> <span class="nam">attribute_doc</span> <span class="op">=</span> <span class="nam">inline_reference_documentation</span><span class="op">.</span><span class="nam">attribute_doc</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1662" href="#t1662">1662</a></span><span class="t"> <span class="key">if</span> <span class="nam">attribute_doc</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1663" href="#t1663">1663</a></span><span class="t"> <span class="nam">seen</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1664" href="#t1664">1664</a></span><span class="t"> <span class="key">for</span> <span class="nam">attr_doc</span> <span class="key">in</span> <span class="nam">attribute_doc</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1665" href="#t1665">1665</a></span><span class="t"> <span class="key">for</span> <span class="nam">attr_name</span> <span class="key">in</span> <span class="nam">attr_doc</span><span class="op">.</span><span class="nam">attributes</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1666" href="#t1666">1666</a></span><span class="t"> <span class="nam">attr</span> <span class="op">=</span> <span class="nam">source_content_attributes</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">attr_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1667" href="#t1667">1667</a></span><span class="t"> <span class="key">if</span> <span class="nam">attr</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1667 ↛ 1668</span><span class="annotate long">line 1667 didn't jump to line 1668, because the condition on line 1667 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1668" href="#t1668">1668</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1669" href="#t1669">1669</a></span><span class="t"> <span class="str">f'The inline_reference_documentation references an attribute "{attr_name}", which does not'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1670" href="#t1670">1670</a></span><span class="t"> <span class="str">f" exist in the source format."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1671" href="#t1671">1671</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1672" href="#t1672">1672</a></span><span class="t"> <span class="key">if</span> <span class="nam">attr_name</span> <span class="key">in</span> <span class="nam">seen</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1672 ↛ 1673</span><span class="annotate long">line 1672 didn't jump to line 1673, because the condition on line 1672 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1673" href="#t1673">1673</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1674" href="#t1674">1674</a></span><span class="t"> <span class="str">f'The inline_reference_documentation has documentation for "{attr_name}" twice,'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1675" href="#t1675">1675</a></span><span class="t"> <span class="str">f" which is not supported. Please document it at most once"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1676" href="#t1676">1676</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1677" href="#t1677">1677</a></span><span class="t"> <span class="nam">seen</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">attr_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1678" href="#t1678">1678</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1679" href="#t1679">1679</a></span><span class="t"> <span class="nam">undocumented</span> <span class="op">=</span> <span class="nam">source_content_attributes</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span> <span class="op">-</span> <span class="nam">seen</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1680" href="#t1680">1680</a></span><span class="t"> <span class="key">if</span> <span class="nam">undocumented</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1680 ↛ 1681</span><span class="annotate long">line 1680 didn't jump to line 1681, because the condition on line 1680 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1681" href="#t1681">1681</a></span><span class="t"> <span class="nam">undocumented_attrs</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">undocumented</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1682" href="#t1682">1682</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1683" href="#t1683">1683</a></span><span class="t"> <span class="str">"The following attributes were not documented. If this is deliberate, then please"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1684" href="#t1684">1684</a></span><span class="t"> <span class="str">' declare each them as undocumented (via undocumented_attr("foo")):'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1685" href="#t1685">1685</a></span><span class="t"> <span class="str">f" {undocumented_attrs}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1686" href="#t1686">1686</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1687" href="#t1687">1687</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1688" href="#t1688">1688</a></span><span class="t"> <span class="key">if</span> <span class="nam">inline_reference_documentation</span><span class="op">.</span><span class="nam">alt_parser_description</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">has_alt_form</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1688 ↛ 1689</span><span class="annotate long">line 1688 didn't jump to line 1689, because the condition on line 1688 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1689" href="#t1689">1689</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1690" href="#t1690">1690</a></span><span class="t"> <span class="str">"The inline_reference_documentation had documentation for an non-mapping format,"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1691" href="#t1691">1691</a></span><span class="t"> <span class="str">" but the source format does not have a non-mapping format."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1692" href="#t1692">1692</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1693" href="#t1693">1693</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1694" href="#t1694">1694</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1695" href="#t1695">1695</a></span><span class="t"><span class="key">def</span> <span class="nam">_check_conflicts</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1696" href="#t1696">1696</a></span><span class="t"> <span class="nam">input_content_attributes</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">AttributeDescription</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1697" href="#t1697">1697</a></span><span class="t"> <span class="nam">required_attributes</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1698" href="#t1698">1698</a></span><span class="t"> <span class="nam">all_attributes</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1699" href="#t1699">1699</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1700" href="#t1700">1700</a></span><span class="t"> <span class="key">for</span> <span class="nam">attr_name</span><span class="op">,</span> <span class="nam">attr</span> <span class="key">in</span> <span class="nam">input_content_attributes</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1701" href="#t1701">1701</a></span><span class="t"> <span class="key">if</span> <span class="nam">attr_name</span> <span class="key">in</span> <span class="nam">required_attributes</span> <span class="key">and</span> <span class="nam">attr</span><span class="op">.</span><span class="nam">conflicting_attributes</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1701 ↛ 1702</span><span class="annotate long">line 1701 didn't jump to line 1702, because the condition on line 1701 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1702" href="#t1702">1702</a></span><span class="t"> <span class="nam">c</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">repr</span><span class="op">(</span><span class="nam">a</span><span class="op">)</span> <span class="key">for</span> <span class="nam">a</span> <span class="key">in</span> <span class="nam">attr</span><span class="op">.</span><span class="nam">conflicting_attributes</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1703" href="#t1703">1703</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1704" href="#t1704">1704</a></span><span class="t"> <span class="str">f'The attribute "{attr_name}" is required and conflicts with the attributes: {c}.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1705" href="#t1705">1705</a></span><span class="t"> <span class="str">" This makes it impossible to use these attributes. Either remove the attributes"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1706" href="#t1706">1706</a></span><span class="t"> <span class="str">f' (along with the conflicts for them), adjust the conflicts or make "{attr_name}"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1707" href="#t1707">1707</a></span><span class="t"> <span class="str">" optional (NotRequired)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1708" href="#t1708">1708</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1709" href="#t1709">1709</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1710" href="#t1710">1710</a></span><span class="t"> <span class="nam">required_conflicts</span> <span class="op">=</span> <span class="nam">attr</span><span class="op">.</span><span class="nam">conflicting_attributes</span> <span class="op">&</span> <span class="nam">required_attributes</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1711" href="#t1711">1711</a></span><span class="t"> <span class="key">if</span> <span class="nam">required_conflicts</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1711 ↛ 1712</span><span class="annotate long">line 1711 didn't jump to line 1712, because the condition on line 1711 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1712" href="#t1712">1712</a></span><span class="t"> <span class="nam">c</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">repr</span><span class="op">(</span><span class="nam">a</span><span class="op">)</span> <span class="key">for</span> <span class="nam">a</span> <span class="key">in</span> <span class="nam">required_conflicts</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1713" href="#t1713">1713</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1714" href="#t1714">1714</a></span><span class="t"> <span class="str">f'The attribute "{attr_name}" conflicts with the following *required* attributes: {c}.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1715" href="#t1715">1715</a></span><span class="t"> <span class="str">f' This makes it impossible to use the "{attr_name}" attribute. Either remove it,'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1716" href="#t1716">1716</a></span><span class="t"> <span class="str">f" adjust the conflicts or make the listed attributes optional (NotRequired)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1717" href="#t1717">1717</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1718" href="#t1718">1718</a></span><span class="t"> <span class="nam">unknown_attributes</span> <span class="op">=</span> <span class="nam">attr</span><span class="op">.</span><span class="nam">conflicting_attributes</span> <span class="op">-</span> <span class="nam">all_attributes</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1719" href="#t1719">1719</a></span><span class="t"> <span class="key">if</span> <span class="nam">unknown_attributes</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1719 ↛ 1720</span><span class="annotate long">line 1719 didn't jump to line 1720, because the condition on line 1719 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1720" href="#t1720">1720</a></span><span class="t"> <span class="nam">c</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">repr</span><span class="op">(</span><span class="nam">a</span><span class="op">)</span> <span class="key">for</span> <span class="nam">a</span> <span class="key">in</span> <span class="nam">unknown_attributes</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1721" href="#t1721">1721</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1722" href="#t1722">1722</a></span><span class="t"> <span class="str">f'The attribute "{attr_name}" declares a conflict with the following unknown attributes: {c}.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1723" href="#t1723">1723</a></span><span class="t"> <span class="str">f" None of these attributes were declared in the input."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1724" href="#t1724">1724</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1725" href="#t1725">1725</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1726" href="#t1726">1726</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1727" href="#t1727">1727</a></span><span class="t"><span class="key">def</span> <span class="nam">_check_attributes</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1728" href="#t1728">1728</a></span><span class="t"> <span class="nam">content</span><span class="op">:</span> <span class="nam">Type</span><span class="op">[</span><span class="nam">TypedDict</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1729" href="#t1729">1729</a></span><span class="t"> <span class="nam">input_content</span><span class="op">:</span> <span class="nam">Type</span><span class="op">[</span><span class="nam">TypedDict</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1730" href="#t1730">1730</a></span><span class="t"> <span class="nam">input_content_attributes</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">AttributeDescription</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1731" href="#t1731">1731</a></span><span class="t"> <span class="nam">sources</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Collection</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1732" href="#t1732">1732</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1733" href="#t1733">1733</a></span><span class="t"> <span class="nam">target_required_keys</span> <span class="op">=</span> <span class="nam">content</span><span class="op">.</span><span class="nam">__required_keys__</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1734" href="#t1734">1734</a></span><span class="t"> <span class="nam">input_required_keys</span> <span class="op">=</span> <span class="nam">input_content</span><span class="op">.</span><span class="nam">__required_keys__</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1735" href="#t1735">1735</a></span><span class="t"> <span class="nam">all_input_keys</span> <span class="op">=</span> <span class="nam">input_required_keys</span> <span class="op">|</span> <span class="nam">input_content</span><span class="op">.</span><span class="nam">__optional_keys__</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1736" href="#t1736">1736</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1737" href="#t1737">1737</a></span><span class="t"> <span class="key">for</span> <span class="nam">input_name</span> <span class="key">in</span> <span class="nam">all_input_keys</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1738" href="#t1738">1738</a></span><span class="t"> <span class="nam">attr</span> <span class="op">=</span> <span class="nam">input_content_attributes</span><span class="op">[</span><span class="nam">input_name</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1739" href="#t1739">1739</a></span><span class="t"> <span class="nam">target_name</span> <span class="op">=</span> <span class="nam">attr</span><span class="op">.</span><span class="nam">target_attribute</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1740" href="#t1740">1740</a></span><span class="t"> <span class="nam">source_names</span> <span class="op">=</span> <span class="nam">sources</span><span class="op">[</span><span class="nam">target_name</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1741" href="#t1741">1741</a></span><span class="t"> <span class="nam">input_is_required</span> <span class="op">=</span> <span class="nam">input_name</span> <span class="key">in</span> <span class="nam">input_required_keys</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1742" href="#t1742">1742</a></span><span class="t"> <span class="nam">target_is_required</span> <span class="op">=</span> <span class="nam">target_name</span> <span class="key">in</span> <span class="nam">target_required_keys</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1743" href="#t1743">1743</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1744" href="#t1744">1744</a></span><span class="t"> <span class="key">assert</span> <span class="nam">source_names</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1745" href="#t1745">1745</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1746" href="#t1746">1746</a></span><span class="t"> <span class="key">if</span> <span class="nam">input_is_required</span> <span class="key">and</span> <span class="nam">len</span><span class="op">(</span><span class="nam">source_names</span><span class="op">)</span> <span class="op">></span> <span class="num">1</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1746 ↛ 1747</span><span class="annotate long">line 1746 didn't jump to line 1747, because the condition on line 1746 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1747" href="#t1747">1747</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1748" href="#t1748">1748</a></span><span class="t"> <span class="str">f'The source attribute "{input_name}" is required, but it maps to "{target_name}",'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1749" href="#t1749">1749</a></span><span class="t"> <span class="str">f' which has multiple sources "{source_names}". If "{input_name}" should be required,'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1750" href="#t1750">1750</a></span><span class="t"> <span class="str">f' then there is no need for additional sources for "{target_name}". Alternatively,'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1751" href="#t1751">1751</a></span><span class="t"> <span class="str">f' "{input_name}" might be missing a NotRequired type'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1752" href="#t1752">1752</a></span><span class="t"> <span class="str">f' (example: "{input_name}: NotRequired[<OriginalTypeHere>]")'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1753" href="#t1753">1753</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1754" href="#t1754">1754</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">input_is_required</span> <span class="key">and</span> <span class="nam">target_is_required</span> <span class="key">and</span> <span class="nam">len</span><span class="op">(</span><span class="nam">source_names</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1754 ↛ 1755</span><span class="annotate long">line 1754 didn't jump to line 1755, because the condition on line 1754 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1755" href="#t1755">1755</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1756" href="#t1756">1756</a></span><span class="t"> <span class="str">f'The source attribute "{input_name}" is not marked as required and maps to'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1757" href="#t1757">1757</a></span><span class="t"> <span class="str">f' "{target_name}", which is marked as required. As there are no other attributes'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1758" href="#t1758">1758</a></span><span class="t"> <span class="str">f' mapping to "{target_name}", then "{input_name}" must be required as well'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1759" href="#t1759">1759</a></span><span class="t"> <span class="str">f' ("{input_name}: Required[<Type>]"). Alternatively, "{target_name}" should be optional'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1760" href="#t1760">1760</a></span><span class="t"> <span class="str">f' ("{target_name}: NotRequired[<Type>]") or an "MappingHint.aliasOf" might be missing.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1761" href="#t1761">1761</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1762" href="#t1762">1762</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1763" href="#t1763">1763</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1764" href="#t1764">1764</a></span><span class="t"><span class="key">def</span> <span class="nam">_validation_type_error</span><span class="op">(</span><span class="nam">path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> <span class="nam">message</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1765" href="#t1765">1765</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1766" href="#t1766">1766</a></span><span class="t"> <span class="str">f'The attribute "{path.path}" did not have a valid structure/type: {message}'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1767" href="#t1767">1767</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1768" href="#t1768">1768</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1769" href="#t1769">1769</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1770" href="#t1770">1770</a></span><span class="t"><span class="key">def</span> <span class="nam">_is_two_arg_x_list_x</span><span class="op">(</span><span class="nam">t_args</span><span class="op">:</span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">Any</span><span class="op">,</span> <span class="op">...</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1771" href="#t1771">1771</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">t_args</span><span class="op">)</span> <span class="op">!=</span> <span class="num">2</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1771 ↛ 1772</span><span class="annotate long">line 1771 didn't jump to line 1772, because the condition on line 1771 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1772" href="#t1772">1772</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1773" href="#t1773">1773</a></span><span class="t"> <span class="nam">lhs</span><span class="op">,</span> <span class="nam">rhs</span> <span class="op">=</span> <span class="nam">t_args</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1774" href="#t1774">1774</a></span><span class="t"> <span class="key">if</span> <span class="nam">get_origin</span><span class="op">(</span><span class="nam">lhs</span><span class="op">)</span> <span class="op">==</span> <span class="nam">list</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1775" href="#t1775">1775</a></span><span class="t"> <span class="key">if</span> <span class="nam">get_origin</span><span class="op">(</span><span class="nam">rhs</span><span class="op">)</span> <span class="op">==</span> <span class="nam">list</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1775 ↛ 1778</span><span class="annotate long">line 1775 didn't jump to line 1778, because the condition on line 1775 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t1776" href="#t1776">1776</a></span><span class="t"> <span class="com"># It could still match X, List[X] - but we do not allow this case for now as the caller</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1777" href="#t1777">1777</a></span><span class="t"> <span class="com"># does not support it.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1778" href="#t1778">1778</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1779" href="#t1779">1779</a></span><span class="t"> <span class="nam">l_args</span> <span class="op">=</span> <span class="nam">get_args</span><span class="op">(</span><span class="nam">lhs</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1780" href="#t1780">1780</a></span><span class="t"> <span class="key">return</span> <span class="nam">bool</span><span class="op">(</span><span class="nam">l_args</span> <span class="key">and</span> <span class="nam">l_args</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="op">==</span> <span class="nam">rhs</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1781" href="#t1781">1781</a></span><span class="t"> <span class="key">if</span> <span class="nam">get_origin</span><span class="op">(</span><span class="nam">rhs</span><span class="op">)</span> <span class="op">==</span> <span class="nam">list</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1782" href="#t1782">1782</a></span><span class="t"> <span class="nam">r_args</span> <span class="op">=</span> <span class="nam">get_args</span><span class="op">(</span><span class="nam">rhs</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1783" href="#t1783">1783</a></span><span class="t"> <span class="key">return</span> <span class="nam">bool</span><span class="op">(</span><span class="nam">r_args</span> <span class="key">and</span> <span class="nam">r_args</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="op">==</span> <span class="nam">lhs</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1784" href="#t1784">1784</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1785" href="#t1785">1785</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1786" href="#t1786">1786</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1787" href="#t1787">1787</a></span><span class="t"><span class="key">def</span> <span class="nam">_extract_typed_dict</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1788" href="#t1788">1788</a></span><span class="t"> <span class="nam">base_type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1789" href="#t1789">1789</a></span><span class="t"> <span class="nam">default_target_attribute</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1790" href="#t1790">1790</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">Optional</span><span class="op">[</span><span class="nam">Type</span><span class="op">[</span><span class="nam">TypedDict</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1791" href="#t1791">1791</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_typeddict</span><span class="op">(</span><span class="nam">base_type</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1792" href="#t1792">1792</a></span><span class="t"> <span class="key">return</span> <span class="nam">base_type</span><span class="op">,</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1793" href="#t1793">1793</a></span><span class="t"> <span class="nam">_</span><span class="op">,</span> <span class="nam">origin</span><span class="op">,</span> <span class="nam">args</span> <span class="op">=</span> <span class="nam">unpack_type</span><span class="op">(</span><span class="nam">base_type</span><span class="op">,</span> <span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1794" href="#t1794">1794</a></span><span class="t"> <span class="key">if</span> <span class="nam">origin</span> <span class="op">!=</span> <span class="nam">Union</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1795" href="#t1795">1795</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">base_type</span><span class="op">,</span> <span class="nam">type</span><span class="op">)</span> <span class="key">and</span> <span class="nam">issubclass</span><span class="op">(</span><span class="nam">base_type</span><span class="op">,</span> <span class="op">(</span><span class="nam">dict</span><span class="op">,</span> <span class="nam">Mapping</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1795 ↛ 1796</span><span class="annotate long">line 1795 didn't jump to line 1796, because the condition on line 1795 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1796" href="#t1796">1796</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1797" href="#t1797">1797</a></span><span class="t"> <span class="str">"The source_format cannot be nor contain a (non-TypedDict) dict"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1798" href="#t1798">1798</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1799" href="#t1799">1799</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span><span class="op">,</span> <span class="nam">base_type</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1800" href="#t1800">1800</a></span><span class="t"> <span class="nam">typed_dicts</span> <span class="op">=</span> <span class="op">[</span><span class="nam">x</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">args</span> <span class="key">if</span> <span class="nam">is_typeddict</span><span class="op">(</span><span class="nam">x</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1801" href="#t1801">1801</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">typed_dicts</span><span class="op">)</span> <span class="op">></span> <span class="num">1</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1801 ↛ 1802</span><span class="annotate long">line 1801 didn't jump to line 1802, because the condition on line 1801 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1802" href="#t1802">1802</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1803" href="#t1803">1803</a></span><span class="t"> <span class="str">"When source_format is a Union, it must contain at most one TypedDict"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1804" href="#t1804">1804</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1805" href="#t1805">1805</a></span><span class="t"> <span class="nam">typed_dict</span> <span class="op">=</span> <span class="nam">typed_dicts</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="key">if</span> <span class="nam">typed_dicts</span> <span class="key">else</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1806" href="#t1806">1806</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1807" href="#t1807">1807</a></span><span class="t"> <span class="key">if</span> <span class="nam">any</span><span class="op">(</span><span class="nam">x</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">x</span> <span class="key">is</span> <span class="nam">_NONE_TYPE</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">args</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1807 ↛ 1808</span><span class="annotate long">line 1807 didn't jump to line 1808, because the condition on line 1807 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1808" href="#t1808">1808</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1809" href="#t1809">1809</a></span><span class="t"> <span class="str">"The source_format cannot be nor contain Optional[X] or Union[X, None]"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1810" href="#t1810">1810</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1811" href="#t1811">1811</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1812" href="#t1812">1812</a></span><span class="t"> <span class="key">if</span> <span class="nam">any</span><span class="op">(</span> </span><span class="r"><span class="annotate short">1812 ↛ 1817</span><span class="annotate long">line 1812 didn't jump to line 1817, because the condition on line 1812 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t1813" href="#t1813">1813</a></span><span class="t"> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">x</span><span class="op">,</span> <span class="nam">type</span><span class="op">)</span> <span class="key">and</span> <span class="nam">issubclass</span><span class="op">(</span><span class="nam">x</span><span class="op">,</span> <span class="op">(</span><span class="nam">dict</span><span class="op">,</span> <span class="nam">Mapping</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1814" href="#t1814">1814</a></span><span class="t"> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">args</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1815" href="#t1815">1815</a></span><span class="t"> <span class="key">if</span> <span class="nam">x</span> <span class="key">is</span> <span class="key">not</span> <span class="nam">typed_dict</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1816" href="#t1816">1816</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1817" href="#t1817">1817</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1818" href="#t1818">1818</a></span><span class="t"> <span class="str">"The source_format cannot be nor contain a (non-TypedDict) dict"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1819" href="#t1819">1819</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1820" href="#t1820">1820</a></span><span class="t"> <span class="nam">remaining</span> <span class="op">=</span> <span class="op">[</span><span class="nam">x</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">args</span> <span class="key">if</span> <span class="nam">x</span> <span class="key">is</span> <span class="key">not</span> <span class="nam">typed_dict</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1821" href="#t1821">1821</a></span><span class="t"> <span class="nam">has_target_attribute</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1822" href="#t1822">1822</a></span><span class="t"> <span class="nam">anno</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1823" href="#t1823">1823</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">remaining</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1823 ↛ 1824</span><span class="annotate long">line 1823 didn't jump to line 1824, because the condition on line 1823 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1824" href="#t1824">1824</a></span><span class="t"> <span class="nam">base_type</span><span class="op">,</span> <span class="nam">anno</span><span class="op">,</span> <span class="nam">_</span> <span class="op">=</span> <span class="nam">_parse_type</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1825" href="#t1825">1825</a></span><span class="t"> <span class="str">"source_format alternative form"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1826" href="#t1826">1826</a></span><span class="t"> <span class="nam">remaining</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1827" href="#t1827">1827</a></span><span class="t"> <span class="nam">forbid_optional</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1828" href="#t1828">1828</a></span><span class="t"> <span class="nam">parsing_typed_dict_attribute</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1829" href="#t1829">1829</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1830" href="#t1830">1830</a></span><span class="t"> <span class="nam">has_target_attribute</span> <span class="op">=</span> <span class="nam">bool</span><span class="op">(</span><span class="nam">anno</span><span class="op">)</span> <span class="key">and</span> <span class="nam">any</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1831" href="#t1831">1831</a></span><span class="t"> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">x</span><span class="op">,</span> <span class="nam">TargetAttribute</span><span class="op">)</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">anno</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1832" href="#t1832">1832</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1833" href="#t1833">1833</a></span><span class="t"> <span class="nam">target_type</span> <span class="op">=</span> <span class="nam">base_type</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1834" href="#t1834">1834</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1835" href="#t1835">1835</a></span><span class="t"> <span class="nam">target_type</span> <span class="op">=</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">tuple</span><span class="op">(</span><span class="nam">remaining</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1836" href="#t1836">1836</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1837" href="#t1837">1837</a></span><span class="t"> <span class="key">if</span> <span class="nam">default_target_attribute</span> <span class="key">is</span> <span class="key">None</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">has_target_attribute</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1837 ↛ 1838</span><span class="annotate long">line 1837 didn't jump to line 1838, because the condition on line 1837 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1838" href="#t1838">1838</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1839" href="#t1839">1839</a></span><span class="t"> <span class="str">'The alternative format must be Union[TypedDict,Annotated[X, DebputyParseHint.target_attribute("...")]]'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1840" href="#t1840">1840</a></span><span class="t"> <span class="str">" OR the parsed_content format must have exactly one attribute that is required."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1841" href="#t1841">1841</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1842" href="#t1842">1842</a></span><span class="t"> <span class="key">if</span> <span class="nam">anno</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1842 ↛ 1843</span><span class="annotate long">line 1842 didn't jump to line 1843, because the condition on line 1842 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1843" href="#t1843">1843</a></span><span class="t"> <span class="nam">final_anno</span> <span class="op">=</span> <span class="op">[</span><span class="nam">target_type</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1844" href="#t1844">1844</a></span><span class="t"> <span class="nam">final_anno</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">anno</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1845" href="#t1845">1845</a></span><span class="t"> <span class="key">return</span> <span class="nam">typed_dict</span><span class="op">,</span> <span class="nam">Annotated</span><span class="op">[</span><span class="nam">tuple</span><span class="op">(</span><span class="nam">final_anno</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1846" href="#t1846">1846</a></span><span class="t"> <span class="key">return</span> <span class="nam">typed_dict</span><span class="op">,</span> <span class="nam">target_type</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1847" href="#t1847">1847</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1848" href="#t1848">1848</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1849" href="#t1849">1849</a></span><span class="t"><span class="key">def</span> <span class="nam">_dispatch_parse_generator</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1850" href="#t1850">1850</a></span><span class="t"> <span class="nam">dispatch_type</span><span class="op">:</span> <span class="nam">Type</span><span class="op">[</span><span class="nam">DebputyDispatchableType</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1851" href="#t1851">1851</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">Any</span><span class="op">,</span> <span class="nam">AttributePath</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"ParserContextData"</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1852" href="#t1852">1852</a></span><span class="t"> <span class="key">def</span> <span class="nam">_dispatch_parse</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1853" href="#t1853">1853</a></span><span class="t"> <span class="nam">value</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1854" href="#t1854">1854</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1855" href="#t1855">1855</a></span><span class="t"> <span class="nam">parser_context</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"ParserContextData"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1856" href="#t1856">1856</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1857" href="#t1857">1857</a></span><span class="t"> <span class="key">assert</span> <span class="nam">parser_context</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1858" href="#t1858">1858</a></span><span class="t"> <span class="nam">dispatching_parser</span> <span class="op">=</span> <span class="nam">parser_context</span><span class="op">.</span><span class="nam">dispatch_parser_table_for</span><span class="op">(</span><span class="nam">dispatch_type</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1859" href="#t1859">1859</a></span><span class="t"> <span class="key">return</span> <span class="nam">dispatching_parser</span><span class="op">.</span><span class="nam">parse_input</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1860" href="#t1860">1860</a></span><span class="t"> <span class="nam">value</span><span class="op">,</span> <span class="nam">attribute_path</span><span class="op">,</span> <span class="nam">parser_context</span><span class="op">=</span><span class="nam">parser_context</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1861" href="#t1861">1861</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1862" href="#t1862">1862</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1863" href="#t1863">1863</a></span><span class="t"> <span class="key">return</span> <span class="nam">_dispatch_parse</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1864" href="#t1864">1864</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1865" href="#t1865">1865</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1866" href="#t1866">1866</a></span><span class="t"><span class="key">def</span> <span class="nam">_dispatch_parser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1867" href="#t1867">1867</a></span><span class="t"> <span class="nam">dispatch_type</span><span class="op">:</span> <span class="nam">Type</span><span class="op">[</span><span class="nam">DebputyDispatchableType</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1868" href="#t1868">1868</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">AttributeTypeHandler</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1869" href="#t1869">1869</a></span><span class="t"> <span class="key">return</span> <span class="nam">AttributeTypeHandler</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1870" href="#t1870">1870</a></span><span class="t"> <span class="nam">dispatch_type</span><span class="op">.</span><span class="nam">__name__</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1871" href="#t1871">1871</a></span><span class="t"> <span class="key">lambda</span> <span class="op">*</span><span class="nam">a</span><span class="op">:</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1872" href="#t1872">1872</a></span><span class="t"> <span class="nam">mapper</span><span class="op">=</span><span class="nam">_dispatch_parse_generator</span><span class="op">(</span><span class="nam">dispatch_type</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1873" href="#t1873">1873</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1874" href="#t1874">1874</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1875" href="#t1875">1875</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1876" href="#t1876">1876</a></span><span class="t"><span class="key">def</span> <span class="nam">_parse_type</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1877" href="#t1877">1877</a></span><span class="t"> <span class="nam">attribute</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1878" href="#t1878">1878</a></span><span class="t"> <span class="nam">orig_td</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1879" href="#t1879">1879</a></span><span class="t"> <span class="nam">forbid_optional</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1880" href="#t1880">1880</a></span><span class="t"> <span class="nam">parsing_typed_dict_attribute</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1881" href="#t1881">1881</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">Any</span><span class="op">,</span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">Any</span><span class="op">,</span> <span class="op">...</span><span class="op">]</span><span class="op">,</span> <span class="nam">bool</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1882" href="#t1882">1882</a></span><span class="t"> <span class="nam">td</span><span class="op">,</span> <span class="nam">v</span><span class="op">,</span> <span class="nam">args</span> <span class="op">=</span> <span class="nam">unpack_type</span><span class="op">(</span><span class="nam">orig_td</span><span class="op">,</span> <span class="nam">parsing_typed_dict_attribute</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1883" href="#t1883">1883</a></span><span class="t"> <span class="nam">md</span><span class="op">:</span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">Any</span><span class="op">,</span> <span class="op">...</span><span class="op">]</span> <span class="op">=</span> <span class="nam">tuple</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1884" href="#t1884">1884</a></span><span class="t"> <span class="nam">optional</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1885" href="#t1885">1885</a></span><span class="t"> <span class="key">if</span> <span class="nam">v</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1886" href="#t1886">1886</a></span><span class="t"> <span class="key">if</span> <span class="nam">v</span> <span class="op">==</span> <span class="nam">Annotated</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1887" href="#t1887">1887</a></span><span class="t"> <span class="nam">anno</span> <span class="op">=</span> <span class="nam">get_args</span><span class="op">(</span><span class="nam">td</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1888" href="#t1888">1888</a></span><span class="t"> <span class="nam">md</span> <span class="op">=</span> <span class="nam">anno</span><span class="op">[</span><span class="num">1</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1889" href="#t1889">1889</a></span><span class="t"> <span class="nam">td</span><span class="op">,</span> <span class="nam">v</span><span class="op">,</span> <span class="nam">args</span> <span class="op">=</span> <span class="nam">unpack_type</span><span class="op">(</span><span class="nam">anno</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">,</span> <span class="nam">parsing_typed_dict_attribute</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1890" href="#t1890">1890</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1891" href="#t1891">1891</a></span><span class="t"> <span class="key">if</span> <span class="nam">td</span> <span class="key">is</span> <span class="nam">_NONE_TYPE</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1891 ↛ 1892</span><span class="annotate long">line 1891 didn't jump to line 1892, because the condition on line 1891 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1892" href="#t1892">1892</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1893" href="#t1893">1893</a></span><span class="t"> <span class="str">f'The attribute "{attribute}" resolved to type "None". "Nil" / "None" fields are not allowed in the'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1894" href="#t1894">1894</a></span><span class="t"> <span class="str">" debputy manifest, so this attribute does not make sense in its current form."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1895" href="#t1895">1895</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1896" href="#t1896">1896</a></span><span class="t"> <span class="key">if</span> <span class="nam">forbid_optional</span> <span class="key">and</span> <span class="nam">v</span> <span class="op">==</span> <span class="nam">Union</span> <span class="key">and</span> <span class="nam">any</span><span class="op">(</span><span class="nam">a</span> <span class="key">is</span> <span class="nam">_NONE_TYPE</span> <span class="key">for</span> <span class="nam">a</span> <span class="key">in</span> <span class="nam">args</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1896 ↛ 1897</span><span class="annotate long">line 1896 didn't jump to line 1897, because the condition on line 1896 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1897" href="#t1897">1897</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1898" href="#t1898">1898</a></span><span class="t"> <span class="str">f'Detected use of Optional in "{attribute}", which is not allowed here.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1899" href="#t1899">1899</a></span><span class="t"> <span class="str">" Please use NotRequired for optional fields"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1900" href="#t1900">1900</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1901" href="#t1901">1901</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1902" href="#t1902">1902</a></span><span class="t"> <span class="key">return</span> <span class="nam">td</span><span class="op">,</span> <span class="nam">md</span><span class="op">,</span> <span class="nam">optional</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1903" href="#t1903">1903</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1904" href="#t1904">1904</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1905" href="#t1905">1905</a></span><span class="t"><span class="key">def</span> <span class="nam">_normalize_attribute_name</span><span class="op">(</span><span class="nam">attribute</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1906" href="#t1906">1906</a></span><span class="t"> <span class="key">if</span> <span class="nam">attribute</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"_"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1907" href="#t1907">1907</a></span><span class="t"> <span class="nam">attribute</span> <span class="op">=</span> <span class="nam">attribute</span><span class="op">[</span><span class="op">:</span><span class="op">-</span><span class="num">1</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1908" href="#t1908">1908</a></span><span class="t"> <span class="key">return</span> <span class="nam">attribute</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">"_"</span><span class="op">,</span> <span class="str">"-"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1909" href="#t1909">1909</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1910" href="#t1910">1910</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1911" href="#t1911">1911</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1912" href="#t1912">1912</a></span><span class="t"><span class="key">class</span> <span class="nam">DetectedDebputyParseHint</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1913" href="#t1913">1913</a></span><span class="t"> <span class="nam">target_attribute</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1914" href="#t1914">1914</a></span><span class="t"> <span class="nam">source_manifest_attribute</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1915" href="#t1915">1915</a></span><span class="t"> <span class="nam">conflict_with_source_attributes</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1916" href="#t1916">1916</a></span><span class="t"> <span class="nam">conditional_required</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ConditionalRequired</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1917" href="#t1917">1917</a></span><span class="t"> <span class="nam">applicable_as_path_hint</span><span class="op">:</span> <span class="nam">bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1918" href="#t1918">1918</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1919" href="#t1919">1919</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1920" href="#t1920">1920</a></span><span class="t"> <span class="key">def</span> <span class="nam">parse_annotations</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1921" href="#t1921">1921</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1922" href="#t1922">1922</a></span><span class="t"> <span class="nam">anno</span><span class="op">:</span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">Any</span><span class="op">,</span> <span class="op">...</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1923" href="#t1923">1923</a></span><span class="t"> <span class="nam">error_context</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1924" href="#t1924">1924</a></span><span class="t"> <span class="nam">default_attribute_name</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1925" href="#t1925">1925</a></span><span class="t"> <span class="nam">is_required</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1926" href="#t1926">1926</a></span><span class="t"> <span class="nam">default_target_attribute</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1927" href="#t1927">1927</a></span><span class="t"> <span class="nam">allow_target_attribute_annotation</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1928" href="#t1928">1928</a></span><span class="t"> <span class="nam">allow_source_attribute_annotations</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1929" href="#t1929">1929</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"DetectedDebputyParseHint"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1930" href="#t1930">1930</a></span><span class="t"> <span class="nam">target_attr_anno</span> <span class="op">=</span> <span class="nam">find_annotation</span><span class="op">(</span><span class="nam">anno</span><span class="op">,</span> <span class="nam">TargetAttribute</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1931" href="#t1931">1931</a></span><span class="t"> <span class="key">if</span> <span class="nam">target_attr_anno</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1932" href="#t1932">1932</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">allow_target_attribute_annotation</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1932 ↛ 1933</span><span class="annotate long">line 1932 didn't jump to line 1933, because the condition on line 1932 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1933" href="#t1933">1933</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1934" href="#t1934">1934</a></span><span class="t"> <span class="str">f"The DebputyParseHint.target_attribute annotation is not allowed in this context.{error_context}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1935" href="#t1935">1935</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1936" href="#t1936">1936</a></span><span class="t"> <span class="nam">target_attribute</span> <span class="op">=</span> <span class="nam">target_attr_anno</span><span class="op">.</span><span class="nam">attribute</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1937" href="#t1937">1937</a></span><span class="t"> <span class="key">elif</span> <span class="nam">default_target_attribute</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1938" href="#t1938">1938</a></span><span class="t"> <span class="nam">target_attribute</span> <span class="op">=</span> <span class="nam">default_target_attribute</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1939" href="#t1939">1939</a></span><span class="t"> <span class="key">elif</span> <span class="nam">default_attribute_name</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1939 ↛ 1942</span><span class="annotate long">line 1939 didn't jump to line 1942, because the condition on line 1939 was never false</span></span></p> - <p class="run"><span class="n"><a id="t1940" href="#t1940">1940</a></span><span class="t"> <span class="nam">target_attribute</span> <span class="op">=</span> <span class="nam">default_attribute_name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1941" href="#t1941">1941</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1942" href="#t1942">1942</a></span><span class="t"> <span class="key">if</span> <span class="nam">default_attribute_name</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1943" href="#t1943">1943</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1944" href="#t1944">1944</a></span><span class="t"> <span class="str">"allow_target_attribute_annotation must be True OR "</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1945" href="#t1945">1945</a></span><span class="t"> <span class="str">"default_attribute_name/default_target_attribute must be not None"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1946" href="#t1946">1946</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1947" href="#t1947">1947</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1948" href="#t1948">1948</a></span><span class="t"> <span class="str">f"Missing DebputyParseHint.target_attribute annotation.{error_context}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1949" href="#t1949">1949</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1950" href="#t1950">1950</a></span><span class="t"> <span class="nam">source_attribute_anno</span> <span class="op">=</span> <span class="nam">find_annotation</span><span class="op">(</span><span class="nam">anno</span><span class="op">,</span> <span class="nam">ManifestAttribute</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1951" href="#t1951">1951</a></span><span class="t"> <span class="nam">_source_attribute_allowed</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1952" href="#t1952">1952</a></span><span class="t"> <span class="nam">allow_source_attribute_annotations</span><span class="op">,</span> <span class="nam">error_context</span><span class="op">,</span> <span class="nam">source_attribute_anno</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1953" href="#t1953">1953</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1954" href="#t1954">1954</a></span><span class="t"> <span class="key">if</span> <span class="nam">source_attribute_anno</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1955" href="#t1955">1955</a></span><span class="t"> <span class="nam">source_attribute_name</span> <span class="op">=</span> <span class="nam">source_attribute_anno</span><span class="op">.</span><span class="nam">attribute</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1956" href="#t1956">1956</a></span><span class="t"> <span class="key">elif</span> <span class="nam">default_attribute_name</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1957" href="#t1957">1957</a></span><span class="t"> <span class="nam">source_attribute_name</span> <span class="op">=</span> <span class="nam">_normalize_attribute_name</span><span class="op">(</span><span class="nam">default_attribute_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1958" href="#t1958">1958</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1959" href="#t1959">1959</a></span><span class="t"> <span class="nam">source_attribute_name</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1960" href="#t1960">1960</a></span><span class="t"> <span class="nam">mutual_exclusive_with_anno</span> <span class="op">=</span> <span class="nam">find_annotation</span><span class="op">(</span><span class="nam">anno</span><span class="op">,</span> <span class="nam">ConflictWithSourceAttribute</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1961" href="#t1961">1961</a></span><span class="t"> <span class="key">if</span> <span class="nam">mutual_exclusive_with_anno</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1962" href="#t1962">1962</a></span><span class="t"> <span class="nam">_source_attribute_allowed</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1963" href="#t1963">1963</a></span><span class="t"> <span class="nam">allow_source_attribute_annotations</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1964" href="#t1964">1964</a></span><span class="t"> <span class="nam">error_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1965" href="#t1965">1965</a></span><span class="t"> <span class="nam">mutual_exclusive_with_anno</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1966" href="#t1966">1966</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1967" href="#t1967">1967</a></span><span class="t"> <span class="nam">conflicting_attributes</span> <span class="op">=</span> <span class="nam">mutual_exclusive_with_anno</span><span class="op">.</span><span class="nam">conflicting_attributes</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1968" href="#t1968">1968</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1969" href="#t1969">1969</a></span><span class="t"> <span class="nam">conflicting_attributes</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1970" href="#t1970">1970</a></span><span class="t"> <span class="nam">conditional_required</span> <span class="op">=</span> <span class="nam">find_annotation</span><span class="op">(</span><span class="nam">anno</span><span class="op">,</span> <span class="nam">ConditionalRequired</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1971" href="#t1971">1971</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1972" href="#t1972">1972</a></span><span class="t"> <span class="key">if</span> <span class="nam">conditional_required</span> <span class="key">and</span> <span class="nam">is_required</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1972 ↛ 1973</span><span class="annotate long">line 1972 didn't jump to line 1973, because the condition on line 1972 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1973" href="#t1973">1973</a></span><span class="t"> <span class="key">if</span> <span class="nam">default_attribute_name</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1974" href="#t1974">1974</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1975" href="#t1975">1975</a></span><span class="t"> <span class="str">f"is_required cannot be True without default_attribute_name being not None"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1976" href="#t1976">1976</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1977" href="#t1977">1977</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1978" href="#t1978">1978</a></span><span class="t"> <span class="str">f'The attribute "{default_attribute_name}" is Required while also being conditionally required.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1979" href="#t1979">1979</a></span><span class="t"> <span class="str">' Please make the attribute "NotRequired" or remove the conditional requirement.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1980" href="#t1980">1980</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1981" href="#t1981">1981</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1982" href="#t1982">1982</a></span><span class="t"> <span class="nam">not_path_hint_anno</span> <span class="op">=</span> <span class="nam">find_annotation</span><span class="op">(</span><span class="nam">anno</span><span class="op">,</span> <span class="nam">NotPathHint</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1983" href="#t1983">1983</a></span><span class="t"> <span class="nam">applicable_as_path_hint</span> <span class="op">=</span> <span class="nam">not_path_hint_anno</span> <span class="key">is</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1984" href="#t1984">1984</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1985" href="#t1985">1985</a></span><span class="t"> <span class="key">return</span> <span class="nam">DetectedDebputyParseHint</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1986" href="#t1986">1986</a></span><span class="t"> <span class="nam">target_attribute</span><span class="op">=</span><span class="nam">target_attribute</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1987" href="#t1987">1987</a></span><span class="t"> <span class="nam">source_manifest_attribute</span><span class="op">=</span><span class="nam">source_attribute_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1988" href="#t1988">1988</a></span><span class="t"> <span class="nam">conflict_with_source_attributes</span><span class="op">=</span><span class="nam">conflicting_attributes</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1989" href="#t1989">1989</a></span><span class="t"> <span class="nam">conditional_required</span><span class="op">=</span><span class="nam">conditional_required</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1990" href="#t1990">1990</a></span><span class="t"> <span class="nam">applicable_as_path_hint</span><span class="op">=</span><span class="nam">applicable_as_path_hint</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1991" href="#t1991">1991</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1992" href="#t1992">1992</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1993" href="#t1993">1993</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1994" href="#t1994">1994</a></span><span class="t"><span class="key">def</span> <span class="nam">_source_attribute_allowed</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1995" href="#t1995">1995</a></span><span class="t"> <span class="nam">source_attribute_allowed</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1996" href="#t1996">1996</a></span><span class="t"> <span class="nam">error_context</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1997" href="#t1997">1997</a></span><span class="t"> <span class="nam">annotation</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">DebputyParseHint</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1998" href="#t1998">1998</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1999" href="#t1999">1999</a></span><span class="t"> <span class="key">if</span> <span class="nam">source_attribute_allowed</span> <span class="key">or</span> <span class="nam">annotation</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1999 ↛ 2001</span><span class="annotate long">line 1999 didn't jump to line 2001, because the condition on line 1999 was never false</span></span></p> - <p class="run"><span class="n"><a id="t2000" href="#t2000">2000</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2001" href="#t2001">2001</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2002" href="#t2002">2002</a></span><span class="t"> <span class="str">f'The annotation "{annotation}" cannot be used here. {error_context}'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2003" href="#t2003">2003</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_4f754ff76d8638bb_base_types_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_4f754ff76d8638bb_exceptions_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_4f754ff76d8638bb_exceptions_py.html b/coverage-report/d_4f754ff76d8638bb_exceptions_py.html deleted file mode 100644 index 038f97c..0000000 --- a/coverage-report/d_4f754ff76d8638bb_exceptions_py.html +++ /dev/null @@ -1,108 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/manifest_parser/exceptions.py: 100%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/manifest_parser/exceptions.py</b>: - <span class="pc_cov">100%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">5 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">5<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">0<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_4f754ff76d8638bb_declarative_parser_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_4f754ff76d8638bb_mapper_code_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">exceptions</span> <span class="key">import</span> <span class="nam">DebputyRuntimeError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">class</span> <span class="nam">ManifestParseException</span><span class="op">(</span><span class="nam">DebputyRuntimeError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="key">class</span> <span class="nam">ManifestTypeException</span><span class="op">(</span><span class="nam">ManifestParseException</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_4f754ff76d8638bb_declarative_parser_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_4f754ff76d8638bb_mapper_code_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_4f754ff76d8638bb_mapper_code_py.html b/coverage-report/d_4f754ff76d8638bb_mapper_code_py.html deleted file mode 100644 index 7b7059c..0000000 --- a/coverage-report/d_4f754ff76d8638bb_mapper_code_py.html +++ /dev/null @@ -1,176 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/manifest_parser/mapper_code.py: 86%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/manifest_parser/mapper_code.py</b>: - <span class="pc_cov">86%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">32 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">28<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">4<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">2<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_4f754ff76d8638bb_exceptions_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_4f754ff76d8638bb_parser_data_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"> <span class="nam">TypeVar</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> <span class="nam">List</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="nam">Callable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">exceptions</span> <span class="key">import</span> <span class="nam">ManifestTypeException</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">parser_data</span> <span class="key">import</span> <span class="nam">ParserContextData</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">AttributePath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">packages</span> <span class="key">import</span> <span class="nam">BinaryPackage</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">assume_not_none</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"><span class="nam">S</span> <span class="op">=</span> <span class="nam">TypeVar</span><span class="op">(</span><span class="str">"S"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"><span class="nam">T</span> <span class="op">=</span> <span class="nam">TypeVar</span><span class="op">(</span><span class="str">"T"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"><span class="key">def</span> <span class="nam">type_mapper_str2package</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">raw_package_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">ap</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">opc</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ParserContextData</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">BinaryPackage</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">pc</span> <span class="op">=</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">opc</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="key">if</span> <span class="str">"{{"</span> <span class="key">in</span> <span class="nam">raw_package_name</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="nam">resolved_package_name</span> <span class="op">=</span> <span class="nam">pc</span><span class="op">.</span><span class="nam">substitution</span><span class="op">.</span><span class="nam">substitute</span><span class="op">(</span><span class="nam">raw_package_name</span><span class="op">,</span> <span class="nam">ap</span><span class="op">.</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="nam">resolved_package_name</span> <span class="op">=</span> <span class="nam">raw_package_name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="nam">package_name_in_message</span> <span class="op">=</span> <span class="nam">raw_package_name</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="key">if</span> <span class="nam">resolved_package_name</span> <span class="op">!=</span> <span class="nam">raw_package_name</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="nam">package_name_in_message</span> <span class="op">=</span> <span class="str">f'"{resolved_package_name}" ["{raw_package_name}"]'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">pc</span><span class="op">.</span><span class="nam">is_known_package</span><span class="op">(</span><span class="nam">resolved_package_name</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">34 ↛ 35</span><span class="annotate long">line 34 didn't jump to line 35, because the condition on line 34 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="nam">package_names</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">pc</span><span class="op">.</span><span class="nam">binary_packages</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestTypeException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="str">f'The value {package_name_in_message} (from "{ap.path}") does not reference a package declared in'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="str">f" debian/control. Valid options are: {package_names}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="nam">package_data</span> <span class="op">=</span> <span class="nam">pc</span><span class="op">.</span><span class="nam">binary_package_data</span><span class="op">(</span><span class="nam">resolved_package_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="key">if</span> <span class="nam">package_data</span><span class="op">.</span><span class="nam">is_auto_generated_package</span><span class="op">:</span> </span><span class="r"><span class="annotate short">41 ↛ 42</span><span class="annotate long">line 41 didn't jump to line 42, because the condition on line 41 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">package_names</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">pc</span><span class="op">.</span><span class="nam">binary_packages</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestTypeException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="str">f'The package name {package_name_in_message} (from "{ap.path}") references an auto-generated package.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="str">" However, auto-generated packages are now permitted here. Valid options are:"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="str">f" {package_names}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="key">return</span> <span class="nam">package_data</span><span class="op">.</span><span class="nam">binary_package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"><span class="key">def</span> <span class="nam">wrap_into_list</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="nam">x</span><span class="op">:</span> <span class="nam">T</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="nam">_ap</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="nam">_pc</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"ParserContextData"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">List</span><span class="op">[</span><span class="nam">T</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="key">return</span> <span class="op">[</span><span class="nam">x</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"><span class="key">def</span> <span class="nam">normalize_into_list</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="nam">x</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">T</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">T</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="nam">_ap</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="nam">_pc</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"ParserContextData"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">List</span><span class="op">[</span><span class="nam">T</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="key">return</span> <span class="nam">x</span> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">x</span><span class="op">,</span> <span class="nam">list</span><span class="op">)</span> <span class="key">else</span> <span class="op">[</span><span class="nam">x</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"><span class="key">def</span> <span class="nam">map_each_element</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="nam">mapper</span><span class="op">:</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">S</span><span class="op">,</span> <span class="nam">AttributePath</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"ParserContextData"</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> <span class="nam">T</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">S</span><span class="op">]</span><span class="op">,</span> <span class="nam">AttributePath</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"ParserContextData"</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">T</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="key">def</span> <span class="nam">_generated_mapper</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="nam">xs</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">S</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="nam">ap</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="nam">pc</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"ParserContextData"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">List</span><span class="op">[</span><span class="nam">T</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="key">return</span> <span class="op">[</span><span class="nam">mapper</span><span class="op">(</span><span class="nam">s</span><span class="op">,</span> <span class="nam">ap</span><span class="op">[</span><span class="nam">i</span><span class="op">]</span><span class="op">,</span> <span class="nam">pc</span><span class="op">)</span> <span class="key">for</span> <span class="nam">i</span><span class="op">,</span> <span class="nam">s</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">xs</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="key">return</span> <span class="nam">_generated_mapper</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_4f754ff76d8638bb_exceptions_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_4f754ff76d8638bb_parser_data_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_4f754ff76d8638bb_parser_data_py.html b/coverage-report/d_4f754ff76d8638bb_parser_data_py.html deleted file mode 100644 index 3f5a3d1..0000000 --- a/coverage-report/d_4f754ff76d8638bb_parser_data_py.html +++ /dev/null @@ -1,232 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/manifest_parser/parser_data.py: 85%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/manifest_parser/parser_data.py</b>: - <span class="pc_cov">85%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">54 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">47<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">7<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">12<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">2<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_4f754ff76d8638bb_mapper_code_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_4f754ff76d8638bb_parser_doc_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">contextlib</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"> <span class="nam">Iterator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> <span class="nam">Mapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="nam">NoReturn</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">TYPE_CHECKING</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"><span class="key">from</span> <span class="nam">debian</span><span class="op">.</span><span class="nam">debian_support</span> <span class="key">import</span> <span class="nam">DpkgArchTable</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">_deb_options_profiles</span> <span class="key">import</span> <span class="nam">DebBuildOptionsAndProfiles</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">architecture_support</span> <span class="key">import</span> <span class="nam">DpkgArchitectureBuildProcessValuesTable</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_conditions</span> <span class="key">import</span> <span class="nam">ManifestCondition</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">exceptions</span> <span class="key">import</span> <span class="nam">ManifestParseException</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">AttributePath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">packages</span> <span class="key">import</span> <span class="nam">BinaryPackage</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">impl_types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">_ALL_PACKAGE_TYPES</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="nam">resolve_package_type_selectors</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">TP</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="nam">DispatchingTableParser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="nam">TTP</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="nam">DispatchingObjectParser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">spec</span> <span class="key">import</span> <span class="nam">PackageTypeSelector</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">substitution</span> <span class="key">import</span> <span class="nam">Substitution</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"><span class="key">if</span> <span class="nam">TYPE_CHECKING</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">highlevel_manifest</span> <span class="key">import</span> <span class="nam">PackageTransformationDefinition</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="key">class</span> <span class="nam">ParserContextData</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="key">def</span> <span class="nam">binary_packages</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="key">def</span> <span class="nam">_package_states</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="str">"PackageTransformationDefinition"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_single_binary_package</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="key">return</span> <span class="nam">len</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">binary_packages</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="key">def</span> <span class="nam">single_binary_package</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="nam">package_type</span><span class="op">:</span> <span class="nam">PackageTypeSelector</span> <span class="op">=</span> <span class="nam">_ALL_PACKAGE_TYPES</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="nam">package_attribute</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="nam">resolved_package_types</span> <span class="op">=</span> <span class="nam">resolve_package_type_selectors</span><span class="op">(</span><span class="nam">package_type</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="nam">possible_matches</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="nam">p</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">binary_packages</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="key">if</span> <span class="nam">p</span><span class="op">.</span><span class="nam">package_type</span> <span class="key">in</span> <span class="nam">resolved_package_types</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">possible_matches</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"><span class="annotate short">63 ↛ 66</span><span class="annotate long">line 63 didn't jump to line 66, because the condition on line 63 was never false</span></span></p> - <p class="run"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="key">return</span> <span class="nam">possible_matches</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="key">if</span> <span class="nam">package_attribute</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="str">f"The {attribute_path.path} rule needs the attribute `{package_attribute}`"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="str">" for this source package."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">possible_matches</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="nam">_package_types</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">sorted</span><span class="op">(</span><span class="nam">resolved_package_types</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="str">f"The {attribute_path.path} rule is not applicable to this source package"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="str">f" (it only applies to source packages that builds exactly one of"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="str">f" the following package types: {_package_types})."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="str">f"The {attribute_path.path} rule is not applicable to multi-binary packages."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="key">def</span> <span class="nam">_error</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">msg</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="str">"NoReturn"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span><span class="nam">msg</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_known_package</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">package_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="key">return</span> <span class="nam">package_name</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_states</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="key">def</span> <span class="nam">binary_package_data</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="nam">package_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"PackageTransformationDefinition"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="key">if</span> <span class="nam">package_name</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_states</span><span class="op">:</span> </span><span class="r"><span class="annotate short">93 ↛ 94</span><span class="annotate long">line 93 didn't jump to line 94, because the condition on line 93 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="str">f'The package "{package_name}" is not present in the debian/control file (could not find'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="str">f' "Package: {package_name}" in a binary stanza) nor is it a -dbgsym package for one'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="str">" for a package in debian/control."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_states</span><span class="op">[</span><span class="nam">package_name</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="key">def</span> <span class="nam">dpkg_architecture_variables</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">DpkgArchitectureBuildProcessValuesTable</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="key">def</span> <span class="nam">dpkg_arch_query_table</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">DpkgArchTable</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="key">def</span> <span class="nam">build_env</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">DebBuildOptionsAndProfiles</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="op">@</span><span class="nam">contextlib</span><span class="op">.</span><span class="nam">contextmanager</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="key">def</span> <span class="nam">binary_package_context</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="nam">package_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="str">"PackageTransformationDefinition"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="key">def</span> <span class="nam">substitution</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Substitution</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="key">def</span> <span class="nam">current_binary_package_state</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="str">"PackageTransformationDefinition"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_in_binary_package_state</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="key">def</span> <span class="nam">dispatch_parser_table_for</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">rule_type</span><span class="op">:</span> <span class="nam">TTP</span><span class="op">)</span> <span class="op">-></span> <span class="nam">DispatchingTableParser</span><span class="op">[</span><span class="nam">TP</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_4f754ff76d8638bb_mapper_code_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_4f754ff76d8638bb_parser_doc_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_4f754ff76d8638bb_parser_doc_py.html b/coverage-report/d_4f754ff76d8638bb_parser_doc_py.html deleted file mode 100644 index 3ce54b7..0000000 --- a/coverage-report/d_4f754ff76d8638bb_parser_doc_py.html +++ /dev/null @@ -1,372 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/manifest_parser/parser_doc.py: 79%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/manifest_parser/parser_doc.py</b>: - <span class="pc_cov">79%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">132 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">107<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">25<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">9<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_4f754ff76d8638bb_parser_data_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_4f754ff76d8638bb_util_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">itertools</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Optional</span><span class="op">,</span> <span class="nam">Iterable</span><span class="op">,</span> <span class="nam">Any</span><span class="op">,</span> <span class="nam">Tuple</span><span class="op">,</span> <span class="nam">Mapping</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">,</span> <span class="nam">FrozenSet</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span> <span class="key">import</span> <span class="nam">DEBPUTY_DOC_ROOT_DIR</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">declarative_parser</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="nam">DeclarativeMappingInputParser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">DeclarativeNonMappingInputParser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">AttributeDescription</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">impl_types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">DebputyPluginMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">DeclarativeInputParser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">DispatchingObjectParser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">ListWrappedDeclarativeInputParser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">InPackageContextParser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">spec</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">ParserDocumentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">reference_documentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">undocumented_attr</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">assume_not_none</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"><span class="key">def</span> <span class="nam">_provide_placeholder_parser_doc</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="nam">parser_doc</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ParserDocumentation</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="nam">attributes</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">ParserDocumentation</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="key">if</span> <span class="nam">parser_doc</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">29 ↛ 30</span><span class="annotate long">line 29 didn't jump to line 30, because the condition on line 29 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="nam">parser_doc</span> <span class="op">=</span> <span class="nam">reference_documentation</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="nam">changes</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="key">if</span> <span class="nam">parser_doc</span><span class="op">.</span><span class="nam">attribute_doc</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="nam">changes</span><span class="op">[</span><span class="str">"attribute_doc"</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span><span class="nam">undocumented_attr</span><span class="op">(</span><span class="nam">attr</span><span class="op">)</span> <span class="key">for</span> <span class="nam">attr</span> <span class="key">in</span> <span class="nam">attributes</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="key">if</span> <span class="nam">changes</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="key">return</span> <span class="nam">parser_doc</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="op">**</span><span class="nam">changes</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="key">return</span> <span class="nam">parser_doc</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"><span class="key">def</span> <span class="nam">doc_args_for_parser_doc</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="nam">rule_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">declarative_parser</span><span class="op">:</span> <span class="nam">DeclarativeInputParser</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">:</span> <span class="nam">DebputyPluginMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">ParserDocumentation</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="nam">attributes</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">declarative_parser</span><span class="op">,</span> <span class="nam">DeclarativeMappingInputParser</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="nam">attributes</span> <span class="op">=</span> <span class="nam">declarative_parser</span><span class="op">.</span><span class="nam">source_attributes</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="nam">attributes</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="nam">doc_args</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="str">"RULE_NAME"</span><span class="op">:</span> <span class="nam">rule_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="str">"MANIFEST_FORMAT_DOC"</span><span class="op">:</span> <span class="str">f"{DEBPUTY_DOC_ROOT_DIR}/MANIFEST-FORMAT.md"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="str">"PLUGIN_NAME"</span><span class="op">:</span> <span class="nam">plugin_metadata</span><span class="op">.</span><span class="nam">plugin_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="nam">parser_doc</span> <span class="op">=</span> <span class="nam">_provide_placeholder_parser_doc</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">declarative_parser</span><span class="op">.</span><span class="nam">inline_reference_documentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="nam">attributes</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="key">return</span> <span class="nam">doc_args</span><span class="op">,</span> <span class="nam">parser_doc</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"><span class="key">def</span> <span class="nam">render_attribute_doc</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="nam">parser</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="nam">attributes</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="str">"AttributeDescription"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="nam">required_attributes</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="nam">conditionally_required_attributes</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="nam">parser_doc</span><span class="op">:</span> <span class="nam">ParserDocumentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="nam">doc_args</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="nam">rule_name</span><span class="op">:</span> <span class="nam">str</span> <span class="op">=</span> <span class="str">"<unset>"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="nam">is_root_rule</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="nam">is_interactive</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="nam">provided_attribute_docs</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="nam">parser_doc</span><span class="op">.</span><span class="nam">attribute_doc</span> <span class="key">if</span> <span class="nam">parser_doc</span><span class="op">.</span><span class="nam">attribute_doc</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">else</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="key">for</span> <span class="nam">attr_doc</span> <span class="key">in</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">provided_attribute_docs</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="nam">attr_description</span> <span class="op">=</span> <span class="nam">attr_doc</span><span class="op">.</span><span class="nam">description</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="nam">rendered_doc</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="key">for</span> <span class="nam">parameter</span> <span class="key">in</span> <span class="nam">sorted</span><span class="op">(</span><span class="nam">attr_doc</span><span class="op">.</span><span class="nam">attributes</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="nam">parameter_details</span> <span class="op">=</span> <span class="nam">attributes</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">parameter</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="key">if</span> <span class="nam">parameter_details</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">84 ↛ 88</span><span class="annotate long">line 84 didn't jump to line 88, because the condition on line 84 was never false</span></span></p> - <p class="run"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="nam">source_name</span> <span class="op">=</span> <span class="nam">parameter_details</span><span class="op">.</span><span class="nam">source_attribute_name</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="nam">describe_type</span> <span class="op">=</span> <span class="nam">parameter_details</span><span class="op">.</span><span class="nam">type_validator</span><span class="op">.</span><span class="nam">describe_type</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="key">assert</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">parser</span><span class="op">,</span> <span class="nam">DispatchingObjectParser</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="nam">source_name</span> <span class="op">=</span> <span class="nam">parameter</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="nam">subparser</span> <span class="op">=</span> <span class="nam">parser</span><span class="op">.</span><span class="nam">parser_for</span><span class="op">(</span><span class="nam">source_name</span><span class="op">)</span><span class="op">.</span><span class="nam">parser</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">subparser</span><span class="op">,</span> <span class="nam">InPackageContextParser</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_interactive</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="nam">describe_type</span> <span class="op">=</span> <span class="str">"PackageContext"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="nam">rule_prefix</span> <span class="op">=</span> <span class="nam">rule_name</span> <span class="key">if</span> <span class="key">not</span> <span class="nam">is_root_rule</span> <span class="key">else</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="nam">describe_type</span> <span class="op">=</span> <span class="str">f"PackageContext (chains to `{rule_prefix}::{subparser.manifest_attribute_path_template}`)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="key">elif</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">subparser</span><span class="op">,</span> <span class="nam">DispatchingObjectParser</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_interactive</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="nam">describe_type</span> <span class="op">=</span> <span class="str">"Object"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="nam">rule_prefix</span> <span class="op">=</span> <span class="nam">rule_name</span> <span class="key">if</span> <span class="key">not</span> <span class="nam">is_root_rule</span> <span class="key">else</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="nam">describe_type</span> <span class="op">=</span> <span class="str">f"Object (see `{rule_prefix}::{subparser.manifest_attribute_path_template}`)"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="key">elif</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">subparser</span><span class="op">,</span> <span class="nam">DeclarativeMappingInputParser</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="nam">describe_type</span> <span class="op">=</span> <span class="str">"<Type definition not implemented yet>"</span> <span class="com"># TODO: Derive from subparser</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="key">elif</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">subparser</span><span class="op">,</span> <span class="nam">DeclarativeNonMappingInputParser</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="nam">describe_type</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="nam">subparser</span><span class="op">.</span><span class="nam">alt_form_parser</span><span class="op">.</span><span class="nam">type_validator</span><span class="op">.</span><span class="nam">describe_type</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="nam">describe_type</span> <span class="op">=</span> <span class="str">f"<Unknown: Non-introspectable subparser - {subparser.__class__.__name__}>"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="key">if</span> <span class="nam">source_name</span> <span class="key">in</span> <span class="nam">required_attributes</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="nam">req_str</span> <span class="op">=</span> <span class="str">"required"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="key">elif</span> <span class="nam">any</span><span class="op">(</span><span class="nam">source_name</span> <span class="key">in</span> <span class="nam">s</span> <span class="key">for</span> <span class="nam">s</span> <span class="key">in</span> <span class="nam">conditionally_required_attributes</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="nam">req_str</span> <span class="op">=</span> <span class="str">"conditional"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="nam">req_str</span> <span class="op">=</span> <span class="str">"optional"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="nam">rendered_doc</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">f"`{source_name}` ({req_str}): {describe_type}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="key">if</span> <span class="nam">attr_description</span><span class="op">:</span> </span><span class="r"><span class="annotate short">121 ↛ 130</span><span class="annotate long">line 121 didn't jump to line 130, because the condition on line 121 was never false</span></span></p> - <p class="run"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="nam">rendered_doc</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">""</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="nam">rendered_doc</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="nam">line</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="key">for</span> <span class="nam">line</span> <span class="key">in</span> <span class="nam">attr_description</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span><span class="op">**</span><span class="nam">doc_args</span><span class="op">)</span><span class="op">.</span><span class="nam">splitlines</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="nam">keepends</span><span class="op">=</span><span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="nam">rendered_doc</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">""</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="key">yield</span> <span class="nam">attr_doc</span><span class="op">.</span><span class="nam">attributes</span><span class="op">,</span> <span class="nam">rendered_doc</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"><span class="key">def</span> <span class="nam">render_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="nam">rule_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="nam">declarative_parser</span><span class="op">:</span> <span class="nam">DeclarativeInputParser</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">:</span> <span class="nam">DebputyPluginMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="nam">is_root_rule</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="nam">doc_args</span><span class="op">,</span> <span class="nam">parser_doc</span> <span class="op">=</span> <span class="nam">doc_args_for_parser_doc</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="str">"the manifest root"</span> <span class="key">if</span> <span class="nam">is_root_rule</span> <span class="key">else</span> <span class="nam">rule_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="nam">declarative_parser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="nam">t</span> <span class="op">=</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">parser_doc</span><span class="op">.</span><span class="nam">title</span><span class="op">)</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span><span class="op">**</span><span class="nam">doc_args</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="nam">r</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="nam">t</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="str">"="</span> <span class="op">*</span> <span class="nam">len</span><span class="op">(</span><span class="nam">t</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="str">""</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">parser_doc</span><span class="op">.</span><span class="nam">description</span><span class="op">)</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span><span class="op">**</span><span class="nam">doc_args</span><span class="op">)</span><span class="op">.</span><span class="nam">rstrip</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="str">""</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="nam">alt_form_parser</span> <span class="op">=</span> <span class="nam">getattr</span><span class="op">(</span><span class="nam">declarative_parser</span><span class="op">,</span> <span class="str">"alt_form_parser"</span><span class="op">,</span> <span class="key">None</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="nam">is_list_wrapped</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="nam">unwrapped_parser</span> <span class="op">=</span> <span class="nam">declarative_parser</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">declarative_parser</span><span class="op">,</span> <span class="nam">ListWrappedDeclarativeInputParser</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="nam">is_list_wrapped</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="nam">unwrapped_parser</span> <span class="op">=</span> <span class="nam">declarative_parser</span><span class="op">.</span><span class="nam">delegate</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="nam">unwrapped_parser</span><span class="op">,</span> <span class="op">(</span><span class="nam">DeclarativeMappingInputParser</span><span class="op">,</span> <span class="nam">DispatchingObjectParser</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">unwrapped_parser</span><span class="op">,</span> <span class="nam">DeclarativeMappingInputParser</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">165 ↛ 171</span><span class="annotate long">line 165 didn't jump to line 171, because the condition on line 165 was never false</span></span></p> - <p class="run"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="nam">attributes</span> <span class="op">=</span> <span class="nam">unwrapped_parser</span><span class="op">.</span><span class="nam">source_attributes</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="nam">required</span> <span class="op">=</span> <span class="nam">unwrapped_parser</span><span class="op">.</span><span class="nam">input_time_required_parameters</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="nam">conditionally_required</span> <span class="op">=</span> <span class="nam">unwrapped_parser</span><span class="op">.</span><span class="nam">at_least_one_of</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="nam">mutually_exclusive</span> <span class="op">=</span> <span class="nam">unwrapped_parser</span><span class="op">.</span><span class="nam">mutually_exclusive_attributes</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="nam">attributes</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="nam">required</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">conditionally_required</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="nam">mutually_exclusive</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_list_wrapped</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">"List where each element has the following attributes:"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">"Attributes:"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="nam">rendered_attr_doc</span> <span class="op">=</span> <span class="nam">render_attribute_doc</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="nam">unwrapped_parser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="nam">attributes</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="nam">required</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="nam">conditionally_required</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="nam">parser_doc</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="nam">doc_args</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="nam">is_root_rule</span><span class="op">=</span><span class="nam">is_root_rule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="nam">rule_name</span><span class="op">=</span><span class="nam">rule_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="nam">is_interactive</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="key">for</span> <span class="nam">_</span><span class="op">,</span> <span class="nam">rendered_doc</span> <span class="key">in</span> <span class="nam">rendered_attr_doc</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="nam">prefix</span> <span class="op">=</span> <span class="str">" - "</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="key">for</span> <span class="nam">line</span> <span class="key">in</span> <span class="nam">rendered_doc</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="key">if</span> <span class="nam">line</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">f"{prefix}{line}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">""</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="nam">prefix</span> <span class="op">=</span> <span class="str">" "</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="nam">bool</span><span class="op">(</span><span class="nam">conditionally_required</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="key">or</span> <span class="nam">bool</span><span class="op">(</span><span class="nam">mutually_exclusive</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="key">or</span> <span class="nam">any</span><span class="op">(</span><span class="nam">pd</span><span class="op">.</span><span class="nam">conflicting_attributes</span> <span class="key">for</span> <span class="nam">pd</span> <span class="key">in</span> <span class="nam">attributes</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">""</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_list_wrapped</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="str">"This rule enforces the following restrictions on each element in the list:"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">"This rule enforces the following restrictions:"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="key">if</span> <span class="nam">conditionally_required</span> <span class="key">or</span> <span class="nam">mutually_exclusive</span><span class="op">:</span> </span><span class="r"><span class="annotate short">213 ↛ 231</span><span class="annotate long">line 213 didn't jump to line 231, because the condition on line 213 was never false</span></span></p> - <p class="run"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="nam">all_groups</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="nam">itertools</span><span class="op">.</span><span class="nam">chain</span><span class="op">(</span><span class="nam">conditionally_required</span><span class="op">,</span> <span class="nam">mutually_exclusive</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="key">for</span> <span class="nam">g</span> <span class="key">in</span> <span class="nam">all_groups</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="nam">anames</span> <span class="op">=</span> <span class="str">"`, `"</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">g</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="nam">is_mx</span> <span class="op">=</span> <span class="nam">g</span> <span class="key">in</span> <span class="nam">mutually_exclusive</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="nam">is_cr</span> <span class="op">=</span> <span class="nam">g</span> <span class="key">in</span> <span class="nam">conditionally_required</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_mx</span> <span class="key">and</span> <span class="nam">is_cr</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">f" - The rule must use exactly one of: `{anames}`"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="key">elif</span> <span class="nam">is_cr</span><span class="op">:</span> </span><span class="r"><span class="annotate short">223 ↛ 224</span><span class="annotate long">line 223 didn't jump to line 224, because the condition on line 223 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">f" - The rule must use at least one of: `{anames}`"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="key">assert</span> <span class="nam">is_mx</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="str">f" - The following attributes are mutually exclusive: `{anames}`"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="key">if</span> <span class="nam">mutually_exclusive</span> <span class="key">or</span> <span class="nam">any</span><span class="op">(</span> </span><span class="r"><span class="annotate short">231 ↛ exit, 231 ↛ 248</span><span class="annotate long">2 missed branches: 1) line 231 didn't run the generator expression on line 231, 2) line 231 didn't jump to line 248, because the condition on line 231 was never false</span></span></p> - <p class="pln"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="nam">pd</span><span class="op">.</span><span class="nam">conflicting_attributes</span> <span class="key">for</span> <span class="nam">pd</span> <span class="key">in</span> <span class="nam">attributes</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="key">for</span> <span class="nam">parameter</span><span class="op">,</span> <span class="nam">parameter_details</span> <span class="key">in</span> <span class="nam">sorted</span><span class="op">(</span><span class="nam">attributes</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="nam">source_name</span> <span class="op">=</span> <span class="nam">parameter_details</span><span class="op">.</span><span class="nam">source_attribute_name</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="nam">conflicts</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="nam">parameter_details</span><span class="op">.</span><span class="nam">conflicting_attributes</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="key">for</span> <span class="nam">mx</span> <span class="key">in</span> <span class="nam">mutually_exclusive</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="key">if</span> <span class="nam">parameter</span> <span class="key">in</span> <span class="nam">mx</span> <span class="key">and</span> <span class="nam">mx</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">conditionally_required</span><span class="op">:</span> </span><span class="r"><span class="annotate short">238 ↛ 239</span><span class="annotate long">line 238 didn't jump to line 239, because the condition on line 238 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="nam">conflicts</span> <span class="op">|=</span> <span class="nam">mx</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="key">if</span> <span class="nam">conflicts</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="nam">conflicts</span><span class="op">.</span><span class="nam">discard</span><span class="op">(</span><span class="nam">parameter</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="nam">cnames</span> <span class="op">=</span> <span class="str">"`, `"</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="nam">attributes</span><span class="op">[</span><span class="nam">a</span><span class="op">]</span><span class="op">.</span><span class="nam">source_attribute_name</span> <span class="key">for</span> <span class="nam">a</span> <span class="key">in</span> <span class="nam">conflicts</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="str">f" - The attribute `{source_name}` cannot be used with any of: `{cnames}`"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">""</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="key">if</span> <span class="nam">alt_form_parser</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="com"># FIXME: Mapping[str, Any] ends here, which is ironic given the headline.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="str">f"Non-mapping format: {alt_form_parser.type_validator.describe_type()}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="nam">alt_parser_desc</span> <span class="op">=</span> <span class="nam">parser_doc</span><span class="op">.</span><span class="nam">alt_parser_description</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="key">if</span> <span class="nam">alt_parser_desc</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="str">f" {line}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="key">for</span> <span class="nam">line</span> <span class="key">in</span> <span class="nam">alt_parser_desc</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span><span class="op">**</span><span class="nam">doc_args</span><span class="op">)</span><span class="op">.</span><span class="nam">splitlines</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="nam">keepends</span><span class="op">=</span><span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">""</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="key">if</span> <span class="nam">declarative_parser</span><span class="op">.</span><span class="nam">reference_documentation_url</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="str">f"Reference documentation: {declarative_parser.reference_documentation_url}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="nam">r</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="str">"Reference documentation: No reference documentation link provided by the plugin"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="key">return</span> <span class="str">"\n"</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">r</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_4f754ff76d8638bb_parser_data_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_4f754ff76d8638bb_util_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_4f754ff76d8638bb_util_py.html b/coverage-report/d_4f754ff76d8638bb_util_py.html deleted file mode 100644 index 4bb7608..0000000 --- a/coverage-report/d_4f754ff76d8638bb_util_py.html +++ /dev/null @@ -1,419 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/manifest_parser/util.py: 89%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/manifest_parser/util.py</b>: - <span class="pc_cov">89%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">192 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">174<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">18<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">3<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">12<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_4f754ff76d8638bb_parser_doc_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_128305113a77411b___init___py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">dataclasses</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"> <span class="nam">Iterator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> <span class="nam">Self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">List</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">Mapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">get_origin</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">get_args</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">Type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">TypeVar</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">TYPE_CHECKING</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">Iterable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"><span class="key">if</span> <span class="nam">TYPE_CHECKING</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">declarative_parser</span> <span class="key">import</span> <span class="nam">DebputyParseHint</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"><span class="nam">MP</span> <span class="op">=</span> <span class="nam">TypeVar</span><span class="op">(</span><span class="str">"MP"</span><span class="op">,</span> <span class="nam">bound</span><span class="op">=</span><span class="str">"DebputyParseHint"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"><span class="nam">StrOrInt</span> <span class="op">=</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">int</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"><span class="nam">AttributePathAliasMapping</span> <span class="op">=</span> <span class="nam">Mapping</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="nam">StrOrInt</span><span class="op">,</span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">StrOrInt</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"AttributePathAliasMapping"</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"><span class="key">class</span> <span class="nam">AttributePath</span><span class="op">(</span><span class="nam">object</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"parent"</span><span class="op">,</span> <span class="str">"name"</span><span class="op">,</span> <span class="str">"alias_mapping"</span><span class="op">,</span> <span class="str">"path_hint"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="nam">parent</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"AttributePath"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="nam">key</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">int</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="nam">alias_mapping</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">AttributePathAliasMapping</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">parent</span> <span class="op">=</span> <span class="nam">parent</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">name</span> <span class="op">=</span> <span class="nam">key</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">path_hint</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">alias_mapping</span> <span class="op">=</span> <span class="nam">alias_mapping</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="key">def</span> <span class="nam">root_path</span><span class="op">(</span><span class="nam">cls</span><span class="op">)</span> <span class="op">-></span> <span class="str">"AttributePath"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="key">return</span> <span class="nam">AttributePath</span><span class="op">(</span><span class="key">None</span><span class="op">,</span> <span class="key">None</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="key">def</span> <span class="nam">builtin_path</span><span class="op">(</span><span class="nam">cls</span><span class="op">)</span> <span class="op">-></span> <span class="str">"AttributePath"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="key">return</span> <span class="nam">AttributePath</span><span class="op">(</span><span class="key">None</span><span class="op">,</span> <span class="str">"$builtin$"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="key">def</span> <span class="nam">test_path</span><span class="op">(</span><span class="nam">cls</span><span class="op">)</span> <span class="op">-></span> <span class="str">"AttributePath"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="key">return</span> <span class="nam">AttributePath</span><span class="op">(</span><span class="key">None</span><span class="op">,</span> <span class="str">"$test$"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="key">def</span> <span class="nam">__bool__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">name</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">self</span><span class="op">.</span><span class="nam">parent</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="key">def</span> <span class="nam">copy_with_path_hint</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">path_hint</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="str">"AttributePath"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="nam">p</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">__class__</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">parent</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">name</span><span class="op">,</span> <span class="nam">alias_mapping</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">alias_mapping</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="nam">p</span><span class="op">.</span><span class="nam">path_hint</span> <span class="op">=</span> <span class="nam">path_hint</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="key">return</span> <span class="nam">p</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="key">def</span> <span class="nam">path_segments</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">int</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="nam">segments</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_iter_path</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="nam">segments</span><span class="op">.</span><span class="nam">reverse</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="op">(</span><span class="nam">s</span><span class="op">.</span><span class="nam">name</span> <span class="key">for</span> <span class="nam">s</span> <span class="key">in</span> <span class="nam">segments</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="key">def</span> <span class="nam">path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="nam">segments</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_iter_path</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="nam">segments</span><span class="op">.</span><span class="nam">reverse</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="nam">parts</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="nam">path_hint</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="key">for</span> <span class="nam">s</span> <span class="key">in</span> <span class="nam">segments</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="nam">k</span> <span class="op">=</span> <span class="nam">s</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="nam">s_path_hint</span> <span class="op">=</span> <span class="nam">s</span><span class="op">.</span><span class="nam">path_hint</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="key">if</span> <span class="nam">s_path_hint</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="nam">path_hint</span> <span class="op">=</span> <span class="nam">s_path_hint</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">k</span><span class="op">,</span> <span class="nam">int</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="nam">parts</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">f"[{k}]"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="key">elif</span> <span class="nam">k</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">84 ↛ 77</span><span class="annotate long">line 84 didn't jump to line 77, because the condition on line 84 was never false</span></span></p> - <p class="run"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="key">if</span> <span class="nam">parts</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="nam">parts</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">"."</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="nam">parts</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">k</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="key">if</span> <span class="nam">path_hint</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="nam">parts</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">f" <Search for: {path_hint}>"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">parts</span><span class="op">:</span> </span><span class="r"><span class="annotate short">90 ↛ 91</span><span class="annotate long">line 90 didn't jump to line 91, because the condition on line 90 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="key">return</span> <span class="str">"document root"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="key">return</span> <span class="str">""</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">parts</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="key">def</span> <span class="nam">__str__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="key">def</span> <span class="nam">__getitem__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">item</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">int</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="str">"AttributePath"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="nam">alias_mapping</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">alias_mapping</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="nam">match</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">alias_mapping</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">item</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="key">if</span> <span class="nam">match</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="nam">item</span><span class="op">,</span> <span class="nam">alias_mapping</span> <span class="op">=</span> <span class="nam">match</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="key">if</span> <span class="nam">item</span> <span class="op">==</span> <span class="str">""</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="com"># Support `sources[0]` mapping to `source` by `sources -> source` and `0 -> ""`.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="key">return</span> <span class="nam">AttributePath</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">parent</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">name</span><span class="op">,</span> <span class="nam">alias_mapping</span><span class="op">=</span><span class="nam">alias_mapping</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="key">return</span> <span class="nam">AttributePath</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">item</span><span class="op">,</span> <span class="nam">alias_mapping</span><span class="op">=</span><span class="nam">alias_mapping</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="key">def</span> <span class="nam">_iter_path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="str">"AttributePath"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="nam">current</span> <span class="op">=</span> <span class="nam">self</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="key">yield</span> <span class="nam">current</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="key">while</span> <span class="key">True</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="nam">parent</span> <span class="op">=</span> <span class="nam">current</span><span class="op">.</span><span class="nam">parent</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">parent</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="nam">current</span> <span class="op">=</span> <span class="nam">parent</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="key">yield</span> <span class="nam">current</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"><span class="key">class</span> <span class="nam">_SymbolicModeSegment</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="nam">base_mode</span><span class="op">:</span> <span class="nam">int</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="nam">base_mask</span><span class="op">:</span> <span class="nam">int</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="nam">cap_x_mode</span><span class="op">:</span> <span class="nam">int</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="nam">cap_x_mask</span><span class="op">:</span> <span class="nam">int</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="key">def</span> <span class="nam">apply</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">current_mode</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> <span class="nam">is_dir</span><span class="op">:</span> <span class="nam">bool</span><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="key">if</span> <span class="nam">current_mode</span> <span class="op">&</span> <span class="num">0o111</span> <span class="key">or</span> <span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="nam">chosen_mode</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">cap_x_mode</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="nam">mode_mask</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">cap_x_mask</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="nam">chosen_mode</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">base_mode</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="nam">mode_mask</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">base_mask</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="com"># set ("="): mode mask clears relevant segment and current_mode are the desired bits</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="com"># add ("+"): mode mask keeps everything and current_mode are the desired bits</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="com"># remove ("-"): mode mask clears relevant bits and current_mode are 0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="key">return</span> <span class="op">(</span><span class="nam">current_mode</span> <span class="op">&</span> <span class="nam">mode_mask</span><span class="op">)</span> <span class="op">|</span> <span class="nam">chosen_mode</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"><span class="key">def</span> <span class="nam">_symbolic_mode_bit_inverse</span><span class="op">(</span><span class="nam">v</span><span class="op">:</span> <span class="nam">int</span><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="com"># The & part is necessary because otherwise python narrows the inversion to the minimum number of bits</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="com"># required, which is not what we want.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="key">return</span> <span class="op">~</span><span class="nam">v</span> <span class="op">&</span> <span class="num">0o7777</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"><span class="key">def</span> <span class="nam">parse_symbolic_mode</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="nam">symbolic_mode</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">AttributePath</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">_SymbolicModeSegment</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="nam">sticky_bit</span> <span class="op">=</span> <span class="num">0o01000</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="nam">setuid_bit</span> <span class="op">=</span> <span class="num">0o04000</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="nam">setgid_bit</span> <span class="op">=</span> <span class="num">0o02000</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="nam">mode_group_flag</span> <span class="op">=</span> <span class="num">0o7</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="nam">subject_mask_and_shift</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="str">"u"</span><span class="op">:</span> <span class="op">(</span><span class="nam">mode_group_flag</span> <span class="op"><<</span> <span class="num">6</span><span class="op">,</span> <span class="num">6</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="str">"g"</span><span class="op">:</span> <span class="op">(</span><span class="nam">mode_group_flag</span> <span class="op"><<</span> <span class="num">3</span><span class="op">,</span> <span class="num">3</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="str">"o"</span><span class="op">:</span> <span class="op">(</span><span class="nam">mode_group_flag</span> <span class="op"><<</span> <span class="num">0</span><span class="op">,</span> <span class="num">0</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="nam">bits</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="str">"r"</span><span class="op">:</span> <span class="op">(</span><span class="num">0o4</span><span class="op">,</span> <span class="num">0o4</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="str">"w"</span><span class="op">:</span> <span class="op">(</span><span class="num">0o2</span><span class="op">,</span> <span class="num">0o2</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="str">"x"</span><span class="op">:</span> <span class="op">(</span><span class="num">0o1</span><span class="op">,</span> <span class="num">0o1</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="str">"X"</span><span class="op">:</span> <span class="op">(</span><span class="num">0o0</span><span class="op">,</span> <span class="num">0o1</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="str">"s"</span><span class="op">:</span> <span class="op">(</span><span class="num">0o0</span><span class="op">,</span> <span class="num">0o0</span><span class="op">)</span><span class="op">,</span> <span class="com"># Special-cased below (it depends on the subject)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="str">"t"</span><span class="op">:</span> <span class="op">(</span><span class="num">0o0</span><span class="op">,</span> <span class="num">0o0</span><span class="op">)</span><span class="op">,</span> <span class="com"># Special-cased below</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="nam">modifiers</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="str">"+"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="str">"-"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="str">"="</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">in_path</span> <span class="op">=</span> <span class="str">f" in {attribute_path.path}"</span> <span class="key">if</span> <span class="nam">attribute_path</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">else</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="key">for</span> <span class="nam">orig_part</span> <span class="key">in</span> <span class="nam">symbolic_mode</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="str">","</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="nam">base_mode</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="nam">cap_x_mode</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="nam">part</span> <span class="op">=</span> <span class="nam">orig_part</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="nam">subjects</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="key">while</span> <span class="nam">part</span> <span class="key">and</span> <span class="nam">part</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="key">in</span> <span class="op">(</span><span class="str">"u"</span><span class="op">,</span> <span class="str">"g"</span><span class="op">,</span> <span class="str">"o"</span><span class="op">,</span> <span class="str">"a"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="nam">subject</span> <span class="op">=</span> <span class="nam">part</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="key">if</span> <span class="nam">subject</span> <span class="op">==</span> <span class="str">"a"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="nam">subjects</span> <span class="op">=</span> <span class="op">{</span><span class="str">"u"</span><span class="op">,</span> <span class="str">"g"</span><span class="op">,</span> <span class="str">"o"</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="nam">subjects</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">subject</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="nam">part</span> <span class="op">=</span> <span class="nam">part</span><span class="op">[</span><span class="num">1</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">subjects</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="nam">subjects</span> <span class="op">=</span> <span class="op">{</span><span class="str">"u"</span><span class="op">,</span> <span class="str">"g"</span><span class="op">,</span> <span class="str">"o"</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="key">if</span> <span class="nam">part</span> <span class="key">and</span> <span class="nam">part</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="key">in</span> <span class="nam">modifiers</span><span class="op">:</span> </span><span class="r"><span class="annotate short">189 ↛ 191</span><span class="annotate long">line 189 didn't jump to line 191, because the condition on line 189 was never false</span></span></p> - <p class="run"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="nam">modifier</span> <span class="op">=</span> <span class="nam">part</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="key">elif</span> <span class="key">not</span> <span class="nam">part</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="str">f'Invalid symbolic mode{in_path}: expected [+-=] to be present (from "{orig_part}")'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="str">f'Invalid symbolic mode{in_path}: Expected "{part[0]}" to be one of [+-=]'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="str">f' (from "{orig_part}")'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="nam">part</span> <span class="op">=</span> <span class="nam">part</span><span class="op">[</span><span class="num">1</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="nam">s_bit_seen</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="nam">t_bit_seen</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="key">while</span> <span class="nam">part</span> <span class="key">and</span> <span class="nam">part</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="key">in</span> <span class="nam">bits</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="key">if</span> <span class="nam">part</span> <span class="op">==</span> <span class="str">"s"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="nam">s_bit_seen</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="key">elif</span> <span class="nam">part</span> <span class="op">==</span> <span class="str">"t"</span><span class="op">:</span> </span><span class="r"><span class="annotate short">206 ↛ 207</span><span class="annotate long">line 206 didn't jump to line 207, because the condition on line 206 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="nam">t_bit_seen</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="key">elif</span> <span class="nam">part</span> <span class="key">in</span> <span class="op">(</span><span class="str">"u"</span><span class="op">,</span> <span class="str">"g"</span><span class="op">,</span> <span class="str">"o"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">208 ↛ 209</span><span class="annotate long">line 208 didn't jump to line 209, because the condition on line 208 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="str">f"Cannot parse symbolic mode{in_path}: Sorry, we do not support referencing an"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="str">" existing subject's permissions (a=u) in symbolic modes."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="nam">matched_bits</span> <span class="op">=</span> <span class="nam">bits</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">part</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="key">if</span> <span class="nam">matched_bits</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">215 ↛ 216</span><span class="annotate long">line 215 didn't jump to line 216, because the condition on line 215 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="nam">valid_bits</span> <span class="op">=</span> <span class="str">""</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">bits</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="str">f'Invalid symbolic mode{in_path}: Expected "{part[0]}" to be one of the letters'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="str">f' in "{valid_bits}" (from "{orig_part}")'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="nam">base_mode_bits</span><span class="op">,</span> <span class="nam">cap_x_mode_bits</span> <span class="op">=</span> <span class="nam">bits</span><span class="op">[</span><span class="nam">part</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="nam">base_mode</span> <span class="op">|=</span> <span class="nam">base_mode_bits</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="nam">cap_x_mode</span> <span class="op">|=</span> <span class="nam">cap_x_mode_bits</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="nam">part</span> <span class="op">=</span> <span class="nam">part</span><span class="op">[</span><span class="num">1</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="key">if</span> <span class="nam">part</span><span class="op">:</span> </span><span class="r"><span class="annotate short">226 ↛ 227</span><span class="annotate long">line 226 didn't jump to line 227, because the condition on line 226 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="str">f'Invalid symbolic mode{in_path}: Could not parse "{part[0]}" from "{orig_part}"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="nam">final_base_mode</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="nam">final_cap_x_mode</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="nam">segment_mask</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="key">for</span> <span class="nam">subject</span> <span class="key">in</span> <span class="nam">subjects</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="nam">mask</span><span class="op">,</span> <span class="nam">shift</span> <span class="op">=</span> <span class="nam">subject_mask_and_shift</span><span class="op">[</span><span class="nam">subject</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="nam">segment_mask</span> <span class="op">|=</span> <span class="nam">mask</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="nam">final_base_mode</span> <span class="op">|=</span> <span class="nam">base_mode</span> <span class="op"><<</span> <span class="nam">shift</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="nam">final_cap_x_mode</span> <span class="op">|=</span> <span class="nam">cap_x_mode</span> <span class="op"><<</span> <span class="nam">shift</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="key">if</span> <span class="nam">modifier</span> <span class="op">==</span> <span class="str">"="</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="nam">segment_mask</span> <span class="op">|=</span> <span class="nam">setuid_bit</span> <span class="key">if</span> <span class="str">"u"</span> <span class="key">in</span> <span class="nam">subjects</span> <span class="key">else</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="nam">segment_mask</span> <span class="op">|=</span> <span class="nam">setgid_bit</span> <span class="key">if</span> <span class="str">"g"</span> <span class="key">in</span> <span class="nam">subjects</span> <span class="key">else</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="nam">segment_mask</span> <span class="op">|=</span> <span class="nam">sticky_bit</span> <span class="key">if</span> <span class="str">"o"</span> <span class="key">in</span> <span class="nam">subjects</span> <span class="key">else</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="key">if</span> <span class="nam">s_bit_seen</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="key">if</span> <span class="str">"u"</span> <span class="key">in</span> <span class="nam">subjects</span><span class="op">:</span> </span><span class="r"><span class="annotate short">244 ↛ 247</span><span class="annotate long">line 244 didn't jump to line 247, because the condition on line 244 was never false</span></span></p> - <p class="run"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="nam">final_base_mode</span> <span class="op">|=</span> <span class="nam">setuid_bit</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="nam">final_cap_x_mode</span> <span class="op">|=</span> <span class="nam">setuid_bit</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="key">if</span> <span class="str">"g"</span> <span class="key">in</span> <span class="nam">subjects</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="nam">final_base_mode</span> <span class="op">|=</span> <span class="nam">setgid_bit</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="nam">final_cap_x_mode</span> <span class="op">|=</span> <span class="nam">setgid_bit</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="key">if</span> <span class="nam">t_bit_seen</span><span class="op">:</span> </span><span class="r"><span class="annotate short">250 ↛ 251</span><span class="annotate long">line 250 didn't jump to line 251, because the condition on line 250 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="nam">final_base_mode</span> <span class="op">|=</span> <span class="nam">sticky_bit</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="nam">final_cap_x_mode</span> <span class="op">|=</span> <span class="nam">sticky_bit</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="key">if</span> <span class="nam">modifier</span> <span class="op">==</span> <span class="str">"+"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="nam">final_base_mask</span> <span class="op">=</span> <span class="op">~</span><span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="nam">final_cap_x_mask</span> <span class="op">=</span> <span class="op">~</span><span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="key">elif</span> <span class="nam">modifier</span> <span class="op">==</span> <span class="str">"-"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="nam">final_base_mask</span> <span class="op">=</span> <span class="nam">_symbolic_mode_bit_inverse</span><span class="op">(</span><span class="nam">final_base_mode</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="nam">final_cap_x_mask</span> <span class="op">=</span> <span class="nam">_symbolic_mode_bit_inverse</span><span class="op">(</span><span class="nam">final_cap_x_mode</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="nam">final_base_mode</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="nam">final_cap_x_mode</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="key">elif</span> <span class="nam">modifier</span> <span class="op">==</span> <span class="str">"="</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="com"># FIXME: Handle "unmentioned directory's setgid/setuid bits"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="nam">inverted_mask</span> <span class="op">=</span> <span class="nam">_symbolic_mode_bit_inverse</span><span class="op">(</span><span class="nam">segment_mask</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="nam">final_base_mask</span> <span class="op">=</span> <span class="nam">inverted_mask</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="nam">final_cap_x_mask</span> <span class="op">=</span> <span class="nam">inverted_mask</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="key">raise</span> <span class="nam">AssertionError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="str">f"Unknown modifier in symbolic mode: {modifier} - should not have happened"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="key">yield</span> <span class="nam">_SymbolicModeSegment</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="nam">base_mode</span><span class="op">=</span><span class="nam">final_base_mode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="nam">base_mask</span><span class="op">=</span><span class="nam">final_base_mask</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="nam">cap_x_mode</span><span class="op">=</span><span class="nam">final_cap_x_mode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="nam">cap_x_mask</span><span class="op">=</span><span class="nam">final_cap_x_mask</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"><span class="key">def</span> <span class="nam">unpack_type</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="nam">orig_type</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="nam">parsing_typed_dict_attribute</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">Any</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">,</span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">Any</span><span class="op">,</span> <span class="op">...</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="nam">raw_type</span> <span class="op">=</span> <span class="nam">orig_type</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="nam">origin</span> <span class="op">=</span> <span class="nam">get_origin</span><span class="op">(</span><span class="nam">raw_type</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="nam">args</span> <span class="op">=</span> <span class="nam">get_args</span><span class="op">(</span><span class="nam">raw_type</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">parsing_typed_dict_attribute</span> <span class="key">and</span> <span class="nam">repr</span><span class="op">(</span><span class="nam">origin</span><span class="op">)</span> <span class="key">in</span> <span class="op">(</span> </span><span class="r"><span class="annotate short">285 ↛ 289</span><span class="annotate long">line 285 didn't jump to line 289, because the condition on line 285 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="str">"typing.NotRequired"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="str">"typing.Required"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="str">f"The Required/NotRequired attributes cannot be used outside typed dicts,"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="str">f" the type that triggered the error: {orig_type}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> <span class="key">while</span> <span class="nam">repr</span><span class="op">(</span><span class="nam">origin</span><span class="op">)</span> <span class="key">in</span> <span class="op">(</span><span class="str">"typing.NotRequired"</span><span class="op">,</span> <span class="str">"typing.Required"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">args</span><span class="op">)</span> <span class="op">!=</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"><span class="annotate short">295 ↛ 296</span><span class="annotate long">line 295 didn't jump to line 296, because the condition on line 295 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="str">f"The type {raw_type} should have exactly one type parameter"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="nam">raw_type</span> <span class="op">=</span> <span class="nam">args</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="nam">origin</span> <span class="op">=</span> <span class="nam">get_origin</span><span class="op">(</span><span class="nam">raw_type</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="nam">args</span> <span class="op">=</span> <span class="nam">get_args</span><span class="op">(</span><span class="nam">raw_type</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="key">assert</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">raw_type</span><span class="op">,</span> <span class="nam">tuple</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="key">return</span> <span class="nam">raw_type</span><span class="op">,</span> <span class="nam">origin</span><span class="op">,</span> <span class="nam">args</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"><span class="key">def</span> <span class="nam">find_annotation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="nam">annotations</span><span class="op">:</span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">Any</span><span class="op">,</span> <span class="op">...</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="nam">anno_class</span><span class="op">:</span> <span class="nam">Type</span><span class="op">[</span><span class="nam">MP</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">MP</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="key">for</span> <span class="nam">anno</span> <span class="key">in</span> <span class="nam">annotations</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">anno</span><span class="op">,</span> <span class="nam">anno_class</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="key">if</span> <span class="nam">m</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">315 ↛ 316</span><span class="annotate long">line 315 didn't jump to line 316, because the condition on line 315 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="str">f"The annotation {anno_class.__name__} was used more than once"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="nam">anno</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="key">return</span> <span class="nam">m</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_4f754ff76d8638bb_parser_doc_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_128305113a77411b___init___py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_4faea183f900b252___init___py.html b/coverage-report/d_4faea183f900b252___init___py.html deleted file mode 100644 index 7266b4f..0000000 --- a/coverage-report/d_4faea183f900b252___init___py.html +++ /dev/null @@ -1,99 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/plugin/__init__.py: 100%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/plugin/__init__.py</b>: - <span class="pc_cov">100%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">0 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">0<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">0<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_path_matcher_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_64287305fe0c6642___init___py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_path_matcher_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_64287305fe0c6642___init___py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_50e3cc0df0cc5f51___init___py.html b/coverage-report/d_50e3cc0df0cc5f51___init___py.html deleted file mode 100644 index 8eee6c1..0000000 --- a/coverage-report/d_50e3cc0df0cc5f51___init___py.html +++ /dev/null @@ -1,99 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/lsp/vendoring/__init__.py: 100%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/lsp/vendoring/__init__.py</b>: - <span class="pc_cov">100%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">0 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">0<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">0<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_5d0ec0d5422112df_text_util_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_e9c451f4ae334f76___init___py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_5d0ec0d5422112df_text_util_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_e9c451f4ae334f76___init___py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_5d0ec0d5422112df___init___py.html b/coverage-report/d_5d0ec0d5422112df___init___py.html deleted file mode 100644 index 15a9aab..0000000 --- a/coverage-report/d_5d0ec0d5422112df___init___py.html +++ /dev/null @@ -1,99 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/lsp/__init__.py: 100%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/lsp/__init__.py</b>: - <span class="pc_cov">100%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">0 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">0<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">0<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_7764373ba25ba45b_lint_util_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_5d0ec0d5422112df_debputy_ls_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_7764373ba25ba45b_lint_util_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_5d0ec0d5422112df_debputy_ls_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_5d0ec0d5422112df_debputy_ls_py.html b/coverage-report/d_5d0ec0d5422112df_debputy_ls_py.html deleted file mode 100644 index 15b1233..0000000 --- a/coverage-report/d_5d0ec0d5422112df_debputy_ls_py.html +++ /dev/null @@ -1,174 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/lsp/debputy_ls.py: 74%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/lsp/debputy_ls.py</b>: - <span class="pc_cov">74%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">48 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">33<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">15<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">2<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_5d0ec0d5422112df___init___py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_debian_changelog_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Optional</span><span class="op">,</span> <span class="nam">List</span><span class="op">,</span> <span class="nam">Any</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">linting</span><span class="op">.</span><span class="nam">lint_util</span> <span class="key">import</span> <span class="nam">LintState</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">text_util</span> <span class="key">import</span> <span class="nam">LintCapablePositionCodec</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">feature_set</span> <span class="key">import</span> <span class="nam">PluginProvidedFeatureSet</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="key">from</span> <span class="nam">pygls</span><span class="op">.</span><span class="nam">server</span> <span class="key">import</span> <span class="nam">LanguageServer</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="key">from</span> <span class="nam">pygls</span><span class="op">.</span><span class="nam">workspace</span> <span class="key">import</span> <span class="nam">TextDocument</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"><span class="key">except</span> <span class="nam">ImportError</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="key">class</span> <span class="nam">LanguageServer</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">*</span><span class="nam">args</span><span class="op">,</span> <span class="op">**</span><span class="nam">kwargs</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="str">"""Placeholder to work if pygls is not installed"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="com"># Should not be called</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="key">raise</span> <span class="nam">e</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"><span class="key">class</span> <span class="nam">LSProvidedLintState</span><span class="op">(</span><span class="nam">LintState</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">ls</span><span class="op">:</span> <span class="str">"DebputyLanguageServer"</span><span class="op">,</span> <span class="nam">doc</span><span class="op">:</span> <span class="str">"TextDocument"</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_ls</span> <span class="op">=</span> <span class="nam">ls</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_doc</span> <span class="op">=</span> <span class="nam">doc</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="com"># Cache lines (doc.lines re-splits everytime)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_lines</span> <span class="op">=</span> <span class="nam">doc</span><span class="op">.</span><span class="nam">lines</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="key">def</span> <span class="nam">plugin_feature_set</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">PluginProvidedFeatureSet</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_ls</span><span class="op">.</span><span class="nam">plugin_feature_set</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="key">def</span> <span class="nam">doc_uri</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_doc</span><span class="op">.</span><span class="nam">uri</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="key">def</span> <span class="nam">path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_doc</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="key">def</span> <span class="nam">lines</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_lines</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="key">def</span> <span class="nam">position_codec</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">LintCapablePositionCodec</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_doc</span><span class="op">.</span><span class="nam">position_codec</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"><span class="key">class</span> <span class="nam">DebputyLanguageServer</span><span class="op">(</span><span class="nam">LanguageServer</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="op">*</span><span class="nam">args</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="op">**</span><span class="nam">kwargs</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="op">*</span><span class="nam">args</span><span class="op">,</span> <span class="op">**</span><span class="nam">kwargs</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_feature_set</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">PluginProvidedFeatureSet</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="key">def</span> <span class="nam">plugin_feature_set</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">PluginProvidedFeatureSet</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="nam">res</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_feature_set</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="key">if</span> <span class="nam">res</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">60 ↛ 61</span><span class="annotate long">line 60 didn't jump to line 61, because the condition on line 60 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="key">raise</span> <span class="nam">RuntimeError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="str">"Initialization error: The plugin feature set has not been initialized before it was needed."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="key">return</span> <span class="nam">res</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="op">@</span><span class="nam">plugin_feature_set</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="key">def</span> <span class="nam">plugin_feature_set</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">plugin_feature_set</span><span class="op">:</span> <span class="nam">PluginProvidedFeatureSet</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_feature_set</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">68 ↛ 69</span><span class="annotate long">line 68 didn't jump to line 69, because the condition on line 68 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="key">raise</span> <span class="nam">RuntimeError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="str">"The plugin_feature_set attribute cannot be changed once set"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_feature_set</span> <span class="op">=</span> <span class="nam">plugin_feature_set</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="key">def</span> <span class="nam">lint_state</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">doc</span><span class="op">:</span> <span class="str">"TextDocument"</span><span class="op">)</span> <span class="op">-></span> <span class="nam">LintState</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="key">return</span> <span class="nam">LSProvidedLintState</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">doc</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_5d0ec0d5422112df___init___py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_debian_changelog_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_5d0ec0d5422112df_lsp_debian_changelog_py.html b/coverage-report/d_5d0ec0d5422112df_lsp_debian_changelog_py.html deleted file mode 100644 index 5d9cb94..0000000 --- a/coverage-report/d_5d0ec0d5422112df_lsp_debian_changelog_py.html +++ /dev/null @@ -1,392 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/lsp/lsp_debian_changelog.py: 21%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/lsp/lsp_debian_changelog.py</b>: - <span class="pc_cov">21%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">108 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">27<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">81<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_5d0ec0d5422112df_debputy_ls_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_debian_control_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">sys</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">from</span> <span class="nam">email</span><span class="op">.</span><span class="nam">utils</span> <span class="key">import</span> <span class="nam">parsedate_to_datetime</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> <span class="nam">List</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="nam">Dict</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">Iterator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">Iterable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="key">from</span> <span class="nam">lsprotocol</span><span class="op">.</span><span class="nam">types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">DidOpenTextDocumentParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">DidChangeTextDocumentParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">TEXT_DOCUMENT_WILL_SAVE_WAIT_UNTIL</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">TEXT_DOCUMENT_CODE_ACTION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">DidCloseTextDocumentParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">Range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">Position</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">DiagnosticSeverity</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">linting</span><span class="op">.</span><span class="nam">lint_util</span> <span class="key">import</span> <span class="nam">LintState</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">lsp_features</span> <span class="key">import</span> <span class="nam">lsp_diagnostics</span><span class="op">,</span> <span class="nam">lsp_standard_handler</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">quickfixes</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="nam">propose_correct_text_quick_fix</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">spellchecking</span> <span class="key">import</span> <span class="nam">spellcheck_line</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">text_util</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="nam">LintCapablePositionCodec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"><span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="key">from</span> <span class="nam">debian</span><span class="op">.</span><span class="nam">_deb822_repro</span><span class="op">.</span><span class="nam">locatable</span> <span class="key">import</span> <span class="nam">Position</span> <span class="key">as</span> <span class="nam">TEPosition</span><span class="op">,</span> <span class="nam">Ranage</span> <span class="key">as</span> <span class="nam">TERange</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="key">from</span> <span class="nam">pygls</span><span class="op">.</span><span class="nam">server</span> <span class="key">import</span> <span class="nam">LanguageServer</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="key">from</span> <span class="nam">pygls</span><span class="op">.</span><span class="nam">workspace</span> <span class="key">import</span> <span class="nam">TextDocument</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"><span class="key">except</span> <span class="nam">ImportError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"><span class="com"># Same as Lintian</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"><span class="nam">_MAXIMUM_WIDTH</span><span class="op">:</span> <span class="nam">int</span> <span class="op">=</span> <span class="num">82</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"><span class="nam">_LANGUAGE_IDS</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="str">"debian/changelog"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="com"># emacs's name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="str">"debian-changelog"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="com"># vim's name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="str">"debchangelog"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"><span class="nam">_WEEKDAYS_BY_IDX</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="str">"Mon"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="str">"Tue"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="str">"Wed"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="str">"Thu"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="str">"Fri"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="str">"Sat"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="str">"Sun"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"><span class="nam">_KNOWN_WEEK_DAYS</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span><span class="nam">_WEEKDAYS_BY_IDX</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"><span class="nam">DOCUMENT_VERSION_TABLE</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">int</span><span class="op">]</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"><span class="key">def</span> <span class="nam">_handle_close</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="nam">ls</span><span class="op">:</span> <span class="str">"LanguageServer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="nam">params</span><span class="op">:</span> <span class="nam">DidCloseTextDocumentParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="key">del</span> <span class="nam">DOCUMENT_VERSION_TABLE</span><span class="op">[</span><span class="nam">params</span><span class="op">.</span><span class="nam">text_document</span><span class="op">.</span><span class="nam">uri</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="key">except</span> <span class="nam">KeyError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"><span class="key">def</span> <span class="nam">is_doc_at_version</span><span class="op">(</span><span class="nam">uri</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">version</span><span class="op">:</span> <span class="nam">int</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="nam">dv</span> <span class="op">=</span> <span class="nam">DOCUMENT_VERSION_TABLE</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">uri</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="key">return</span> <span class="nam">dv</span> <span class="op">==</span> <span class="nam">version</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"><span class="nam">lsp_standard_handler</span><span class="op">(</span><span class="nam">_LANGUAGE_IDS</span><span class="op">,</span> <span class="nam">TEXT_DOCUMENT_CODE_ACTION</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"><span class="nam">lsp_standard_handler</span><span class="op">(</span><span class="nam">_LANGUAGE_IDS</span><span class="op">,</span> <span class="nam">TEXT_DOCUMENT_WILL_SAVE_WAIT_UNTIL</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"><span class="op">@</span><span class="nam">lsp_diagnostics</span><span class="op">(</span><span class="nam">_LANGUAGE_IDS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"><span class="key">def</span> <span class="nam">_diagnostics_debian_changelog</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="nam">ls</span><span class="op">:</span> <span class="str">"LanguageServer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="nam">params</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">DidOpenTextDocumentParams</span><span class="op">,</span> <span class="nam">DidChangeTextDocumentParams</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="nam">doc_uri</span> <span class="op">=</span> <span class="nam">params</span><span class="op">.</span><span class="nam">text_document</span><span class="op">.</span><span class="nam">uri</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="nam">doc</span> <span class="op">=</span> <span class="nam">ls</span><span class="op">.</span><span class="nam">workspace</span><span class="op">.</span><span class="nam">get_text_document</span><span class="op">(</span><span class="nam">doc_uri</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="nam">lines</span> <span class="op">=</span> <span class="nam">doc</span><span class="op">.</span><span class="nam">lines</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="nam">max_words</span> <span class="op">=</span> <span class="num">1_000</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="nam">delta_update_size</span> <span class="op">=</span> <span class="num">10</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="nam">max_lines_between_update</span> <span class="op">=</span> <span class="num">10</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="nam">scanner</span> <span class="op">=</span> <span class="nam">_scan_debian_changelog_for_diagnostics</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="nam">doc</span><span class="op">.</span><span class="nam">position_codec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="nam">delta_update_size</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="nam">max_words</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="nam">max_lines_between_update</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">scanner</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"><span class="key">def</span> <span class="nam">_check_footer_line</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="nam">line</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="nam">line_no</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">:</span> <span class="nam">LintCapablePositionCodec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="nam">end_email_idx</span> <span class="op">=</span> <span class="nam">line</span><span class="op">.</span><span class="nam">rindex</span><span class="op">(</span><span class="str">"> "</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="key">except</span> <span class="nam">ValueError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="com"># Syntax error; flag later</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="nam">line_len</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">line</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="nam">start_date_idx</span> <span class="op">=</span> <span class="nam">end_email_idx</span> <span class="op">+</span> <span class="num">3</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="com"># 3 characters for the day name (Mon), then a comma plus a space followed by the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="com"># actual date. The 6 characters limit is a gross under estimation of the real</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="com"># size.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="key">if</span> <span class="nam">line_len</span> <span class="op"><</span> <span class="nam">start_date_idx</span> <span class="op">+</span> <span class="num">6</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="nam">range_server_units</span> <span class="op">=</span> <span class="nam">Range</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="nam">line_no</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="nam">start_date_idx</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="nam">line_no</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="nam">line_len</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span><span class="nam">lines</span><span class="op">,</span> <span class="nam">range_server_units</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="str">"Expected a date in RFC822 format (Tue, 12 Mar 2024 12:34:56 +0000)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="nam">day_name_range_server_units</span> <span class="op">=</span> <span class="nam">Range</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="nam">line_no</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="nam">start_date_idx</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="nam">line_no</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="nam">start_date_idx</span> <span class="op">+</span> <span class="num">3</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="nam">day_name</span> <span class="op">=</span> <span class="nam">line</span><span class="op">[</span><span class="nam">start_date_idx</span> <span class="op">:</span> <span class="nam">start_date_idx</span> <span class="op">+</span> <span class="num">3</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="key">if</span> <span class="nam">day_name</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">_KNOWN_WEEK_DAYS</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span><span class="nam">lines</span><span class="op">,</span> <span class="nam">day_name_range_server_units</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="str">"Expected a three letter date here (Mon, Tue, ..., Sun)."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="nam">date_str</span> <span class="op">=</span> <span class="nam">line</span><span class="op">[</span><span class="nam">start_date_idx</span> <span class="op">+</span> <span class="num">5</span> <span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="key">if</span> <span class="nam">line</span><span class="op">[</span><span class="nam">start_date_idx</span> <span class="op">+</span> <span class="num">3</span> <span class="op">:</span> <span class="nam">start_date_idx</span> <span class="op">+</span> <span class="num">5</span><span class="op">]</span> <span class="op">!=</span> <span class="str">", "</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="nam">sep</span> <span class="op">=</span> <span class="nam">line</span><span class="op">[</span><span class="nam">start_date_idx</span> <span class="op">+</span> <span class="num">3</span> <span class="op">:</span> <span class="nam">start_date_idx</span> <span class="op">+</span> <span class="num">5</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="nam">range_server_units</span> <span class="op">=</span> <span class="nam">Range</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="nam">line_no</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="nam">start_date_idx</span> <span class="op">+</span> <span class="num">3</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="nam">line_no</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">start_date_idx</span> <span class="op">+</span> <span class="num">4</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span><span class="nam">lines</span><span class="op">,</span> <span class="nam">range_server_units</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="str">f'Improper formatting of date. Expected ", " here, not "{sep}"'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="com"># FIXME: this parser is too forgiving (it ignores trailing garbage)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="nam">date</span> <span class="op">=</span> <span class="nam">parsedate_to_datetime</span><span class="op">(</span><span class="nam">date_str</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="key">except</span> <span class="nam">ValueError</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="nam">range_server_units</span> <span class="op">=</span> <span class="nam">Range</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="nam">line_no</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="nam">start_date_idx</span> <span class="op">+</span> <span class="num">5</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="nam">line_no</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="nam">line_len</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span><span class="nam">lines</span><span class="op">,</span> <span class="nam">range_server_units</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="str">f"Unable to the date as a valid RFC822 date: {e.args[0]}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="nam">expected_week_day</span> <span class="op">=</span> <span class="nam">_WEEKDAYS_BY_IDX</span><span class="op">[</span><span class="nam">date</span><span class="op">.</span><span class="nam">weekday</span><span class="op">(</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="key">if</span> <span class="nam">expected_week_day</span> <span class="op">!=</span> <span class="nam">day_name</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span><span class="nam">lines</span><span class="op">,</span> <span class="nam">day_name_range_server_units</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="str">f"The date was a {expected_week_day}day."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Warning</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="nam">data</span><span class="op">=</span><span class="op">[</span><span class="nam">propose_correct_text_quick_fix</span><span class="op">(</span><span class="nam">expected_week_day</span><span class="op">)</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"><span class="key">def</span> <span class="nam">_scan_debian_changelog_for_diagnostics</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">:</span> <span class="nam">LintCapablePositionCodec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="nam">delta_update_size</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="nam">max_words</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="nam">max_lines_between_update</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="nam">max_line_length</span><span class="op">:</span> <span class="nam">int</span> <span class="op">=</span> <span class="nam">_MAXIMUM_WIDTH</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="nam">diagnostics</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="nam">diagnostics_at_last_update</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="nam">lines_since_last_update</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="key">for</span> <span class="nam">line_no</span><span class="op">,</span> <span class="nam">line</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">lines</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="nam">orig_line</span> <span class="op">=</span> <span class="nam">line</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="nam">line</span> <span class="op">=</span> <span class="nam">line</span><span class="op">.</span><span class="nam">rstrip</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">line</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="key">if</span> <span class="nam">line</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">" --"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">_check_footer_line</span><span class="op">(</span><span class="nam">line</span><span class="op">,</span> <span class="nam">line_no</span><span class="op">,</span> <span class="nam">lines</span><span class="op">,</span> <span class="nam">position_codec</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">line</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">" "</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="com"># minus 1 for newline</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="nam">orig_line_len</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">orig_line</span><span class="op">)</span> <span class="op">-</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="key">if</span> <span class="nam">orig_line_len</span> <span class="op">></span> <span class="nam">max_line_length</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="nam">range_server_units</span> <span class="op">=</span> <span class="nam">Range</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="nam">line_no</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="nam">max_line_length</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="nam">line_no</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="nam">orig_line_len</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span><span class="nam">lines</span><span class="op">,</span> <span class="nam">range_server_units</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="str">f"Line exceeds {max_line_length} characters"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Hint</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">line</span><span class="op">)</span> <span class="op">></span> <span class="num">3</span> <span class="key">and</span> <span class="nam">line</span><span class="op">[</span><span class="num">2</span><span class="op">]</span> <span class="op">==</span> <span class="str">"["</span> <span class="key">and</span> <span class="nam">line</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span> <span class="op">==</span> <span class="str">"]"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="com"># Do not spell check [ X ] as X is usually a name</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="nam">lines_since_last_update</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="key">if</span> <span class="nam">max_words</span> <span class="op">></span> <span class="num">0</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="nam">typos</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">spellcheck_line</span><span class="op">(</span><span class="nam">lines</span><span class="op">,</span> <span class="nam">position_codec</span><span class="op">,</span> <span class="nam">line_no</span><span class="op">,</span> <span class="nam">line</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="nam">new_diagnostics</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">typos</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="nam">max_words</span> <span class="op">-=</span> <span class="nam">new_diagnostics</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">typos</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="nam">current_diagnostics_len</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">diagnostics</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="nam">lines_since_last_update</span> <span class="op">>=</span> <span class="nam">max_lines_between_update</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="key">or</span> <span class="nam">current_diagnostics_len</span> <span class="op">-</span> <span class="nam">diagnostics_at_last_update</span> <span class="op">></span> <span class="nam">delta_update_size</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="nam">diagnostics_at_last_update</span> <span class="op">=</span> <span class="nam">current_diagnostics_len</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="nam">lines_since_last_update</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="key">yield</span> <span class="nam">diagnostics</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">diagnostics</span> <span class="key">or</span> <span class="nam">diagnostics_at_last_update</span> <span class="op">!=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">diagnostics</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="key">yield</span> <span class="nam">diagnostics</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"><span class="key">def</span> <span class="nam">_lint_debian_changelog</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="nam">lint_state</span><span class="op">:</span> <span class="nam">LintState</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="nam">limits</span> <span class="op">=</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">maxsize</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="nam">scanner</span> <span class="op">=</span> <span class="nam">_scan_debian_changelog_for_diagnostics</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="nam">lint_state</span><span class="op">.</span><span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="nam">lint_state</span><span class="op">.</span><span class="nam">position_codec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="nam">limits</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="nam">limits</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="nam">limits</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="key">return</span> <span class="nam">next</span><span class="op">(</span><span class="nam">iter</span><span class="op">(</span><span class="nam">scanner</span><span class="op">)</span><span class="op">,</span> <span class="key">None</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_5d0ec0d5422112df_debputy_ls_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_debian_control_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_5d0ec0d5422112df_lsp_debian_control_py.html b/coverage-report/d_5d0ec0d5422112df_lsp_debian_control_py.html deleted file mode 100644 index d004ff7..0000000 --- a/coverage-report/d_5d0ec0d5422112df_lsp_debian_control_py.html +++ /dev/null @@ -1,729 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/lsp/lsp_debian_control.py: 72%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/lsp/lsp_debian_control.py</b>: - <span class="pc_cov">72%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">216 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">163<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">53<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">14<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_debian_changelog_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_debian_control_reference_data_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"> <span class="nam">Sequence</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> <span class="nam">Iterator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">Iterable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">Mapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">List</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="key">from</span> <span class="nam">lsprotocol</span><span class="op">.</span><span class="nam">types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">DiagnosticSeverity</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">Range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">Position</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">DidOpenTextDocumentParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">DidChangeTextDocumentParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">FoldingRange</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">FoldingRangeParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">CompletionItem</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">CompletionList</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="nam">CompletionParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">TEXT_DOCUMENT_WILL_SAVE_WAIT_UNTIL</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="nam">DiagnosticRelatedInformation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="nam">Location</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="nam">HoverParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="nam">Hover</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="nam">TEXT_DOCUMENT_CODE_ACTION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="nam">SemanticTokens</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="nam">SemanticTokensParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">linting</span><span class="op">.</span><span class="nam">lint_util</span> <span class="key">import</span> <span class="nam">LintState</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">lsp_debian_control_reference_data</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="nam">BINARY_FIELDS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="nam">SOURCE_FIELDS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">DctrlFileMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">lsp_features</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">lint_diagnostics</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">lsp_completer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="nam">lsp_hover</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="nam">lsp_standard_handler</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="nam">lsp_folding_ranges</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="nam">lsp_semantic_tokens_full</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">lsp_generic_deb822</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="nam">deb822_completer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="nam">deb822_hover</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="nam">deb822_folding_ranges</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="nam">deb822_semantic_tokens_full</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">quickfixes</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">propose_remove_line_quick_fix</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="nam">range_compatible_with_remove_line_fix</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="nam">propose_correct_text_quick_fix</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">spellchecking</span> <span class="key">import</span> <span class="nam">default_spellchecker</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">text_util</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="nam">normalize_dctrl_field_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="nam">LintCapablePositionCodec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="nam">detect_possible_typo</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="nam">te_range_to_lsp</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">vendoring</span><span class="op">.</span><span class="nam">_deb822_repro</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="nam">parse_deb822_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="nam">Deb822FileElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="nam">Deb822ParagraphElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">vendoring</span><span class="op">.</span><span class="nam">_deb822_repro</span><span class="op">.</span><span class="nam">parsing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="nam">Deb822KeyValuePairElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="nam">LIST_SPACE_SEPARATED_INTERPRETATION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">vendoring</span><span class="op">.</span><span class="nam">_deb822_repro</span><span class="op">.</span><span class="nam">tokens</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="nam">Deb822Token</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">_info</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"><span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">vendoring</span><span class="op">.</span><span class="nam">_deb822_repro</span><span class="op">.</span><span class="nam">locatable</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="nam">Position</span> <span class="key">as</span> <span class="nam">TEPosition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="nam">Range</span> <span class="key">as</span> <span class="nam">TERange</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="nam">START_POSITION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="key">from</span> <span class="nam">pygls</span><span class="op">.</span><span class="nam">server</span> <span class="key">import</span> <span class="nam">LanguageServer</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="key">from</span> <span class="nam">pygls</span><span class="op">.</span><span class="nam">workspace</span> <span class="key">import</span> <span class="nam">TextDocument</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"><span class="key">except</span> <span class="nam">ImportError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"><span class="nam">_LANGUAGE_IDS</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="str">"debian/control"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="com"># emacs's name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="str">"debian-control"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="com"># vim's name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="str">"debcontrol"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"><span class="nam">_DCTRL_FILE_METADATA</span> <span class="op">=</span> <span class="nam">DctrlFileMetadata</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"><span class="nam">lsp_standard_handler</span><span class="op">(</span><span class="nam">_LANGUAGE_IDS</span><span class="op">,</span> <span class="nam">TEXT_DOCUMENT_CODE_ACTION</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"><span class="nam">lsp_standard_handler</span><span class="op">(</span><span class="nam">_LANGUAGE_IDS</span><span class="op">,</span> <span class="nam">TEXT_DOCUMENT_WILL_SAVE_WAIT_UNTIL</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"><span class="op">@</span><span class="nam">lsp_hover</span><span class="op">(</span><span class="nam">_LANGUAGE_IDS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"><span class="key">def</span> <span class="nam">_debian_control_hover</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="nam">ls</span><span class="op">:</span> <span class="str">"LanguageServer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="nam">params</span><span class="op">:</span> <span class="nam">HoverParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Hover</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="key">return</span> <span class="nam">deb822_hover</span><span class="op">(</span><span class="nam">ls</span><span class="op">,</span> <span class="nam">params</span><span class="op">,</span> <span class="nam">_DCTRL_FILE_METADATA</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"><span class="op">@</span><span class="nam">lsp_completer</span><span class="op">(</span><span class="nam">_LANGUAGE_IDS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"><span class="key">def</span> <span class="nam">_debian_control_completions</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="nam">ls</span><span class="op">:</span> <span class="str">"LanguageServer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="nam">params</span><span class="op">:</span> <span class="nam">CompletionParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">CompletionList</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">CompletionItem</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="key">return</span> <span class="nam">deb822_completer</span><span class="op">(</span><span class="nam">ls</span><span class="op">,</span> <span class="nam">params</span><span class="op">,</span> <span class="nam">_DCTRL_FILE_METADATA</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"><span class="op">@</span><span class="nam">lsp_folding_ranges</span><span class="op">(</span><span class="nam">_LANGUAGE_IDS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"><span class="key">def</span> <span class="nam">_debian_control_folding_ranges</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="nam">ls</span><span class="op">:</span> <span class="str">"LanguageServer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="nam">params</span><span class="op">:</span> <span class="nam">FoldingRangeParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Sequence</span><span class="op">[</span><span class="nam">FoldingRange</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="key">return</span> <span class="nam">deb822_folding_ranges</span><span class="op">(</span><span class="nam">ls</span><span class="op">,</span> <span class="nam">params</span><span class="op">,</span> <span class="nam">_DCTRL_FILE_METADATA</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"><span class="key">def</span> <span class="nam">_deb822_token_iter</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="nam">tokens</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Deb822Token</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">Deb822Token</span><span class="op">,</span> <span class="nam">int</span><span class="op">,</span> <span class="nam">int</span><span class="op">,</span> <span class="nam">int</span><span class="op">,</span> <span class="nam">int</span><span class="op">,</span> <span class="nam">int</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="nam">line_no</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="nam">line_offset</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="key">for</span> <span class="nam">token</span> <span class="key">in</span> <span class="nam">tokens</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="nam">start_line</span> <span class="op">=</span> <span class="nam">line_no</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="nam">start_line_offset</span> <span class="op">=</span> <span class="nam">line_offset</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="nam">newlines</span> <span class="op">=</span> <span class="nam">token</span><span class="op">.</span><span class="nam">text</span><span class="op">.</span><span class="nam">count</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="nam">line_no</span> <span class="op">+=</span> <span class="nam">newlines</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="nam">text_len</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">token</span><span class="op">.</span><span class="nam">text</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="key">if</span> <span class="nam">newlines</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="key">if</span> <span class="nam">token</span><span class="op">.</span><span class="nam">text</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">148 ↛ 152</span><span class="annotate long">line 148 didn't jump to line 152, because the condition on line 148 was never false</span></span></p> - <p class="run"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="nam">line_offset</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="com"># -2, one to remove the "\n" and one to get 0-offset</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="nam">line_offset</span> <span class="op">=</span> <span class="nam">text_len</span> <span class="op">-</span> <span class="nam">token</span><span class="op">.</span><span class="nam">text</span><span class="op">.</span><span class="nam">rindex</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span> <span class="op">-</span> <span class="num">2</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="nam">line_offset</span> <span class="op">+=</span> <span class="nam">text_len</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="key">yield</span> <span class="nam">token</span><span class="op">,</span> <span class="nam">start_line</span><span class="op">,</span> <span class="nam">start_line_offset</span><span class="op">,</span> <span class="nam">line_no</span><span class="op">,</span> <span class="nam">line_offset</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"><span class="key">def</span> <span class="nam">_paragraph_representation_field</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="nam">paragraph</span><span class="op">:</span> <span class="nam">Deb822ParagraphElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Deb822KeyValuePairElement</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="key">return</span> <span class="nam">next</span><span class="op">(</span><span class="nam">iter</span><span class="op">(</span><span class="nam">paragraph</span><span class="op">.</span><span class="nam">iter_parts_of_type</span><span class="op">(</span><span class="nam">Deb822KeyValuePairElement</span><span class="op">)</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"><span class="key">def</span> <span class="nam">_extract_first_value_and_position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="nam">kvpair</span><span class="op">:</span> <span class="nam">Deb822KeyValuePairElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="nam">stanza_pos</span><span class="op">:</span> <span class="str">"TEPosition"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">:</span> <span class="str">"LintCapablePositionCodec"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Range</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="nam">kvpair_pos</span> <span class="op">=</span> <span class="nam">kvpair</span><span class="op">.</span><span class="nam">position_in_parent</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span><span class="nam">stanza_pos</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="nam">value_element_pos</span> <span class="op">=</span> <span class="nam">kvpair</span><span class="op">.</span><span class="nam">value_element</span><span class="op">.</span><span class="nam">position_in_parent</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">kvpair_pos</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="key">for</span> <span class="nam">value_ref</span> <span class="key">in</span> <span class="nam">kvpair</span><span class="op">.</span><span class="nam">interpret_as</span><span class="op">(</span> </span><span class="r"><span class="annotate short">175 ↛ 188</span><span class="annotate long">line 175 didn't jump to line 188, because the loop on line 175 didn't complete</span></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="nam">LIST_SPACE_SEPARATED_INTERPRETATION</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="op">)</span><span class="op">.</span><span class="nam">iter_value_references</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="nam">v</span> <span class="op">=</span> <span class="nam">value_ref</span><span class="op">.</span><span class="nam">value</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="nam">section_value_loc</span> <span class="op">=</span> <span class="nam">value_ref</span><span class="op">.</span><span class="nam">locatable</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="nam">value_range_te</span> <span class="op">=</span> <span class="nam">section_value_loc</span><span class="op">.</span><span class="nam">range_in_parent</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="nam">value_element_pos</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="nam">section_range_server_units</span> <span class="op">=</span> <span class="nam">te_range_to_lsp</span><span class="op">(</span><span class="nam">value_range_te</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="nam">section_range</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> <span class="nam">section_range_server_units</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="key">return</span> <span class="nam">v</span><span class="op">,</span> <span class="nam">section_range</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span><span class="op">,</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"><span class="key">def</span> <span class="nam">_binary_package_checks</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="nam">stanza</span><span class="op">:</span> <span class="nam">Deb822ParagraphElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="nam">stanza_position</span><span class="op">:</span> <span class="str">"TEPosition"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="nam">source_stanza</span><span class="op">:</span> <span class="nam">Deb822ParagraphElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="nam">representation_field_range</span><span class="op">:</span> <span class="nam">Range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">:</span> <span class="str">"LintCapablePositionCodec"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="nam">package_name</span> <span class="op">=</span> <span class="nam">stanza</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"Package"</span><span class="op">,</span> <span class="str">""</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="nam">source_section</span> <span class="op">=</span> <span class="nam">source_stanza</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"Section"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="nam">section_kvpair</span> <span class="op">=</span> <span class="nam">stanza</span><span class="op">.</span><span class="nam">get_kvpair_element</span><span class="op">(</span><span class="str">"Section"</span><span class="op">,</span> <span class="nam">use_get</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="nam">section</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="key">if</span> <span class="nam">section_kvpair</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="nam">section</span><span class="op">,</span> <span class="nam">section_range</span> <span class="op">=</span> <span class="nam">_extract_first_value_and_position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="nam">section_kvpair</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="nam">stanza_position</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="nam">section_range</span> <span class="op">=</span> <span class="nam">representation_field_range</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="nam">effective_section</span> <span class="op">=</span> <span class="nam">section</span> <span class="key">or</span> <span class="nam">source_section</span> <span class="key">or</span> <span class="str">"unknown"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="nam">package_type</span> <span class="op">=</span> <span class="nam">stanza</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"Package-Type"</span><span class="op">,</span> <span class="str">""</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="nam">component_prefix</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="key">if</span> <span class="str">"/"</span> <span class="key">in</span> <span class="nam">effective_section</span><span class="op">:</span> </span><span class="r"><span class="annotate short">216 ↛ 217</span><span class="annotate long">line 216 didn't jump to line 217, because the condition on line 216 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="nam">component_prefix</span><span class="op">,</span> <span class="nam">effective_section</span> <span class="op">=</span> <span class="nam">effective_section</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="str">"/"</span><span class="op">,</span> <span class="nam">maxsplit</span><span class="op">=</span><span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="nam">component_prefix</span> <span class="op">+=</span> <span class="str">"/"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="key">if</span> <span class="nam">package_name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"-udeb"</span><span class="op">)</span> <span class="key">or</span> <span class="nam">package_type</span> <span class="op">==</span> <span class="str">"udeb"</span><span class="op">:</span> </span><span class="r"><span class="annotate short">220 ↛ 221</span><span class="annotate long">line 220 didn't jump to line 221, because the condition on line 220 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="key">if</span> <span class="nam">package_type</span> <span class="op">!=</span> <span class="str">"udeb"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="nam">package_type_kvpair</span> <span class="op">=</span> <span class="nam">stanza</span><span class="op">.</span><span class="nam">get_kvpair_element</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="str">"Package-Type"</span><span class="op">,</span> <span class="nam">use_get</span><span class="op">=</span><span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="nam">package_type_range</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="key">if</span> <span class="nam">package_type_kvpair</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="nam">_</span><span class="op">,</span> <span class="nam">package_type_range</span> <span class="op">=</span> <span class="nam">_extract_first_value_and_position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="nam">package_type_kvpair</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="nam">stanza_position</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="key">if</span> <span class="nam">package_type_range</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="nam">package_type_range</span> <span class="op">=</span> <span class="nam">representation_field_range</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="nam">package_type_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="str">'The Package-Type should be "udeb" given the package name'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Warning</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="key">if</span> <span class="nam">effective_section</span> <span class="op">!=</span> <span class="str">"debian-installer"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="nam">quickfix_data</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="key">if</span> <span class="nam">section</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="nam">quickfix_data</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="nam">propose_correct_text_quick_fix</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="str">f"{component_prefix}debian-installer"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="nam">section_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="str">f'The Section should be "{component_prefix}debian-installer" for udebs'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Warning</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="nam">data</span><span class="op">=</span><span class="nam">quickfix_data</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"><span class="key">def</span> <span class="nam">_diagnostics_for_paragraph</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="nam">stanza</span><span class="op">:</span> <span class="nam">Deb822ParagraphElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="nam">stanza_position</span><span class="op">:</span> <span class="str">"TEPosition"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="nam">source_stanza</span><span class="op">:</span> <span class="nam">Deb822ParagraphElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="nam">known_fields</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">DctrlKnownField</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="nam">other_known_fields</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">DctrlKnownField</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="nam">is_binary_paragraph</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="nam">doc_reference</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">:</span> <span class="str">"LintCapablePositionCodec"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="nam">representation_field</span> <span class="op">=</span> <span class="nam">_paragraph_representation_field</span><span class="op">(</span><span class="nam">stanza</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="nam">representation_field_pos</span> <span class="op">=</span> <span class="nam">representation_field</span><span class="op">.</span><span class="nam">position_in_parent</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="nam">stanza_position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="nam">representation_field_range_server_units</span> <span class="op">=</span> <span class="nam">te_range_to_lsp</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="nam">TERange</span><span class="op">.</span><span class="nam">from_position_and_size</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="nam">representation_field_pos</span><span class="op">,</span> <span class="nam">representation_field</span><span class="op">.</span><span class="nam">size</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="nam">representation_field_range</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="nam">representation_field_range_server_units</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="key">for</span> <span class="nam">known_field</span> <span class="key">in</span> <span class="nam">known_fields</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="nam">missing_field_severity</span> <span class="op">=</span> <span class="nam">known_field</span><span class="op">.</span><span class="nam">missing_field_severity</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="key">if</span> <span class="nam">missing_field_severity</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">known_field</span><span class="op">.</span><span class="nam">name</span> <span class="key">in</span> <span class="nam">stanza</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> <span class="key">if</span> <span class="nam">known_field</span><span class="op">.</span><span class="nam">inherits_from_source</span> <span class="key">and</span> <span class="nam">known_field</span><span class="op">.</span><span class="nam">name</span> <span class="key">in</span> <span class="nam">source_stanza</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="nam">representation_field_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="str">f"Stanza is missing field {known_field.name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">missing_field_severity</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_binary_paragraph</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="nam">_binary_package_checks</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> <span class="nam">stanza</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="nam">stanza_position</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="nam">source_stanza</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="nam">representation_field_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="nam">seen_fields</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="key">for</span> <span class="nam">kvpair</span> <span class="key">in</span> <span class="nam">stanza</span><span class="op">.</span><span class="nam">iter_parts_of_type</span><span class="op">(</span><span class="nam">Deb822KeyValuePairElement</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="nam">field_name_token</span> <span class="op">=</span> <span class="nam">kvpair</span><span class="op">.</span><span class="nam">field_token</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="nam">field_name</span> <span class="op">=</span> <span class="nam">field_name_token</span><span class="op">.</span><span class="nam">text</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="nam">field_name_lc</span> <span class="op">=</span> <span class="nam">field_name</span><span class="op">.</span><span class="nam">lower</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="nam">normalized_field_name_lc</span> <span class="op">=</span> <span class="nam">normalize_dctrl_field_name</span><span class="op">(</span><span class="nam">field_name_lc</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="nam">known_field</span> <span class="op">=</span> <span class="nam">known_fields</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">normalized_field_name_lc</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> <span class="nam">field_value</span> <span class="op">=</span> <span class="nam">stanza</span><span class="op">[</span><span class="nam">field_name</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> <span class="nam">field_range_te</span> <span class="op">=</span> <span class="nam">kvpair</span><span class="op">.</span><span class="nam">range_in_parent</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span><span class="nam">stanza_position</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> <span class="nam">field_position_te</span> <span class="op">=</span> <span class="nam">field_range_te</span><span class="op">.</span><span class="nam">start_pos</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> <span class="nam">field_range_server_units</span> <span class="op">=</span> <span class="nam">te_range_to_lsp</span><span class="op">(</span><span class="nam">field_range_te</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> <span class="nam">field_range</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> <span class="nam">field_range_server_units</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> <span class="nam">field_name_typo_detected</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> <span class="nam">existing_field_range</span> <span class="op">=</span> <span class="nam">seen_fields</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">normalized_field_name_lc</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing_field_range</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">333 ↛ 334</span><span class="annotate long">line 333 didn't jump to line 334, because the condition on line 333 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> <span class="nam">existing_field_range</span><span class="op">[</span><span class="num">3</span><span class="op">]</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">field_range</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> <span class="nam">normalized_field_name</span> <span class="op">=</span> <span class="nam">normalize_dctrl_field_name</span><span class="op">(</span><span class="nam">field_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> <span class="nam">seen_fields</span><span class="op">[</span><span class="nam">field_name_lc</span><span class="op">]</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> <span class="nam">field_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"> <span class="nam">normalized_field_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> <span class="nam">field_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"> <span class="op">[</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> <span class="key">if</span> <span class="nam">known_field</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"> <span class="nam">candidates</span> <span class="op">=</span> <span class="nam">detect_possible_typo</span><span class="op">(</span><span class="nam">normalized_field_name_lc</span><span class="op">,</span> <span class="nam">known_fields</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"> <span class="key">if</span> <span class="nam">candidates</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"> <span class="nam">known_field</span> <span class="op">=</span> <span class="nam">known_fields</span><span class="op">[</span><span class="nam">candidates</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"> <span class="nam">token_range_server_units</span> <span class="op">=</span> <span class="nam">te_range_to_lsp</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"> <span class="nam">TERange</span><span class="op">.</span><span class="nam">from_position_and_size</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"> <span class="nam">field_position_te</span><span class="op">,</span> <span class="nam">kvpair</span><span class="op">.</span><span class="nam">field_token</span><span class="op">.</span><span class="nam">size</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"> <span class="nam">field_range</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"> <span class="nam">token_range_server_units</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"> <span class="nam">field_name_typo_detected</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"> <span class="nam">field_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"> <span class="str">f'The "{field_name}" looks like a typo of "{known_field.name}".'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Warning</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"> <span class="nam">data</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"> <span class="nam">propose_correct_text_quick_fix</span><span class="op">(</span><span class="nam">known_fields</span><span class="op">[</span><span class="nam">m</span><span class="op">]</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"> <span class="key">for</span> <span class="nam">m</span> <span class="key">in</span> <span class="nam">candidates</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"> <span class="key">if</span> <span class="nam">known_field</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"> <span class="nam">known_else_where</span> <span class="op">=</span> <span class="nam">other_known_fields</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">normalized_field_name_lc</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"> <span class="key">if</span> <span class="nam">known_else_where</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">372 ↛ 373</span><span class="annotate long">line 372 didn't jump to line 373, because the condition on line 372 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"> <span class="nam">intended_usage</span> <span class="op">=</span> <span class="str">"Source"</span> <span class="key">if</span> <span class="nam">is_binary_paragraph</span> <span class="key">else</span> <span class="str">"Package"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"> <span class="nam">field_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"> <span class="str">f'The {field_name} is defined for use in the "{intended_usage}" stanza.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"> <span class="str">f" Please move it to the right place or remove it"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t385" href="#t385">385</a></span><span class="t"> <span class="key">if</span> <span class="nam">field_value</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span> <span class="op">==</span> <span class="str">""</span><span class="op">:</span> </span><span class="r"><span class="annotate short">385 ↛ 386</span><span class="annotate long">line 385 didn't jump to line 386, because the condition on line 385 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t386" href="#t386">386</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t387" href="#t387">387</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t388" href="#t388">388</a></span><span class="t"> <span class="nam">field_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t389" href="#t389">389</a></span><span class="t"> <span class="str">f"The {field_name} has no value. Either provide a value or remove it."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t390" href="#t390">390</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t391" href="#t391">391</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t392" href="#t392">392</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t393" href="#t393">393</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t394" href="#t394">394</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t395" href="#t395">395</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t396" href="#t396">396</a></span><span class="t"> <span class="nam">known_field</span><span class="op">.</span><span class="nam">field_diagnostics</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t397" href="#t397">397</a></span><span class="t"> <span class="nam">kvpair</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t398" href="#t398">398</a></span><span class="t"> <span class="nam">stanza</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t399" href="#t399">399</a></span><span class="t"> <span class="nam">stanza_position</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t400" href="#t400">400</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t401" href="#t401">401</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t402" href="#t402">402</a></span><span class="t"> <span class="nam">field_name_typo_reported</span><span class="op">=</span><span class="nam">field_name_typo_detected</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t403" href="#t403">403</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t404" href="#t404">404</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t405" href="#t405">405</a></span><span class="t"> <span class="key">if</span> <span class="nam">known_field</span><span class="op">.</span><span class="nam">spellcheck_value</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t406" href="#t406">406</a></span><span class="t"> <span class="nam">words</span> <span class="op">=</span> <span class="nam">kvpair</span><span class="op">.</span><span class="nam">interpret_as</span><span class="op">(</span><span class="nam">LIST_SPACE_SEPARATED_INTERPRETATION</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t407" href="#t407">407</a></span><span class="t"> <span class="nam">spell_checker</span> <span class="op">=</span> <span class="nam">default_spellchecker</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t408" href="#t408">408</a></span><span class="t"> <span class="nam">value_position</span> <span class="op">=</span> <span class="nam">kvpair</span><span class="op">.</span><span class="nam">value_element</span><span class="op">.</span><span class="nam">position_in_parent</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t409" href="#t409">409</a></span><span class="t"> <span class="nam">field_position_te</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t410" href="#t410">410</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t411" href="#t411">411</a></span><span class="t"> <span class="key">for</span> <span class="nam">word_ref</span> <span class="key">in</span> <span class="nam">words</span><span class="op">.</span><span class="nam">iter_value_references</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t412" href="#t412">412</a></span><span class="t"> <span class="nam">token</span> <span class="op">=</span> <span class="nam">word_ref</span><span class="op">.</span><span class="nam">value</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t413" href="#t413">413</a></span><span class="t"> <span class="key">for</span> <span class="nam">word</span><span class="op">,</span> <span class="nam">pos</span><span class="op">,</span> <span class="nam">endpos</span> <span class="key">in</span> <span class="nam">spell_checker</span><span class="op">.</span><span class="nam">iter_words</span><span class="op">(</span><span class="nam">token</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t414" href="#t414">414</a></span><span class="t"> <span class="nam">corrections</span> <span class="op">=</span> <span class="nam">spell_checker</span><span class="op">.</span><span class="nam">provide_corrections_for</span><span class="op">(</span><span class="nam">word</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t415" href="#t415">415</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">corrections</span><span class="op">:</span> </span><span class="r"><span class="annotate short">415 ↛ 417</span><span class="annotate long">line 415 didn't jump to line 417, because the condition on line 415 was never false</span></span></p> - <p class="run"><span class="n"><a id="t416" href="#t416">416</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t417" href="#t417">417</a></span><span class="t"> <span class="nam">word_loc</span> <span class="op">=</span> <span class="nam">word_ref</span><span class="op">.</span><span class="nam">locatable</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t418" href="#t418">418</a></span><span class="t"> <span class="nam">word_pos_te</span> <span class="op">=</span> <span class="nam">word_loc</span><span class="op">.</span><span class="nam">position_in_parent</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t419" href="#t419">419</a></span><span class="t"> <span class="nam">value_position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t420" href="#t420">420</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t421" href="#t421">421</a></span><span class="t"> <span class="key">if</span> <span class="nam">pos</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t422" href="#t422">422</a></span><span class="t"> <span class="nam">word_pos_te</span> <span class="op">=</span> <span class="nam">TEPosition</span><span class="op">(</span><span class="num">0</span><span class="op">,</span> <span class="nam">pos</span><span class="op">)</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span><span class="nam">word_pos_te</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t423" href="#t423">423</a></span><span class="t"> <span class="nam">word_range</span> <span class="op">=</span> <span class="nam">TERange</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t424" href="#t424">424</a></span><span class="t"> <span class="nam">START_POSITION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t425" href="#t425">425</a></span><span class="t"> <span class="nam">TEPosition</span><span class="op">(</span><span class="num">0</span><span class="op">,</span> <span class="nam">endpos</span> <span class="op">-</span> <span class="nam">pos</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t426" href="#t426">426</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t427" href="#t427">427</a></span><span class="t"> <span class="nam">word_range_server_units</span> <span class="op">=</span> <span class="nam">te_range_to_lsp</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t428" href="#t428">428</a></span><span class="t"> <span class="nam">TERange</span><span class="op">.</span><span class="nam">from_position_and_size</span><span class="op">(</span><span class="nam">word_pos_te</span><span class="op">,</span> <span class="nam">word_range</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t429" href="#t429">429</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t430" href="#t430">430</a></span><span class="t"> <span class="nam">word_range</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t431" href="#t431">431</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t432" href="#t432">432</a></span><span class="t"> <span class="nam">word_range_server_units</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t433" href="#t433">433</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t434" href="#t434">434</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t435" href="#t435">435</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t436" href="#t436">436</a></span><span class="t"> <span class="nam">word_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t437" href="#t437">437</a></span><span class="t"> <span class="str">f'Spelling "{word}"'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t438" href="#t438">438</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Hint</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t439" href="#t439">439</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t440" href="#t440">440</a></span><span class="t"> <span class="nam">data</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t441" href="#t441">441</a></span><span class="t"> <span class="nam">propose_correct_text_quick_fix</span><span class="op">(</span><span class="nam">c</span><span class="op">)</span> <span class="key">for</span> <span class="nam">c</span> <span class="key">in</span> <span class="nam">corrections</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t442" href="#t442">442</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t443" href="#t443">443</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t444" href="#t444">444</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t445" href="#t445">445</a></span><span class="t"> <span class="nam">source_value</span> <span class="op">=</span> <span class="nam">source_stanza</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">field_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t446" href="#t446">446</a></span><span class="t"> <span class="key">if</span> <span class="nam">known_field</span><span class="op">.</span><span class="nam">warn_if_default</span> <span class="key">and</span> <span class="nam">field_value</span> <span class="op">==</span> <span class="nam">known_field</span><span class="op">.</span><span class="nam">default_value</span><span class="op">:</span> </span><span class="r"><span class="annotate short">446 ↛ 447</span><span class="annotate long">line 446 didn't jump to line 447, because the condition on line 446 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t447" href="#t447">447</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t448" href="#t448">448</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t449" href="#t449">449</a></span><span class="t"> <span class="nam">field_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t450" href="#t450">450</a></span><span class="t"> <span class="str">f"The {field_name} is redundant as it is set to the default value and the field should only be"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t451" href="#t451">451</a></span><span class="t"> <span class="str">" used in exceptional cases."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t452" href="#t452">452</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Warning</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t453" href="#t453">453</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t454" href="#t454">454</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t455" href="#t455">455</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t456" href="#t456">456</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t457" href="#t457">457</a></span><span class="t"> <span class="key">if</span> <span class="nam">known_field</span><span class="op">.</span><span class="nam">inherits_from_source</span> <span class="key">and</span> <span class="nam">field_value</span> <span class="op">==</span> <span class="nam">source_value</span><span class="op">:</span> </span><span class="r"><span class="annotate short">457 ↛ 458</span><span class="annotate long">line 457 didn't jump to line 458, because the condition on line 457 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t458" href="#t458">458</a></span><span class="t"> <span class="key">if</span> <span class="nam">range_compatible_with_remove_line_fix</span><span class="op">(</span><span class="nam">field_range</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t459" href="#t459">459</a></span><span class="t"> <span class="nam">fix_data</span> <span class="op">=</span> <span class="nam">propose_remove_line_quick_fix</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t460" href="#t460">460</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t461" href="#t461">461</a></span><span class="t"> <span class="nam">fix_data</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t462" href="#t462">462</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t463" href="#t463">463</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t464" href="#t464">464</a></span><span class="t"> <span class="nam">field_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t465" href="#t465">465</a></span><span class="t"> <span class="str">f"The field {field_name} duplicates the value from the Source stanza."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t466" href="#t466">466</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Information</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t467" href="#t467">467</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t468" href="#t468">468</a></span><span class="t"> <span class="nam">data</span><span class="op">=</span><span class="nam">fix_data</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t469" href="#t469">469</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t470" href="#t470">470</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t471" href="#t471">471</a></span><span class="t"> <span class="key">for</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t472" href="#t472">472</a></span><span class="t"> <span class="nam">field_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t473" href="#t473">473</a></span><span class="t"> <span class="nam">normalized_field_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t474" href="#t474">474</a></span><span class="t"> <span class="nam">field_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t475" href="#t475">475</a></span><span class="t"> <span class="nam">duplicates</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t476" href="#t476">476</a></span><span class="t"> <span class="op">)</span> <span class="key">in</span> <span class="nam">seen_fields</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t477" href="#t477">477</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">duplicates</span><span class="op">:</span> </span><span class="r"><span class="annotate short">477 ↛ 479</span><span class="annotate long">line 477 didn't jump to line 479</span></span></p> - <p class="run"><span class="n"><a id="t478" href="#t478">478</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t479" href="#t479">479</a></span><span class="t"> <span class="nam">related_information</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t480" href="#t480">480</a></span><span class="t"> <span class="nam">DiagnosticRelatedInformation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t481" href="#t481">481</a></span><span class="t"> <span class="nam">location</span><span class="op">=</span><span class="nam">Location</span><span class="op">(</span><span class="nam">doc_reference</span><span class="op">,</span> <span class="nam">field_range</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t482" href="#t482">482</a></span><span class="t"> <span class="nam">message</span><span class="op">=</span><span class="str">f"First definition of {field_name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t483" href="#t483">483</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t484" href="#t484">484</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t485" href="#t485">485</a></span><span class="t"> <span class="nam">related_information</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t486" href="#t486">486</a></span><span class="t"> <span class="nam">DiagnosticRelatedInformation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t487" href="#t487">487</a></span><span class="t"> <span class="nam">location</span><span class="op">=</span><span class="nam">Location</span><span class="op">(</span><span class="nam">doc_reference</span><span class="op">,</span> <span class="nam">r</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t488" href="#t488">488</a></span><span class="t"> <span class="nam">message</span><span class="op">=</span><span class="str">f"Duplicate of {field_name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t489" href="#t489">489</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t490" href="#t490">490</a></span><span class="t"> <span class="key">for</span> <span class="nam">r</span> <span class="key">in</span> <span class="nam">duplicates</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t491" href="#t491">491</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t492" href="#t492">492</a></span><span class="t"> <span class="key">for</span> <span class="nam">dup_range</span> <span class="key">in</span> <span class="nam">duplicates</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t493" href="#t493">493</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t494" href="#t494">494</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t495" href="#t495">495</a></span><span class="t"> <span class="nam">dup_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t496" href="#t496">496</a></span><span class="t"> <span class="str">f"The {normalized_field_name} field name was used multiple times in this stanza."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t497" href="#t497">497</a></span><span class="t"> <span class="str">f" Please ensure the field is only used once per stanza. Note that {normalized_field_name} and"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t498" href="#t498">498</a></span><span class="t"> <span class="str">f" X[BCS]-{normalized_field_name} are considered the same field."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t499" href="#t499">499</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t500" href="#t500">500</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t501" href="#t501">501</a></span><span class="t"> <span class="nam">related_information</span><span class="op">=</span><span class="nam">related_information</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t502" href="#t502">502</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t503" href="#t503">503</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t504" href="#t504">504</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t505" href="#t505">505</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t506" href="#t506">506</a></span><span class="t"><span class="key">def</span> <span class="nam">_scan_for_syntax_errors_and_token_level_diagnostics</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t507" href="#t507">507</a></span><span class="t"> <span class="nam">deb822_file</span><span class="op">:</span> <span class="nam">Deb822FileElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t508" href="#t508">508</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">:</span> <span class="nam">LintCapablePositionCodec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t509" href="#t509">509</a></span><span class="t"> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t510" href="#t510">510</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t511" href="#t511">511</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t512" href="#t512">512</a></span><span class="t"> <span class="nam">first_error</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">lines</span><span class="op">)</span> <span class="op">+</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t513" href="#t513">513</a></span><span class="t"> <span class="nam">spell_checker</span> <span class="op">=</span> <span class="nam">default_spellchecker</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t514" href="#t514">514</a></span><span class="t"> <span class="key">for</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t515" href="#t515">515</a></span><span class="t"> <span class="nam">token</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t516" href="#t516">516</a></span><span class="t"> <span class="nam">start_line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t517" href="#t517">517</a></span><span class="t"> <span class="nam">start_offset</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t518" href="#t518">518</a></span><span class="t"> <span class="nam">end_line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t519" href="#t519">519</a></span><span class="t"> <span class="nam">end_offset</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t520" href="#t520">520</a></span><span class="t"> <span class="op">)</span> <span class="key">in</span> <span class="nam">_deb822_token_iter</span><span class="op">(</span><span class="nam">deb822_file</span><span class="op">.</span><span class="nam">iter_tokens</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t521" href="#t521">521</a></span><span class="t"> <span class="key">if</span> <span class="nam">token</span><span class="op">.</span><span class="nam">is_error</span><span class="op">:</span> </span><span class="r"><span class="annotate short">521 ↛ 522</span><span class="annotate long">line 521 didn't jump to line 522, because the condition on line 521 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t522" href="#t522">522</a></span><span class="t"> <span class="nam">first_error</span> <span class="op">=</span> <span class="nam">min</span><span class="op">(</span><span class="nam">first_error</span><span class="op">,</span> <span class="nam">start_line</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t523" href="#t523">523</a></span><span class="t"> <span class="nam">start_pos</span> <span class="op">=</span> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t524" href="#t524">524</a></span><span class="t"> <span class="nam">start_line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t525" href="#t525">525</a></span><span class="t"> <span class="nam">start_offset</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t526" href="#t526">526</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t527" href="#t527">527</a></span><span class="t"> <span class="nam">end_pos</span> <span class="op">=</span> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t528" href="#t528">528</a></span><span class="t"> <span class="nam">end_line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t529" href="#t529">529</a></span><span class="t"> <span class="nam">end_offset</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t530" href="#t530">530</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t531" href="#t531">531</a></span><span class="t"> <span class="nam">token_range</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t532" href="#t532">532</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> <span class="nam">Range</span><span class="op">(</span><span class="nam">start_pos</span><span class="op">,</span> <span class="nam">end_pos</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t533" href="#t533">533</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t534" href="#t534">534</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t535" href="#t535">535</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t536" href="#t536">536</a></span><span class="t"> <span class="nam">token_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t537" href="#t537">537</a></span><span class="t"> <span class="str">"Syntax error"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t538" href="#t538">538</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t539" href="#t539">539</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy (python-debian parser)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t540" href="#t540">540</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t541" href="#t541">541</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t542" href="#t542">542</a></span><span class="t"> <span class="key">elif</span> <span class="nam">token</span><span class="op">.</span><span class="nam">is_comment</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t543" href="#t543">543</a></span><span class="t"> <span class="key">for</span> <span class="nam">word</span><span class="op">,</span> <span class="nam">pos</span><span class="op">,</span> <span class="nam">end_pos</span> <span class="key">in</span> <span class="nam">spell_checker</span><span class="op">.</span><span class="nam">iter_words</span><span class="op">(</span><span class="nam">token</span><span class="op">.</span><span class="nam">text</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t544" href="#t544">544</a></span><span class="t"> <span class="nam">corrections</span> <span class="op">=</span> <span class="nam">spell_checker</span><span class="op">.</span><span class="nam">provide_corrections_for</span><span class="op">(</span><span class="nam">word</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t545" href="#t545">545</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">corrections</span><span class="op">:</span> </span><span class="r"><span class="annotate short">545 ↛ 547</span><span class="annotate long">line 545 didn't jump to line 547, because the condition on line 545 was never false</span></span></p> - <p class="run"><span class="n"><a id="t546" href="#t546">546</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t547" href="#t547">547</a></span><span class="t"> <span class="nam">start_pos</span> <span class="op">=</span> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t548" href="#t548">548</a></span><span class="t"> <span class="nam">start_line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t549" href="#t549">549</a></span><span class="t"> <span class="nam">pos</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t550" href="#t550">550</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t551" href="#t551">551</a></span><span class="t"> <span class="nam">end_pos</span> <span class="op">=</span> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t552" href="#t552">552</a></span><span class="t"> <span class="nam">start_line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t553" href="#t553">553</a></span><span class="t"> <span class="nam">end_pos</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t554" href="#t554">554</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t555" href="#t555">555</a></span><span class="t"> <span class="nam">word_range</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t556" href="#t556">556</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> <span class="nam">Range</span><span class="op">(</span><span class="nam">start_pos</span><span class="op">,</span> <span class="nam">end_pos</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t557" href="#t557">557</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t558" href="#t558">558</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t559" href="#t559">559</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t560" href="#t560">560</a></span><span class="t"> <span class="nam">word_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t561" href="#t561">561</a></span><span class="t"> <span class="str">f'Spelling "{word}"'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t562" href="#t562">562</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Hint</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t563" href="#t563">563</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t564" href="#t564">564</a></span><span class="t"> <span class="nam">data</span><span class="op">=</span><span class="op">[</span><span class="nam">propose_correct_text_quick_fix</span><span class="op">(</span><span class="nam">c</span><span class="op">)</span> <span class="key">for</span> <span class="nam">c</span> <span class="key">in</span> <span class="nam">corrections</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t565" href="#t565">565</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t566" href="#t566">566</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t567" href="#t567">567</a></span><span class="t"> <span class="key">return</span> <span class="nam">first_error</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t568" href="#t568">568</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t569" href="#t569">569</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t570" href="#t570">570</a></span><span class="t"><span class="op">@</span><span class="nam">lint_diagnostics</span><span class="op">(</span><span class="nam">_LANGUAGE_IDS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t571" href="#t571">571</a></span><span class="t"><span class="key">def</span> <span class="nam">_lint_debian_control</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t572" href="#t572">572</a></span><span class="t"> <span class="nam">lint_state</span><span class="op">:</span> <span class="nam">LintState</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t573" href="#t573">573</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t574" href="#t574">574</a></span><span class="t"> <span class="nam">lines</span> <span class="op">=</span> <span class="nam">lint_state</span><span class="op">.</span><span class="nam">lines</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t575" href="#t575">575</a></span><span class="t"> <span class="nam">position_codec</span> <span class="op">=</span> <span class="nam">lint_state</span><span class="op">.</span><span class="nam">position_codec</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t576" href="#t576">576</a></span><span class="t"> <span class="nam">doc_reference</span> <span class="op">=</span> <span class="nam">lint_state</span><span class="op">.</span><span class="nam">doc_uri</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t577" href="#t577">577</a></span><span class="t"> <span class="nam">diagnostics</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t578" href="#t578">578</a></span><span class="t"> <span class="nam">deb822_file</span> <span class="op">=</span> <span class="nam">parse_deb822_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t579" href="#t579">579</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t580" href="#t580">580</a></span><span class="t"> <span class="nam">accept_files_with_duplicated_fields</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t581" href="#t581">581</a></span><span class="t"> <span class="nam">accept_files_with_error_tokens</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t582" href="#t582">582</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t583" href="#t583">583</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t584" href="#t584">584</a></span><span class="t"> <span class="nam">first_error</span> <span class="op">=</span> <span class="nam">_scan_for_syntax_errors_and_token_level_diagnostics</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t585" href="#t585">585</a></span><span class="t"> <span class="nam">deb822_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t586" href="#t586">586</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t587" href="#t587">587</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t588" href="#t588">588</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t589" href="#t589">589</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t590" href="#t590">590</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t591" href="#t591">591</a></span><span class="t"> <span class="nam">paragraphs</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">deb822_file</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t592" href="#t592">592</a></span><span class="t"> <span class="nam">source_paragraph</span> <span class="op">=</span> <span class="nam">paragraphs</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="key">if</span> <span class="nam">paragraphs</span> <span class="key">else</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t593" href="#t593">593</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t594" href="#t594">594</a></span><span class="t"> <span class="key">for</span> <span class="nam">paragraph_no</span><span class="op">,</span> <span class="nam">paragraph</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">paragraphs</span><span class="op">,</span> <span class="nam">start</span><span class="op">=</span><span class="num">1</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t595" href="#t595">595</a></span><span class="t"> <span class="nam">paragraph_pos</span> <span class="op">=</span> <span class="nam">paragraph</span><span class="op">.</span><span class="nam">position_in_file</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t596" href="#t596">596</a></span><span class="t"> <span class="key">if</span> <span class="nam">paragraph_pos</span><span class="op">.</span><span class="nam">line_position</span> <span class="op">>=</span> <span class="nam">first_error</span><span class="op">:</span> </span><span class="r"><span class="annotate short">596 ↛ 597</span><span class="annotate long">line 596 didn't jump to line 597, because the condition on line 596 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t597" href="#t597">597</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t598" href="#t598">598</a></span><span class="t"> <span class="nam">is_binary_paragraph</span> <span class="op">=</span> <span class="nam">paragraph_no</span> <span class="op">!=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t599" href="#t599">599</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_binary_paragraph</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t600" href="#t600">600</a></span><span class="t"> <span class="nam">known_fields</span> <span class="op">=</span> <span class="nam">BINARY_FIELDS</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t601" href="#t601">601</a></span><span class="t"> <span class="nam">other_known_fields</span> <span class="op">=</span> <span class="nam">SOURCE_FIELDS</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t602" href="#t602">602</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t603" href="#t603">603</a></span><span class="t"> <span class="nam">known_fields</span> <span class="op">=</span> <span class="nam">SOURCE_FIELDS</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t604" href="#t604">604</a></span><span class="t"> <span class="nam">other_known_fields</span> <span class="op">=</span> <span class="nam">BINARY_FIELDS</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t605" href="#t605">605</a></span><span class="t"> <span class="nam">_diagnostics_for_paragraph</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t606" href="#t606">606</a></span><span class="t"> <span class="nam">paragraph</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t607" href="#t607">607</a></span><span class="t"> <span class="nam">paragraph_pos</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t608" href="#t608">608</a></span><span class="t"> <span class="nam">source_paragraph</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t609" href="#t609">609</a></span><span class="t"> <span class="nam">known_fields</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t610" href="#t610">610</a></span><span class="t"> <span class="nam">other_known_fields</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t611" href="#t611">611</a></span><span class="t"> <span class="nam">is_binary_paragraph</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t612" href="#t612">612</a></span><span class="t"> <span class="nam">doc_reference</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t613" href="#t613">613</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t614" href="#t614">614</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t615" href="#t615">615</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t616" href="#t616">616</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t617" href="#t617">617</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t618" href="#t618">618</a></span><span class="t"> <span class="key">return</span> <span class="nam">diagnostics</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t619" href="#t619">619</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t620" href="#t620">620</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t621" href="#t621">621</a></span><span class="t"><span class="op">@</span><span class="nam">lsp_semantic_tokens_full</span><span class="op">(</span><span class="nam">_LANGUAGE_IDS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t622" href="#t622">622</a></span><span class="t"><span class="key">def</span> <span class="nam">_semantic_tokens_full</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t623" href="#t623">623</a></span><span class="t"> <span class="nam">ls</span><span class="op">:</span> <span class="str">"LanguageServer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t624" href="#t624">624</a></span><span class="t"> <span class="nam">request</span><span class="op">:</span> <span class="nam">SemanticTokensParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t625" href="#t625">625</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">SemanticTokens</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t626" href="#t626">626</a></span><span class="t"> <span class="key">return</span> <span class="nam">deb822_semantic_tokens_full</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t627" href="#t627">627</a></span><span class="t"> <span class="nam">ls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t628" href="#t628">628</a></span><span class="t"> <span class="nam">request</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t629" href="#t629">629</a></span><span class="t"> <span class="nam">_DCTRL_FILE_METADATA</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t630" href="#t630">630</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_debian_changelog_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_debian_control_reference_data_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_5d0ec0d5422112df_lsp_debian_control_reference_data_py.html b/coverage-report/d_5d0ec0d5422112df_lsp_debian_control_reference_data_py.html deleted file mode 100644 index 70398a4..0000000 --- a/coverage-report/d_5d0ec0d5422112df_lsp_debian_control_reference_data_py.html +++ /dev/null @@ -1,2896 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/lsp/lsp_debian_control_reference_data.py: 59%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/lsp/lsp_debian_control_reference_data.py</b>: - <span class="pc_cov">59%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">335 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">212<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">123<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">6<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">13<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_debian_control_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_debian_copyright_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">dataclasses</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">functools</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">itertools</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">import</span> <span class="nam">re</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">import</span> <span class="nam">sys</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">import</span> <span class="nam">textwrap</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">from</span> <span class="nam">abc</span> <span class="key">import</span> <span class="nam">ABC</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="key">from</span> <span class="nam">enum</span> <span class="key">import</span> <span class="nam">Enum</span><span class="op">,</span> <span class="nam">auto</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">FrozenSet</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">cast</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">Mapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">Iterable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">List</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">Generic</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">TypeVar</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">Callable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"><span class="key">from</span> <span class="nam">debian</span><span class="op">.</span><span class="nam">debian_support</span> <span class="key">import</span> <span class="nam">DpkgArchTable</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"><span class="key">from</span> <span class="nam">lsprotocol</span><span class="op">.</span><span class="nam">types</span> <span class="key">import</span> <span class="nam">DiagnosticSeverity</span><span class="op">,</span> <span class="nam">Diagnostic</span><span class="op">,</span> <span class="nam">DiagnosticTag</span><span class="op">,</span> <span class="nam">Range</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">quickfixes</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="nam">propose_correct_text_quick_fix</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="nam">propose_remove_line_quick_fix</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">text_util</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="nam">normalize_dctrl_field_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="nam">LintCapablePositionCodec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="nam">detect_possible_typo</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="nam">te_range_to_lsp</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">vendoring</span><span class="op">.</span><span class="nam">_deb822_repro</span><span class="op">.</span><span class="nam">parsing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="nam">Deb822KeyValuePairElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">LIST_SPACE_SEPARATED_INTERPRETATION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="nam">Deb822ParagraphElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="nam">Deb822FileElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">Interpretation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">LIST_COMMA_SEPARATED_INTERPRETATION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="nam">ListInterpretation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="nam">_parsed_value_render_factory</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="nam">Deb822ParsedValueElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="nam">LIST_UPLOADERS_INTERPRETATION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="nam">_parse_whitespace_list_value</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">vendoring</span><span class="op">.</span><span class="nam">_deb822_repro</span><span class="op">.</span><span class="nam">tokens</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="nam">Deb822FieldNameToken</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="nam">_value_line_tokenizer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="nam">Deb822ValueToken</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="nam">Deb822Token</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="nam">_RE_WHITESPACE_SEPARATED_WORD_LIST</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">Deb822SpaceSeparatorToken</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">PKGNAME_REGEX</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"><span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">vendoring</span><span class="op">.</span><span class="nam">_deb822_repro</span><span class="op">.</span><span class="nam">locatable</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="nam">Position</span> <span class="key">as</span> <span class="nam">TEPosition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="nam">Range</span> <span class="key">as</span> <span class="nam">TERange</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="nam">START_POSITION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"><span class="key">except</span> <span class="nam">ImportError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"><span class="nam">F</span> <span class="op">=</span> <span class="nam">TypeVar</span><span class="op">(</span><span class="str">"F"</span><span class="op">,</span> <span class="nam">bound</span><span class="op">=</span><span class="str">"Deb822KnownField"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"><span class="nam">S</span> <span class="op">=</span> <span class="nam">TypeVar</span><span class="op">(</span><span class="str">"S"</span><span class="op">,</span> <span class="nam">bound</span><span class="op">=</span><span class="str">"StanzaMetadata"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"><span class="com"># FIXME: should go into python3-debian</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"><span class="nam">_RE_COMMA</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">"([^,]*),([^,]*)"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"><span class="op">@</span><span class="nam">_value_line_tokenizer</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"><span class="key">def</span> <span class="nam">comma_or_space_split_tokenizer</span><span class="op">(</span><span class="nam">v</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="com"># type: (str) -> Iterable[Deb822Token]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="key">assert</span> <span class="str">"\n"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="key">for</span> <span class="nam">match</span> <span class="key">in</span> <span class="nam">_RE_WHITESPACE_SEPARATED_WORD_LIST</span><span class="op">.</span><span class="nam">finditer</span><span class="op">(</span><span class="nam">v</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="nam">space_before</span><span class="op">,</span> <span class="nam">word</span><span class="op">,</span> <span class="nam">space_after</span> <span class="op">=</span> <span class="nam">match</span><span class="op">.</span><span class="nam">groups</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="key">if</span> <span class="nam">space_before</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822SpaceSeparatorToken</span><span class="op">(</span><span class="nam">sys</span><span class="op">.</span><span class="nam">intern</span><span class="op">(</span><span class="nam">space_before</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="key">if</span> <span class="str">","</span> <span class="key">in</span> <span class="nam">word</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="key">for</span> <span class="nam">m</span> <span class="key">in</span> <span class="nam">_RE_COMMA</span><span class="op">.</span><span class="nam">finditer</span><span class="op">(</span><span class="nam">word</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="nam">word_before</span><span class="op">,</span> <span class="nam">word_after</span> <span class="op">=</span> <span class="nam">m</span><span class="op">.</span><span class="nam">groups</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="key">if</span> <span class="nam">word_before</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822ValueToken</span><span class="op">(</span><span class="nam">word_before</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="com"># ... not quite a whitespace, but it is too much pain to make it a non-whitespace token.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822SpaceSeparatorToken</span><span class="op">(</span><span class="str">","</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="key">if</span> <span class="nam">word_after</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822ValueToken</span><span class="op">(</span><span class="nam">word_after</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822ValueToken</span><span class="op">(</span><span class="nam">word</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="key">if</span> <span class="nam">space_after</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822SpaceSeparatorToken</span><span class="op">(</span><span class="nam">sys</span><span class="op">.</span><span class="nam">intern</span><span class="op">(</span><span class="nam">space_after</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"><span class="com"># FIXME: should go into python3-debian</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"><span class="nam">LIST_COMMA_OR_SPACE_SEPARATED_INTERPRETATION</span> <span class="op">=</span> <span class="nam">ListInterpretation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="nam">comma_or_space_split_tokenizer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="nam">_parse_whitespace_list_value</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="nam">Deb822ParsedValueElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="nam">Deb822SpaceSeparatorToken</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="nam">Deb822SpaceSeparatorToken</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="nam">_parsed_value_render_factory</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"><span class="nam">CustomFieldCheck</span> <span class="op">=</span> <span class="nam">Callable</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="str">"F"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="nam">Deb822KeyValuePairElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="str">"TERange"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="nam">Deb822ParagraphElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="str">"TEPosition"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="str">"LintCapablePositionCodec"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"><span class="nam">ALL_SECTIONS_WITHOUT_COMPONENT</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="str">"admin"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="str">"cli-mono"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="str">"comm"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="str">"database"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="str">"debian-installer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="str">"debug"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="str">"devel"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="str">"doc"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="str">"editors"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="str">"education"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="str">"electronics"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="str">"embedded"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="str">"fonts"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="str">"games"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="str">"gnome"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="str">"gnu-r"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="str">"gnustep"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="str">"graphics"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="str">"hamradio"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="str">"haskell"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="str">"interpreters"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="str">"introspection"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="str">"java"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="str">"javascript"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="str">"kde"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="str">"kernel"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="str">"libdevel"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="str">"libs"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="str">"lisp"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="str">"localization"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="str">"mail"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="str">"math"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="str">"metapackages"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="str">"misc"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="str">"net"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="str">"news"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="str">"ocaml"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="str">"oldlibs"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="str">"otherosfs"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="str">"perl"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="str">"php"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="str">"python"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="str">"ruby"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="str">"rust"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="str">"science"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="str">"shells"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="str">"sound"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="str">"tasks"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="str">"tex"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="str">"text"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="str">"utils"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="str">"vcs"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="str">"video"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="str">"virtual"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="str">"web"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="str">"x11"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="str">"xfce"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="str">"zope"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"><span class="nam">ALL_COMPONENTS</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="str">"main"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="str">"restricted"</span><span class="op">,</span> <span class="com"># Ubuntu</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="str">"non-free"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="str">"non-free-firmware"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="str">"contrib"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"><span class="key">def</span> <span class="nam">_fields</span><span class="op">(</span><span class="op">*</span><span class="nam">fields</span><span class="op">:</span> <span class="nam">F</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">F</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="key">return</span> <span class="op">{</span><span class="nam">normalize_dctrl_field_name</span><span class="op">(</span><span class="nam">f</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">lower</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> <span class="nam">f</span> <span class="key">for</span> <span class="nam">f</span> <span class="key">in</span> <span class="nam">fields</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"><span class="key">class</span> <span class="nam">Keyword</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="nam">value</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="nam">is_obsolete</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="nam">replaced_by</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"><span class="key">def</span> <span class="nam">_allowed_values</span><span class="op">(</span><span class="op">*</span><span class="nam">values</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Keyword</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Keyword</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="nam">as_keywords</span> <span class="op">=</span> <span class="op">[</span><span class="nam">k</span> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">k</span><span class="op">,</span> <span class="nam">Keyword</span><span class="op">)</span> <span class="key">else</span> <span class="nam">Keyword</span><span class="op">(</span><span class="nam">k</span><span class="op">)</span> <span class="key">for</span> <span class="nam">k</span> <span class="key">in</span> <span class="nam">values</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="nam">as_mapping</span> <span class="op">=</span> <span class="op">{</span><span class="nam">k</span><span class="op">.</span><span class="nam">value</span><span class="op">:</span> <span class="nam">k</span> <span class="key">for</span> <span class="nam">k</span> <span class="key">in</span> <span class="nam">as_keywords</span> <span class="key">if</span> <span class="nam">k</span><span class="op">.</span><span class="nam">value</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="com"># Simple bug check</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="key">assert</span> <span class="nam">len</span><span class="op">(</span><span class="nam">as_keywords</span><span class="op">)</span> <span class="op">==</span> <span class="nam">len</span><span class="op">(</span><span class="nam">as_mapping</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="key">return</span> <span class="nam">as_mapping</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"><span class="nam">ALL_SECTIONS</span> <span class="op">=</span> <span class="nam">_allowed_values</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="op">*</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="nam">s</span> <span class="key">if</span> <span class="nam">c</span> <span class="key">is</span> <span class="key">None</span> <span class="key">else</span> <span class="str">f"{c}/{s}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="key">for</span> <span class="nam">c</span><span class="op">,</span> <span class="nam">s</span> <span class="key">in</span> <span class="nam">itertools</span><span class="op">.</span><span class="nam">product</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="nam">itertools</span><span class="op">.</span><span class="nam">chain</span><span class="op">(</span><span class="nam">cast</span><span class="op">(</span><span class="str">"Iterable[Optional[str]]"</span><span class="op">,</span> <span class="op">[</span><span class="key">None</span><span class="op">]</span><span class="op">)</span><span class="op">,</span> <span class="nam">ALL_COMPONENTS</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="nam">ALL_SECTIONS_WITHOUT_COMPONENT</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"><span class="nam">ALL_PRIORITIES</span> <span class="op">=</span> <span class="nam">_allowed_values</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="str">"required"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"><span class="str"> The package is necessary for the proper functioning of the system (read: dpkg needs it).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"><span class="str"> Applicable if dpkg *needs* this package to function and it is not a library.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"><span class="str"> No two packages that both have a priority of *standard* or higher may conflict with</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"><span class="str"> each other.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="str">"important"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"><span class="str"> The *important* packages are a bare minimum of commonly-expected and necessary tools.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"><span class="str"> Applicable if 99% of all users in the distribution needs this package and it is not a library.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"><span class="str"> No two packages that both have a priority of *standard* or higher may conflict with</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"><span class="str"> each other.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="str">"standard"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"><span class="str"> These packages provide a reasonable small but not too limited character-mode system. This is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"><span class="str"> what will be installed by default (by the debian-installer) if the user does not select anything</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"><span class="str"> else. This does not include many large applications.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"><span class="str"> Applicable if your distribution installer will install this package by default on a new system</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"><span class="str"> and it is not a library.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"><span class="str"> No two packages that both have a priority of *standard* or higher may conflict with</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"><span class="str"> each other.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="str">"optional"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="str">"This is the default priority and used by the majority of all packages"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="str">" in the Debian archive"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="str">"extra"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="nam">is_obsolete</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="nam">replaced_by</span><span class="op">=</span><span class="str">"optional"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="str">"Obsolete alias of `optional`."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"><span class="key">def</span> <span class="nam">all_architectures_and_wildcards</span><span class="op">(</span><span class="nam">arch2table</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Keyword</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="nam">wildcards</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="str">"any"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"><span class="str"> The package is an architecture dependent package and need to be compiled for each and every</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"><span class="str"> architecture it.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"><span class="str"> The name `any` refers to the fact that this is an architecture *wildcard* matching</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"><span class="str"> *any machine architecture* supported by dpkg.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="str">"all"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"><span class="str"> The package is an architecture independent package. This is typically fitting for packages containing</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"><span class="str"> only scripts, data or documentation.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"><span class="str"> This name `all` refers to the fact that the package can be used for *all* architectures at the same.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"><span class="str"> Though note that it is still subject to the rules of the `Multi-Arch` field.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="key">for</span> <span class="nam">arch_name</span><span class="op">,</span> <span class="nam">quad_tuple</span> <span class="key">in</span> <span class="nam">arch2table</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="key">yield</span> <span class="nam">arch_name</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="nam">cpu_wc</span> <span class="op">=</span> <span class="str">"any-"</span> <span class="op">+</span> <span class="nam">quad_tuple</span><span class="op">.</span><span class="nam">cpu_name</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="nam">os_wc</span> <span class="op">=</span> <span class="nam">quad_tuple</span><span class="op">.</span><span class="nam">os_name</span> <span class="op">+</span> <span class="str">"-any"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="key">if</span> <span class="nam">cpu_wc</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">wildcards</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="key">yield</span> <span class="nam">cpu_wc</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="nam">wildcards</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">cpu_wc</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="key">if</span> <span class="nam">os_wc</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">wildcards</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="key">yield</span> <span class="nam">os_wc</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="nam">wildcards</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">os_wc</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="com"># Add the remaining wildcards</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"><span class="op">@</span><span class="nam">functools</span><span class="op">.</span><span class="nam">lru_cache</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"><span class="key">def</span> <span class="nam">dpkg_arch_and_wildcards</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> <span class="nam">dpkg_arch_table</span> <span class="op">=</span> <span class="nam">DpkgArchTable</span><span class="op">.</span><span class="nam">load_arch_table</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> <span class="key">return</span> <span class="nam">frozenset</span><span class="op">(</span><span class="nam">all_architectures_and_wildcards</span><span class="op">(</span><span class="nam">dpkg_arch_table</span><span class="op">.</span><span class="nam">_arch2table</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"><span class="key">def</span> <span class="nam">_extract_first_value_and_position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> <span class="nam">kvpair</span><span class="op">:</span> <span class="nam">Deb822KeyValuePairElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> <span class="nam">stanza_pos</span><span class="op">:</span> <span class="str">"TEPosition"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">:</span> <span class="str">"LintCapablePositionCodec"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Range</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> <span class="nam">kvpair_pos</span> <span class="op">=</span> <span class="nam">kvpair</span><span class="op">.</span><span class="nam">position_in_parent</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span><span class="nam">stanza_pos</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> <span class="nam">value_element_pos</span> <span class="op">=</span> <span class="nam">kvpair</span><span class="op">.</span><span class="nam">value_element</span><span class="op">.</span><span class="nam">position_in_parent</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"> <span class="nam">kvpair_pos</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"> <span class="key">for</span> <span class="nam">value_ref</span> <span class="key">in</span> <span class="nam">kvpair</span><span class="op">.</span><span class="nam">interpret_as</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"> <span class="nam">LIST_SPACE_SEPARATED_INTERPRETATION</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"> <span class="op">)</span><span class="op">.</span><span class="nam">iter_value_references</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> <span class="nam">v</span> <span class="op">=</span> <span class="nam">value_ref</span><span class="op">.</span><span class="nam">value</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"> <span class="nam">section_value_loc</span> <span class="op">=</span> <span class="nam">value_ref</span><span class="op">.</span><span class="nam">locatable</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"> <span class="nam">value_range_te</span> <span class="op">=</span> <span class="nam">section_value_loc</span><span class="op">.</span><span class="nam">range_in_parent</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"> <span class="nam">value_element_pos</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"> <span class="nam">value_range_server_units</span> <span class="op">=</span> <span class="nam">te_range_to_lsp</span><span class="op">(</span><span class="nam">value_range_te</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"> <span class="nam">value_range</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> <span class="nam">value_range_server_units</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"> <span class="key">return</span> <span class="nam">v</span><span class="op">,</span> <span class="nam">value_range</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span><span class="op">,</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"><span class="key">def</span> <span class="nam">_dctrl_ma_field_validation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"> <span class="nam">_known_field</span><span class="op">:</span> <span class="str">"F"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"> <span class="nam">_kvpair</span><span class="op">:</span> <span class="nam">Deb822KeyValuePairElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"> <span class="nam">_field_range</span><span class="op">:</span> <span class="str">"TERange"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"> <span class="nam">stanza</span><span class="op">:</span> <span class="nam">Deb822ParagraphElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"> <span class="nam">stanza_position</span><span class="op">:</span> <span class="str">"TEPosition"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">:</span> <span class="str">"LintCapablePositionCodec"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"> <span class="nam">ma_kvpair</span> <span class="op">=</span> <span class="nam">stanza</span><span class="op">.</span><span class="nam">get_kvpair_element</span><span class="op">(</span><span class="str">"Multi-Arch"</span><span class="op">,</span> <span class="nam">use_get</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"> <span class="nam">arch</span> <span class="op">=</span> <span class="nam">stanza</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"Architecture"</span><span class="op">,</span> <span class="str">"any"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"> <span class="key">if</span> <span class="nam">arch</span> <span class="op">==</span> <span class="str">"all"</span> <span class="key">and</span> <span class="nam">ma_kvpair</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"> <span class="nam">ma_value</span><span class="op">,</span> <span class="nam">ma_value_range</span> <span class="op">=</span> <span class="nam">_extract_first_value_and_position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"> <span class="nam">ma_kvpair</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"> <span class="nam">stanza_position</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"> <span class="key">if</span> <span class="nam">ma_value</span> <span class="op">==</span> <span class="str">"same"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"> <span class="nam">ma_value_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"> <span class="str">"Multi-Arch: same is not valid for Architecture: all packages. Maybe you want foreign?"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"><span class="key">def</span> <span class="nam">_udeb_only_field_validation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t385" href="#t385">385</a></span><span class="t"> <span class="nam">known_field</span><span class="op">:</span> <span class="str">"F"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t386" href="#t386">386</a></span><span class="t"> <span class="nam">_kvpair</span><span class="op">:</span> <span class="nam">Deb822KeyValuePairElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t387" href="#t387">387</a></span><span class="t"> <span class="nam">field_range_te</span><span class="op">:</span> <span class="str">"TERange"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t388" href="#t388">388</a></span><span class="t"> <span class="nam">stanza</span><span class="op">:</span> <span class="nam">Deb822ParagraphElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t389" href="#t389">389</a></span><span class="t"> <span class="nam">_stanza_position</span><span class="op">:</span> <span class="str">"TEPosition"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t390" href="#t390">390</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">:</span> <span class="str">"LintCapablePositionCodec"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t391" href="#t391">391</a></span><span class="t"> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t392" href="#t392">392</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t393" href="#t393">393</a></span><span class="t"> <span class="nam">package_type</span> <span class="op">=</span> <span class="nam">stanza</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"Package-Type"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t394" href="#t394">394</a></span><span class="t"> <span class="key">if</span> <span class="nam">package_type</span> <span class="op">!=</span> <span class="str">"udeb"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t395" href="#t395">395</a></span><span class="t"> <span class="nam">field_range_server_units</span> <span class="op">=</span> <span class="nam">te_range_to_lsp</span><span class="op">(</span><span class="nam">field_range_te</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t396" href="#t396">396</a></span><span class="t"> <span class="nam">field_range</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t397" href="#t397">397</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t398" href="#t398">398</a></span><span class="t"> <span class="nam">field_range_server_units</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t399" href="#t399">399</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t400" href="#t400">400</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t401" href="#t401">401</a></span><span class="t"> <span class="nam">field_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t402" href="#t402">402</a></span><span class="t"> <span class="str">f"The {known_field.name} field is only applicable to udeb packages (`Package-Type: udeb`)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t403" href="#t403">403</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Warning</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t404" href="#t404">404</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t405" href="#t405">405</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t406" href="#t406">406</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t407" href="#t407">407</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t408" href="#t408">408</a></span><span class="t"><span class="key">def</span> <span class="nam">_arch_not_all_only_field_validation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t409" href="#t409">409</a></span><span class="t"> <span class="nam">known_field</span><span class="op">:</span> <span class="str">"F"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t410" href="#t410">410</a></span><span class="t"> <span class="nam">_kvpair</span><span class="op">:</span> <span class="nam">Deb822KeyValuePairElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t411" href="#t411">411</a></span><span class="t"> <span class="nam">field_range_te</span><span class="op">:</span> <span class="str">"TERange"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t412" href="#t412">412</a></span><span class="t"> <span class="nam">stanza</span><span class="op">:</span> <span class="nam">Deb822ParagraphElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t413" href="#t413">413</a></span><span class="t"> <span class="nam">_stanza_position</span><span class="op">:</span> <span class="str">"TEPosition"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t414" href="#t414">414</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">:</span> <span class="str">"LintCapablePositionCodec"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t415" href="#t415">415</a></span><span class="t"> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t416" href="#t416">416</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t417" href="#t417">417</a></span><span class="t"> <span class="nam">architecture</span> <span class="op">=</span> <span class="nam">stanza</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"Architecture"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t418" href="#t418">418</a></span><span class="t"> <span class="key">if</span> <span class="nam">architecture</span> <span class="op">==</span> <span class="str">"all"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t419" href="#t419">419</a></span><span class="t"> <span class="nam">field_range_server_units</span> <span class="op">=</span> <span class="nam">te_range_to_lsp</span><span class="op">(</span><span class="nam">field_range_te</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t420" href="#t420">420</a></span><span class="t"> <span class="nam">field_range</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t421" href="#t421">421</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t422" href="#t422">422</a></span><span class="t"> <span class="nam">field_range_server_units</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t423" href="#t423">423</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t424" href="#t424">424</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t425" href="#t425">425</a></span><span class="t"> <span class="nam">field_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t426" href="#t426">426</a></span><span class="t"> <span class="str">f"The {known_field.name} field is not applicable to arch:all packages (`Architecture: all`)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t427" href="#t427">427</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Warning</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t428" href="#t428">428</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t429" href="#t429">429</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t430" href="#t430">430</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t431" href="#t431">431</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t432" href="#t432">432</a></span><span class="t"><span class="key">def</span> <span class="nam">_each_value_match_regex_validation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t433" href="#t433">433</a></span><span class="t"> <span class="nam">regex</span><span class="op">:</span> <span class="nam">re</span><span class="op">.</span><span class="nam">Pattern</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t434" href="#t434">434</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t435" href="#t435">435</a></span><span class="t"> <span class="nam">diagnostic_severity</span><span class="op">:</span> <span class="nam">DiagnosticSeverity</span> <span class="op">=</span> <span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t436" href="#t436">436</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">CustomFieldCheck</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t437" href="#t437">437</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t438" href="#t438">438</a></span><span class="t"> <span class="key">def</span> <span class="nam">_validator</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t439" href="#t439">439</a></span><span class="t"> <span class="nam">_known_field</span><span class="op">:</span> <span class="str">"F"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t440" href="#t440">440</a></span><span class="t"> <span class="nam">kvpair</span><span class="op">:</span> <span class="nam">Deb822KeyValuePairElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t441" href="#t441">441</a></span><span class="t"> <span class="nam">field_range_te</span><span class="op">:</span> <span class="str">"TERange"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t442" href="#t442">442</a></span><span class="t"> <span class="nam">_stanza</span><span class="op">:</span> <span class="nam">Deb822ParagraphElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t443" href="#t443">443</a></span><span class="t"> <span class="nam">_stanza_position</span><span class="op">:</span> <span class="str">"TEPosition"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t444" href="#t444">444</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">:</span> <span class="str">"LintCapablePositionCodec"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t445" href="#t445">445</a></span><span class="t"> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t446" href="#t446">446</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t447" href="#t447">447</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t448" href="#t448">448</a></span><span class="t"> <span class="nam">value_element_pos</span> <span class="op">=</span> <span class="nam">kvpair</span><span class="op">.</span><span class="nam">value_element</span><span class="op">.</span><span class="nam">position_in_parent</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t449" href="#t449">449</a></span><span class="t"> <span class="nam">field_range_te</span><span class="op">.</span><span class="nam">start_pos</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t450" href="#t450">450</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t451" href="#t451">451</a></span><span class="t"> <span class="key">for</span> <span class="nam">value_ref</span> <span class="key">in</span> <span class="nam">kvpair</span><span class="op">.</span><span class="nam">interpret_as</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t452" href="#t452">452</a></span><span class="t"> <span class="nam">LIST_SPACE_SEPARATED_INTERPRETATION</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t453" href="#t453">453</a></span><span class="t"> <span class="op">)</span><span class="op">.</span><span class="nam">iter_value_references</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t454" href="#t454">454</a></span><span class="t"> <span class="nam">v</span> <span class="op">=</span> <span class="nam">value_ref</span><span class="op">.</span><span class="nam">value</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t455" href="#t455">455</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="nam">regex</span><span class="op">.</span><span class="nam">fullmatch</span><span class="op">(</span><span class="nam">v</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t456" href="#t456">456</a></span><span class="t"> <span class="key">if</span> <span class="nam">m</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">456 ↛ 459</span><span class="annotate long">line 456 didn't jump to line 459, because the condition on line 456 was never false</span></span></p> - <p class="run"><span class="n"><a id="t457" href="#t457">457</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t458" href="#t458">458</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t459" href="#t459">459</a></span><span class="t"> <span class="nam">section_value_loc</span> <span class="op">=</span> <span class="nam">value_ref</span><span class="op">.</span><span class="nam">locatable</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t460" href="#t460">460</a></span><span class="t"> <span class="nam">value_range_te</span> <span class="op">=</span> <span class="nam">section_value_loc</span><span class="op">.</span><span class="nam">range_in_parent</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t461" href="#t461">461</a></span><span class="t"> <span class="nam">value_element_pos</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t462" href="#t462">462</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t463" href="#t463">463</a></span><span class="t"> <span class="nam">value_range_server_units</span> <span class="op">=</span> <span class="nam">te_range_to_lsp</span><span class="op">(</span><span class="nam">value_range_te</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t464" href="#t464">464</a></span><span class="t"> <span class="nam">value_range</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t465" href="#t465">465</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> <span class="nam">value_range_server_units</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t466" href="#t466">466</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t467" href="#t467">467</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t468" href="#t468">468</a></span><span class="t"> <span class="nam">value_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t469" href="#t469">469</a></span><span class="t"> <span class="str">f'The value "{v}" does not match the regex {regex.pattern}.'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t470" href="#t470">470</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">diagnostic_severity</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t471" href="#t471">471</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t472" href="#t472">472</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t473" href="#t473">473</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t474" href="#t474">474</a></span><span class="t"> <span class="key">return</span> <span class="nam">_validator</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t475" href="#t475">475</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t476" href="#t476">476</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t477" href="#t477">477</a></span><span class="t"><span class="key">def</span> <span class="nam">_combined_custom_field_check</span><span class="op">(</span><span class="op">*</span><span class="nam">checks</span><span class="op">:</span> <span class="nam">CustomFieldCheck</span><span class="op">)</span> <span class="op">-></span> <span class="nam">CustomFieldCheck</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t478" href="#t478">478</a></span><span class="t"> <span class="key">def</span> <span class="nam">_validator</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t479" href="#t479">479</a></span><span class="t"> <span class="nam">known_field</span><span class="op">:</span> <span class="str">"F"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t480" href="#t480">480</a></span><span class="t"> <span class="nam">kvpair</span><span class="op">:</span> <span class="nam">Deb822KeyValuePairElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t481" href="#t481">481</a></span><span class="t"> <span class="nam">field_range_te</span><span class="op">:</span> <span class="str">"TERange"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t482" href="#t482">482</a></span><span class="t"> <span class="nam">stanza</span><span class="op">:</span> <span class="nam">Deb822ParagraphElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t483" href="#t483">483</a></span><span class="t"> <span class="nam">stanza_position</span><span class="op">:</span> <span class="str">"TEPosition"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t484" href="#t484">484</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">:</span> <span class="str">"LintCapablePositionCodec"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t485" href="#t485">485</a></span><span class="t"> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t486" href="#t486">486</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t487" href="#t487">487</a></span><span class="t"> <span class="key">for</span> <span class="nam">check</span> <span class="key">in</span> <span class="nam">checks</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t488" href="#t488">488</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">check</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t489" href="#t489">489</a></span><span class="t"> <span class="nam">known_field</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t490" href="#t490">490</a></span><span class="t"> <span class="nam">kvpair</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t491" href="#t491">491</a></span><span class="t"> <span class="nam">field_range_te</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t492" href="#t492">492</a></span><span class="t"> <span class="nam">stanza</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t493" href="#t493">493</a></span><span class="t"> <span class="nam">stanza_position</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t494" href="#t494">494</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t495" href="#t495">495</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t496" href="#t496">496</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t497" href="#t497">497</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t498" href="#t498">498</a></span><span class="t"> <span class="key">return</span> <span class="nam">_validator</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t499" href="#t499">499</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t500" href="#t500">500</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t501" href="#t501">501</a></span><span class="t"><span class="key">class</span> <span class="nam">FieldValueClass</span><span class="op">(</span><span class="nam">Enum</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t502" href="#t502">502</a></span><span class="t"> <span class="nam">SINGLE_VALUE</span> <span class="op">=</span> <span class="nam">auto</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> <span class="nam">LIST_SPACE_SEPARATED_INTERPRETATION</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t503" href="#t503">503</a></span><span class="t"> <span class="nam">SPACE_SEPARATED_LIST</span> <span class="op">=</span> <span class="nam">auto</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> <span class="nam">LIST_SPACE_SEPARATED_INTERPRETATION</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t504" href="#t504">504</a></span><span class="t"> <span class="nam">BUILD_PROFILES_LIST</span> <span class="op">=</span> <span class="nam">auto</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> <span class="key">None</span> <span class="com"># TODO</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t505" href="#t505">505</a></span><span class="t"> <span class="nam">COMMA_SEPARATED_LIST</span> <span class="op">=</span> <span class="nam">auto</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> <span class="nam">LIST_COMMA_SEPARATED_INTERPRETATION</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t506" href="#t506">506</a></span><span class="t"> <span class="nam">COMMA_SEPARATED_EMAIL_LIST</span> <span class="op">=</span> <span class="nam">auto</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> <span class="nam">LIST_UPLOADERS_INTERPRETATION</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t507" href="#t507">507</a></span><span class="t"> <span class="nam">COMMA_OR_SPACE_SEPARATED_LIST</span> <span class="op">=</span> <span class="nam">auto</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> <span class="nam">LIST_COMMA_OR_SPACE_SEPARATED_INTERPRETATION</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t508" href="#t508">508</a></span><span class="t"> <span class="nam">FREE_TEXT_FIELD</span> <span class="op">=</span> <span class="nam">auto</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t509" href="#t509">509</a></span><span class="t"> <span class="nam">DEP5_FILE_LIST</span> <span class="op">=</span> <span class="nam">auto</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> <span class="key">None</span> <span class="com"># TODO</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t510" href="#t510">510</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t511" href="#t511">511</a></span><span class="t"> <span class="key">def</span> <span class="nam">interpreter</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Interpretation</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t512" href="#t512">512</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">value</span><span class="op">[</span><span class="num">1</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t513" href="#t513">513</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t514" href="#t514">514</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t515" href="#t515">515</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t516" href="#t516">516</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822KnownField</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t517" href="#t517">517</a></span><span class="t"> <span class="nam">name</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t518" href="#t518">518</a></span><span class="t"> <span class="nam">field_value_class</span><span class="op">:</span> <span class="nam">FieldValueClass</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t519" href="#t519">519</a></span><span class="t"> <span class="nam">warn_if_default</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t520" href="#t520">520</a></span><span class="t"> <span class="nam">replaced_by</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t521" href="#t521">521</a></span><span class="t"> <span class="nam">deprecated_with_no_replacement</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t522" href="#t522">522</a></span><span class="t"> <span class="nam">missing_field_severity</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">DiagnosticSeverity</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t523" href="#t523">523</a></span><span class="t"> <span class="nam">default_value</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t524" href="#t524">524</a></span><span class="t"> <span class="nam">known_values</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Keyword</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t525" href="#t525">525</a></span><span class="t"> <span class="nam">unknown_value_diagnostic_severity</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">DiagnosticSeverity</span><span class="op">]</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t526" href="#t526">526</a></span><span class="t"> <span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t527" href="#t527">527</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t528" href="#t528">528</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t529" href="#t529">529</a></span><span class="t"> <span class="nam">spellcheck_value</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t530" href="#t530">530</a></span><span class="t"> <span class="nam">is_stanza_name</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t531" href="#t531">531</a></span><span class="t"> <span class="nam">is_single_value_field</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t532" href="#t532">532</a></span><span class="t"> <span class="nam">custom_field_check</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">CustomFieldCheck</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t533" href="#t533">533</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t534" href="#t534">534</a></span><span class="t"> <span class="key">def</span> <span class="nam">field_diagnostics</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t535" href="#t535">535</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t536" href="#t536">536</a></span><span class="t"> <span class="nam">kvpair</span><span class="op">:</span> <span class="nam">Deb822KeyValuePairElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t537" href="#t537">537</a></span><span class="t"> <span class="nam">stanza</span><span class="op">:</span> <span class="nam">Deb822ParagraphElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t538" href="#t538">538</a></span><span class="t"> <span class="nam">stanza_position</span><span class="op">:</span> <span class="str">"TEPosition"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t539" href="#t539">539</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">:</span> <span class="str">"LintCapablePositionCodec"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t540" href="#t540">540</a></span><span class="t"> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t541" href="#t541">541</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t542" href="#t542">542</a></span><span class="t"> <span class="nam">field_name_typo_reported</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t543" href="#t543">543</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t544" href="#t544">544</a></span><span class="t"> <span class="nam">field_name_token</span> <span class="op">=</span> <span class="nam">kvpair</span><span class="op">.</span><span class="nam">field_token</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t545" href="#t545">545</a></span><span class="t"> <span class="nam">field_range_te</span> <span class="op">=</span> <span class="nam">kvpair</span><span class="op">.</span><span class="nam">range_in_parent</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span><span class="nam">stanza_position</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t546" href="#t546">546</a></span><span class="t"> <span class="nam">field_position_te</span> <span class="op">=</span> <span class="nam">field_range_te</span><span class="op">.</span><span class="nam">start_pos</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t547" href="#t547">547</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_diagnostics_for_field_name</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t548" href="#t548">548</a></span><span class="t"> <span class="nam">field_name_token</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t549" href="#t549">549</a></span><span class="t"> <span class="nam">field_position_te</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t550" href="#t550">550</a></span><span class="t"> <span class="nam">field_name_typo_reported</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t551" href="#t551">551</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t552" href="#t552">552</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t553" href="#t553">553</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t554" href="#t554">554</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">custom_field_check</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t555" href="#t555">555</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">self</span><span class="op">.</span><span class="nam">custom_field_check</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t556" href="#t556">556</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t557" href="#t557">557</a></span><span class="t"> <span class="nam">kvpair</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t558" href="#t558">558</a></span><span class="t"> <span class="nam">field_range_te</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t559" href="#t559">559</a></span><span class="t"> <span class="nam">stanza</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t560" href="#t560">560</a></span><span class="t"> <span class="nam">stanza_position</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t561" href="#t561">561</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t562" href="#t562">562</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t563" href="#t563">563</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t564" href="#t564">564</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">spellcheck_value</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t565" href="#t565">565</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_known_value_diagnostics</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t566" href="#t566">566</a></span><span class="t"> <span class="nam">kvpair</span><span class="op">,</span> <span class="nam">field_position_te</span><span class="op">,</span> <span class="nam">position_codec</span><span class="op">,</span> <span class="nam">lines</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t567" href="#t567">567</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t568" href="#t568">568</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t569" href="#t569">569</a></span><span class="t"> <span class="key">def</span> <span class="nam">_diagnostics_for_field_name</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t570" href="#t570">570</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t571" href="#t571">571</a></span><span class="t"> <span class="nam">token</span><span class="op">:</span> <span class="nam">Deb822FieldNameToken</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t572" href="#t572">572</a></span><span class="t"> <span class="nam">token_position</span><span class="op">:</span> <span class="str">"TEPosition"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t573" href="#t573">573</a></span><span class="t"> <span class="nam">typo_detected</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t574" href="#t574">574</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">:</span> <span class="str">"LintCapablePositionCodec"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t575" href="#t575">575</a></span><span class="t"> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t576" href="#t576">576</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t577" href="#t577">577</a></span><span class="t"> <span class="nam">field_name</span> <span class="op">=</span> <span class="nam">token</span><span class="op">.</span><span class="nam">text</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t578" href="#t578">578</a></span><span class="t"> <span class="com"># Defeat the case-insensitivity from python-debian</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t579" href="#t579">579</a></span><span class="t"> <span class="nam">field_name_cased</span> <span class="op">=</span> <span class="nam">str</span><span class="op">(</span><span class="nam">field_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t580" href="#t580">580</a></span><span class="t"> <span class="nam">token_range_server_units</span> <span class="op">=</span> <span class="nam">te_range_to_lsp</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t581" href="#t581">581</a></span><span class="t"> <span class="nam">TERange</span><span class="op">.</span><span class="nam">from_position_and_size</span><span class="op">(</span><span class="nam">token_position</span><span class="op">,</span> <span class="nam">token</span><span class="op">.</span><span class="nam">size</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t582" href="#t582">582</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t583" href="#t583">583</a></span><span class="t"> <span class="nam">token_range</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t584" href="#t584">584</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t585" href="#t585">585</a></span><span class="t"> <span class="nam">token_range_server_units</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t586" href="#t586">586</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t587" href="#t587">587</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">deprecated_with_no_replacement</span><span class="op">:</span> </span><span class="r"><span class="annotate short">587 ↛ 588</span><span class="annotate long">line 587 didn't jump to line 588, because the condition on line 587 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t588" href="#t588">588</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t589" href="#t589">589</a></span><span class="t"> <span class="nam">token_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t590" href="#t590">590</a></span><span class="t"> <span class="str">f"{field_name_cased} is deprecated and no longer used"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t591" href="#t591">591</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Warning</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t592" href="#t592">592</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t593" href="#t593">593</a></span><span class="t"> <span class="nam">tags</span><span class="op">=</span><span class="op">[</span><span class="nam">DiagnosticTag</span><span class="op">.</span><span class="nam">Deprecated</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t594" href="#t594">594</a></span><span class="t"> <span class="nam">data</span><span class="op">=</span><span class="nam">propose_remove_line_quick_fix</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t595" href="#t595">595</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t596" href="#t596">596</a></span><span class="t"> <span class="key">elif</span> <span class="nam">self</span><span class="op">.</span><span class="nam">replaced_by</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">596 ↛ 597</span><span class="annotate long">line 596 didn't jump to line 597, because the condition on line 596 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t597" href="#t597">597</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t598" href="#t598">598</a></span><span class="t"> <span class="nam">token_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t599" href="#t599">599</a></span><span class="t"> <span class="str">f"{field_name_cased} is a deprecated name for {self.replaced_by}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t600" href="#t600">600</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Warning</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t601" href="#t601">601</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t602" href="#t602">602</a></span><span class="t"> <span class="nam">tags</span><span class="op">=</span><span class="op">[</span><span class="nam">DiagnosticTag</span><span class="op">.</span><span class="nam">Deprecated</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t603" href="#t603">603</a></span><span class="t"> <span class="nam">data</span><span class="op">=</span><span class="nam">propose_correct_text_quick_fix</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">replaced_by</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t604" href="#t604">604</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t605" href="#t605">605</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t606" href="#t606">606</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">typo_detected</span> <span class="key">and</span> <span class="nam">field_name_cased</span> <span class="op">!=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">name</span><span class="op">:</span> </span><span class="r"><span class="annotate short">606 ↛ 607</span><span class="annotate long">line 606 didn't jump to line 607, because the condition on line 606 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t607" href="#t607">607</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t608" href="#t608">608</a></span><span class="t"> <span class="nam">token_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t609" href="#t609">609</a></span><span class="t"> <span class="str">f"Non-canonical spelling of {self.name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t610" href="#t610">610</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Information</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t611" href="#t611">611</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t612" href="#t612">612</a></span><span class="t"> <span class="nam">data</span><span class="op">=</span><span class="nam">propose_correct_text_quick_fix</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t613" href="#t613">613</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t614" href="#t614">614</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t615" href="#t615">615</a></span><span class="t"> <span class="key">def</span> <span class="nam">_known_value_diagnostics</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t616" href="#t616">616</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t617" href="#t617">617</a></span><span class="t"> <span class="nam">kvpair</span><span class="op">:</span> <span class="nam">Deb822KeyValuePairElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t618" href="#t618">618</a></span><span class="t"> <span class="nam">field_position_te</span><span class="op">:</span> <span class="str">"TEPosition"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t619" href="#t619">619</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">:</span> <span class="str">"LintCapablePositionCodec"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t620" href="#t620">620</a></span><span class="t"> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t621" href="#t621">621</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t622" href="#t622">622</a></span><span class="t"> <span class="nam">unknown_value_severity</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">unknown_value_diagnostic_severity</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t623" href="#t623">623</a></span><span class="t"> <span class="nam">allowed_values</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">known_values</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t624" href="#t624">624</a></span><span class="t"> <span class="nam">interpreter</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">field_value_class</span><span class="op">.</span><span class="nam">interpreter</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t625" href="#t625">625</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">allowed_values</span> <span class="key">or</span> <span class="nam">interpreter</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t626" href="#t626">626</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t627" href="#t627">627</a></span><span class="t"> <span class="nam">hint_text</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t628" href="#t628">628</a></span><span class="t"> <span class="nam">values</span> <span class="op">=</span> <span class="nam">kvpair</span><span class="op">.</span><span class="nam">interpret_as</span><span class="op">(</span><span class="nam">interpreter</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t629" href="#t629">629</a></span><span class="t"> <span class="nam">value_off</span> <span class="op">=</span> <span class="nam">kvpair</span><span class="op">.</span><span class="nam">value_element</span><span class="op">.</span><span class="nam">position_in_parent</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t630" href="#t630">630</a></span><span class="t"> <span class="nam">field_position_te</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t631" href="#t631">631</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t632" href="#t632">632</a></span><span class="t"> <span class="nam">first_value</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t633" href="#t633">633</a></span><span class="t"> <span class="key">for</span> <span class="nam">value_ref</span> <span class="key">in</span> <span class="nam">values</span><span class="op">.</span><span class="nam">iter_value_references</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t634" href="#t634">634</a></span><span class="t"> <span class="nam">value</span> <span class="op">=</span> <span class="nam">value_ref</span><span class="op">.</span><span class="nam">value</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t635" href="#t635">635</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"><span class="annotate short">635 ↛ 639</span><span class="annotate long">line 635 didn't jump to line 639</span></span></p> - <p class="pln"><span class="n"><a id="t636" href="#t636">636</a></span><span class="t"> <span class="key">not</span> <span class="nam">first_value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t637" href="#t637">637</a></span><span class="t"> <span class="key">and</span> <span class="nam">self</span><span class="op">.</span><span class="nam">field_value_class</span> <span class="op">==</span> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SINGLE_VALUE</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t638" href="#t638">638</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t639" href="#t639">639</a></span><span class="t"> <span class="nam">value_loc</span> <span class="op">=</span> <span class="nam">value_ref</span><span class="op">.</span><span class="nam">locatable</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t640" href="#t640">640</a></span><span class="t"> <span class="nam">value_position_te</span> <span class="op">=</span> <span class="nam">value_loc</span><span class="op">.</span><span class="nam">position_in_parent</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t641" href="#t641">641</a></span><span class="t"> <span class="nam">value_off</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t642" href="#t642">642</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t643" href="#t643">643</a></span><span class="t"> <span class="nam">value_range_in_server_units</span> <span class="op">=</span> <span class="nam">te_range_to_lsp</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t644" href="#t644">644</a></span><span class="t"> <span class="nam">TERange</span><span class="op">.</span><span class="nam">from_position_and_size</span><span class="op">(</span><span class="nam">value_position_te</span><span class="op">,</span> <span class="nam">value_loc</span><span class="op">.</span><span class="nam">size</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t645" href="#t645">645</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t646" href="#t646">646</a></span><span class="t"> <span class="nam">value_range</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t647" href="#t647">647</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t648" href="#t648">648</a></span><span class="t"> <span class="nam">value_range_in_server_units</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t649" href="#t649">649</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t650" href="#t650">650</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t651" href="#t651">651</a></span><span class="t"> <span class="nam">value_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t652" href="#t652">652</a></span><span class="t"> <span class="str">f"The field {self.name} can only have exactly one value."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t653" href="#t653">653</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t654" href="#t654">654</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t655" href="#t655">655</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t656" href="#t656">656</a></span><span class="t"> <span class="com"># TODO: Add quickfix if the value is also invalid</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t657" href="#t657">657</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t658" href="#t658">658</a></span><span class="t"> <span class="nam">first_value</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t659" href="#t659">659</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t660" href="#t660">660</a></span><span class="t"> <span class="nam">known_value</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">known_values</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">value</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t661" href="#t661">661</a></span><span class="t"> <span class="key">if</span> <span class="nam">known_value</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t662" href="#t662">662</a></span><span class="t"> <span class="nam">candidates</span> <span class="op">=</span> <span class="nam">detect_possible_typo</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t663" href="#t663">663</a></span><span class="t"> <span class="nam">value</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t664" href="#t664">664</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">known_values</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t665" href="#t665">665</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t666" href="#t666">666</a></span><span class="t"> <span class="key">if</span> <span class="nam">hint_text</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">666 ↛ 672</span><span class="annotate long">line 666 didn't jump to line 672, because the condition on line 666 was never false</span></span></p> - <p class="par run show_par"><span class="n"><a id="t667" href="#t667">667</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">known_values</span><span class="op">)</span> <span class="op"><</span> <span class="num">5</span><span class="op">:</span> </span><span class="r"><span class="annotate short">667 ↛ 668</span><span class="annotate long">line 667 didn't jump to line 668, because the condition on line 667 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t668" href="#t668">668</a></span><span class="t"> <span class="nam">values</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">sorted</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">known_values</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t669" href="#t669">669</a></span><span class="t"> <span class="nam">hint_text</span> <span class="op">=</span> <span class="str">f" Known values for this field: {values}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t670" href="#t670">670</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t671" href="#t671">671</a></span><span class="t"> <span class="nam">hint_text</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t672" href="#t672">672</a></span><span class="t"> <span class="nam">fix_data</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t673" href="#t673">673</a></span><span class="t"> <span class="nam">severity</span> <span class="op">=</span> <span class="nam">unknown_value_severity</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t674" href="#t674">674</a></span><span class="t"> <span class="nam">fix_text</span> <span class="op">=</span> <span class="nam">hint_text</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t675" href="#t675">675</a></span><span class="t"> <span class="key">if</span> <span class="nam">candidates</span><span class="op">:</span> </span><span class="r"><span class="annotate short">675 ↛ 676</span><span class="annotate long">line 675 didn't jump to line 676, because the condition on line 675 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t676" href="#t676">676</a></span><span class="t"> <span class="nam">match</span> <span class="op">=</span> <span class="nam">candidates</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t677" href="#t677">677</a></span><span class="t"> <span class="nam">fix_text</span> <span class="op">=</span> <span class="str">f' It is possible that the value is a typo of "{match}".{fix_text}'</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t678" href="#t678">678</a></span><span class="t"> <span class="nam">fix_data</span> <span class="op">=</span> <span class="op">[</span><span class="nam">propose_correct_text_quick_fix</span><span class="op">(</span><span class="nam">m</span><span class="op">)</span> <span class="key">for</span> <span class="nam">m</span> <span class="key">in</span> <span class="nam">candidates</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t679" href="#t679">679</a></span><span class="t"> <span class="key">elif</span> <span class="nam">severity</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">679 ↛ 680</span><span class="annotate long">line 679 didn't jump to line 680, because the condition on line 679 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t680" href="#t680">680</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t681" href="#t681">681</a></span><span class="t"> <span class="key">if</span> <span class="nam">severity</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">681 ↛ 682</span><span class="annotate long">line 681 didn't jump to line 682, because the condition on line 681 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t682" href="#t682">682</a></span><span class="t"> <span class="nam">severity</span> <span class="op">=</span> <span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Warning</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t683" href="#t683">683</a></span><span class="t"> <span class="nam">message</span> <span class="op">=</span> <span class="nam">fix_text</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t684" href="#t684">684</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t685" href="#t685">685</a></span><span class="t"> <span class="nam">message</span> <span class="op">=</span> <span class="str">f'The value "{value}" is not supported in {self.name}.{fix_text}'</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t686" href="#t686">686</a></span><span class="t"> <span class="key">elif</span> <span class="nam">known_value</span><span class="op">.</span><span class="nam">is_obsolete</span><span class="op">:</span> </span><span class="r"><span class="annotate short">686 ↛ 687</span><span class="annotate long">line 686 didn't jump to line 687, because the condition on line 686 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t687" href="#t687">687</a></span><span class="t"> <span class="nam">replacement</span> <span class="op">=</span> <span class="nam">known_value</span><span class="op">.</span><span class="nam">replaced_by</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t688" href="#t688">688</a></span><span class="t"> <span class="key">if</span> <span class="nam">replacement</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t689" href="#t689">689</a></span><span class="t"> <span class="nam">message</span> <span class="op">=</span> <span class="str">f'The value "{value}" has been replaced by {replacement}'</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t690" href="#t690">690</a></span><span class="t"> <span class="nam">severity</span> <span class="op">=</span> <span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Warning</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t691" href="#t691">691</a></span><span class="t"> <span class="nam">fix_data</span> <span class="op">=</span> <span class="op">[</span><span class="nam">propose_correct_text_quick_fix</span><span class="op">(</span><span class="nam">replacement</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t692" href="#t692">692</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t693" href="#t693">693</a></span><span class="t"> <span class="nam">message</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t694" href="#t694">694</a></span><span class="t"> <span class="str">f'The value "{value}" is obsolete without a single replacement'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t695" href="#t695">695</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t696" href="#t696">696</a></span><span class="t"> <span class="nam">severity</span> <span class="op">=</span> <span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Warning</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t697" href="#t697">697</a></span><span class="t"> <span class="nam">fix_data</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t698" href="#t698">698</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t699" href="#t699">699</a></span><span class="t"> <span class="com"># All good</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t700" href="#t700">700</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t701" href="#t701">701</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t702" href="#t702">702</a></span><span class="t"> <span class="nam">value_loc</span> <span class="op">=</span> <span class="nam">value_ref</span><span class="op">.</span><span class="nam">locatable</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t703" href="#t703">703</a></span><span class="t"> <span class="nam">value_position_te</span> <span class="op">=</span> <span class="nam">value_loc</span><span class="op">.</span><span class="nam">position_in_parent</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span><span class="nam">value_off</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t704" href="#t704">704</a></span><span class="t"> <span class="nam">value_range_in_server_units</span> <span class="op">=</span> <span class="nam">te_range_to_lsp</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t705" href="#t705">705</a></span><span class="t"> <span class="nam">TERange</span><span class="op">.</span><span class="nam">from_position_and_size</span><span class="op">(</span><span class="nam">value_position_te</span><span class="op">,</span> <span class="nam">value_loc</span><span class="op">.</span><span class="nam">size</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t706" href="#t706">706</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t707" href="#t707">707</a></span><span class="t"> <span class="nam">value_range</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t708" href="#t708">708</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t709" href="#t709">709</a></span><span class="t"> <span class="nam">value_range_in_server_units</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t710" href="#t710">710</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t711" href="#t711">711</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t712" href="#t712">712</a></span><span class="t"> <span class="nam">value_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t713" href="#t713">713</a></span><span class="t"> <span class="nam">message</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t714" href="#t714">714</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">severity</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t715" href="#t715">715</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t716" href="#t716">716</a></span><span class="t"> <span class="nam">data</span><span class="op">=</span><span class="nam">fix_data</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t717" href="#t717">717</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t718" href="#t718">718</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t719" href="#t719">719</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t720" href="#t720">720</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t721" href="#t721">721</a></span><span class="t"><span class="key">class</span> <span class="nam">DctrlKnownField</span><span class="op">(</span><span class="nam">Deb822KnownField</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t722" href="#t722">722</a></span><span class="t"> <span class="nam">inherits_from_source</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t723" href="#t723">723</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t724" href="#t724">724</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t725" href="#t725">725</a></span><span class="t"><span class="nam">SOURCE_FIELDS</span> <span class="op">=</span> <span class="nam">_fields</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t726" href="#t726">726</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t727" href="#t727">727</a></span><span class="t"> <span class="str">"Source"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t728" href="#t728">728</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SINGLE_VALUE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t729" href="#t729">729</a></span><span class="t"> <span class="nam">custom_field_check</span><span class="op">=</span><span class="nam">_each_value_match_regex_validation</span><span class="op">(</span><span class="nam">PKGNAME_REGEX</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t730" href="#t730">730</a></span><span class="t"> <span class="nam">missing_field_severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t731" href="#t731">731</a></span><span class="t"> <span class="nam">is_stanza_name</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t732" href="#t732">732</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t733" href="#t733">733</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t734" href="#t734">734</a></span><span class="t"><span class="str"> Declares the name of the source package.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t735" href="#t735">735</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t736" href="#t736">736</a></span><span class="t"><span class="str"> Note this must match the name in the first entry of `debian/changelog` file.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t737" href="#t737">737</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t738" href="#t738">738</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t739" href="#t739">739</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t740" href="#t740">740</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t741" href="#t741">741</a></span><span class="t"> <span class="str">"Standards-Version"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t742" href="#t742">742</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SINGLE_VALUE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t743" href="#t743">743</a></span><span class="t"> <span class="nam">missing_field_severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t744" href="#t744">744</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t745" href="#t745">745</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t746" href="#t746">746</a></span><span class="t"><span class="str"> Declares the last semantic version of the Debian Policy this package as last checked against.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t747" href="#t747">747</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t748" href="#t748">748</a></span><span class="t"><span class="str"> **Example**:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t749" href="#t749">749</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t750" href="#t750">750</a></span><span class="t"><span class="str"> Standards-Version: 4.5.2</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t751" href="#t751">751</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t752" href="#t752">752</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t753" href="#t753">753</a></span><span class="t"><span class="str"> Note that the last version part of the full Policy version (the **.X** in 4.5.2**.X**) is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t754" href="#t754">754</a></span><span class="t"><span class="str"> typically omitted as it is used solely for editorial changes to the policy (e.g. typo fixes).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t755" href="#t755">755</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t756" href="#t756">756</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t757" href="#t757">757</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t758" href="#t758">758</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t759" href="#t759">759</a></span><span class="t"> <span class="str">"Section"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t760" href="#t760">760</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SINGLE_VALUE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t761" href="#t761">761</a></span><span class="t"> <span class="nam">known_values</span><span class="op">=</span><span class="nam">ALL_SECTIONS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t762" href="#t762">762</a></span><span class="t"> <span class="nam">unknown_value_diagnostic_severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Warning</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t763" href="#t763">763</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t764" href="#t764">764</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t765" href="#t765">765</a></span><span class="t"><span class="str"> Define the default section for packages in this source package.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t766" href="#t766">766</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t767" href="#t767">767</a></span><span class="t"><span class="str"> **Example**:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t768" href="#t768">768</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t769" href="#t769">769</a></span><span class="t"><span class="str"> Section: devel</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t770" href="#t770">770</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t771" href="#t771">771</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t772" href="#t772">772</a></span><span class="t"><span class="str"> Please see <https://packages.debian.org/unstable> for more details about the sections.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t773" href="#t773">773</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t774" href="#t774">774</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t775" href="#t775">775</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t776" href="#t776">776</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t777" href="#t777">777</a></span><span class="t"> <span class="str">"Priority"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t778" href="#t778">778</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SINGLE_VALUE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t779" href="#t779">779</a></span><span class="t"> <span class="nam">default_value</span><span class="op">=</span><span class="str">"optional"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t780" href="#t780">780</a></span><span class="t"> <span class="nam">warn_if_default</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t781" href="#t781">781</a></span><span class="t"> <span class="nam">known_values</span><span class="op">=</span><span class="nam">ALL_PRIORITIES</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t782" href="#t782">782</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t783" href="#t783">783</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t784" href="#t784">784</a></span><span class="t"><span class="str"> Define the default priority for packages in this source package.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t785" href="#t785">785</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t786" href="#t786">786</a></span><span class="t"><span class="str"> The priority field describes how important the package is for the functionality of the system.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t787" href="#t787">787</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t788" href="#t788">788</a></span><span class="t"><span class="str"> **Example**:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t789" href="#t789">789</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t790" href="#t790">790</a></span><span class="t"><span class="str"> Priority: optional</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t791" href="#t791">791</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t792" href="#t792">792</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t793" href="#t793">793</a></span><span class="t"><span class="str"> Unless you know you need a different value, you should choose **optional** for your packages.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t794" href="#t794">794</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t795" href="#t795">795</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t796" href="#t796">796</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t797" href="#t797">797</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t798" href="#t798">798</a></span><span class="t"> <span class="str">"Maintainer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t799" href="#t799">799</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SINGLE_VALUE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t800" href="#t800">800</a></span><span class="t"> <span class="nam">missing_field_severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t801" href="#t801">801</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t802" href="#t802">802</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t803" href="#t803">803</a></span><span class="t"><span class="str"> The maintainer of the package.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t804" href="#t804">804</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t805" href="#t805">805</a></span><span class="t"><span class="str"> **Example**:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t806" href="#t806">806</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t807" href="#t807">807</a></span><span class="t"><span class="str"> Maintainer: Jane Contributor <jane@janes.email-provider.org></span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t808" href="#t808">808</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t809" href="#t809">809</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t810" href="#t810">810</a></span><span class="t"><span class="str"> Note: If a person is listed in the Maintainer field, they should *not* be listed in Uploaders field.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t811" href="#t811">811</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t812" href="#t812">812</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t813" href="#t813">813</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t814" href="#t814">814</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t815" href="#t815">815</a></span><span class="t"> <span class="str">"Uploaders"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t816" href="#t816">816</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">COMMA_SEPARATED_EMAIL_LIST</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t817" href="#t817">817</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t818" href="#t818">818</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t819" href="#t819">819</a></span><span class="t"><span class="str"> Comma separated list of uploaders associated with the package.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t820" href="#t820">820</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t821" href="#t821">821</a></span><span class="t"><span class="str"> **Example**:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t822" href="#t822">822</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t823" href="#t823">823</a></span><span class="t"><span class="str"> Uploaders:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t824" href="#t824">824</a></span><span class="t"><span class="str"> John Doe <john@doe.org>,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t825" href="#t825">825</a></span><span class="t"><span class="str"> Lisbeth Worker <lis@worker.org>,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t826" href="#t826">826</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t827" href="#t827">827</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t828" href="#t828">828</a></span><span class="t"><span class="str"> Formally uploaders are considered co-maintainers for the package with the party listed in the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t829" href="#t829">829</a></span><span class="t"><span class="str"> **Maintainer** field being the primary maintainer. In practice, each maintainer or maintenance</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t830" href="#t830">830</a></span><span class="t"><span class="str"> team can have their own ruleset about the difference between the **Maintainer** and the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t831" href="#t831">831</a></span><span class="t"><span class="str"> **Uploaders**. As an example, the Python packaging team has a different rule set for how to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t832" href="#t832">832</a></span><span class="t"><span class="str"> react to a package depending on whether the packaging team is the **Maintainer** or in the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t833" href="#t833">833</a></span><span class="t"><span class="str"> **Uploaders** field.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t834" href="#t834">834</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t835" href="#t835">835</a></span><span class="t"><span class="str"> Note: If a person is listed in the Maintainer field, they should *not* be listed in Uploaders field.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t836" href="#t836">836</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t837" href="#t837">837</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t838" href="#t838">838</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t839" href="#t839">839</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t840" href="#t840">840</a></span><span class="t"> <span class="str">"Vcs-Browser"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t841" href="#t841">841</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SINGLE_VALUE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t842" href="#t842">842</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t843" href="#t843">843</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t844" href="#t844">844</a></span><span class="t"><span class="str"> URL to the Version control system repo used for the packaging. The URL should be usable with a</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t845" href="#t845">845</a></span><span class="t"><span class="str"> browser *without* requiring any login.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t846" href="#t846">846</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t847" href="#t847">847</a></span><span class="t"><span class="str"> This should be used together with one of the other **Vcs-** fields.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t848" href="#t848">848</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t849" href="#t849">849</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t850" href="#t850">850</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t851" href="#t851">851</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t852" href="#t852">852</a></span><span class="t"> <span class="str">"Vcs-Git"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t853" href="#t853">853</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SPACE_SEPARATED_LIST</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t854" href="#t854">854</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t855" href="#t855">855</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t856" href="#t856">856</a></span><span class="t"><span class="str"> URL to the git repo used for the packaging. The URL should be usable with `git clone`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t857" href="#t857">857</a></span><span class="t"><span class="str"> *without* requiring any login.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t858" href="#t858">858</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t859" href="#t859">859</a></span><span class="t"><span class="str"> This should be used together with the **Vcs-Browser** field provided there is a web UI for the repo.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t860" href="#t860">860</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t861" href="#t861">861</a></span><span class="t"><span class="str"> Note it is possible to specify a branch via the `-b` option.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t862" href="#t862">862</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t863" href="#t863">863</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t864" href="#t864">864</a></span><span class="t"><span class="str"> Vcs-Git: https://salsa.debian.org/some/packaging-repo -b debian/unstable</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t865" href="#t865">865</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t866" href="#t866">866</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t867" href="#t867">867</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t868" href="#t868">868</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t869" href="#t869">869</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t870" href="#t870">870</a></span><span class="t"> <span class="str">"Vcs-Svn"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t871" href="#t871">871</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SPACE_SEPARATED_LIST</span><span class="op">,</span> <span class="com"># TODO: Might be a single value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t872" href="#t872">872</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t873" href="#t873">873</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t874" href="#t874">874</a></span><span class="t"><span class="str"> URL to the git repo used for the packaging. The URL should be usable with `svn checkout`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t875" href="#t875">875</a></span><span class="t"><span class="str"> *without* requiring any login.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t876" href="#t876">876</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t877" href="#t877">877</a></span><span class="t"><span class="str"> This should be used together with the **Vcs-Browser** field provided there is a web UI for the repo.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t878" href="#t878">878</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t879" href="#t879">879</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t880" href="#t880">880</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t881" href="#t881">881</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t882" href="#t882">882</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t883" href="#t883">883</a></span><span class="t"> <span class="str">"Vcs-Arch"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t884" href="#t884">884</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SPACE_SEPARATED_LIST</span><span class="op">,</span> <span class="com"># TODO: Might be a single value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t885" href="#t885">885</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t886" href="#t886">886</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t887" href="#t887">887</a></span><span class="t"><span class="str"> URL to the git repo used for the packaging. The URL should be usable for getting a copy of the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t888" href="#t888">888</a></span><span class="t"><span class="str"> sources *without* requiring any login.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t889" href="#t889">889</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t890" href="#t890">890</a></span><span class="t"><span class="str"> This should be used together with the **Vcs-Browser** field provided there is a web UI for the repo.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t891" href="#t891">891</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t892" href="#t892">892</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t893" href="#t893">893</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t894" href="#t894">894</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t895" href="#t895">895</a></span><span class="t"> <span class="str">"Vcs-Cvs"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t896" href="#t896">896</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SPACE_SEPARATED_LIST</span><span class="op">,</span> <span class="com"># TODO: Might be a single value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t897" href="#t897">897</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t898" href="#t898">898</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t899" href="#t899">899</a></span><span class="t"><span class="str"> URL to the git repo used for the packaging. The URL should be usable for getting a copy of the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t900" href="#t900">900</a></span><span class="t"><span class="str"> sources *without* requiring any login.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t901" href="#t901">901</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t902" href="#t902">902</a></span><span class="t"><span class="str"> This should be used together with the **Vcs-Browser** field provided there is a web UI for the repo.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t903" href="#t903">903</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t904" href="#t904">904</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t905" href="#t905">905</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t906" href="#t906">906</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t907" href="#t907">907</a></span><span class="t"> <span class="str">"Vcs-Darcs"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t908" href="#t908">908</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SPACE_SEPARATED_LIST</span><span class="op">,</span> <span class="com"># TODO: Might be a single value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t909" href="#t909">909</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t910" href="#t910">910</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t911" href="#t911">911</a></span><span class="t"><span class="str"> URL to the git repo used for the packaging. The URL should be usable for getting a copy of the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t912" href="#t912">912</a></span><span class="t"><span class="str"> sources *without* requiring any login.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t913" href="#t913">913</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t914" href="#t914">914</a></span><span class="t"><span class="str"> This should be used together with the **Vcs-Browser** field provided there is a web UI for the repo.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t915" href="#t915">915</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t916" href="#t916">916</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t917" href="#t917">917</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t918" href="#t918">918</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t919" href="#t919">919</a></span><span class="t"> <span class="str">"Vcs-Hg"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t920" href="#t920">920</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SPACE_SEPARATED_LIST</span><span class="op">,</span> <span class="com"># TODO: Might be a single value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t921" href="#t921">921</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t922" href="#t922">922</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t923" href="#t923">923</a></span><span class="t"><span class="str"> URL to the git repo used for the packaging. The URL should be usable for getting a copy of the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t924" href="#t924">924</a></span><span class="t"><span class="str"> sources *without* requiring any login.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t925" href="#t925">925</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t926" href="#t926">926</a></span><span class="t"><span class="str"> This should be used together with the **Vcs-Browser** field provided there is a web UI for the repo.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t927" href="#t927">927</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t928" href="#t928">928</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t929" href="#t929">929</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t930" href="#t930">930</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t931" href="#t931">931</a></span><span class="t"> <span class="str">"Vcs-Mtn"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t932" href="#t932">932</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SPACE_SEPARATED_LIST</span><span class="op">,</span> <span class="com"># TODO: Might be a single value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t933" href="#t933">933</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t934" href="#t934">934</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t935" href="#t935">935</a></span><span class="t"><span class="str"> URL to the git repo used for the packaging. The URL should be usable for getting a copy of the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t936" href="#t936">936</a></span><span class="t"><span class="str"> sources *without* requiring any login.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t937" href="#t937">937</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t938" href="#t938">938</a></span><span class="t"><span class="str"> This should be used together with the **Vcs-Browser** field provided there is a web UI for the repo.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t939" href="#t939">939</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t940" href="#t940">940</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t941" href="#t941">941</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t942" href="#t942">942</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t943" href="#t943">943</a></span><span class="t"> <span class="str">"DM-Upload-Allowed"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t944" href="#t944">944</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SINGLE_VALUE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t945" href="#t945">945</a></span><span class="t"> <span class="nam">deprecated_with_no_replacement</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t946" href="#t946">946</a></span><span class="t"> <span class="nam">default_value</span><span class="op">=</span><span class="str">"no"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t947" href="#t947">947</a></span><span class="t"> <span class="nam">known_values</span><span class="op">=</span><span class="nam">_allowed_values</span><span class="op">(</span><span class="str">"yes"</span><span class="op">,</span> <span class="str">"no"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t948" href="#t948">948</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t949" href="#t949">949</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t950" href="#t950">950</a></span><span class="t"><span class="str"> Obsolete field</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t951" href="#t951">951</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t952" href="#t952">952</a></span><span class="t"><span class="str"> It was used to enabling Debian Maintainers to upload the package without requiring a Debian Developer</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t953" href="#t953">953</a></span><span class="t"><span class="str"> to sign the package. This mechanism has been replaced by a new authorization mechanism.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t954" href="#t954">954</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t955" href="#t955">955</a></span><span class="t"><span class="str"> Please see <https://lists.debian.org/debian-devel-announce/2012/09/msg00008.html> for details about the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t956" href="#t956">956</a></span><span class="t"><span class="str"> replacement.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t957" href="#t957">957</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t958" href="#t958">958</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t959" href="#t959">959</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t960" href="#t960">960</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t961" href="#t961">961</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t962" href="#t962">962</a></span><span class="t"> <span class="str">"Build-Depends"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t963" href="#t963">963</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">COMMA_SEPARATED_LIST</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t964" href="#t964">964</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t965" href="#t965">965</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t966" href="#t966">966</a></span><span class="t"><span class="str"> All minimum build-dependencies for this source package. Needed for any target including **clean**.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t967" href="#t967">967</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t968" href="#t968">968</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t969" href="#t969">969</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t970" href="#t970">970</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t971" href="#t971">971</a></span><span class="t"> <span class="str">"Build-Depends-Arch"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t972" href="#t972">972</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">COMMA_SEPARATED_LIST</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t973" href="#t973">973</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t974" href="#t974">974</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t975" href="#t975">975</a></span><span class="t"><span class="str"> Build-dependencies required for building the architecture dependent binary packages of this source</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t976" href="#t976">976</a></span><span class="t"><span class="str"> package.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t977" href="#t977">977</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t978" href="#t978">978</a></span><span class="t"><span class="str"> These build-dependencies must be satisfied when executing the **build-arch** and **binary-arch**</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t979" href="#t979">979</a></span><span class="t"><span class="str"> targets either directly or indirectly in addition to those listed in **Build-Depends**.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t980" href="#t980">980</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t981" href="#t981">981</a></span><span class="t"><span class="str"> Note that these dependencies are *not* available during **clean**.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t982" href="#t982">982</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t983" href="#t983">983</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t984" href="#t984">984</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t985" href="#t985">985</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t986" href="#t986">986</a></span><span class="t"> <span class="str">"Build-Depends-Indep"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t987" href="#t987">987</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">COMMA_SEPARATED_LIST</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t988" href="#t988">988</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t989" href="#t989">989</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t990" href="#t990">990</a></span><span class="t"><span class="str"> Build-dependencies required for building the architecture independent binary packages of this source</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t991" href="#t991">991</a></span><span class="t"><span class="str"> package.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t992" href="#t992">992</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t993" href="#t993">993</a></span><span class="t"><span class="str"> These build-dependencies must be satisfied when executing the **build-indep** and **binary-indep**</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t994" href="#t994">994</a></span><span class="t"><span class="str"> targets either directly or indirectly in addition to those listed in **Build-Depends**.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t995" href="#t995">995</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t996" href="#t996">996</a></span><span class="t"><span class="str"> Note that these dependencies are *not* available during **clean**.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t997" href="#t997">997</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t998" href="#t998">998</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t999" href="#t999">999</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1000" href="#t1000">1000</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1001" href="#t1001">1001</a></span><span class="t"> <span class="str">"Build-Conflicts"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1002" href="#t1002">1002</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">COMMA_SEPARATED_LIST</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1003" href="#t1003">1003</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1004" href="#t1004">1004</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1005" href="#t1005">1005</a></span><span class="t"><span class="str"> Packages that must **not** be installed during **any** part of the build, including the **clean**</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1006" href="#t1006">1006</a></span><span class="t"><span class="str"> target **clean**.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1007" href="#t1007">1007</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1008" href="#t1008">1008</a></span><span class="t"><span class="str"> Where possible, it is often better to configure the build so that it does not react to the package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1009" href="#t1009">1009</a></span><span class="t"><span class="str"> being present in the first place. Usually this is a question of using a `--without-foo` or</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1010" href="#t1010">1010</a></span><span class="t"><span class="str"> `--disable-foo` or such to the build configuration.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1011" href="#t1011">1011</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1012" href="#t1012">1012</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1013" href="#t1013">1013</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1014" href="#t1014">1014</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1015" href="#t1015">1015</a></span><span class="t"> <span class="str">"Build-Conflicts-Arch"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1016" href="#t1016">1016</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">COMMA_SEPARATED_LIST</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1017" href="#t1017">1017</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1018" href="#t1018">1018</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1019" href="#t1019">1019</a></span><span class="t"><span class="str"> Packages that must **not** be installed during the **build-arch** or **binary-arch** targets.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1020" href="#t1020">1020</a></span><span class="t"><span class="str"> This also applies when these targets are run implicitly such as via the **binary** target.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1021" href="#t1021">1021</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1022" href="#t1022">1022</a></span><span class="t"><span class="str"> Where possible, it is often better to configure the build so that it does not react to the package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1023" href="#t1023">1023</a></span><span class="t"><span class="str"> being present in the first place. Usually this is a question of using a `--without-foo` or</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1024" href="#t1024">1024</a></span><span class="t"><span class="str"> `--disable-foo` or such to the build configuration.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1025" href="#t1025">1025</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1026" href="#t1026">1026</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1027" href="#t1027">1027</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1028" href="#t1028">1028</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1029" href="#t1029">1029</a></span><span class="t"> <span class="str">"Build-Conflicts-Indep"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1030" href="#t1030">1030</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">COMMA_SEPARATED_LIST</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1031" href="#t1031">1031</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1032" href="#t1032">1032</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1033" href="#t1033">1033</a></span><span class="t"><span class="str"> Packages that must **not** be installed during the **build-indep** or **binary-indep** targets.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1034" href="#t1034">1034</a></span><span class="t"><span class="str"> This also applies when these targets are run implicitly such as via the **binary** target.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1035" href="#t1035">1035</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1036" href="#t1036">1036</a></span><span class="t"><span class="str"> Where possible, it is often better to configure the build so that it does not react to the package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1037" href="#t1037">1037</a></span><span class="t"><span class="str"> being present in the first place. Usually this is a question of using a `--without-foo` or</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1038" href="#t1038">1038</a></span><span class="t"><span class="str"> `--disable-foo` or such to the build configuration.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1039" href="#t1039">1039</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1040" href="#t1040">1040</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1041" href="#t1041">1041</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1042" href="#t1042">1042</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1043" href="#t1043">1043</a></span><span class="t"> <span class="str">"Testsuite"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1044" href="#t1044">1044</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SPACE_SEPARATED_LIST</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1045" href="#t1045">1045</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1046" href="#t1046">1046</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1047" href="#t1047">1047</a></span><span class="t"><span class="str"> Declares that this package provides or should run install time tests via `autopkgtest`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1048" href="#t1048">1048</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1049" href="#t1049">1049</a></span><span class="t"><span class="str"> This field can be used to request an automatically generated autopkgtests via the **autodep8** package.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1050" href="#t1050">1050</a></span><span class="t"><span class="str"> Please refer to the documentation of the **autodep8** package for which values you can put into</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1051" href="#t1051">1051</a></span><span class="t"><span class="str"> this field and what kind of testsuite the keywords will provide.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1052" href="#t1052">1052</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1053" href="#t1053">1053</a></span><span class="t"><span class="str"> Declaring this field in `debian/control` is only necessary when you want additional tests beyond</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1054" href="#t1054">1054</a></span><span class="t"><span class="str"> those in `debian/tests/control` as **dpkg** automatically records the package provided ones from</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1055" href="#t1055">1055</a></span><span class="t"><span class="str"> `debian/tests/control`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1056" href="#t1056">1056</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1057" href="#t1057">1057</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1058" href="#t1058">1058</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1059" href="#t1059">1059</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1060" href="#t1060">1060</a></span><span class="t"> <span class="str">"Homepage"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1061" href="#t1061">1061</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SINGLE_VALUE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1062" href="#t1062">1062</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1063" href="#t1063">1063</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1064" href="#t1064">1064</a></span><span class="t"><span class="str"> Link to the upstream homepage for this source package.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1065" href="#t1065">1065</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1066" href="#t1066">1066</a></span><span class="t"><span class="str"> **Example**:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1067" href="#t1067">1067</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1068" href="#t1068">1068</a></span><span class="t"><span class="str"> Homepage: https://www.janes-tools.org/frob-cleaner</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1069" href="#t1069">1069</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1070" href="#t1070">1070</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1071" href="#t1071">1071</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1072" href="#t1072">1072</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1073" href="#t1073">1073</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1074" href="#t1074">1074</a></span><span class="t"> <span class="str">"Rules-Requires-Root"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1075" href="#t1075">1075</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SPACE_SEPARATED_LIST</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1076" href="#t1076">1076</a></span><span class="t"> <span class="nam">unknown_value_diagnostic_severity</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1077" href="#t1077">1077</a></span><span class="t"> <span class="nam">known_values</span><span class="op">=</span><span class="nam">_allowed_values</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1078" href="#t1078">1078</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1079" href="#t1079">1079</a></span><span class="t"> <span class="str">"no"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1080" href="#t1080">1080</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1081" href="#t1081">1081</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1082" href="#t1082">1082</a></span><span class="t"><span class="str"> The build process will not require root or fakeroot during any step. This enables</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1083" href="#t1083">1083</a></span><span class="t"><span class="str"> dpkg-buildpackage, debhelper or/and `debputy` to perform several optimizations during the build.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1084" href="#t1084">1084</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1085" href="#t1085">1085</a></span><span class="t"><span class="str"> This is the default with dpkg-build-api at version 1 or later.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1086" href="#t1086">1086</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1087" href="#t1087">1087</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1088" href="#t1088">1088</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1089" href="#t1089">1089</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1090" href="#t1090">1090</a></span><span class="t"> <span class="str">"binary-targets"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1091" href="#t1091">1091</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1092" href="#t1092">1092</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1093" href="#t1093">1093</a></span><span class="t"><span class="str"> The build process assumes that dpkg-buildpackage will run the relevant binary</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1094" href="#t1094">1094</a></span><span class="t"><span class="str"> target with root or fakeroot. This was the historical default behaviour.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1095" href="#t1095">1095</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1096" href="#t1096">1096</a></span><span class="t"><span class="str"> This is the default with dpkg-build-api at version 0.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1097" href="#t1097">1097</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1098" href="#t1098">1098</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1099" href="#t1099">1099</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1100" href="#t1100">1100</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1101" href="#t1101">1101</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1102" href="#t1102">1102</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1103" href="#t1103">1103</a></span><span class="t"><span class="str"> Declare if and when the package build assumes it is run as root or fakeroot.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1104" href="#t1104">1104</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1105" href="#t1105">1105</a></span><span class="t"><span class="str"> Most packages do not need to run as root or fakeroot and the legacy behaviour comes with a</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1106" href="#t1106">1106</a></span><span class="t"><span class="str"> performance cost. This field can be used to explicitly declare that the legacy behaviour is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1107" href="#t1107">1107</a></span><span class="t"><span class="str"> unnecessary.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1108" href="#t1108">1108</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1109" href="#t1109">1109</a></span><span class="t"><span class="str"> **Example**:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1110" href="#t1110">1110</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1111" href="#t1111">1111</a></span><span class="t"><span class="str"> Rules-Requires-Root: no</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1112" href="#t1112">1112</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1113" href="#t1113">1113</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1114" href="#t1114">1114</a></span><span class="t"><span class="str"> Setting this field to `no` *can* cause the package to stop building if it requires root.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1115" href="#t1115">1115</a></span><span class="t"><span class="str"> Depending on the situation, it might require some trivial or some complicated changes to fix that.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1116" href="#t1116">1116</a></span><span class="t"><span class="str"> If it breaks and you cannot figure out how to fix it, then reset the field to `binary-targets`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1117" href="#t1117">1117</a></span><span class="t"><span class="str"> and move on until you have time to fix it.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1118" href="#t1118">1118</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1119" href="#t1119">1119</a></span><span class="t"><span class="str"> The default value for this field depends on the `dpkg-build-api` version. If the package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1120" href="#t1120">1120</a></span><span class="t"><span class="str"> ` Build-Depends` on `dpkg-build-api (>= 1)` or later, the default is `no`. Otherwise,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1121" href="#t1121">1121</a></span><span class="t"><span class="str"> the default is `binary-target`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1122" href="#t1122">1122</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1123" href="#t1123">1123</a></span><span class="t"><span class="str"> Note it is **not** possible to require running the package as "true root".</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1124" href="#t1124">1124</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1125" href="#t1125">1125</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1126" href="#t1126">1126</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1127" href="#t1127">1127</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1128" href="#t1128">1128</a></span><span class="t"> <span class="str">"Bugs"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1129" href="#t1129">1129</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SINGLE_VALUE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1130" href="#t1130">1130</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1131" href="#t1131">1131</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1132" href="#t1132">1132</a></span><span class="t"><span class="str"> Provide a custom bug tracker URL</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1133" href="#t1133">1133</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1134" href="#t1134">1134</a></span><span class="t"><span class="str"> This field is *not* used by packages uploaded to Debian or most derivatives as the distro tooling</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1135" href="#t1135">1135</a></span><span class="t"><span class="str"> has a default bugtracker built-in. It is primarily useful for third-party provided packages such</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1136" href="#t1136">1136</a></span><span class="t"><span class="str"> that bug reporting tooling can redirect the user to their bug tracker.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1137" href="#t1137">1137</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1138" href="#t1138">1138</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1139" href="#t1139">1139</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1140" href="#t1140">1140</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1141" href="#t1141">1141</a></span><span class="t"> <span class="str">"Origin"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1142" href="#t1142">1142</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SINGLE_VALUE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1143" href="#t1143">1143</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1144" href="#t1144">1144</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1145" href="#t1145">1145</a></span><span class="t"><span class="str"> Declare the origin of the package.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1146" href="#t1146">1146</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1147" href="#t1147">1147</a></span><span class="t"><span class="str"> This field is *not* used by packages uploaded to Debian or most derivatives as the origin would</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1148" href="#t1148">1148</a></span><span class="t"><span class="str"> be the distribution. It is primarily useful for third-party provided packages as some tools will</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1149" href="#t1149">1149</a></span><span class="t"><span class="str"> detect this field.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1150" href="#t1150">1150</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1151" href="#t1151">1151</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1152" href="#t1152">1152</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1153" href="#t1153">1153</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1154" href="#t1154">1154</a></span><span class="t"> <span class="str">"X-Python-Version"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1155" href="#t1155">1155</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">COMMA_SEPARATED_LIST</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1156" href="#t1156">1156</a></span><span class="t"> <span class="nam">replaced_by</span><span class="op">=</span><span class="str">"X-Python3-Version"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1157" href="#t1157">1157</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1158" href="#t1158">1158</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1159" href="#t1159">1159</a></span><span class="t"><span class="str"> Obsolete field for declaring the supported Python2 versions</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1160" href="#t1160">1160</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1161" href="#t1161">1161</a></span><span class="t"><span class="str"> Since Python2 is no longer supported, this field is now redundant. For Python3, the field is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1162" href="#t1162">1162</a></span><span class="t"><span class="str"> called **X-Python3-Version**.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1163" href="#t1163">1163</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1164" href="#t1164">1164</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1165" href="#t1165">1165</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1166" href="#t1166">1166</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1167" href="#t1167">1167</a></span><span class="t"> <span class="str">"X-Python3-Version"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1168" href="#t1168">1168</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">COMMA_SEPARATED_LIST</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1169" href="#t1169">1169</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1170" href="#t1170">1170</a></span><span class="t"> <span class="com"># Too lazy to provide a better description</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1171" href="#t1171">1171</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1172" href="#t1172">1172</a></span><span class="t"><span class="str"> For declaring the supported Python3 versions</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1173" href="#t1173">1173</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1174" href="#t1174">1174</a></span><span class="t"><span class="str"> This is used by the tools from `dh-python` package. Please see the documentation of that package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1175" href="#t1175">1175</a></span><span class="t"><span class="str"> for when and how to use it.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1176" href="#t1176">1176</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1177" href="#t1177">1177</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1178" href="#t1178">1178</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1179" href="#t1179">1179</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1180" href="#t1180">1180</a></span><span class="t"> <span class="str">"XS-Autobuild"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1181" href="#t1181">1181</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SINGLE_VALUE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1182" href="#t1182">1182</a></span><span class="t"> <span class="nam">known_values</span><span class="op">=</span><span class="nam">_allowed_values</span><span class="op">(</span><span class="str">"yes"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1183" href="#t1183">1183</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1184" href="#t1184">1184</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1185" href="#t1185">1185</a></span><span class="t"><span class="str"> Used for non-free packages to denote that they may be auto-build on the Debian build infrastructure</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1186" href="#t1186">1186</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1187" href="#t1187">1187</a></span><span class="t"><span class="str"> Note that adding this field **must** be combined with following the instructions at</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1188" href="#t1188">1188</a></span><span class="t"><span class="str"> <https://www.debian.org/doc/manuals/developers-reference/pkgs.html#non-free-buildd></span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1189" href="#t1189">1189</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1190" href="#t1190">1190</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1191" href="#t1191">1191</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1192" href="#t1192">1192</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1193" href="#t1193">1193</a></span><span class="t"> <span class="str">"Description"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1194" href="#t1194">1194</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">FREE_TEXT_FIELD</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1195" href="#t1195">1195</a></span><span class="t"> <span class="nam">spellcheck_value</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1196" href="#t1196">1196</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1197" href="#t1197">1197</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1198" href="#t1198">1198</a></span><span class="t"><span class="str"> This field contains a human-readable description of the package. However, it is not used directly.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1199" href="#t1199">1199</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1200" href="#t1200">1200</a></span><span class="t"><span class="str"> Binary packages can reference parts of it via the `${source:Synopsis}` and the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1201" href="#t1201">1201</a></span><span class="t"><span class="str"> `${source:Extended-Description}` substvars. Without any of these substvars, the `Description` field</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1202" href="#t1202">1202</a></span><span class="t"><span class="str"> of the `Source` stanza remains unused.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1203" href="#t1203">1203</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1204" href="#t1204">1204</a></span><span class="t"><span class="str"> The first line immediately after the field is called the *Synopsis* and is a short "noun-phrase"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1205" href="#t1205">1205</a></span><span class="t"><span class="str"> intended to provide a one-line summary of a package. The lines after the **Synopsis** is known</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1206" href="#t1206">1206</a></span><span class="t"><span class="str"> as the **Extended Description** and is intended as a longer summary of a package.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1207" href="#t1207">1207</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1208" href="#t1208">1208</a></span><span class="t"><span class="str"> **Example**:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1209" href="#t1209">1209</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1210" href="#t1210">1210</a></span><span class="t"><span class="str"> Description: documentation generator for Python projects</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1211" href="#t1211">1211</a></span><span class="t"><span class="str"> Sphinx is a tool for producing documentation for Python projects, using</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1212" href="#t1212">1212</a></span><span class="t"><span class="str"> reStructuredText as markup language.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1213" href="#t1213">1213</a></span><span class="t"><span class="str"> .</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1214" href="#t1214">1214</a></span><span class="t"><span class="str"> Sphinx features:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1215" href="#t1215">1215</a></span><span class="t"><span class="str"> * HTML, CHM, LaTeX output,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1216" href="#t1216">1216</a></span><span class="t"><span class="str"> * Cross-referencing source code,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1217" href="#t1217">1217</a></span><span class="t"><span class="str"> * Automatic indices,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1218" href="#t1218">1218</a></span><span class="t"><span class="str"> * Code highlighting, using Pygments,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1219" href="#t1219">1219</a></span><span class="t"><span class="str"> * Extensibility. Existing extensions:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1220" href="#t1220">1220</a></span><span class="t"><span class="str"> - automatic testing of code snippets,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1221" href="#t1221">1221</a></span><span class="t"><span class="str"> - including docstrings from Python modules.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1222" href="#t1222">1222</a></span><span class="t"><span class="str"> .</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1223" href="#t1223">1223</a></span><span class="t"><span class="str"> Build-depend on sphinx if your package uses /usr/bin/sphinx-*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1224" href="#t1224">1224</a></span><span class="t"><span class="str"> executables. Build-depend on python3-sphinx if your package uses</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1225" href="#t1225">1225</a></span><span class="t"><span class="str"> the Python API (for instance by calling python3 -m sphinx).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1226" href="#t1226">1226</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1227" href="#t1227">1227</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1228" href="#t1228">1228</a></span><span class="t"><span class="str"> The **Synopsis** is usually displayed in cases where there is limited space such as when reviewing</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1229" href="#t1229">1229</a></span><span class="t"><span class="str"> the search results from `apt search foo`. It is often a good idea to imagine that the **Synopsis**</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1230" href="#t1230">1230</a></span><span class="t"><span class="str"> part is inserted into a sentence like "The package provides {{Synopsis-goes-here}}". The</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1231" href="#t1231">1231</a></span><span class="t"><span class="str"> **Extended Description** is a standalone description that should describe what the package does and</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1232" href="#t1232">1232</a></span><span class="t"><span class="str"> how it relates to the rest of the system (in terms of, for example, which subsystem it is which part of).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1233" href="#t1233">1233</a></span><span class="t"><span class="str"> Please see <https://www.debian.org/doc/debian-policy/ch-controlfields.html#description> for more details</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1234" href="#t1234">1234</a></span><span class="t"><span class="str"> about the description field and suggestions for how to write it.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1235" href="#t1235">1235</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1236" href="#t1236">1236</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1237" href="#t1237">1237</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1238" href="#t1238">1238</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1239" href="#t1239">1239</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1240" href="#t1240">1240</a></span><span class="t"> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1241" href="#t1241">1241</a></span><span class="t"><span class="nam">BINARY_FIELDS</span> <span class="op">=</span> <span class="nam">_fields</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1242" href="#t1242">1242</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1243" href="#t1243">1243</a></span><span class="t"> <span class="str">"Package"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1244" href="#t1244">1244</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SINGLE_VALUE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1245" href="#t1245">1245</a></span><span class="t"> <span class="nam">custom_field_check</span><span class="op">=</span><span class="nam">_each_value_match_regex_validation</span><span class="op">(</span><span class="nam">PKGNAME_REGEX</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1246" href="#t1246">1246</a></span><span class="t"> <span class="nam">is_stanza_name</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1247" href="#t1247">1247</a></span><span class="t"> <span class="nam">missing_field_severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1248" href="#t1248">1248</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="str">"Declares the name of a binary package"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1249" href="#t1249">1249</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1250" href="#t1250">1250</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1251" href="#t1251">1251</a></span><span class="t"> <span class="str">"Package-Type"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1252" href="#t1252">1252</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SINGLE_VALUE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1253" href="#t1253">1253</a></span><span class="t"> <span class="nam">default_value</span><span class="op">=</span><span class="str">"deb"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1254" href="#t1254">1254</a></span><span class="t"> <span class="nam">known_values</span><span class="op">=</span><span class="nam">_allowed_values</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1255" href="#t1255">1255</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span><span class="str">"deb"</span><span class="op">,</span> <span class="nam">hover_text</span><span class="op">=</span><span class="str">"The package will be built as a regular deb."</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1256" href="#t1256">1256</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1257" href="#t1257">1257</a></span><span class="t"> <span class="str">"udeb"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1258" href="#t1258">1258</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="str">"The package will be built as a micro-deb (also known as a udeb). These are solely used by the debian-installer."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1259" href="#t1259">1259</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1260" href="#t1260">1260</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1261" href="#t1261">1261</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1262" href="#t1262">1262</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1263" href="#t1263">1263</a></span><span class="t"><span class="str"> **Special-purpose only**. *This field is a special purpose field and is rarely needed.*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1264" href="#t1264">1264</a></span><span class="t"><span class="str"> *You are recommended to omit unless you know you need it or someone told you to use it.*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1265" href="#t1265">1265</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1266" href="#t1266">1266</a></span><span class="t"><span class="str"> Determines the type of package. This field can be used to declare that a given package is a different</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1267" href="#t1267">1267</a></span><span class="t"><span class="str"> type of package than usual. The primary case where this is known to be useful is for building</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1268" href="#t1268">1268</a></span><span class="t"><span class="str"> micro-debs ("udeb") to be consumed by the debian-installer.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1269" href="#t1269">1269</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1270" href="#t1270">1270</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1271" href="#t1271">1271</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1272" href="#t1272">1272</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1273" href="#t1273">1273</a></span><span class="t"> <span class="str">"Architecture"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1274" href="#t1274">1274</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SPACE_SEPARATED_LIST</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1275" href="#t1275">1275</a></span><span class="t"> <span class="nam">missing_field_severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1276" href="#t1276">1276</a></span><span class="t"> <span class="nam">unknown_value_diagnostic_severity</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1277" href="#t1277">1277</a></span><span class="t"> <span class="nam">known_values</span><span class="op">=</span><span class="nam">_allowed_values</span><span class="op">(</span><span class="op">*</span><span class="nam">dpkg_arch_and_wildcards</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1278" href="#t1278">1278</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1279" href="#t1279">1279</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1280" href="#t1280">1280</a></span><span class="t"><span class="str"> Determines which architectures this package can be compiled for or if it is an architecture-independent</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1281" href="#t1281">1281</a></span><span class="t"><span class="str"> package. The value is a space-separated list of dpkg architecture names or wildcards.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1282" href="#t1282">1282</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1283" href="#t1283">1283</a></span><span class="t"><span class="str"> **Example**:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1284" href="#t1284">1284</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1285" href="#t1285">1285</a></span><span class="t"><span class="str"> Package: architecture-specific-package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1286" href="#t1286">1286</a></span><span class="t"><span class="str"> Architecture: any</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1287" href="#t1287">1287</a></span><span class="t"><span class="str"> # ...</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1288" href="#t1288">1288</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1289" href="#t1289">1289</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1290" href="#t1290">1290</a></span><span class="t"><span class="str"> Package: data-only-package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1291" href="#t1291">1291</a></span><span class="t"><span class="str"> Architecture: all</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1292" href="#t1292">1292</a></span><span class="t"><span class="str"> Multi-Arch: foreign</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1293" href="#t1293">1293</a></span><span class="t"><span class="str"> # ...</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1294" href="#t1294">1294</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1295" href="#t1295">1295</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1296" href="#t1296">1296</a></span><span class="t"><span class="str"> Package: linux-only-package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1297" href="#t1297">1297</a></span><span class="t"><span class="str"> Architecture: linux-any</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1298" href="#t1298">1298</a></span><span class="t"><span class="str"> # ...</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1299" href="#t1299">1299</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1300" href="#t1300">1300</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1301" href="#t1301">1301</a></span><span class="t"><span class="str"> When in doubt, stick to the values **all** (for scripts, data or documentation, etc.) or **any**</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1302" href="#t1302">1302</a></span><span class="t"><span class="str"> (for anything that can be compiled). For official Debian packages, it is often easier to attempt the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1303" href="#t1303">1303</a></span><span class="t"><span class="str"> compilation for unsupported architectures than to maintain the list of machine architectures that work.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1304" href="#t1304">1304</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1305" href="#t1305">1305</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1306" href="#t1306">1306</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1307" href="#t1307">1307</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1308" href="#t1308">1308</a></span><span class="t"> <span class="str">"Essential"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1309" href="#t1309">1309</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SINGLE_VALUE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1310" href="#t1310">1310</a></span><span class="t"> <span class="nam">default_value</span><span class="op">=</span><span class="str">"no"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1311" href="#t1311">1311</a></span><span class="t"> <span class="nam">known_values</span><span class="op">=</span><span class="nam">_allowed_values</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1312" href="#t1312">1312</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1313" href="#t1313">1313</a></span><span class="t"> <span class="str">"yes"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1314" href="#t1314">1314</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="str">"The package is essential and uninstalling it will completely and utterly break the"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1315" href="#t1315">1315</a></span><span class="t"> <span class="str">" system beyond repair."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1316" href="#t1316">1316</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1317" href="#t1317">1317</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1318" href="#t1318">1318</a></span><span class="t"> <span class="str">"no"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1319" href="#t1319">1319</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1320" href="#t1320">1320</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1321" href="#t1321">1321</a></span><span class="t"><span class="str"> The package is a regular package. This is the default and recommended.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1322" href="#t1322">1322</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1323" href="#t1323">1323</a></span><span class="t"><span class="str"> Note that declaring a package to be "Essential: no" is the same as not having the field except omitting</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1324" href="#t1324">1324</a></span><span class="t"><span class="str"> the field wastes fewer bytes on everyone's hard disk.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1325" href="#t1325">1325</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1326" href="#t1326">1326</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1327" href="#t1327">1327</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1328" href="#t1328">1328</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1329" href="#t1329">1329</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1330" href="#t1330">1330</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1331" href="#t1331">1331</a></span><span class="t"><span class="str"> **Special-purpose only**. *This field is a special purpose field and is rarely needed.*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1332" href="#t1332">1332</a></span><span class="t"><span class="str"> *You are recommended to omit unless you know you need it or someone told you to use it.*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1333" href="#t1333">1333</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1334" href="#t1334">1334</a></span><span class="t"><span class="str"> Whether the package should be considered Essential as defined by Debian Policy.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1335" href="#t1335">1335</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1336" href="#t1336">1336</a></span><span class="t"><span class="str"> Essential packages are subject to several distinct but very important rules:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1337" href="#t1337">1337</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1338" href="#t1338">1338</a></span><span class="t"><span class="str"> * Essential packages are considered essential for the system to work. The packaging system</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1339" href="#t1339">1339</a></span><span class="t"><span class="str"> (APT and dpkg) will refuse to uninstall it without some very insisting force options and warnings.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1340" href="#t1340">1340</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1341" href="#t1341">1341</a></span><span class="t"><span class="str"> * Other packages are not required to declare explicit dependencies on essential packages as a</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1342" href="#t1342">1342</a></span><span class="t"><span class="str"> side-effect of the above except as to ensure a that the given essential package is upgraded</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1343" href="#t1343">1343</a></span><span class="t"><span class="str"> to a given minimum version.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1344" href="#t1344">1344</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1345" href="#t1345">1345</a></span><span class="t"><span class="str"> * Once installed, essential packages function must at all time no matter where dpkg is in its</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1346" href="#t1346">1346</a></span><span class="t"><span class="str"> installation or upgrade process. During bootstrapping or installation, this requirement is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1347" href="#t1347">1347</a></span><span class="t"><span class="str"> relaxed.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1348" href="#t1348">1348</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1349" href="#t1349">1349</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1350" href="#t1350">1350</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1351" href="#t1351">1351</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1352" href="#t1352">1352</a></span><span class="t"> <span class="str">"XB-Important"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1353" href="#t1353">1353</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SINGLE_VALUE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1354" href="#t1354">1354</a></span><span class="t"> <span class="nam">replaced_by</span><span class="op">=</span><span class="str">"Protected"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1355" href="#t1355">1355</a></span><span class="t"> <span class="nam">default_value</span><span class="op">=</span><span class="str">"no"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1356" href="#t1356">1356</a></span><span class="t"> <span class="nam">known_values</span><span class="op">=</span><span class="nam">_allowed_values</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1357" href="#t1357">1357</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1358" href="#t1358">1358</a></span><span class="t"> <span class="str">"yes"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1359" href="#t1359">1359</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="str">"The package is protected and attempts to uninstall it will cause strong warnings to the"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1360" href="#t1360">1360</a></span><span class="t"> <span class="str">" user that they might be breaking the system."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1361" href="#t1361">1361</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1362" href="#t1362">1362</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1363" href="#t1363">1363</a></span><span class="t"> <span class="str">"no"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1364" href="#t1364">1364</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1365" href="#t1365">1365</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1366" href="#t1366">1366</a></span><span class="t"><span class="str"> The package is a regular package. This is the default and recommended.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1367" href="#t1367">1367</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1368" href="#t1368">1368</a></span><span class="t"><span class="str"> Note that declaring a package to be `XB-Important: no` is the same as not having the field</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1369" href="#t1369">1369</a></span><span class="t"><span class="str"> except omitting the field wastes fewer bytes on everyone's hard-disk.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1370" href="#t1370">1370</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1371" href="#t1371">1371</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1372" href="#t1372">1372</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1373" href="#t1373">1373</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1374" href="#t1374">1374</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1375" href="#t1375">1375</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1376" href="#t1376">1376</a></span><span class="t"> <span class="str">"Protected"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1377" href="#t1377">1377</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SINGLE_VALUE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1378" href="#t1378">1378</a></span><span class="t"> <span class="nam">default_value</span><span class="op">=</span><span class="str">"no"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1379" href="#t1379">1379</a></span><span class="t"> <span class="nam">known_values</span><span class="op">=</span><span class="nam">_allowed_values</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1380" href="#t1380">1380</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1381" href="#t1381">1381</a></span><span class="t"> <span class="str">"yes"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1382" href="#t1382">1382</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="str">"The package is protected and attempts to uninstall it will cause strong warnings to the"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1383" href="#t1383">1383</a></span><span class="t"> <span class="str">" user that they might be breaking the system."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1384" href="#t1384">1384</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1385" href="#t1385">1385</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1386" href="#t1386">1386</a></span><span class="t"> <span class="str">"no"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1387" href="#t1387">1387</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1388" href="#t1388">1388</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1389" href="#t1389">1389</a></span><span class="t"><span class="str"> The package is a regular package. This is the default and recommended.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1390" href="#t1390">1390</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1391" href="#t1391">1391</a></span><span class="t"><span class="str"> Note that declaring a package to be `Protected: no` is the same as not having the field</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1392" href="#t1392">1392</a></span><span class="t"><span class="str"> except omitting the field wastes fewer bytes on everyone's hard-disk.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1393" href="#t1393">1393</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1394" href="#t1394">1394</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1395" href="#t1395">1395</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1396" href="#t1396">1396</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1397" href="#t1397">1397</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1398" href="#t1398">1398</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1399" href="#t1399">1399</a></span><span class="t"> <span class="str">"Pre-Depends"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1400" href="#t1400">1400</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">COMMA_SEPARATED_LIST</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1401" href="#t1401">1401</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1402" href="#t1402">1402</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1403" href="#t1403">1403</a></span><span class="t"><span class="str"> **Advanced field**. *This field covers an advanced topic. If you are new to packaging, you are*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1404" href="#t1404">1404</a></span><span class="t"><span class="str"> *probably not looking for this field (except to set a **${misc:Pre-Depends}** relation. Incorrect use*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1405" href="#t1405">1405</a></span><span class="t"><span class="str"> *of this field can cause issues - among other causing issues during upgrades that users cannot work*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1406" href="#t1406">1406</a></span><span class="t"><span class="str"> *around without passing `--force-*` options to dpkg.*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1407" href="#t1407">1407</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1408" href="#t1408">1408</a></span><span class="t"><span class="str"> This field is like *Depends*, except that is also forces dpkg to complete installation of the packages</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1409" href="#t1409">1409</a></span><span class="t"><span class="str"> named before even starting the installation of the package which declares the pre-dependency.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1410" href="#t1410">1410</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1411" href="#t1411">1411</a></span><span class="t"><span class="str"> **Example**:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1412" href="#t1412">1412</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1413" href="#t1413">1413</a></span><span class="t"><span class="str"> Pre-Depends: ${misc:Pre-Depends}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1414" href="#t1414">1414</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1415" href="#t1415">1415</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1416" href="#t1416">1416</a></span><span class="t"><span class="str"> Note this is a very strong dependency and not all packages support being a pre-dependency because it</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1417" href="#t1417">1417</a></span><span class="t"><span class="str"> puts additional requirements on the package being depended on. Use of **${misc:Pre-Depends}** is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1418" href="#t1418">1418</a></span><span class="t"><span class="str"> pre-approved and recommended. Essential packages are known to support being in **Pre-Depends**.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1419" href="#t1419">1419</a></span><span class="t"><span class="str"> However, careless use of **Pre-Depends** for essential packages can still cause dependency resolvers</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1420" href="#t1420">1420</a></span><span class="t"><span class="str"> problems.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1421" href="#t1421">1421</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1422" href="#t1422">1422</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1423" href="#t1423">1423</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1424" href="#t1424">1424</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1425" href="#t1425">1425</a></span><span class="t"> <span class="str">"Depends"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1426" href="#t1426">1426</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">COMMA_SEPARATED_LIST</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1427" href="#t1427">1427</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1428" href="#t1428">1428</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1429" href="#t1429">1429</a></span><span class="t"><span class="str"> Lists the packages that must be installed, before this package is installed.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1430" href="#t1430">1430</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1431" href="#t1431">1431</a></span><span class="t"><span class="str"> **Example**:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1432" href="#t1432">1432</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1433" href="#t1433">1433</a></span><span class="t"><span class="str"> Package: foo</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1434" href="#t1434">1434</a></span><span class="t"><span class="str"> Architecture: any</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1435" href="#t1435">1435</a></span><span class="t"><span class="str"> Depends: ${misc:Depends},</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1436" href="#t1436">1436</a></span><span class="t"><span class="str"> ${shlibs:Depends},</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1437" href="#t1437">1437</a></span><span class="t"><span class="str"> libfoo1 (= ${binary:Version}),</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1438" href="#t1438">1438</a></span><span class="t"><span class="str"> foo-data (= ${source:Version}),</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1439" href="#t1439">1439</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1440" href="#t1440">1440</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1441" href="#t1441">1441</a></span><span class="t"><span class="str"> This field declares an absolute dependency. Before installing the package, **dpkg** will require</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1442" href="#t1442">1442</a></span><span class="t"><span class="str"> all dependencies to be in state `configured` first. Though, if there is a circular dependency between</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1443" href="#t1443">1443</a></span><span class="t"><span class="str"> two or more packages, **dpkg** will break that circle at an arbitrary point where necessary based on</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1444" href="#t1444">1444</a></span><span class="t"><span class="str"> built-in heuristics.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1445" href="#t1445">1445</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1446" href="#t1446">1446</a></span><span class="t"><span class="str"> This field should be used if the depended-on package is required for the depending package to provide a</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1447" href="#t1447">1447</a></span><span class="t"><span class="str"> *significant amount of functionality* or when it is used in the **postinst** or **prerm** maintainer</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1448" href="#t1448">1448</a></span><span class="t"><span class="str"> scripts.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1449" href="#t1449">1449</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1450" href="#t1450">1450</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1451" href="#t1451">1451</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1452" href="#t1452">1452</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1453" href="#t1453">1453</a></span><span class="t"> <span class="str">"Recommends"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1454" href="#t1454">1454</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">COMMA_SEPARATED_LIST</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1455" href="#t1455">1455</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1456" href="#t1456">1456</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1457" href="#t1457">1457</a></span><span class="t"><span class="str"> Lists the packages that *should* be installed when this package is installed in all but</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1458" href="#t1458">1458</a></span><span class="t"><span class="str"> *unusual installations*.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1459" href="#t1459">1459</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1460" href="#t1460">1460</a></span><span class="t"><span class="str"> **Example**:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1461" href="#t1461">1461</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1462" href="#t1462">1462</a></span><span class="t"><span class="str"> Recommends: foo-optional</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1463" href="#t1463">1463</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1464" href="#t1464">1464</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1465" href="#t1465">1465</a></span><span class="t"><span class="str"> By default, APT will attempt to install recommends unless they cannot be installed or the user</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1466" href="#t1466">1466</a></span><span class="t"><span class="str"> has configured APT skip recommends. Notably, during automated package builds for the Debian</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1467" href="#t1467">1467</a></span><span class="t"><span class="str"> archive, **Recommends** are **not** installed.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1468" href="#t1468">1468</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1469" href="#t1469">1469</a></span><span class="t"><span class="str"> As implied, the package must have some core functionality that works **without** the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1470" href="#t1470">1470</a></span><span class="t"><span class="str"> **Recommends** being satisfied as they are not guaranteed to be there. If the package cannot</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1471" href="#t1471">1471</a></span><span class="t"><span class="str"> provide any functionality without a given package, that package should be in **Depends**.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1472" href="#t1472">1472</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1473" href="#t1473">1473</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1474" href="#t1474">1474</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1475" href="#t1475">1475</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1476" href="#t1476">1476</a></span><span class="t"> <span class="str">"Suggests"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1477" href="#t1477">1477</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">COMMA_SEPARATED_LIST</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1478" href="#t1478">1478</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1479" href="#t1479">1479</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1480" href="#t1480">1480</a></span><span class="t"><span class="str"> Lists the packages that may make this package more useful but not installing them is perfectly</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1481" href="#t1481">1481</a></span><span class="t"><span class="str"> reasonable as well. Suggests can also be useful for add-ons that only make sense in particular</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1482" href="#t1482">1482</a></span><span class="t"><span class="str"> corner cases like supporting a non-standard file format.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1483" href="#t1483">1483</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1484" href="#t1484">1484</a></span><span class="t"><span class="str"> **Example**:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1485" href="#t1485">1485</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1486" href="#t1486">1486</a></span><span class="t"><span class="str"> Suggests: bar</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1487" href="#t1487">1487</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1488" href="#t1488">1488</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1489" href="#t1489">1489</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1490" href="#t1490">1490</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1491" href="#t1491">1491</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1492" href="#t1492">1492</a></span><span class="t"> <span class="str">"Enhances"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1493" href="#t1493">1493</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">COMMA_SEPARATED_LIST</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1494" href="#t1494">1494</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1495" href="#t1495">1495</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1496" href="#t1496">1496</a></span><span class="t"><span class="str"> This field is similar to Suggests but works in the opposite direction. It is used to declare that</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1497" href="#t1497">1497</a></span><span class="t"><span class="str"> this package can enhance the functionality of another package.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1498" href="#t1498">1498</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1499" href="#t1499">1499</a></span><span class="t"><span class="str"> **Example**:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1500" href="#t1500">1500</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1501" href="#t1501">1501</a></span><span class="t"><span class="str"> Package: foo</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1502" href="#t1502">1502</a></span><span class="t"><span class="str"> Provide: debputy-plugin-foo</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1503" href="#t1503">1503</a></span><span class="t"><span class="str"> Enhances: debputy</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1504" href="#t1504">1504</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1505" href="#t1505">1505</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1506" href="#t1506">1506</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1507" href="#t1507">1507</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1508" href="#t1508">1508</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1509" href="#t1509">1509</a></span><span class="t"> <span class="str">"Provides"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1510" href="#t1510">1510</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">COMMA_SEPARATED_LIST</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1511" href="#t1511">1511</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1512" href="#t1512">1512</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1513" href="#t1513">1513</a></span><span class="t"><span class="str"> Declare this package also provide one or more other packages. This means that this package can</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1514" href="#t1514">1514</a></span><span class="t"><span class="str"> substitute for the provided package in some relations.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1515" href="#t1515">1515</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1516" href="#t1516">1516</a></span><span class="t"><span class="str"> **Example**:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1517" href="#t1517">1517</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1518" href="#t1518">1518</a></span><span class="t"><span class="str"> Package: foo</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1519" href="#t1519">1519</a></span><span class="t"><span class="str"> ...</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1520" href="#t1520">1520</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1521" href="#t1521">1521</a></span><span class="t"><span class="str"> Package: foo-plus</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1522" href="#t1522">1522</a></span><span class="t"><span class="str"> Provides: foo (= ${source:Upstream-Version})</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1523" href="#t1523">1523</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1524" href="#t1524">1524</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1525" href="#t1525">1525</a></span><span class="t"><span class="str"> If the provides relation is versioned, it must use a "strictly equals" version. If it does not</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1526" href="#t1526">1526</a></span><span class="t"><span class="str"> declare a version, then it *cannot* be used to satisfy a dependency with a version restriction.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1527" href="#t1527">1527</a></span><span class="t"><span class="str"> Consider the following example:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1528" href="#t1528">1528</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1529" href="#t1529">1529</a></span><span class="t"><span class="str"> **Archive scenario**: (This is *not* a `debian/control` file, despite the resemblance)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1530" href="#t1530">1530</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1531" href="#t1531">1531</a></span><span class="t"><span class="str"> Package foo</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1532" href="#t1532">1532</a></span><span class="t"><span class="str"> Depends: bar (>= 1.0)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1533" href="#t1533">1533</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1534" href="#t1534">1534</a></span><span class="t"><span class="str"> Package: bar</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1535" href="#t1535">1535</a></span><span class="t"><span class="str"> Version: 0.9</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1536" href="#t1536">1536</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1537" href="#t1537">1537</a></span><span class="t"><span class="str"> Package: bar-plus</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1538" href="#t1538">1538</a></span><span class="t"><span class="str"> Provides: bar (= 1.0)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1539" href="#t1539">1539</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1540" href="#t1540">1540</a></span><span class="t"><span class="str"> Package: bar-clone</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1541" href="#t1541">1541</a></span><span class="t"><span class="str"> Provides: bar</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1542" href="#t1542">1542</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1543" href="#t1543">1543</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1544" href="#t1544">1544</a></span><span class="t"><span class="str"> In this archive scenario, the `bar-plus` package will satisfy the dependency of `foo` as the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1545" href="#t1545">1545</a></span><span class="t"><span class="str"> only one. The `bar` package fails because the version is only *0.9* and `bar-clone` because</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1546" href="#t1546">1546</a></span><span class="t"><span class="str"> the provides is unversioned, but the dependency clause is versioned.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1547" href="#t1547">1547</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1548" href="#t1548">1548</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1549" href="#t1549">1549</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1550" href="#t1550">1550</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1551" href="#t1551">1551</a></span><span class="t"> <span class="str">"Conflicts"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1552" href="#t1552">1552</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">COMMA_SEPARATED_LIST</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1553" href="#t1553">1553</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1554" href="#t1554">1554</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1555" href="#t1555">1555</a></span><span class="t"><span class="str"> **Warning**: *You may be looking for Breaks instead of Conflicts*.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1556" href="#t1556">1556</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1557" href="#t1557">1557</a></span><span class="t"><span class="str"> This package cannot be installed together with the packages listed in the Conflicts field. This</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1558" href="#t1558">1558</a></span><span class="t"><span class="str"> is a *bigger hammer* than **Breaks** and is used sparingly. Notably, if you want to do a versioned</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1559" href="#t1559">1559</a></span><span class="t"><span class="str"> **Conflicts** then you *almost certainly* want **Breaks** instead.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1560" href="#t1560">1560</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1561" href="#t1561">1561</a></span><span class="t"><span class="str"> **Example**:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1562" href="#t1562">1562</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1563" href="#t1563">1563</a></span><span class="t"><span class="str"> Conflicts: bar</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1564" href="#t1564">1564</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1565" href="#t1565">1565</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1566" href="#t1566">1566</a></span><span class="t"><span class="str"> Please check the description of the **Breaks** field for when you would use **Breaks** vs.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1567" href="#t1567">1567</a></span><span class="t"><span class="str"> **Conflicts**.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1568" href="#t1568">1568</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1569" href="#t1569">1569</a></span><span class="t"><span class="str"> Note if a package conflicts with itself (indirectly or via **Provides**), then it is using a</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1570" href="#t1570">1570</a></span><span class="t"><span class="str"> special rule for **Conflicts**. See section</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1571" href="#t1571">1571</a></span><span class="t"><span class="str"> 7.6.2 "[Replacing whole packages, forcing their removal]" in the Debian Policy Manual.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1572" href="#t1572">1572</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1573" href="#t1573">1573</a></span><span class="t"><span class="str"> [Replacing whole packages, forcing their removal]: https://www.debian.org/doc/debian-policy/ch-relationships.html#replacing-whole-packages-forcing-their-removal</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1574" href="#t1574">1574</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1575" href="#t1575">1575</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1576" href="#t1576">1576</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1577" href="#t1577">1577</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1578" href="#t1578">1578</a></span><span class="t"> <span class="str">"Breaks"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1579" href="#t1579">1579</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">COMMA_SEPARATED_LIST</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1580" href="#t1580">1580</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1581" href="#t1581">1581</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1582" href="#t1582">1582</a></span><span class="t"><span class="str"> This package cannot be installed together with the packages listed in the `Breaks` field.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1583" href="#t1583">1583</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1584" href="#t1584">1584</a></span><span class="t"><span class="str"> This is often use to declare versioned issues such as "This package does not work with foo if</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1585" href="#t1585">1585</a></span><span class="t"><span class="str"> it is version 1.0 or less". In comparison, `Conflicts` is generally used to declare that</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1586" href="#t1586">1586</a></span><span class="t"><span class="str"> "This package does not work at all as long as foo is installed".</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1587" href="#t1587">1587</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1588" href="#t1588">1588</a></span><span class="t"><span class="str"> **Example**:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1589" href="#t1589">1589</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1590" href="#t1590">1590</a></span><span class="t"><span class="str"> Breaks: bar (<= 1.0~)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1591" href="#t1591">1591</a></span><span class="t"><span class="str"> ````</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1592" href="#t1592">1592</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1593" href="#t1593">1593</a></span><span class="t"><span class="str"> **Breaks vs. Conflicts**:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1594" href="#t1594">1594</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1595" href="#t1595">1595</a></span><span class="t"><span class="str"> * I moved files from **foo** to **bar** in version X, what should I do?</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1596" href="#t1596">1596</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1597" href="#t1597">1597</a></span><span class="t"><span class="str"> Add `Breaks: foo (<< X~)` + `Replaces: foo (<< X~)` to **bar**</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1598" href="#t1598">1598</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1599" href="#t1599">1599</a></span><span class="t"><span class="str"> * Upgrading **bar** while **foo** is version X or less causes problems **foo** or **bar** to break.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1600" href="#t1600">1600</a></span><span class="t"><span class="str"> How do I solve this?</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1601" href="#t1601">1601</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1602" href="#t1602">1602</a></span><span class="t"><span class="str"> Add `Breaks: foo (<< X~)` to **bar**</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1603" href="#t1603">1603</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1604" href="#t1604">1604</a></span><span class="t"><span class="str"> * The **foo** and **bar** packages provide the same functionality (interface) but different</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1605" href="#t1605">1605</a></span><span class="t"><span class="str"> implementations and there can be at most one of them. What should I do?</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1606" href="#t1606">1606</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1607" href="#t1607">1607</a></span><span class="t"><span class="str"> See section 7.6.2 [Replacing whole packages, forcing their removal] in the Debian Policy Manual.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1608" href="#t1608">1608</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1609" href="#t1609">1609</a></span><span class="t"><span class="str"> * How to handle when **foo** and **bar** packages are unrelated but happen to provide the same binary?</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1610" href="#t1610">1610</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1611" href="#t1611">1611</a></span><span class="t"><span class="str"> Attempt to resolve the name conflict by renaming the clashing files in question on either (or both) sides.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1612" href="#t1612">1612</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1613" href="#t1613">1613</a></span><span class="t"><span class="str"> Note the use of *~* in version numbers in the answers are generally used to ensure this works correctly in</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1614" href="#t1614">1614</a></span><span class="t"><span class="str"> case of a backports (in the Debian archive), where the package is rebuilt with the "~bpo" suffix in its</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1615" href="#t1615">1615</a></span><span class="t"><span class="str"> version.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1616" href="#t1616">1616</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1617" href="#t1617">1617</a></span><span class="t"><span class="str"> [Replacing whole packages, forcing their removal]: https://www.debian.org/doc/debian-policy/ch-relationships.html#replacing-whole-packages-forcing-their-removal</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1618" href="#t1618">1618</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1619" href="#t1619">1619</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1620" href="#t1620">1620</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1621" href="#t1621">1621</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1622" href="#t1622">1622</a></span><span class="t"> <span class="str">"Replaces"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1623" href="#t1623">1623</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">COMMA_SEPARATED_LIST</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1624" href="#t1624">1624</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1625" href="#t1625">1625</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1626" href="#t1626">1626</a></span><span class="t"><span class="str"> This package either replaces another package or overwrites files that used to be provided by</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1627" href="#t1627">1627</a></span><span class="t"><span class="str"> another package.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1628" href="#t1628">1628</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1629" href="#t1629">1629</a></span><span class="t"><span class="str"> **Attention**: The `Replaces` field is **always** used with either `Breaks` or `Conflicts` field.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1630" href="#t1630">1630</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1631" href="#t1631">1631</a></span><span class="t"><span class="str"> **Example**:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1632" href="#t1632">1632</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1633" href="#t1633">1633</a></span><span class="t"><span class="str"> Package: foo</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1634" href="#t1634">1634</a></span><span class="t"><span class="str"> ...</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1635" href="#t1635">1635</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1636" href="#t1636">1636</a></span><span class="t"><span class="str"> # The foo package was split to move data files into foo-data in version 1.2-3</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1637" href="#t1637">1637</a></span><span class="t"><span class="str"> Package: foo-data</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1638" href="#t1638">1638</a></span><span class="t"><span class="str"> Replaces: foo (<< 1.2-3~)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1639" href="#t1639">1639</a></span><span class="t"><span class="str"> Breaks: foo (<< 1.2-3~)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1640" href="#t1640">1640</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1641" href="#t1641">1641</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1642" href="#t1642">1642</a></span><span class="t"><span class="str"> Please check the description of the `Breaks` field for when you would use `Breaks` vs. `Conflicts`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1643" href="#t1643">1643</a></span><span class="t"><span class="str"> It also covers common uses of `Replaces`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1644" href="#t1644">1644</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1645" href="#t1645">1645</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1646" href="#t1646">1646</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1647" href="#t1647">1647</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1648" href="#t1648">1648</a></span><span class="t"> <span class="str">"Build-Profiles"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1649" href="#t1649">1649</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">BUILD_PROFILES_LIST</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1650" href="#t1650">1650</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1651" href="#t1651">1651</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1652" href="#t1652">1652</a></span><span class="t"><span class="str"> **Advanced field**. *This field covers an advanced topic. If you are new to packaging, you are*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1653" href="#t1653">1653</a></span><span class="t"><span class="str"> *advised to leave it at its default until you have a working basic package or lots of time to understand*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1654" href="#t1654">1654</a></span><span class="t"><span class="str"> *this topic.*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1655" href="#t1655">1655</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1656" href="#t1656">1656</a></span><span class="t"><span class="str"> Declare that the package will only built when the given build-profiles are satisfied.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1657" href="#t1657">1657</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1658" href="#t1658">1658</a></span><span class="t"><span class="str"> This field is primarily used in combination with build profiles inside the build dependency related fields</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1659" href="#t1659">1659</a></span><span class="t"><span class="str"> to reduce the number of build dependencies required during bootstrapping of a new architecture.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1660" href="#t1660">1660</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1661" href="#t1661">1661</a></span><span class="t"><span class="str"> **Example**:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1662" href="#t1662">1662</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1663" href="#t1663">1663</a></span><span class="t"><span class="str"> Package: foo</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1664" href="#t1664">1664</a></span><span class="t"><span class="str"> ...</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1665" href="#t1665">1665</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1666" href="#t1666">1666</a></span><span class="t"><span class="str"> Package: foo-udeb</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1667" href="#t1667">1667</a></span><span class="t"><span class="str"> Package-Type: udeb</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1668" href="#t1668">1668</a></span><span class="t"><span class="str"> # Skip building foo-udeb when the build profile "noudeb" is set (e.g., via dpkg-buildpackage -Pnoudeb)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1669" href="#t1669">1669</a></span><span class="t"><span class="str"> Build-Profiles: <!noudeb></span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1670" href="#t1670">1670</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1671" href="#t1671">1671</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1672" href="#t1672">1672</a></span><span class="t"><span class="str"> Note that there is an official list of "common" build profiles with predefined purposes along with rules</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1673" href="#t1673">1673</a></span><span class="t"><span class="str"> for how and when the can be used. This list can be found at</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1674" href="#t1674">1674</a></span><span class="t"><span class="str"> <https://wiki.debian.org/BuildProfileSpec#Registered_profile_names>.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1675" href="#t1675">1675</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1676" href="#t1676">1676</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1677" href="#t1677">1677</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1678" href="#t1678">1678</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1679" href="#t1679">1679</a></span><span class="t"> <span class="str">"Section"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1680" href="#t1680">1680</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SINGLE_VALUE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1681" href="#t1681">1681</a></span><span class="t"> <span class="nam">missing_field_severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1682" href="#t1682">1682</a></span><span class="t"> <span class="nam">inherits_from_source</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1683" href="#t1683">1683</a></span><span class="t"> <span class="nam">known_values</span><span class="op">=</span><span class="nam">ALL_SECTIONS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1684" href="#t1684">1684</a></span><span class="t"> <span class="nam">unknown_value_diagnostic_severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Warning</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1685" href="#t1685">1685</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1686" href="#t1686">1686</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1687" href="#t1687">1687</a></span><span class="t"><span class="str"> Define the section for this package.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1688" href="#t1688">1688</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1689" href="#t1689">1689</a></span><span class="t"><span class="str"> **Example**:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1690" href="#t1690">1690</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1691" href="#t1691">1691</a></span><span class="t"><span class="str"> Section: devel</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1692" href="#t1692">1692</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1693" href="#t1693">1693</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1694" href="#t1694">1694</a></span><span class="t"><span class="str"> Please see <https://packages.debian.org/unstable> for more details about the sections.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1695" href="#t1695">1695</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1696" href="#t1696">1696</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1697" href="#t1697">1697</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1698" href="#t1698">1698</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1699" href="#t1699">1699</a></span><span class="t"> <span class="str">"Priority"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1700" href="#t1700">1700</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SINGLE_VALUE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1701" href="#t1701">1701</a></span><span class="t"> <span class="nam">default_value</span><span class="op">=</span><span class="str">"optional"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1702" href="#t1702">1702</a></span><span class="t"> <span class="nam">warn_if_default</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1703" href="#t1703">1703</a></span><span class="t"> <span class="nam">missing_field_severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1704" href="#t1704">1704</a></span><span class="t"> <span class="nam">inherits_from_source</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1705" href="#t1705">1705</a></span><span class="t"> <span class="nam">known_values</span><span class="op">=</span><span class="nam">ALL_PRIORITIES</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1706" href="#t1706">1706</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1707" href="#t1707">1707</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1708" href="#t1708">1708</a></span><span class="t"><span class="str"> Define the priority this package.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1709" href="#t1709">1709</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1710" href="#t1710">1710</a></span><span class="t"><span class="str"> The priority field describes how important the package is for the functionality of the system.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1711" href="#t1711">1711</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1712" href="#t1712">1712</a></span><span class="t"><span class="str"> **Example**:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1713" href="#t1713">1713</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1714" href="#t1714">1714</a></span><span class="t"><span class="str"> Priority: optional</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1715" href="#t1715">1715</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1716" href="#t1716">1716</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1717" href="#t1717">1717</a></span><span class="t"><span class="str"> Unless you know you need a different value, you should choose **optional** for your packages.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1718" href="#t1718">1718</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1719" href="#t1719">1719</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1720" href="#t1720">1720</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1721" href="#t1721">1721</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1722" href="#t1722">1722</a></span><span class="t"> <span class="str">"Multi-Arch"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1723" href="#t1723">1723</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SINGLE_VALUE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1724" href="#t1724">1724</a></span><span class="t"> <span class="com"># Explicit "no" tends to be used as "someone reviewed this and concluded no", so we do</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1725" href="#t1725">1725</a></span><span class="t"> <span class="com"># not warn about it being explicitly "no".</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1726" href="#t1726">1726</a></span><span class="t"> <span class="nam">warn_if_default</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1727" href="#t1727">1727</a></span><span class="t"> <span class="nam">default_value</span><span class="op">=</span><span class="str">"no"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1728" href="#t1728">1728</a></span><span class="t"> <span class="nam">custom_field_check</span><span class="op">=</span><span class="nam">_dctrl_ma_field_validation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1729" href="#t1729">1729</a></span><span class="t"> <span class="nam">known_values</span><span class="op">=</span><span class="nam">_allowed_values</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1730" href="#t1730">1730</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1731" href="#t1731">1731</a></span><span class="t"> <span class="str">"no"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1732" href="#t1732">1732</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1733" href="#t1733">1733</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1734" href="#t1734">1734</a></span><span class="t"><span class="str"> The default. The package can be installed for at most one architecture at the time. It can</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1735" href="#t1735">1735</a></span><span class="t"><span class="str"> *only* satisfy relations for the same architecture as itself. Note that `Architecture: all`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1736" href="#t1736">1736</a></span><span class="t"><span class="str"> packages are considered as a part of the system's "primary" architecture (see output of</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1737" href="#t1737">1737</a></span><span class="t"><span class="str"> `dpkg --print-architecture`).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1738" href="#t1738">1738</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1739" href="#t1739">1739</a></span><span class="t"><span class="str"> Note: Despite the "no", the package *can* be installed for a foreign architecture (as an example,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1740" href="#t1740">1740</a></span><span class="t"><span class="str"> you can install a 32-bit version of a package on a 64-bit system). However, packages depending</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1741" href="#t1741">1741</a></span><span class="t"><span class="str"> on it must also be installed for the foreign architecture.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1742" href="#t1742">1742</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1743" href="#t1743">1743</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1744" href="#t1744">1744</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1745" href="#t1745">1745</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1746" href="#t1746">1746</a></span><span class="t"> <span class="str">"foreign"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1747" href="#t1747">1747</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1748" href="#t1748">1748</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1749" href="#t1749">1749</a></span><span class="t"><span class="str"> The package can be installed for at most one architecture at the time. However, it can</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1750" href="#t1750">1750</a></span><span class="t"><span class="str"> satisfy relations for packages regardless of their architecture. This is often useful for packages</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1751" href="#t1751">1751</a></span><span class="t"><span class="str"> solely providing data or binaries that have "Multi-Arch neutral interfaces".</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1752" href="#t1752">1752</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1753" href="#t1753">1753</a></span><span class="t"><span class="str"> Sadly, describing a "Multi-Arch neutral interface" is hard and often only done by Multi-Arch</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1754" href="#t1754">1754</a></span><span class="t"><span class="str"> experts on a case-by-case basis. Some programs and scripts have "Multi-Arch dependent interfaces"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1755" href="#t1755">1755</a></span><span class="t"><span class="str"> and are not safe to declare as `Multi-Arch: foreign`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1756" href="#t1756">1756</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1757" href="#t1757">1757</a></span><span class="t"><span class="str"> The name "foreign" refers to the fact that the package can satisfy relations for native</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1758" href="#t1758">1758</a></span><span class="t"><span class="str"> *and foreign* architectures at the same time.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1759" href="#t1759">1759</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1760" href="#t1760">1760</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1761" href="#t1761">1761</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1762" href="#t1762">1762</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1763" href="#t1763">1763</a></span><span class="t"> <span class="str">"same"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1764" href="#t1764">1764</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1765" href="#t1765">1765</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1766" href="#t1766">1766</a></span><span class="t"><span class="str"> The same version of the package can be co-installed for multiple architecture. However,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1767" href="#t1767">1767</a></span><span class="t"><span class="str"> for this to work, the package *must* ship all files in architecture unique paths (usually</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1768" href="#t1768">1768</a></span><span class="t"><span class="str"> beneath `/usr/lib/<DEB_HOST_MULTIARCH>`) or have bit-for-bit identical content</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1769" href="#t1769">1769</a></span><span class="t"><span class="str"> in files that are in non-architecture unique paths (such as files beneath `/usr/share/doc`).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1770" href="#t1770">1770</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1771" href="#t1771">1771</a></span><span class="t"><span class="str"> The name `same` refers to the fact that the package can satisfy relations only for the `same`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1772" href="#t1772">1772</a></span><span class="t"><span class="str"> architecture as itself. However, in this case, it is co-installable with itself as noted above.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1773" href="#t1773">1773</a></span><span class="t"><span class="str"> Note: This value **cannot** be used with `Architecture: all`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1774" href="#t1774">1774</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1775" href="#t1775">1775</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1776" href="#t1776">1776</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1777" href="#t1777">1777</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1778" href="#t1778">1778</a></span><span class="t"> <span class="str">"allowed"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1779" href="#t1779">1779</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1780" href="#t1780">1780</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1781" href="#t1781">1781</a></span><span class="t"><span class="str"> **Advanced value**. The package is *not* co-installable with itself but can satisfy Multi-Arch</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1782" href="#t1782">1782</a></span><span class="t"><span class="str"> foreign and Multi-Arch same relations at the same. This is useful for implementations of</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1783" href="#t1783">1783</a></span><span class="t"><span class="str"> scripting languages (such as Perl or Python). Here the interpreter contextually need to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1784" href="#t1784">1784</a></span><span class="t"><span class="str"> satisfy some relations as `Multi-Arch: foreign` and others as `Multi-Arch: same`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1785" href="#t1785">1785</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1786" href="#t1786">1786</a></span><span class="t"><span class="str"> Typically, native extensions or plugins will need a `Multi-Arch: same`-relation as they only</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1787" href="#t1787">1787</a></span><span class="t"><span class="str"> work with the interpreter compiled for the same machine architecture as themselves whereas</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1788" href="#t1788">1788</a></span><span class="t"><span class="str"> scripts are usually less picky and can rely on the `Multi-Arch: foreign` relation. Packages</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1789" href="#t1789">1789</a></span><span class="t"><span class="str"> wanting to rely on the "Multi-Arch: foreign" interface must explicitly declare this adding a</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1790" href="#t1790">1790</a></span><span class="t"><span class="str"> `:any` suffix to the package name in the dependency relation (e.g. `Depends: python3:any`).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1791" href="#t1791">1791</a></span><span class="t"><span class="str"> However, the `:any"`suffix cannot be used unconditionally and should not be used unless you</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1792" href="#t1792">1792</a></span><span class="t"><span class="str"> know you need it.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1793" href="#t1793">1793</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1794" href="#t1794">1794</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1795" href="#t1795">1795</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1796" href="#t1796">1796</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1797" href="#t1797">1797</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1798" href="#t1798">1798</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1799" href="#t1799">1799</a></span><span class="t"><span class="str"> **Advanced field**. *This field covers an advanced topic. If you are new to packaging, you are*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1800" href="#t1800">1800</a></span><span class="t"><span class="str"> *advised to leave it at its default until you have a working basic package or lots of time to understand*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1801" href="#t1801">1801</a></span><span class="t"><span class="str"> *this topic.*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1802" href="#t1802">1802</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1803" href="#t1803">1803</a></span><span class="t"><span class="str"> This field is used to declare the Multi-Arch interface of the package.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1804" href="#t1804">1804</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1805" href="#t1805">1805</a></span><span class="t"><span class="str"> The `Multi-Arch` field is used to inform the installation system (APT and dpkg) about how it should handle</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1806" href="#t1806">1806</a></span><span class="t"><span class="str"> dependency relations involving this package and foreign architectures. This is useful for multiple purposes</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1807" href="#t1807">1807</a></span><span class="t"><span class="str"> such as cross-building without emulation and installing 32-bit packages on a 64-bit system. The latter is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1808" href="#t1808">1808</a></span><span class="t"><span class="str"> often done to use legacy apps or old games that was never ported to 64-bit machines.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1809" href="#t1809">1809</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1810" href="#t1810">1810</a></span><span class="t"><span class="str"> **Example**:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1811" href="#t1811">1811</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1812" href="#t1812">1812</a></span><span class="t"><span class="str"> Multi-Arch: foreign</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1813" href="#t1813">1813</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1814" href="#t1814">1814</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1815" href="#t1815">1815</a></span><span class="t"><span class="str"> The rules for `Multi-Arch` can be quite complicated, but in many cases the following simple rules of thumb</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1816" href="#t1816">1816</a></span><span class="t"><span class="str"> gets you a long way:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1817" href="#t1817">1817</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1818" href="#t1818">1818</a></span><span class="t"><span class="str"> * If the [Multi-Arch hinter] comes with a hint, then it almost certainly correct. You are recommended</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1819" href="#t1819">1819</a></span><span class="t"><span class="str"> to check the hint for further details (some changes can be complicated to do). Note that the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1820" href="#t1820">1820</a></span><span class="t"><span class="str"> Multi-Arch hinter is only run for official Debian packages and may not be applicable to your case.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1821" href="#t1821">1821</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1822" href="#t1822">1822</a></span><span class="t"><span class="str"> * If you have an `Architecture: all` data-only package, then it often want to be `Multi-Arch: foreign`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1823" href="#t1823">1823</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1824" href="#t1824">1824</a></span><span class="t"><span class="str"> * If you have an architecture dependent package, where everything is installed in</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1825" href="#t1825">1825</a></span><span class="t"><span class="str"> `/usr/lib/${DEB_HOST_MULTIARCH}` (plus a bit of standard documentation in `/usr/share/doc`), then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1826" href="#t1826">1826</a></span><span class="t"><span class="str"> you *probably* want `Multi-Arch: same`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1827" href="#t1827">1827</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1828" href="#t1828">1828</a></span><span class="t"><span class="str"> * If none of the above applies, then omit the field unless you know what you are doing or you are</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1829" href="#t1829">1829</a></span><span class="t"><span class="str"> receiving advice from a Multi-Arch expert.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1830" href="#t1830">1830</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1831" href="#t1831">1831</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1832" href="#t1832">1832</a></span><span class="t"><span class="str"> There are 4 possible values for the Multi-Arch field, though not all values are applicable to all packages:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1833" href="#t1833">1833</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1834" href="#t1834">1834</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1835" href="#t1835">1835</a></span><span class="t"><span class="str"> * `no` - The default. The package can be installed for at most one architecture at the time. It can</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1836" href="#t1836">1836</a></span><span class="t"><span class="str"> *only* satisfy relations for the same architecture as itself. Note that `Architecture: all` packages</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1837" href="#t1837">1837</a></span><span class="t"><span class="str"> are considered as a part of the system's "primary" architecture (see output of `dpkg --print-architecture`).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1838" href="#t1838">1838</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1839" href="#t1839">1839</a></span><span class="t"><span class="str"> Use of an explicit `no` over omitting the field is commonly done to signal that someone took the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1840" href="#t1840">1840</a></span><span class="t"><span class="str"> effort to understand the situation and concluded `no` was the right answer.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1841" href="#t1841">1841</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1842" href="#t1842">1842</a></span><span class="t"><span class="str"> Note: Despite the `no`, the package *can* be installed for a foreign architecture (e.g. you can</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1843" href="#t1843">1843</a></span><span class="t"><span class="str"> install a 32-bit version of a package on a 64-bit system). However, packages depending on it must also</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1844" href="#t1844">1844</a></span><span class="t"><span class="str"> be installed for the foreign architecture.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1845" href="#t1845">1845</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1846" href="#t1846">1846</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1847" href="#t1847">1847</a></span><span class="t"><span class="str"> * `foreign` - The package can be installed for at most one architecture at the time. However, it can</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1848" href="#t1848">1848</a></span><span class="t"><span class="str"> satisfy relations for packages regardless of their architecture. This is often useful for packages</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1849" href="#t1849">1849</a></span><span class="t"><span class="str"> solely providing data or binaries that have "Multi-Arch neutral interfaces". Sadly, describing</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1850" href="#t1850">1850</a></span><span class="t"><span class="str"> a "Multi-Arch neutral interface" is hard and often only done by Multi-Arch experts on a case-by-case</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1851" href="#t1851">1851</a></span><span class="t"><span class="str"> basis. Among other, scripts despite being the same on all architectures can still have a "non-neutral"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1852" href="#t1852">1852</a></span><span class="t"><span class="str"> "Multi-Arch" interface if their output is architecture dependent or if they dependencies force them</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1853" href="#t1853">1853</a></span><span class="t"><span class="str"> out of the `foreign` role. The dependency issue usually happens when depending indirectly on an</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1854" href="#t1854">1854</a></span><span class="t"><span class="str"> `Multi-Arch: allowed` package.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1855" href="#t1855">1855</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1856" href="#t1856">1856</a></span><span class="t"><span class="str"> Some programs are have "Multi-Arch dependent interfaces" and are not safe to declare as</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1857" href="#t1857">1857</a></span><span class="t"><span class="str"> `Multi-Arch: foreign`. The name `foreign` refers to the fact that the package can satisfy relations</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1858" href="#t1858">1858</a></span><span class="t"><span class="str"> for native *and foreign* architectures at the same time.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1859" href="#t1859">1859</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1860" href="#t1860">1860</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1861" href="#t1861">1861</a></span><span class="t"><span class="str"> * `same` - The same version of the package can be co-installed for multiple architecture. However,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1862" href="#t1862">1862</a></span><span class="t"><span class="str"> for this to work, the package **must** ship all files in architecture unique paths (usually</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1863" href="#t1863">1863</a></span><span class="t"><span class="str"> beneath `/usr/lib/${DEB_HOST_MULTIARCH}`) **or** have bit-for-bit identical content in files</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1864" href="#t1864">1864</a></span><span class="t"><span class="str"> that are in non-architecture unique paths (e.g. `/usr/share/doc`). Note that these packages</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1865" href="#t1865">1865</a></span><span class="t"><span class="str"> typically do not contain configuration files or **dpkg** `conffile`s.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1866" href="#t1866">1866</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1867" href="#t1867">1867</a></span><span class="t"><span class="str"> The name `same` refers to the fact that the package can satisfy relations only for the "same"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1868" href="#t1868">1868</a></span><span class="t"><span class="str"> architecture as itself. However, in this case, it is co-installable with itself as noted above.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1869" href="#t1869">1869</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1870" href="#t1870">1870</a></span><span class="t"><span class="str"> Note: This value **cannot** be used with `Architecture: all`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1871" href="#t1871">1871</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1872" href="#t1872">1872</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1873" href="#t1873">1873</a></span><span class="t"><span class="str"> * `allowed` - **Advanced value**. This value is for a complex use-case that most people does not</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1874" href="#t1874">1874</a></span><span class="t"><span class="str"> need. Consider it only if none of the other values seem to do the trick.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1875" href="#t1875">1875</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1876" href="#t1876">1876</a></span><span class="t"><span class="str"> The package is **NOT** co-installable with itself but can satisfy Multi-Arch foreign and Multi-Arch same</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1877" href="#t1877">1877</a></span><span class="t"><span class="str"> relations at the same. This is useful for implementations of scripting languages (e.g. Perl or Python).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1878" href="#t1878">1878</a></span><span class="t"><span class="str"> Here the interpreter contextually need to satisfy some relations as `Multi-Arch: foreign` and others as</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1879" href="#t1879">1879</a></span><span class="t"><span class="str"> `Multi-Arch: same` (or `Multi-Arch: no`).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1880" href="#t1880">1880</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1881" href="#t1881">1881</a></span><span class="t"><span class="str"> Typically, native extensions or plugins will need a `Multi-Arch: same`-relation as they only work with</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1882" href="#t1882">1882</a></span><span class="t"><span class="str"> the interpreter compiled for the same machine architecture as themselves whereas scripts are usually</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1883" href="#t1883">1883</a></span><span class="t"><span class="str"> less picky and can rely on the `Multi-Arch: foreign` relation. Packages wanting to rely on the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1884" href="#t1884">1884</a></span><span class="t"><span class="str"> `Multi-Arch: foreign` interface must explicitly declare this adding a `:any` suffix to the package name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1885" href="#t1885">1885</a></span><span class="t"><span class="str"> in the dependency relation (such as `Depends: python3:any`). However, the `:any` suffix cannot be used</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1886" href="#t1886">1886</a></span><span class="t"><span class="str"> unconditionally and should not be used unless you know you need it.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1887" href="#t1887">1887</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1888" href="#t1888">1888</a></span><span class="t"><span class="str"> Note that depending indirectly on a `Multi-Arch: allowed` package can require a `Architecture: all` +</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1889" href="#t1889">1889</a></span><span class="t"><span class="str"> `Multi-Arch: foreign` package to be converted to a `Architecture: any` package. This case is named</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1890" href="#t1890">1890</a></span><span class="t"><span class="str"> the "Multi-Arch interpreter problem", since it is commonly seen with script interpreters. However,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1891" href="#t1891">1891</a></span><span class="t"><span class="str"> despite the name, it can happen to any kind of package. The bug [Debian#984701] is an example of</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1892" href="#t1892">1892</a></span><span class="t"><span class="str"> this happen in practice.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1893" href="#t1893">1893</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1894" href="#t1894">1894</a></span><span class="t"><span class="str"> [Multi-Arch hinter]: https://wiki.debian.org/MultiArch/Hints</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1895" href="#t1895">1895</a></span><span class="t"><span class="str"> [Debian#984701]: https://bugs.debian.org/984701</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1896" href="#t1896">1896</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1897" href="#t1897">1897</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1898" href="#t1898">1898</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1899" href="#t1899">1899</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1900" href="#t1900">1900</a></span><span class="t"> <span class="str">"XB-Installer-Menu-Item"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1901" href="#t1901">1901</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SINGLE_VALUE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1902" href="#t1902">1902</a></span><span class="t"> <span class="nam">custom_field_check</span><span class="op">=</span><span class="nam">_combined_custom_field_check</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1903" href="#t1903">1903</a></span><span class="t"> <span class="nam">_udeb_only_field_validation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1904" href="#t1904">1904</a></span><span class="t"> <span class="nam">_each_value_match_regex_validation</span><span class="op">(</span><span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r"^[1-9]\d{3,4}$"</span><span class="op">)</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1905" href="#t1905">1905</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1906" href="#t1906">1906</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1907" href="#t1907">1907</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1908" href="#t1908">1908</a></span><span class="t"><span class="str"> This field is only relevant for `udeb` packages (debian-installer).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1909" href="#t1909">1909</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1910" href="#t1910">1910</a></span><span class="t"><span class="str"> The field is used to declare where in the installer menu this package's menu item should</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1911" href="#t1911">1911</a></span><span class="t"><span class="str"> be placed (assuming it has any menu item). For packages targeting the Debian archive,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1912" href="#t1912">1912</a></span><span class="t"><span class="str"> any new package should have its menu item number aligned with the debian-installer team</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1913" href="#t1913">1913</a></span><span class="t"><span class="str"> before upload.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1914" href="#t1914">1914</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1915" href="#t1915">1915</a></span><span class="t"><span class="str"> A menu item is 4-5 digits (In the range `1000 <= X <= 99999`). In rare cases, the menu</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1916" href="#t1916">1916</a></span><span class="t"><span class="str"> item can be architecture dependent. For architecture dependent menu item values, use a</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1917" href="#t1917">1917</a></span><span class="t"><span class="str"> custom substvar.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1918" href="#t1918">1918</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1919" href="#t1919">1919</a></span><span class="t"><span class="str"> See <https://d-i.debian.org/doc/internals/apa.html> for the full list of menu item ranges</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1920" href="#t1920">1920</a></span><span class="t"><span class="str"> and for how to request a number.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1921" href="#t1921">1921</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1922" href="#t1922">1922</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1923" href="#t1923">1923</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1924" href="#t1924">1924</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1925" href="#t1925">1925</a></span><span class="t"> <span class="str">"X-DH-Build-For-Type"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1926" href="#t1926">1926</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SINGLE_VALUE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1927" href="#t1927">1927</a></span><span class="t"> <span class="nam">custom_field_check</span><span class="op">=</span><span class="nam">_arch_not_all_only_field_validation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1928" href="#t1928">1928</a></span><span class="t"> <span class="nam">default_value</span><span class="op">=</span><span class="str">"host"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1929" href="#t1929">1929</a></span><span class="t"> <span class="nam">known_values</span><span class="op">=</span><span class="nam">_allowed_values</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1930" href="#t1930">1930</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1931" href="#t1931">1931</a></span><span class="t"> <span class="str">"host"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1932" href="#t1932">1932</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="str">"The package should be compiled for `DEB_HOST_TARGET` (the default)."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1933" href="#t1933">1933</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1934" href="#t1934">1934</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1935" href="#t1935">1935</a></span><span class="t"> <span class="str">"target"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1936" href="#t1936">1936</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="str">"The package should be compiled for `DEB_TARGET_ARCH`."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1937" href="#t1937">1937</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1938" href="#t1938">1938</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1939" href="#t1939">1939</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1940" href="#t1940">1940</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1941" href="#t1941">1941</a></span><span class="t"><span class="str"> **Special-purpose only**. *This field is a special purpose field and is rarely needed.*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1942" href="#t1942">1942</a></span><span class="t"><span class="str"> *You are recommended to omit unless you know you need it or someone told you to use it.*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1943" href="#t1943">1943</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1944" href="#t1944">1944</a></span><span class="t"><span class="str"> This field is used when building a cross-compiling C-compiler (or similar cases), some packages need</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1945" href="#t1945">1945</a></span><span class="t"><span class="str"> to be build for target (DEB_**TARGET**_ARCH) rather than the host (DEB_**HOST**_ARCH) architecture.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1946" href="#t1946">1946</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1947" href="#t1947">1947</a></span><span class="t"><span class="str"> **Example**:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1948" href="#t1948">1948</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1949" href="#t1949">1949</a></span><span class="t"><span class="str"> Package: gcc</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1950" href="#t1950">1950</a></span><span class="t"><span class="str"> Architecture: any</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1951" href="#t1951">1951</a></span><span class="t"><span class="str"> # ...</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1952" href="#t1952">1952</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1953" href="#t1953">1953</a></span><span class="t"><span class="str"> Package: libgcc-s1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1954" href="#t1954">1954</a></span><span class="t"><span class="str"> Architecture: any</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1955" href="#t1955">1955</a></span><span class="t"><span class="str"> # When building a cross-compiling gcc, then this library needs to be built for the target architecture</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1956" href="#t1956">1956</a></span><span class="t"><span class="str"> # as binaries compiled by gcc will link with this library.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1957" href="#t1957">1957</a></span><span class="t"><span class="str"> X-DH-Build-For-Type: target</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1958" href="#t1958">1958</a></span><span class="t"><span class="str"> # ...</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1959" href="#t1959">1959</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1960" href="#t1960">1960</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1961" href="#t1961">1961</a></span><span class="t"><span class="str"> If you are in doubt, then you probably do **not** need this field.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1962" href="#t1962">1962</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1963" href="#t1963">1963</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1964" href="#t1964">1964</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1965" href="#t1965">1965</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1966" href="#t1966">1966</a></span><span class="t"> <span class="str">"X-Time64-Compat"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1967" href="#t1967">1967</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SINGLE_VALUE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1968" href="#t1968">1968</a></span><span class="t"> <span class="nam">custom_field_check</span><span class="op">=</span><span class="nam">_each_value_match_regex_validation</span><span class="op">(</span><span class="nam">PKGNAME_REGEX</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1969" href="#t1969">1969</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1970" href="#t1970">1970</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1971" href="#t1971">1971</a></span><span class="t"><span class="str"> Special purpose field related to the 64-bit time transition.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1972" href="#t1972">1972</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1973" href="#t1973">1973</a></span><span class="t"><span class="str"> It is used to inform packaging helpers what the original (non-transitioned) package name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1974" href="#t1974">1974</a></span><span class="t"><span class="str"> was when the auto-detection is inadequate. The non-transitioned package name is then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1975" href="#t1975">1975</a></span><span class="t"><span class="str"> conditionally provided in the `${t64:Provides}` substitution variable.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1976" href="#t1976">1976</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1977" href="#t1977">1977</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1978" href="#t1978">1978</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1979" href="#t1979">1979</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1980" href="#t1980">1980</a></span><span class="t"> <span class="str">"Homepage"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1981" href="#t1981">1981</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SINGLE_VALUE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1982" href="#t1982">1982</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1983" href="#t1983">1983</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1984" href="#t1984">1984</a></span><span class="t"><span class="str"> Link to the upstream homepage for this binary package.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1985" href="#t1985">1985</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1986" href="#t1986">1986</a></span><span class="t"><span class="str"> This field is rarely used in Package stanzas as most binary packages should have the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1987" href="#t1987">1987</a></span><span class="t"><span class="str"> same homepage as the source package. Though, in the exceptional case where a particular</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1988" href="#t1988">1988</a></span><span class="t"><span class="str"> binary package should have a more specific homepage than the source package, you can</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1989" href="#t1989">1989</a></span><span class="t"><span class="str"> use this field to override the source package field.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1990" href="#t1990">1990</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1991" href="#t1991">1991</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1992" href="#t1992">1992</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1993" href="#t1993">1993</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1994" href="#t1994">1994</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1995" href="#t1995">1995</a></span><span class="t"> <span class="str">"Description"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1996" href="#t1996">1996</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">FREE_TEXT_FIELD</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1997" href="#t1997">1997</a></span><span class="t"> <span class="nam">spellcheck_value</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1998" href="#t1998">1998</a></span><span class="t"> <span class="com"># It will build just fine. But no one will know what it is for, so it probably won't be installed</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1999" href="#t1999">1999</a></span><span class="t"> <span class="nam">missing_field_severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Warning</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2000" href="#t2000">2000</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2001" href="#t2001">2001</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2002" href="#t2002">2002</a></span><span class="t"><span class="str"> A human-readable description of the package. This field consists of two related but distinct parts.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2003" href="#t2003">2003</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2004" href="#t2004">2004</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2005" href="#t2005">2005</a></span><span class="t"><span class="str"> The first line immediately after the field is called the *Synopsis* and is a short "noun-phrase"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2006" href="#t2006">2006</a></span><span class="t"><span class="str"> intended to provide a one-line summary of the package. The lines after the **Synopsis** is known</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2007" href="#t2007">2007</a></span><span class="t"><span class="str"> as the **Extended Description** and is intended as a longer summary of the package.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2008" href="#t2008">2008</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2009" href="#t2009">2009</a></span><span class="t"><span class="str"> **Example**:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2010" href="#t2010">2010</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2011" href="#t2011">2011</a></span><span class="t"><span class="str"> Description: documentation generator for Python projects</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2012" href="#t2012">2012</a></span><span class="t"><span class="str"> Sphinx is a tool for producing documentation for Python projects, using</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2013" href="#t2013">2013</a></span><span class="t"><span class="str"> reStructuredText as markup language.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2014" href="#t2014">2014</a></span><span class="t"><span class="str"> .</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2015" href="#t2015">2015</a></span><span class="t"><span class="str"> Sphinx features:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2016" href="#t2016">2016</a></span><span class="t"><span class="str"> * HTML, CHM, LaTeX output,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2017" href="#t2017">2017</a></span><span class="t"><span class="str"> * Cross-referencing source code,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2018" href="#t2018">2018</a></span><span class="t"><span class="str"> * Automatic indices,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2019" href="#t2019">2019</a></span><span class="t"><span class="str"> * Code highlighting, using Pygments,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2020" href="#t2020">2020</a></span><span class="t"><span class="str"> * Extensibility. Existing extensions:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2021" href="#t2021">2021</a></span><span class="t"><span class="str"> - automatic testing of code snippets,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2022" href="#t2022">2022</a></span><span class="t"><span class="str"> - including docstrings from Python modules.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2023" href="#t2023">2023</a></span><span class="t"><span class="str"> .</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2024" href="#t2024">2024</a></span><span class="t"><span class="str"> Build-depend on sphinx if your package uses /usr/bin/sphinx-*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2025" href="#t2025">2025</a></span><span class="t"><span class="str"> executables. Build-depend on python3-sphinx if your package uses</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2026" href="#t2026">2026</a></span><span class="t"><span class="str"> the Python API (for instance by calling python3 -m sphinx).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2027" href="#t2027">2027</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2028" href="#t2028">2028</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2029" href="#t2029">2029</a></span><span class="t"><span class="str"> The **Synopsis** is usually displayed in cases where there is limited space such as when reviewing</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2030" href="#t2030">2030</a></span><span class="t"><span class="str"> the search results from `apt search foo`. It is often a good idea to imagine that the **Synopsis**</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2031" href="#t2031">2031</a></span><span class="t"><span class="str"> part is inserted into a sentence like "The package provides {{Synopsis-goes-here}}". The</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2032" href="#t2032">2032</a></span><span class="t"><span class="str"> **Extended Description** is a standalone description that should describe what the package does and</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2033" href="#t2033">2033</a></span><span class="t"><span class="str"> how it relates to the rest of the system (in terms of, for example, which subsystem it is which part of).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2034" href="#t2034">2034</a></span><span class="t"><span class="str"> Please see <https://www.debian.org/doc/debian-policy/ch-controlfields.html#description> for more details</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2035" href="#t2035">2035</a></span><span class="t"><span class="str"> about the description field and suggestions for how to write it.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2036" href="#t2036">2036</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2037" href="#t2037">2037</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2038" href="#t2038">2038</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2039" href="#t2039">2039</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2040" href="#t2040">2040</a></span><span class="t"> <span class="str">"XB-Cnf-Visible-Pkgname"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2041" href="#t2041">2041</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SINGLE_VALUE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2042" href="#t2042">2042</a></span><span class="t"> <span class="nam">custom_field_check</span><span class="op">=</span><span class="nam">_each_value_match_regex_validation</span><span class="op">(</span><span class="nam">PKGNAME_REGEX</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2043" href="#t2043">2043</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2044" href="#t2044">2044</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2045" href="#t2045">2045</a></span><span class="t"><span class="str"> **Special-case field**: *This field is only useful in very special circumstances.*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2046" href="#t2046">2046</a></span><span class="t"><span class="str"> *Consider whether you truly need it before adding this field.*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2047" href="#t2047">2047</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2048" href="#t2048">2048</a></span><span class="t"><span class="str"> This field is used by `command-not-found` and can be used to override which package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2049" href="#t2049">2049</a></span><span class="t"><span class="str"> `command-not-found` should propose the user to install.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2050" href="#t2050">2050</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2051" href="#t2051">2051</a></span><span class="t"><span class="str"> Normally, when `command-not-found` detects a missing command, it will suggest the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2052" href="#t2052">2052</a></span><span class="t"><span class="str"> user to install the package name listed in the `Package` field. In most cases, this</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2053" href="#t2053">2053</a></span><span class="t"><span class="str"> is what you want. However, in certain special-cases, the binary is provided by a</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2054" href="#t2054">2054</a></span><span class="t"><span class="str"> minimal package for technical reasons (like `python3-minimal`) and the user should</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2055" href="#t2055">2055</a></span><span class="t"><span class="str"> really install a package that provides more features (such as `python3` to follow</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2056" href="#t2056">2056</a></span><span class="t"><span class="str"> the example).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2057" href="#t2057">2057</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2058" href="#t2058">2058</a></span><span class="t"><span class="str"> **Example**:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2059" href="#t2059">2059</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2060" href="#t2060">2060</a></span><span class="t"><span class="str"> Package: python3-minimal</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2061" href="#t2061">2061</a></span><span class="t"><span class="str"> XB-Cnf-Visible-Pkgname: python3</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2062" href="#t2062">2062</a></span><span class="t"><span class="str"> ```</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2063" href="#t2063">2063</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2064" href="#t2064">2064</a></span><span class="t"><span class="str"> Related bug: <https://bugs.launchpad.net/ubuntu/+source/python-defaults/+bug/1867157></span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2065" href="#t2065">2065</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2066" href="#t2066">2066</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2067" href="#t2067">2067</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2068" href="#t2068">2068</a></span><span class="t"> <span class="nam">DctrlKnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2069" href="#t2069">2069</a></span><span class="t"> <span class="str">"X-DhRuby-Root"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2070" href="#t2070">2070</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SINGLE_VALUE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2071" href="#t2071">2071</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2072" href="#t2072">2072</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2073" href="#t2073">2073</a></span><span class="t"><span class="str"> Used by `dh_ruby` to request "multi-binary" layout and where the root for the given</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2074" href="#t2074">2074</a></span><span class="t"><span class="str"> package is.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2075" href="#t2075">2075</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2076" href="#t2076">2076</a></span><span class="t"><span class="str"> Please refer to the documentation of `dh_ruby` for more details.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2077" href="#t2077">2077</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2078" href="#t2078">2078</a></span><span class="t"><span class="str"> <https://manpages.debian.org/dh_ruby></span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2079" href="#t2079">2079</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2080" href="#t2080">2080</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2081" href="#t2081">2081</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2082" href="#t2082">2082</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2083" href="#t2083">2083</a></span><span class="t"><span class="nam">_DEP5_HEADER_FIELDS</span> <span class="op">=</span> <span class="nam">_fields</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2084" href="#t2084">2084</a></span><span class="t"> <span class="nam">Deb822KnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2085" href="#t2085">2085</a></span><span class="t"> <span class="str">"Format"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2086" href="#t2086">2086</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SINGLE_VALUE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2087" href="#t2087">2087</a></span><span class="t"> <span class="nam">is_stanza_name</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2088" href="#t2088">2088</a></span><span class="t"> <span class="nam">missing_field_severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2089" href="#t2089">2089</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2090" href="#t2090">2090</a></span><span class="t"> <span class="nam">Deb822KnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2091" href="#t2091">2091</a></span><span class="t"> <span class="str">"Upstream-Name"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2092" href="#t2092">2092</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">FREE_TEXT_FIELD</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2093" href="#t2093">2093</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2094" href="#t2094">2094</a></span><span class="t"> <span class="nam">Deb822KnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2095" href="#t2095">2095</a></span><span class="t"> <span class="str">"Upstream-Contact"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2096" href="#t2096">2096</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">FREE_TEXT_FIELD</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2097" href="#t2097">2097</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2098" href="#t2098">2098</a></span><span class="t"> <span class="nam">Deb822KnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2099" href="#t2099">2099</a></span><span class="t"> <span class="str">"Source"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2100" href="#t2100">2100</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">FREE_TEXT_FIELD</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2101" href="#t2101">2101</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2102" href="#t2102">2102</a></span><span class="t"> <span class="nam">Deb822KnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2103" href="#t2103">2103</a></span><span class="t"> <span class="str">"Disclaimer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2104" href="#t2104">2104</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">FREE_TEXT_FIELD</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2105" href="#t2105">2105</a></span><span class="t"> <span class="nam">spellcheck_value</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2106" href="#t2106">2106</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2107" href="#t2107">2107</a></span><span class="t"> <span class="nam">Deb822KnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2108" href="#t2108">2108</a></span><span class="t"> <span class="str">"Comment"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2109" href="#t2109">2109</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">FREE_TEXT_FIELD</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2110" href="#t2110">2110</a></span><span class="t"> <span class="nam">spellcheck_value</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2111" href="#t2111">2111</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2112" href="#t2112">2112</a></span><span class="t"> <span class="nam">Deb822KnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2113" href="#t2113">2113</a></span><span class="t"> <span class="str">"License"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2114" href="#t2114">2114</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">FREE_TEXT_FIELD</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2115" href="#t2115">2115</a></span><span class="t"> <span class="com"># Do not tempt people to change legal text because the spellchecker wants to do a typo fix.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2116" href="#t2116">2116</a></span><span class="t"> <span class="nam">spellcheck_value</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2117" href="#t2117">2117</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2118" href="#t2118">2118</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2119" href="#t2119">2119</a></span><span class="t"><span class="nam">_DEP5_FILES_FIELDS</span> <span class="op">=</span> <span class="nam">_fields</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2120" href="#t2120">2120</a></span><span class="t"> <span class="nam">Deb822KnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2121" href="#t2121">2121</a></span><span class="t"> <span class="str">"Files"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2122" href="#t2122">2122</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">DEP5_FILE_LIST</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2123" href="#t2123">2123</a></span><span class="t"> <span class="nam">is_stanza_name</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2124" href="#t2124">2124</a></span><span class="t"> <span class="nam">missing_field_severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2125" href="#t2125">2125</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2126" href="#t2126">2126</a></span><span class="t"> <span class="nam">Deb822KnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2127" href="#t2127">2127</a></span><span class="t"> <span class="str">"Copyright"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2128" href="#t2128">2128</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">FREE_TEXT_FIELD</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2129" href="#t2129">2129</a></span><span class="t"> <span class="com"># Mostly going to be names with very little free-text; high risk of false positives with low value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2130" href="#t2130">2130</a></span><span class="t"> <span class="nam">spellcheck_value</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2131" href="#t2131">2131</a></span><span class="t"> <span class="nam">missing_field_severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2132" href="#t2132">2132</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2133" href="#t2133">2133</a></span><span class="t"> <span class="nam">Deb822KnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2134" href="#t2134">2134</a></span><span class="t"> <span class="str">"License"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2135" href="#t2135">2135</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">FREE_TEXT_FIELD</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2136" href="#t2136">2136</a></span><span class="t"> <span class="nam">missing_field_severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2137" href="#t2137">2137</a></span><span class="t"> <span class="com"># Do not tempt people to change legal text because the spellchecker wants to do a typo fix.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2138" href="#t2138">2138</a></span><span class="t"> <span class="nam">spellcheck_value</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2139" href="#t2139">2139</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2140" href="#t2140">2140</a></span><span class="t"> <span class="nam">Deb822KnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2141" href="#t2141">2141</a></span><span class="t"> <span class="str">"Comment"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2142" href="#t2142">2142</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">FREE_TEXT_FIELD</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2143" href="#t2143">2143</a></span><span class="t"> <span class="nam">spellcheck_value</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2144" href="#t2144">2144</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2145" href="#t2145">2145</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2146" href="#t2146">2146</a></span><span class="t"><span class="nam">_DEP5_LICENSE_FIELDS</span> <span class="op">=</span> <span class="nam">_fields</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2147" href="#t2147">2147</a></span><span class="t"> <span class="nam">Deb822KnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2148" href="#t2148">2148</a></span><span class="t"> <span class="str">"License"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2149" href="#t2149">2149</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">FREE_TEXT_FIELD</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2150" href="#t2150">2150</a></span><span class="t"> <span class="nam">is_stanza_name</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2151" href="#t2151">2151</a></span><span class="t"> <span class="com"># Do not tempt people to change legal text because the spellchecker wants to do a typo fix.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2152" href="#t2152">2152</a></span><span class="t"> <span class="nam">spellcheck_value</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2153" href="#t2153">2153</a></span><span class="t"> <span class="nam">missing_field_severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2154" href="#t2154">2154</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2155" href="#t2155">2155</a></span><span class="t"> <span class="nam">Deb822KnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2156" href="#t2156">2156</a></span><span class="t"> <span class="str">"Comment"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2157" href="#t2157">2157</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">FREE_TEXT_FIELD</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2158" href="#t2158">2158</a></span><span class="t"> <span class="nam">spellcheck_value</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2159" href="#t2159">2159</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2160" href="#t2160">2160</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2161" href="#t2161">2161</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2162" href="#t2162">2162</a></span><span class="t"><span class="nam">_DTESTSCTRL_FIELDS</span> <span class="op">=</span> <span class="nam">_fields</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2163" href="#t2163">2163</a></span><span class="t"> <span class="nam">Deb822KnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2164" href="#t2164">2164</a></span><span class="t"> <span class="str">"Architecture"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2165" href="#t2165">2165</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SPACE_SEPARATED_LIST</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2166" href="#t2166">2166</a></span><span class="t"> <span class="nam">unknown_value_diagnostic_severity</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2167" href="#t2167">2167</a></span><span class="t"> <span class="nam">known_values</span><span class="op">=</span><span class="nam">_allowed_values</span><span class="op">(</span><span class="op">*</span><span class="nam">dpkg_arch_and_wildcards</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2168" href="#t2168">2168</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2169" href="#t2169">2169</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2170" href="#t2170">2170</a></span><span class="t"><span class="str"> When package tests are only supported on a limited set of</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2171" href="#t2171">2171</a></span><span class="t"><span class="str"> architectures, or are known to not work on a particular (set of)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2172" href="#t2172">2172</a></span><span class="t"><span class="str"> architecture(s), this field can be used to define the supported</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2173" href="#t2173">2173</a></span><span class="t"><span class="str"> architectures. The autopkgtest will be skipped when the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2174" href="#t2174">2174</a></span><span class="t"><span class="str"> architecture of the testbed doesn't match the content of this</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2175" href="#t2175">2175</a></span><span class="t"><span class="str"> field. The format is the same as in (Build-)Depends, with the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2176" href="#t2176">2176</a></span><span class="t"><span class="str"> understanding that `all` is not allowed, and `any` means that</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2177" href="#t2177">2177</a></span><span class="t"><span class="str"> the test will be run on every architecture, which is the default</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2178" href="#t2178">2178</a></span><span class="t"><span class="str"> when not specifying this field at all.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2179" href="#t2179">2179</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2180" href="#t2180">2180</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2181" href="#t2181">2181</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2182" href="#t2182">2182</a></span><span class="t"> <span class="nam">Deb822KnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2183" href="#t2183">2183</a></span><span class="t"> <span class="str">"Classes"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2184" href="#t2184">2184</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">FREE_TEXT_FIELD</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2185" href="#t2185">2185</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2186" href="#t2186">2186</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2187" href="#t2187">2187</a></span><span class="t"><span class="str"> Most package tests should work in a minimal environment and are</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2188" href="#t2188">2188</a></span><span class="t"><span class="str"> usually not hardware specific. However, some packages like the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2189" href="#t2189">2189</a></span><span class="t"><span class="str"> kernel, X.org, or graphics drivers should be tested on particular</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2190" href="#t2190">2190</a></span><span class="t"><span class="str"> hardware, and also run on a set of different platforms rather than</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2191" href="#t2191">2191</a></span><span class="t"><span class="str"> just a single virtual testbeds.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2192" href="#t2192">2192</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2193" href="#t2193">2193</a></span><span class="t"><span class="str"> This field can specify a list of abstract class names such as</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2194" href="#t2194">2194</a></span><span class="t"><span class="str"> "desktop" or "graphics-driver". Consumers of autopkgtest can then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2195" href="#t2195">2195</a></span><span class="t"><span class="str"> map these class names to particular machines/platforms/policies.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2196" href="#t2196">2196</a></span><span class="t"><span class="str"> Unknown class names should be ignored.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2197" href="#t2197">2197</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2198" href="#t2198">2198</a></span><span class="t"><span class="str"> This is purely an informational field for autopkgtest itself and</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2199" href="#t2199">2199</a></span><span class="t"><span class="str"> will be ignored.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2200" href="#t2200">2200</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2201" href="#t2201">2201</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2202" href="#t2202">2202</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2203" href="#t2203">2203</a></span><span class="t"> <span class="nam">Deb822KnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2204" href="#t2204">2204</a></span><span class="t"> <span class="str">"Depends"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2205" href="#t2205">2205</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">COMMA_SEPARATED_LIST</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2206" href="#t2206">2206</a></span><span class="t"> <span class="nam">default_value</span><span class="op">=</span><span class="str">"@"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2207" href="#t2207">2207</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2208" href="#t2208">2208</a></span><span class="t"><span class="str"> Declares that the specified packages must be installed for the test</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2209" href="#t2209">2209</a></span><span class="t"><span class="str"> to go ahead. This supports all features of dpkg dependencies, including</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2210" href="#t2210">2210</a></span><span class="t"><span class="str"> the architecture qualifiers (see</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2211" href="#t2211">2211</a></span><span class="t"><span class="str"> <https://www.debian.org/doc/debian-policy/ch-relationships.html>),</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2212" href="#t2212">2212</a></span><span class="t"><span class="str"> plus the following extensions:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2213" href="#t2213">2213</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2214" href="#t2214">2214</a></span><span class="t"><span class="str"> `@` stands for the package(s) generated by the source package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2215" href="#t2215">2215</a></span><span class="t"><span class="str"> containing the tests; each dependency (strictly, or-clause, which</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2216" href="#t2216">2216</a></span><span class="t"><span class="str"> may contain `|`s but not commas) containing `@` is replicated</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2217" href="#t2217">2217</a></span><span class="t"><span class="str"> once for each such binary package, with the binary package name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2218" href="#t2218">2218</a></span><span class="t"><span class="str"> substituted for each `@` (but normally `@` should occur only</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2219" href="#t2219">2219</a></span><span class="t"><span class="str"> once and without a version restriction).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2220" href="#t2220">2220</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2221" href="#t2221">2221</a></span><span class="t"><span class="str"> `@builddeps@` will be replaced by the package's</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2222" href="#t2222">2222</a></span><span class="t"><span class="str"> `Build-Depends:`, `Build-Depends-Indep:`, `Build-Depends-Arch:`, and</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2223" href="#t2223">2223</a></span><span class="t"><span class="str"> `build-essential`. This is useful if you have many build</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2224" href="#t2224">2224</a></span><span class="t"><span class="str"> dependencies which are only necessary for running the test suite and</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2225" href="#t2225">2225</a></span><span class="t"><span class="str"> you don't want to replicate them in the test `Depends:`. However,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2226" href="#t2226">2226</a></span><span class="t"><span class="str"> please use this sparingly, as this can easily lead to missing binary</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2227" href="#t2227">2227</a></span><span class="t"><span class="str"> package dependencies being overlooked if they get pulled in via</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2228" href="#t2228">2228</a></span><span class="t"><span class="str"> build dependencies.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2229" href="#t2229">2229</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2230" href="#t2230">2230</a></span><span class="t"><span class="str"> `@recommends@` stands for all the packages listed in the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2231" href="#t2231">2231</a></span><span class="t"><span class="str"> `Recommends:` fields of all the binary packages mentioned in the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2232" href="#t2232">2232</a></span><span class="t"><span class="str"> `debian/control` file. Please note that variables are stripped,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2233" href="#t2233">2233</a></span><span class="t"><span class="str"> so if some required test dependencies aren't explicitly mentioned,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2234" href="#t2234">2234</a></span><span class="t"><span class="str"> they may not be installed.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2235" href="#t2235">2235</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2236" href="#t2236">2236</a></span><span class="t"><span class="str"> If no Depends field is present, `Depends: @` is assumed. Note that</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2237" href="#t2237">2237</a></span><span class="t"><span class="str"> the source tree's Build-Dependencies are *not* necessarily</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2238" href="#t2238">2238</a></span><span class="t"><span class="str"> installed, and if you specify any Depends, no binary packages from</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2239" href="#t2239">2239</a></span><span class="t"><span class="str"> the source are installed unless explicitly requested.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2240" href="#t2240">2240</a></span><span class="t"><span class="str"> """</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2241" href="#t2241">2241</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2242" href="#t2242">2242</a></span><span class="t"> <span class="nam">Deb822KnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2243" href="#t2243">2243</a></span><span class="t"> <span class="str">"Features"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2244" href="#t2244">2244</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">COMMA_OR_SPACE_SEPARATED_LIST</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2245" href="#t2245">2245</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2246" href="#t2246">2246</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2247" href="#t2247">2247</a></span><span class="t"><span class="str"> Declares some additional capabilities or good properties of the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2248" href="#t2248">2248</a></span><span class="t"><span class="str"> tests defined in this stanza. Any unknown features declared will be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2249" href="#t2249">2249</a></span><span class="t"><span class="str"> completely ignored. See below for the defined features.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2250" href="#t2250">2250</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2251" href="#t2251">2251</a></span><span class="t"><span class="str"> Features are separated by commas and/or whitespace.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2252" href="#t2252">2252</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2253" href="#t2253">2253</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2254" href="#t2254">2254</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2255" href="#t2255">2255</a></span><span class="t"> <span class="nam">Deb822KnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2256" href="#t2256">2256</a></span><span class="t"> <span class="str">"Restrictions"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2257" href="#t2257">2257</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">COMMA_OR_SPACE_SEPARATED_LIST</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2258" href="#t2258">2258</a></span><span class="t"> <span class="nam">unknown_value_diagnostic_severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Warning</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2259" href="#t2259">2259</a></span><span class="t"> <span class="nam">known_values</span><span class="op">=</span><span class="nam">_allowed_values</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2260" href="#t2260">2260</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2261" href="#t2261">2261</a></span><span class="t"> <span class="str">"allow-stderr"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2262" href="#t2262">2262</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2263" href="#t2263">2263</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2264" href="#t2264">2264</a></span><span class="t"><span class="str"> Output to stderr is not considered a failure. This is useful for</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2265" href="#t2265">2265</a></span><span class="t"><span class="str"> tests which write e. g. lots of logging to stderr.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2266" href="#t2266">2266</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2267" href="#t2267">2267</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2268" href="#t2268">2268</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2269" href="#t2269">2269</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2270" href="#t2270">2270</a></span><span class="t"> <span class="str">"breaks-testbed"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2271" href="#t2271">2271</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2272" href="#t2272">2272</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2273" href="#t2273">2273</a></span><span class="t"><span class="str"> The test, when run, is liable to break the testbed system. This</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2274" href="#t2274">2274</a></span><span class="t"><span class="str"> includes causing data loss, causing services that the machine is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2275" href="#t2275">2275</a></span><span class="t"><span class="str"> running to malfunction, or permanently disabling services; it does</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2276" href="#t2276">2276</a></span><span class="t"><span class="str"> not include causing services on the machine to temporarily fail.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2277" href="#t2277">2277</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2278" href="#t2278">2278</a></span><span class="t"><span class="str"> When this restriction is present the test will usually be skipped</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2279" href="#t2279">2279</a></span><span class="t"><span class="str"> unless the testbed's virtualisation arrangements are sufficiently</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2280" href="#t2280">2280</a></span><span class="t"><span class="str"> powerful, or alternatively if the user explicitly requests.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2281" href="#t2281">2281</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2282" href="#t2282">2282</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2283" href="#t2283">2283</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2284" href="#t2284">2284</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2285" href="#t2285">2285</a></span><span class="t"> <span class="str">"build-needed"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2286" href="#t2286">2286</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2287" href="#t2287">2287</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2288" href="#t2288">2288</a></span><span class="t"><span class="str"> The tests need to be run from a built source tree. The test runner</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2289" href="#t2289">2289</a></span><span class="t"><span class="str"> will build the source tree (honouring the source package's build</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2290" href="#t2290">2290</a></span><span class="t"><span class="str"> dependencies), before running the tests. However, the tests are</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2291" href="#t2291">2291</a></span><span class="t"><span class="str"> *not* entitled to assume that the source package's build</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2292" href="#t2292">2292</a></span><span class="t"><span class="str"> dependencies will be installed when the test is run.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2293" href="#t2293">2293</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2294" href="#t2294">2294</a></span><span class="t"><span class="str"> Please use this considerately, as for large builds it unnecessarily</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2295" href="#t2295">2295</a></span><span class="t"><span class="str"> builds the entire project when you only need a tiny subset (like the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2296" href="#t2296">2296</a></span><span class="t"><span class="str"> `tests/` subdirectory). It is often possible to run `make -C tests`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2297" href="#t2297">2297</a></span><span class="t"><span class="str"> instead, or copy the test code to `$AUTOPKGTEST_TMP` and build it</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2298" href="#t2298">2298</a></span><span class="t"><span class="str"> there with some custom commands. This cuts down the load on the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2299" href="#t2299">2299</a></span><span class="t"><span class="str"> Continuous Integration servers and also makes tests more robust as</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2300" href="#t2300">2300</a></span><span class="t"><span class="str"> it prevents accidentally running them against the built source tree</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2301" href="#t2301">2301</a></span><span class="t"><span class="str"> instead of the installed packages.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2302" href="#t2302">2302</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2303" href="#t2303">2303</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2304" href="#t2304">2304</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2305" href="#t2305">2305</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2306" href="#t2306">2306</a></span><span class="t"> <span class="str">"flaky"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2307" href="#t2307">2307</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2308" href="#t2308">2308</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2309" href="#t2309">2309</a></span><span class="t"><span class="str"> The test is expected to fail intermittently, and is not suitable for</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2310" href="#t2310">2310</a></span><span class="t"><span class="str"> gating continuous integration. This indicates a bug in either the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2311" href="#t2311">2311</a></span><span class="t"><span class="str"> package under test, a dependency or the test itself, but such bugs</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2312" href="#t2312">2312</a></span><span class="t"><span class="str"> can be difficult to fix, and it is often difficult to know when the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2313" href="#t2313">2313</a></span><span class="t"><span class="str"> bug has been fixed without running the test for a while. If a</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2314" href="#t2314">2314</a></span><span class="t"><span class="str"> `flaky` test succeeds, it will be treated like any other</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2315" href="#t2315">2315</a></span><span class="t"><span class="str"> successful test, but if it fails it will be treated as though it</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2316" href="#t2316">2316</a></span><span class="t"><span class="str"> had been skipped.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2317" href="#t2317">2317</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2318" href="#t2318">2318</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2319" href="#t2319">2319</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2320" href="#t2320">2320</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2321" href="#t2321">2321</a></span><span class="t"> <span class="str">"hint-testsuite-triggers"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2322" href="#t2322">2322</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2323" href="#t2323">2323</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2324" href="#t2324">2324</a></span><span class="t"><span class="str"> This test exists purely as a hint to suggest when rerunning the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2325" href="#t2325">2325</a></span><span class="t"><span class="str"> tests is likely to be useful. Specifically, it exists to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2326" href="#t2326">2326</a></span><span class="t"><span class="str"> influence the way dpkg-source generates the Testsuite-Triggers</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2327" href="#t2327">2327</a></span><span class="t"><span class="str"> .dsc header from test metadata: the Depends for this test are</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2328" href="#t2328">2328</a></span><span class="t"><span class="str"> to be added to Testsuite-Triggers. (Just as they are for any other</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2329" href="#t2329">2329</a></span><span class="t"><span class="str"> test.)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2330" href="#t2330">2330</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2331" href="#t2331">2331</a></span><span class="t"><span class="str"> The test with the hint-testsuite-triggers restriction should not</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2332" href="#t2332">2332</a></span><span class="t"><span class="str"> actually be run.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2333" href="#t2333">2333</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2334" href="#t2334">2334</a></span><span class="t"><span class="str"> The packages listed as Depends for this test are usually indirect</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2335" href="#t2335">2335</a></span><span class="t"><span class="str"> dependencies, updates to which are considered to pose a risk of</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2336" href="#t2336">2336</a></span><span class="t"><span class="str"> regressions in other tests defined in this package.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2337" href="#t2337">2337</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2338" href="#t2338">2338</a></span><span class="t"><span class="str"> There is currently no way to specify this hint on a per-test</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2339" href="#t2339">2339</a></span><span class="t"><span class="str"> basis; but in any case the debian.org machinery is not able to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2340" href="#t2340">2340</a></span><span class="t"><span class="str"> think about triggering individual tests.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2341" href="#t2341">2341</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2342" href="#t2342">2342</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2343" href="#t2343">2343</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2344" href="#t2344">2344</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2345" href="#t2345">2345</a></span><span class="t"> <span class="str">"isolation-container"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2346" href="#t2346">2346</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2347" href="#t2347">2347</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2348" href="#t2348">2348</a></span><span class="t"><span class="str"> The test wants to start services or open network TCP ports. This</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2349" href="#t2349">2349</a></span><span class="t"><span class="str"> commonly fails in a simple chroot/schroot, so tests need to be run</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2350" href="#t2350">2350</a></span><span class="t"><span class="str"> in their own container (e. g. autopkgtest-virt-lxc) or their own</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2351" href="#t2351">2351</a></span><span class="t"><span class="str"> machine/VM (e. g. autopkgtest-virt-qemu or autopkgtest-virt-null).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2352" href="#t2352">2352</a></span><span class="t"><span class="str"> When running the test in a virtualization server which does not</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2353" href="#t2353">2353</a></span><span class="t"><span class="str"> provide this (like autopkgtest-schroot) it will be skipped.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2354" href="#t2354">2354</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2355" href="#t2355">2355</a></span><span class="t"><span class="str"> Tests may assume that this restriction implies that process 1 in the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2356" href="#t2356">2356</a></span><span class="t"><span class="str"> container's process namespace is a system service manager (init system)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2357" href="#t2357">2357</a></span><span class="t"><span class="str"> such as systemd or sysvinit + sysv-rc, and therefore system services</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2358" href="#t2358">2358</a></span><span class="t"><span class="str"> are available via the `service(8)`, `invoke-rc.d(8)` and</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2359" href="#t2359">2359</a></span><span class="t"><span class="str"> `update-rc.d(8))` interfaces.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2360" href="#t2360">2360</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2361" href="#t2361">2361</a></span><span class="t"><span class="str"> Tests must not assume that a specific init system is in use: a</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2362" href="#t2362">2362</a></span><span class="t"><span class="str"> dependency such as `systemd-sysv` or `sysvinit-core` does not work</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2363" href="#t2363">2363</a></span><span class="t"><span class="str"> in practice, because switching the init system often cannot be done</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2364" href="#t2364">2364</a></span><span class="t"><span class="str"> automatically. Tests that require a specific init system should use the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2365" href="#t2365">2365</a></span><span class="t"><span class="str"> `skippable` restriction, and skip the test if the required init system</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2366" href="#t2366">2366</a></span><span class="t"><span class="str"> was not detected.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2367" href="#t2367">2367</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2368" href="#t2368">2368</a></span><span class="t"><span class="str"> Many implementations of the `isolation-container` restriction will</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2369" href="#t2369">2369</a></span><span class="t"><span class="str"> also provide `systemd-logind(8)` or a compatible interface, but this</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2370" href="#t2370">2370</a></span><span class="t"><span class="str"> is not guaranteed. Tests requiring a login session registered with</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2371" href="#t2371">2371</a></span><span class="t"><span class="str"> logind should declare a dependency on `default-logind | logind`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2372" href="#t2372">2372</a></span><span class="t"><span class="str"> or on a more specific implementation of `logind`, and should use the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2373" href="#t2373">2373</a></span><span class="t"><span class="str"> `skippable` restriction to exit gracefully if its functionality is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2374" href="#t2374">2374</a></span><span class="t"><span class="str"> not available at runtime.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2375" href="#t2375">2375</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2376" href="#t2376">2376</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2377" href="#t2377">2377</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2378" href="#t2378">2378</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2379" href="#t2379">2379</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2380" href="#t2380">2380</a></span><span class="t"> <span class="str">"isolation-machine"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2381" href="#t2381">2381</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2382" href="#t2382">2382</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2383" href="#t2383">2383</a></span><span class="t"><span class="str"> The test wants to interact with the kernel, reboot the machine, or</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2384" href="#t2384">2384</a></span><span class="t"><span class="str"> other things which fail in a simple schroot and even a container.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2385" href="#t2385">2385</a></span><span class="t"><span class="str"> Those tests need to be run in their own machine/VM (e. g.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2386" href="#t2386">2386</a></span><span class="t"><span class="str"> autopkgtest-virt-qemu or autopkgtest-virt-null). When running the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2387" href="#t2387">2387</a></span><span class="t"><span class="str"> test in a virtualization server which does not provide this it will</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2388" href="#t2388">2388</a></span><span class="t"><span class="str"> be skipped.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2389" href="#t2389">2389</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2390" href="#t2390">2390</a></span><span class="t"><span class="str"> This restriction also provides the same facilities as</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2391" href="#t2391">2391</a></span><span class="t"><span class="str"> `isolation-container`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2392" href="#t2392">2392</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2393" href="#t2393">2393</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2394" href="#t2394">2394</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2395" href="#t2395">2395</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2396" href="#t2396">2396</a></span><span class="t"> <span class="str">"needs-internet"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2397" href="#t2397">2397</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2398" href="#t2398">2398</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2399" href="#t2399">2399</a></span><span class="t"><span class="str"> The test needs unrestricted internet access, e.g. to download test data</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2400" href="#t2400">2400</a></span><span class="t"><span class="str"> that's not shipped as a package, or to test a protocol implementation</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2401" href="#t2401">2401</a></span><span class="t"><span class="str"> against a test server. Please also see the note about Network access later</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2402" href="#t2402">2402</a></span><span class="t"><span class="str"> in this document.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2403" href="#t2403">2403</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2404" href="#t2404">2404</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2405" href="#t2405">2405</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2406" href="#t2406">2406</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2407" href="#t2407">2407</a></span><span class="t"> <span class="str">"needs-reboot"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2408" href="#t2408">2408</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2409" href="#t2409">2409</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2410" href="#t2410">2410</a></span><span class="t"><span class="str"> The test wants to reboot the machine using</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2411" href="#t2411">2411</a></span><span class="t"><span class="str"> `/tmp/autopkgtest-reboot`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2412" href="#t2412">2412</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2413" href="#t2413">2413</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2414" href="#t2414">2414</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2415" href="#t2415">2415</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2416" href="#t2416">2416</a></span><span class="t"> <span class="str">"needs-recommends"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2417" href="#t2417">2417</a></span><span class="t"> <span class="nam">is_obsolete</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2418" href="#t2418">2418</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2419" href="#t2419">2419</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2420" href="#t2420">2420</a></span><span class="t"><span class="str"> Please use `@recommends@` in your test `Depends:` instead.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2421" href="#t2421">2421</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2422" href="#t2422">2422</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2423" href="#t2423">2423</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2424" href="#t2424">2424</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2425" href="#t2425">2425</a></span><span class="t"> <span class="str">"needs-root"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2426" href="#t2426">2426</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2427" href="#t2427">2427</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2428" href="#t2428">2428</a></span><span class="t"><span class="str"> The test script must be run as root.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2429" href="#t2429">2429</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2430" href="#t2430">2430</a></span><span class="t"><span class="str"> While running tests with this restriction, some test runners will</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2431" href="#t2431">2431</a></span><span class="t"><span class="str"> set the `AUTOPKGTEST_NORMAL_USER` environment variable to the name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2432" href="#t2432">2432</a></span><span class="t"><span class="str"> of an ordinary user account. If so, the test script may drop</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2433" href="#t2433">2433</a></span><span class="t"><span class="str"> privileges from root to that user, for example via the `runuser`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2434" href="#t2434">2434</a></span><span class="t"><span class="str"> command. Test scripts must not assume that this environment variable</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2435" href="#t2435">2435</a></span><span class="t"><span class="str"> will always be set.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2436" href="#t2436">2436</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2437" href="#t2437">2437</a></span><span class="t"><span class="str"> For tests that declare both the `needs-root` and `isolation-machine`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2438" href="#t2438">2438</a></span><span class="t"><span class="str"> restrictions, the test may assume that it has "global root" with full</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2439" href="#t2439">2439</a></span><span class="t"><span class="str"> control over the kernel that is running the test, and not just root</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2440" href="#t2440">2440</a></span><span class="t"><span class="str"> in a container (more formally, it has uid 0 and full capabilities in</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2441" href="#t2441">2441</a></span><span class="t"><span class="str"> the initial user namespace as defined in `user_namespaces(7)`).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2442" href="#t2442">2442</a></span><span class="t"><span class="str"> For example, it can expect that mounting block devices will succeed.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2443" href="#t2443">2443</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2444" href="#t2444">2444</a></span><span class="t"><span class="str"> For tests that declare the `needs-root` restriction but not the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2445" href="#t2445">2445</a></span><span class="t"><span class="str"> `isolation-machine` restriction, the test will be run as uid 0 in</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2446" href="#t2446">2446</a></span><span class="t"><span class="str"> a user namespace with a reasonable range of system and user uids</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2447" href="#t2447">2447</a></span><span class="t"><span class="str"> available, but will not necessarily have full control over the kernel,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2448" href="#t2448">2448</a></span><span class="t"><span class="str"> and in particular it is not guaranteed to have elevated capabilities</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2449" href="#t2449">2449</a></span><span class="t"><span class="str"> in the initial user namespace as defined by `user_namespaces(7)`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2450" href="#t2450">2450</a></span><span class="t"><span class="str"> For example, it might be run in a namespace where uid 0 is mapped to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2451" href="#t2451">2451</a></span><span class="t"><span class="str"> an ordinary uid in the initial user namespace, or it might run in a</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2452" href="#t2452">2452</a></span><span class="t"><span class="str"> Docker-style container where global uid 0 is used but its ability to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2453" href="#t2453">2453</a></span><span class="t"><span class="str"> carry out operations that affect the whole system is restricted by</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2454" href="#t2454">2454</a></span><span class="t"><span class="str"> capabilities and system call filtering. Tests requiring particular</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2455" href="#t2455">2455</a></span><span class="t"><span class="str"> privileges should use the `skippable` restriction to check for</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2456" href="#t2456">2456</a></span><span class="t"><span class="str"> required functionality at runtime.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2457" href="#t2457">2457</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2458" href="#t2458">2458</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2459" href="#t2459">2459</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2460" href="#t2460">2460</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2461" href="#t2461">2461</a></span><span class="t"> <span class="str">"needs-sudo"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2462" href="#t2462">2462</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2463" href="#t2463">2463</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2464" href="#t2464">2464</a></span><span class="t"><span class="str"> The test script needs to be run as a non-root user who is a member of</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2465" href="#t2465">2465</a></span><span class="t"><span class="str"> the `sudo` group, and has the ability to elevate privileges to root</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2466" href="#t2466">2466</a></span><span class="t"><span class="str"> on-demand.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2467" href="#t2467">2467</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2468" href="#t2468">2468</a></span><span class="t"><span class="str"> This is useful for testing user components which should not normally</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2469" href="#t2469">2469</a></span><span class="t"><span class="str"> be run as root, in test scenarios that require configuring a system</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2470" href="#t2470">2470</a></span><span class="t"><span class="str"> service to support the test. For example, gvfs has a test-case which</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2471" href="#t2471">2471</a></span><span class="t"><span class="str"> uses sudo for privileged configuration of a Samba server, so that</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2472" href="#t2472">2472</a></span><span class="t"><span class="str"> the unprivileged gvfs service under test can communicate with that server.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2473" href="#t2473">2473</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2474" href="#t2474">2474</a></span><span class="t"><span class="str"> While running a test with this restriction, `sudo(8)` will be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2475" href="#t2475">2475</a></span><span class="t"><span class="str"> installed and configured to allow members of the `sudo` group to run</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2476" href="#t2476">2476</a></span><span class="t"><span class="str"> any command without password authentication.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2477" href="#t2477">2477</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2478" href="#t2478">2478</a></span><span class="t"><span class="str"> Because the test user is a member of the `sudo` group, they will</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2479" href="#t2479">2479</a></span><span class="t"><span class="str"> also gain the ability to take any other privileged actions that are</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2480" href="#t2480">2480</a></span><span class="t"><span class="str"> controlled by membership in that group. In particular, several packages</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2481" href="#t2481">2481</a></span><span class="t"><span class="str"> install `polkit(8)` policies allowing members of group `sudo` to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2482" href="#t2482">2482</a></span><span class="t"><span class="str"> take administrative actions with or without authentication.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2483" href="#t2483">2483</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2484" href="#t2484">2484</a></span><span class="t"><span class="str"> If the test requires access to additional privileged actions, it may</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2485" href="#t2485">2485</a></span><span class="t"><span class="str"> use its access to `sudo(8)` to install additional configuration</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2486" href="#t2486">2486</a></span><span class="t"><span class="str"> files, for example configuring `polkit(8)` or `doas.conf(5)`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2487" href="#t2487">2487</a></span><span class="t"><span class="str"> to allow running `pkexec(1)` or `doas(1)` without authentication.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2488" href="#t2488">2488</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2489" href="#t2489">2489</a></span><span class="t"><span class="str"> Commands run via `sudo(8)` or another privilege-elevation tool could</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2490" href="#t2490">2490</a></span><span class="t"><span class="str"> be run with either "global root" or root in a container, depending</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2491" href="#t2491">2491</a></span><span class="t"><span class="str"> on the presence or absence of the `isolation-machine` restriction,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2492" href="#t2492">2492</a></span><span class="t"><span class="str"> in the same way described for `needs-root`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2493" href="#t2493">2493</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2494" href="#t2494">2494</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2495" href="#t2495">2495</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2496" href="#t2496">2496</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2497" href="#t2497">2497</a></span><span class="t"> <span class="str">"rw-build-tree"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2498" href="#t2498">2498</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2499" href="#t2499">2499</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2500" href="#t2500">2500</a></span><span class="t"><span class="str"> The test(s) needs write access to the built source tree (so it may</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2501" href="#t2501">2501</a></span><span class="t"><span class="str"> need to be copied first). Even with this restriction, the test is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2502" href="#t2502">2502</a></span><span class="t"><span class="str"> not allowed to make any change to the built source tree which (i)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2503" href="#t2503">2503</a></span><span class="t"><span class="str"> isn't cleaned up by `debian/rules clean`, (ii) affects the future</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2504" href="#t2504">2504</a></span><span class="t"><span class="str"> results of any test, or (iii) affects binary packages produced by</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2505" href="#t2505">2505</a></span><span class="t"><span class="str"> the build tree in the future.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2506" href="#t2506">2506</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2507" href="#t2507">2507</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2508" href="#t2508">2508</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2509" href="#t2509">2509</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2510" href="#t2510">2510</a></span><span class="t"> <span class="str">"skip-not-installable"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2511" href="#t2511">2511</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2512" href="#t2512">2512</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2513" href="#t2513">2513</a></span><span class="t"><span class="str"> This restrictions may cause a test to miss a regression due to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2514" href="#t2514">2514</a></span><span class="t"><span class="str"> installability issues, so use with caution. If one only wants to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2515" href="#t2515">2515</a></span><span class="t"><span class="str"> skip certain architectures, use the `Architecture` field for</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2516" href="#t2516">2516</a></span><span class="t"><span class="str"> that.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2517" href="#t2517">2517</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2518" href="#t2518">2518</a></span><span class="t"><span class="str"> This test might have test dependencies that can't be fulfilled in</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2519" href="#t2519">2519</a></span><span class="t"><span class="str"> all suites or in derivatives. Therefore, when apt-get installs the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2520" href="#t2520">2520</a></span><span class="t"><span class="str"> test dependencies, it will fail. Don't treat this as a test</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2521" href="#t2521">2521</a></span><span class="t"><span class="str"> failure, but instead treat it as if the test was skipped.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2522" href="#t2522">2522</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2523" href="#t2523">2523</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2524" href="#t2524">2524</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2525" href="#t2525">2525</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2526" href="#t2526">2526</a></span><span class="t"> <span class="str">"skippable"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2527" href="#t2527">2527</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2528" href="#t2528">2528</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2529" href="#t2529">2529</a></span><span class="t"><span class="str"> The test might need to be skipped for reasons that cannot be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2530" href="#t2530">2530</a></span><span class="t"><span class="str"> described by an existing restriction such as isolation-machine or</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2531" href="#t2531">2531</a></span><span class="t"><span class="str"> breaks-testbed, but must instead be detected at runtime. If the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2532" href="#t2532">2532</a></span><span class="t"><span class="str"> test exits with status 77 (a convention borrowed from Automake), it</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2533" href="#t2533">2533</a></span><span class="t"><span class="str"> will be treated as though it had been skipped. If it exits with any</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2534" href="#t2534">2534</a></span><span class="t"><span class="str"> other status, its success or failure will be derived from the exit</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2535" href="#t2535">2535</a></span><span class="t"><span class="str"> status and stderr as usual. Test authors must be careful to ensure</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2536" href="#t2536">2536</a></span><span class="t"><span class="str"> that `skippable` tests never exit with status 77 for reasons that</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2537" href="#t2537">2537</a></span><span class="t"><span class="str"> should be treated as a failure.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2538" href="#t2538">2538</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2539" href="#t2539">2539</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2540" href="#t2540">2540</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2541" href="#t2541">2541</a></span><span class="t"> <span class="nam">Keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2542" href="#t2542">2542</a></span><span class="t"> <span class="str">"superficial"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2543" href="#t2543">2543</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2544" href="#t2544">2544</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2545" href="#t2545">2545</a></span><span class="t"><span class="str"> The test does not provide significant test coverage, so if it</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2546" href="#t2546">2546</a></span><span class="t"><span class="str"> passes, that does not necessarily mean that the package under test</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2547" href="#t2547">2547</a></span><span class="t"><span class="str"> is actually functional. If a `superficial` test fails, it will be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2548" href="#t2548">2548</a></span><span class="t"><span class="str"> treated like any other failing test, but if it succeeds, this is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2549" href="#t2549">2549</a></span><span class="t"><span class="str"> only a weak indication of success. Continuous integration systems</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2550" href="#t2550">2550</a></span><span class="t"><span class="str"> should treat a package where all non-superficial tests are skipped as</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2551" href="#t2551">2551</a></span><span class="t"><span class="str"> equivalent to a package where all tests are skipped.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2552" href="#t2552">2552</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2553" href="#t2553">2553</a></span><span class="t"><span class="str"> For example, a C library might have a superficial test that simply</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2554" href="#t2554">2554</a></span><span class="t"><span class="str"> compiles, links and executes a "hello world" program against the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2555" href="#t2555">2555</a></span><span class="t"><span class="str"> library under test but does not attempt to make use of the library's</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2556" href="#t2556">2556</a></span><span class="t"><span class="str"> functionality, while a Python or Perl library might have a</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2557" href="#t2557">2557</a></span><span class="t"><span class="str"> superficial test that runs `import foo` or `require Foo;` but</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2558" href="#t2558">2558</a></span><span class="t"><span class="str"> does not attempt to use the library beyond that.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2559" href="#t2559">2559</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2560" href="#t2560">2560</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2561" href="#t2561">2561</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2562" href="#t2562">2562</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2563" href="#t2563">2563</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2564" href="#t2564">2564</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2565" href="#t2565">2565</a></span><span class="t"><span class="str"> Declares some restrictions or problems with the tests defined in</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2566" href="#t2566">2566</a></span><span class="t"><span class="str"> this stanza. Depending on the test environment capabilities, user</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2567" href="#t2567">2567</a></span><span class="t"><span class="str"> requests, and so on, restrictions can cause tests to be skipped or</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2568" href="#t2568">2568</a></span><span class="t"><span class="str"> can cause the test to be run in a different manner. Tests which</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2569" href="#t2569">2569</a></span><span class="t"><span class="str"> declare unknown restrictions will be skipped. See below for the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2570" href="#t2570">2570</a></span><span class="t"><span class="str"> defined restrictions.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2571" href="#t2571">2571</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2572" href="#t2572">2572</a></span><span class="t"><span class="str"> Restrictions are separated by commas and/or whitespace.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2573" href="#t2573">2573</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2574" href="#t2574">2574</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2575" href="#t2575">2575</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2576" href="#t2576">2576</a></span><span class="t"> <span class="nam">Deb822KnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2577" href="#t2577">2577</a></span><span class="t"> <span class="str">"Tests"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2578" href="#t2578">2578</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">COMMA_OR_SPACE_SEPARATED_LIST</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2579" href="#t2579">2579</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2580" href="#t2580">2580</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2581" href="#t2581">2581</a></span><span class="t"><span class="str"> This field names the tests which are defined by this stanza, and map</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2582" href="#t2582">2582</a></span><span class="t"><span class="str"> to executables/scripts in the test directory. All of the other</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2583" href="#t2583">2583</a></span><span class="t"><span class="str"> fields in the same stanza apply to all of the named tests. Either</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2584" href="#t2584">2584</a></span><span class="t"><span class="str"> this field or `Test-Command:` must be present.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2585" href="#t2585">2585</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2586" href="#t2586">2586</a></span><span class="t"><span class="str"> Test names are separated by comma and/or whitespace and should</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2587" href="#t2587">2587</a></span><span class="t"><span class="str"> contain only characters which are legal in package names. It is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2588" href="#t2588">2588</a></span><span class="t"><span class="str"> permitted, but not encouraged, to use upper-case characters as well.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2589" href="#t2589">2589</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2590" href="#t2590">2590</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2591" href="#t2591">2591</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2592" href="#t2592">2592</a></span><span class="t"> <span class="nam">Deb822KnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2593" href="#t2593">2593</a></span><span class="t"> <span class="str">"Test-Command"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2594" href="#t2594">2594</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">FREE_TEXT_FIELD</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2595" href="#t2595">2595</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2596" href="#t2596">2596</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2597" href="#t2597">2597</a></span><span class="t"><span class="str"> If your test only contains a shell command or two, or you want to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2598" href="#t2598">2598</a></span><span class="t"><span class="str"> reuse an existing upstream test executable and just need to wrap it</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2599" href="#t2599">2599</a></span><span class="t"><span class="str"> with some command like `dbus-launch` or `env`, you can use this</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2600" href="#t2600">2600</a></span><span class="t"><span class="str"> field to specify the shell command directly. It will be run under</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2601" href="#t2601">2601</a></span><span class="t"><span class="str"> `bash -e`. This is mutually exclusive with the `Tests:` field.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2602" href="#t2602">2602</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2603" href="#t2603">2603</a></span><span class="t"><span class="str"> This is also useful for running the same script under different</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2604" href="#t2604">2604</a></span><span class="t"><span class="str"> interpreters and/or with different dependencies, such as</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2605" href="#t2605">2605</a></span><span class="t"><span class="str"> `Test-Command: python debian/tests/mytest.py` and</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2606" href="#t2606">2606</a></span><span class="t"><span class="str"> `Test-Command: python3 debian/tests/mytest.py`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2607" href="#t2607">2607</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2608" href="#t2608">2608</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2609" href="#t2609">2609</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2610" href="#t2610">2610</a></span><span class="t"> <span class="nam">Deb822KnownField</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2611" href="#t2611">2611</a></span><span class="t"> <span class="str">"Test-Directory"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2612" href="#t2612">2612</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">FREE_TEXT_FIELD</span><span class="op">,</span> <span class="com"># TODO: Single path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2613" href="#t2613">2613</a></span><span class="t"> <span class="nam">hover_text</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2614" href="#t2614">2614</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2615" href="#t2615">2615</a></span><span class="t"><span class="str"> Replaces the path segment `debian/tests` in the filenames of the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2616" href="#t2616">2616</a></span><span class="t"><span class="str"> test programs with `path`. I. e., the tests are run by executing</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2617" href="#t2617">2617</a></span><span class="t"><span class="str"> `built/source/tree/path/testname`. `path` must be a relative</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2618" href="#t2618">2618</a></span><span class="t"><span class="str"> path and is interpreted starting from the root of the built source</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2619" href="#t2619">2619</a></span><span class="t"><span class="str"> tree.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2620" href="#t2620">2620</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2621" href="#t2621">2621</a></span><span class="t"><span class="str"> This allows tests to live outside the `debian/` metadata area, so that</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2622" href="#t2622">2622</a></span><span class="t"><span class="str"> they can more palatably be shared with non-Debian distributions.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2623" href="#t2623">2623</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2624" href="#t2624">2624</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2625" href="#t2625">2625</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2626" href="#t2626">2626</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2627" href="#t2627">2627</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2628" href="#t2628">2628</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2629" href="#t2629">2629</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2630" href="#t2630">2630</a></span><span class="t"><span class="key">class</span> <span class="nam">StanzaMetadata</span><span class="op">(</span><span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">F</span><span class="op">]</span><span class="op">,</span> <span class="nam">Generic</span><span class="op">[</span><span class="nam">F</span><span class="op">]</span><span class="op">,</span> <span class="nam">ABC</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2631" href="#t2631">2631</a></span><span class="t"> <span class="nam">stanza_type_name</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2632" href="#t2632">2632</a></span><span class="t"> <span class="nam">stanza_fields</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">F</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2633" href="#t2633">2633</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2634" href="#t2634">2634</a></span><span class="t"> <span class="key">def</span> <span class="nam">stanza_diagnostics</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2635" href="#t2635">2635</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2636" href="#t2636">2636</a></span><span class="t"> <span class="nam">stanza</span><span class="op">:</span> <span class="nam">Deb822ParagraphElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2637" href="#t2637">2637</a></span><span class="t"> <span class="nam">stanza_position_in_file</span><span class="op">:</span> <span class="str">"TEPosition"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2638" href="#t2638">2638</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t2639" href="#t2639">2639</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2640" href="#t2640">2640</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2641" href="#t2641">2641</a></span><span class="t"> <span class="key">def</span> <span class="nam">__getitem__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">key</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">F</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2642" href="#t2642">2642</a></span><span class="t"> <span class="nam">key_lc</span> <span class="op">=</span> <span class="nam">key</span><span class="op">.</span><span class="nam">lower</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2643" href="#t2643">2643</a></span><span class="t"> <span class="nam">key_norm</span> <span class="op">=</span> <span class="nam">normalize_dctrl_field_name</span><span class="op">(</span><span class="nam">key_lc</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2644" href="#t2644">2644</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">stanza_fields</span><span class="op">[</span><span class="nam">key_norm</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2645" href="#t2645">2645</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2646" href="#t2646">2646</a></span><span class="t"> <span class="key">def</span> <span class="nam">__len__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2647" href="#t2647">2647</a></span><span class="t"> <span class="key">return</span> <span class="nam">len</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">stanza_fields</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2648" href="#t2648">2648</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2649" href="#t2649">2649</a></span><span class="t"> <span class="key">def</span> <span class="nam">__iter__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2650" href="#t2650">2650</a></span><span class="t"> <span class="key">return</span> <span class="nam">iter</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">stanza_fields</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2651" href="#t2651">2651</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2652" href="#t2652">2652</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2653" href="#t2653">2653</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2654" href="#t2654">2654</a></span><span class="t"><span class="key">class</span> <span class="nam">Dep5StanzaMetadata</span><span class="op">(</span><span class="nam">StanzaMetadata</span><span class="op">[</span><span class="nam">Deb822KnownField</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2655" href="#t2655">2655</a></span><span class="t"> <span class="key">def</span> <span class="nam">stanza_diagnostics</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2656" href="#t2656">2656</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2657" href="#t2657">2657</a></span><span class="t"> <span class="nam">stanza</span><span class="op">:</span> <span class="nam">Deb822ParagraphElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2658" href="#t2658">2658</a></span><span class="t"> <span class="nam">stanza_position_in_file</span><span class="op">:</span> <span class="str">"TEPosition"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2659" href="#t2659">2659</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2660" href="#t2660">2660</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2661" href="#t2661">2661</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2662" href="#t2662">2662</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2663" href="#t2663">2663</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2664" href="#t2664">2664</a></span><span class="t"><span class="key">class</span> <span class="nam">DctrlStanzaMetadata</span><span class="op">(</span><span class="nam">StanzaMetadata</span><span class="op">[</span><span class="nam">DctrlKnownField</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2665" href="#t2665">2665</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2666" href="#t2666">2666</a></span><span class="t"> <span class="key">def</span> <span class="nam">stanza_diagnostics</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2667" href="#t2667">2667</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2668" href="#t2668">2668</a></span><span class="t"> <span class="nam">stanza</span><span class="op">:</span> <span class="nam">Deb822ParagraphElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2669" href="#t2669">2669</a></span><span class="t"> <span class="nam">stanza_position_in_file</span><span class="op">:</span> <span class="str">"TEPosition"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2670" href="#t2670">2670</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2671" href="#t2671">2671</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2672" href="#t2672">2672</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2673" href="#t2673">2673</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2674" href="#t2674">2674</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2675" href="#t2675">2675</a></span><span class="t"><span class="key">class</span> <span class="nam">DTestsCtrlStanzaMetadata</span><span class="op">(</span><span class="nam">StanzaMetadata</span><span class="op">[</span><span class="nam">Deb822KnownField</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2676" href="#t2676">2676</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2677" href="#t2677">2677</a></span><span class="t"> <span class="key">def</span> <span class="nam">stanza_diagnostics</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2678" href="#t2678">2678</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2679" href="#t2679">2679</a></span><span class="t"> <span class="nam">stanza</span><span class="op">:</span> <span class="nam">Deb822ParagraphElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2680" href="#t2680">2680</a></span><span class="t"> <span class="nam">stanza_position_in_file</span><span class="op">:</span> <span class="str">"TEPosition"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2681" href="#t2681">2681</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2682" href="#t2682">2682</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2683" href="#t2683">2683</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2684" href="#t2684">2684</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2685" href="#t2685">2685</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822FileMetadata</span><span class="op">(</span><span class="nam">Generic</span><span class="op">[</span><span class="nam">S</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2686" href="#t2686">2686</a></span><span class="t"> <span class="key">def</span> <span class="nam">classify_stanza</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">stanza</span><span class="op">:</span> <span class="nam">Deb822ParagraphElement</span><span class="op">,</span> <span class="nam">stanza_idx</span><span class="op">:</span> <span class="nam">int</span><span class="op">)</span> <span class="op">-></span> <span class="nam">S</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2687" href="#t2687">2687</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">guess_stanza_classification_by_idx</span><span class="op">(</span><span class="nam">stanza_idx</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2688" href="#t2688">2688</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2689" href="#t2689">2689</a></span><span class="t"> <span class="key">def</span> <span class="nam">guess_stanza_classification_by_idx</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">stanza_idx</span><span class="op">:</span> <span class="nam">int</span><span class="op">)</span> <span class="op">-></span> <span class="nam">S</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t2690" href="#t2690">2690</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2691" href="#t2691">2691</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2692" href="#t2692">2692</a></span><span class="t"> <span class="key">def</span> <span class="nam">stanza_types</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">S</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t2693" href="#t2693">2693</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2694" href="#t2694">2694</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2695" href="#t2695">2695</a></span><span class="t"> <span class="key">def</span> <span class="nam">__getitem__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">item</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">S</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t2696" href="#t2696">2696</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2697" href="#t2697">2697</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2698" href="#t2698">2698</a></span><span class="t"> <span class="key">def</span> <span class="nam">file_diagnostics</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2699" href="#t2699">2699</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2700" href="#t2700">2700</a></span><span class="t"> <span class="nam">file</span><span class="op">:</span> <span class="nam">Deb822FileElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2701" href="#t2701">2701</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t2702" href="#t2702">2702</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2703" href="#t2703">2703</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2704" href="#t2704">2704</a></span><span class="t"> <span class="key">def</span> <span class="nam">get</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">item</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">S</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2705" href="#t2705">2705</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2706" href="#t2706">2706</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">[</span><span class="nam">item</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2707" href="#t2707">2707</a></span><span class="t"> <span class="key">except</span> <span class="nam">KeyError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2708" href="#t2708">2708</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2709" href="#t2709">2709</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2710" href="#t2710">2710</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2711" href="#t2711">2711</a></span><span class="t"><span class="nam">_DCTRL_SOURCE_STANZA</span> <span class="op">=</span> <span class="nam">DctrlStanzaMetadata</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2712" href="#t2712">2712</a></span><span class="t"> <span class="str">"Source"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2713" href="#t2713">2713</a></span><span class="t"> <span class="nam">SOURCE_FIELDS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2714" href="#t2714">2714</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2715" href="#t2715">2715</a></span><span class="t"><span class="nam">_DCTRL_PACKAGE_STANZA</span> <span class="op">=</span> <span class="nam">DctrlStanzaMetadata</span><span class="op">(</span><span class="str">"Package"</span><span class="op">,</span> <span class="nam">BINARY_FIELDS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2716" href="#t2716">2716</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2717" href="#t2717">2717</a></span><span class="t"><span class="nam">_DEP5_HEADER_STANZA</span> <span class="op">=</span> <span class="nam">Dep5StanzaMetadata</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2718" href="#t2718">2718</a></span><span class="t"> <span class="str">"Header"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2719" href="#t2719">2719</a></span><span class="t"> <span class="nam">_DEP5_HEADER_FIELDS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2720" href="#t2720">2720</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2721" href="#t2721">2721</a></span><span class="t"><span class="nam">_DEP5_FILES_STANZA</span> <span class="op">=</span> <span class="nam">Dep5StanzaMetadata</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2722" href="#t2722">2722</a></span><span class="t"> <span class="str">"Files"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2723" href="#t2723">2723</a></span><span class="t"> <span class="nam">_DEP5_FILES_FIELDS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2724" href="#t2724">2724</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2725" href="#t2725">2725</a></span><span class="t"><span class="nam">_DEP5_LICENSE_STANZA</span> <span class="op">=</span> <span class="nam">Dep5StanzaMetadata</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2726" href="#t2726">2726</a></span><span class="t"> <span class="str">"License"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2727" href="#t2727">2727</a></span><span class="t"> <span class="nam">_DEP5_LICENSE_FIELDS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2728" href="#t2728">2728</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2729" href="#t2729">2729</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2730" href="#t2730">2730</a></span><span class="t"><span class="nam">_DTESTSCTRL_STANZA</span> <span class="op">=</span> <span class="nam">DTestsCtrlStanzaMetadata</span><span class="op">(</span><span class="str">"Tests"</span><span class="op">,</span> <span class="nam">_DTESTSCTRL_FIELDS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2731" href="#t2731">2731</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2732" href="#t2732">2732</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2733" href="#t2733">2733</a></span><span class="t"><span class="key">class</span> <span class="nam">Dep5FileMetadata</span><span class="op">(</span><span class="nam">Deb822FileMetadata</span><span class="op">[</span><span class="nam">Dep5StanzaMetadata</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2734" href="#t2734">2734</a></span><span class="t"> <span class="key">def</span> <span class="nam">classify_stanza</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">stanza</span><span class="op">:</span> <span class="nam">Deb822ParagraphElement</span><span class="op">,</span> <span class="nam">stanza_idx</span><span class="op">:</span> <span class="nam">int</span><span class="op">)</span> <span class="op">-></span> <span class="nam">S</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2735" href="#t2735">2735</a></span><span class="t"> <span class="key">if</span> <span class="nam">stanza_idx</span> <span class="op">==</span> <span class="num">0</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2736" href="#t2736">2736</a></span><span class="t"> <span class="key">return</span> <span class="nam">_DEP5_HEADER_STANZA</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2737" href="#t2737">2737</a></span><span class="t"> <span class="key">if</span> <span class="nam">stanza_idx</span> <span class="op">></span> <span class="num">0</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2738" href="#t2738">2738</a></span><span class="t"> <span class="key">if</span> <span class="str">"Files"</span> <span class="key">in</span> <span class="nam">stanza</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2739" href="#t2739">2739</a></span><span class="t"> <span class="key">return</span> <span class="nam">_DEP5_FILES_STANZA</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2740" href="#t2740">2740</a></span><span class="t"> <span class="key">return</span> <span class="nam">_DEP5_LICENSE_STANZA</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2741" href="#t2741">2741</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"The stanza_idx must be 0 or greater"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2742" href="#t2742">2742</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2743" href="#t2743">2743</a></span><span class="t"> <span class="key">def</span> <span class="nam">guess_stanza_classification_by_idx</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">stanza_idx</span><span class="op">:</span> <span class="nam">int</span><span class="op">)</span> <span class="op">-></span> <span class="nam">S</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2744" href="#t2744">2744</a></span><span class="t"> <span class="key">if</span> <span class="nam">stanza_idx</span> <span class="op">==</span> <span class="num">0</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2745" href="#t2745">2745</a></span><span class="t"> <span class="key">return</span> <span class="nam">_DEP5_HEADER_STANZA</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2746" href="#t2746">2746</a></span><span class="t"> <span class="key">if</span> <span class="nam">stanza_idx</span> <span class="op">></span> <span class="num">0</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2747" href="#t2747">2747</a></span><span class="t"> <span class="key">return</span> <span class="nam">_DEP5_FILES_STANZA</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2748" href="#t2748">2748</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"The stanza_idx must be 0 or greater"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2749" href="#t2749">2749</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2750" href="#t2750">2750</a></span><span class="t"> <span class="key">def</span> <span class="nam">stanza_types</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">S</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2751" href="#t2751">2751</a></span><span class="t"> <span class="key">yield</span> <span class="nam">_DEP5_HEADER_STANZA</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2752" href="#t2752">2752</a></span><span class="t"> <span class="key">yield</span> <span class="nam">_DEP5_FILES_STANZA</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2753" href="#t2753">2753</a></span><span class="t"> <span class="key">yield</span> <span class="nam">_DEP5_LICENSE_STANZA</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2754" href="#t2754">2754</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2755" href="#t2755">2755</a></span><span class="t"> <span class="key">def</span> <span class="nam">__getitem__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">item</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">S</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2756" href="#t2756">2756</a></span><span class="t"> <span class="key">if</span> <span class="nam">item</span> <span class="op">==</span> <span class="str">"Header"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2757" href="#t2757">2757</a></span><span class="t"> <span class="key">return</span> <span class="nam">_DEP5_FILES_STANZA</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2758" href="#t2758">2758</a></span><span class="t"> <span class="key">if</span> <span class="nam">item</span> <span class="op">==</span> <span class="str">"Files"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2759" href="#t2759">2759</a></span><span class="t"> <span class="key">return</span> <span class="nam">_DEP5_FILES_STANZA</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2760" href="#t2760">2760</a></span><span class="t"> <span class="key">if</span> <span class="nam">item</span> <span class="op">==</span> <span class="str">"License"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2761" href="#t2761">2761</a></span><span class="t"> <span class="key">return</span> <span class="nam">_DEP5_LICENSE_STANZA</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2762" href="#t2762">2762</a></span><span class="t"> <span class="key">raise</span> <span class="nam">KeyError</span><span class="op">(</span><span class="nam">item</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2763" href="#t2763">2763</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2764" href="#t2764">2764</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2765" href="#t2765">2765</a></span><span class="t"><span class="key">class</span> <span class="nam">DctrlFileMetadata</span><span class="op">(</span><span class="nam">Deb822FileMetadata</span><span class="op">[</span><span class="nam">DctrlStanzaMetadata</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2766" href="#t2766">2766</a></span><span class="t"> <span class="key">def</span> <span class="nam">guess_stanza_classification_by_idx</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">stanza_idx</span><span class="op">:</span> <span class="nam">int</span><span class="op">)</span> <span class="op">-></span> <span class="nam">S</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2767" href="#t2767">2767</a></span><span class="t"> <span class="key">if</span> <span class="nam">stanza_idx</span> <span class="op">==</span> <span class="num">0</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2767 ↛ 2768</span><span class="annotate long">line 2767 didn't jump to line 2768, because the condition on line 2767 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t2768" href="#t2768">2768</a></span><span class="t"> <span class="key">return</span> <span class="nam">_DCTRL_SOURCE_STANZA</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2769" href="#t2769">2769</a></span><span class="t"> <span class="key">if</span> <span class="nam">stanza_idx</span> <span class="op">></span> <span class="num">0</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2769 ↛ 2771</span><span class="annotate long">line 2769 didn't jump to line 2771, because the condition on line 2769 was never false</span></span></p> - <p class="run"><span class="n"><a id="t2770" href="#t2770">2770</a></span><span class="t"> <span class="key">return</span> <span class="nam">_DCTRL_PACKAGE_STANZA</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2771" href="#t2771">2771</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"The stanza_idx must be 0 or greater"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2772" href="#t2772">2772</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2773" href="#t2773">2773</a></span><span class="t"> <span class="key">def</span> <span class="nam">stanza_types</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">S</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2774" href="#t2774">2774</a></span><span class="t"> <span class="key">yield</span> <span class="nam">_DCTRL_SOURCE_STANZA</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2775" href="#t2775">2775</a></span><span class="t"> <span class="key">yield</span> <span class="nam">_DCTRL_PACKAGE_STANZA</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2776" href="#t2776">2776</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2777" href="#t2777">2777</a></span><span class="t"> <span class="key">def</span> <span class="nam">__getitem__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">item</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">S</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2778" href="#t2778">2778</a></span><span class="t"> <span class="key">if</span> <span class="nam">item</span> <span class="op">==</span> <span class="str">"Source"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2779" href="#t2779">2779</a></span><span class="t"> <span class="key">return</span> <span class="nam">_DCTRL_SOURCE_STANZA</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2780" href="#t2780">2780</a></span><span class="t"> <span class="key">if</span> <span class="nam">item</span> <span class="op">==</span> <span class="str">"Package"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2781" href="#t2781">2781</a></span><span class="t"> <span class="key">return</span> <span class="nam">_DCTRL_PACKAGE_STANZA</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2782" href="#t2782">2782</a></span><span class="t"> <span class="key">raise</span> <span class="nam">KeyError</span><span class="op">(</span><span class="nam">item</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2783" href="#t2783">2783</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2784" href="#t2784">2784</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2785" href="#t2785">2785</a></span><span class="t"><span class="key">class</span> <span class="nam">DTestsCtrlFileMetadata</span><span class="op">(</span><span class="nam">Deb822FileMetadata</span><span class="op">[</span><span class="nam">DctrlStanzaMetadata</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2786" href="#t2786">2786</a></span><span class="t"> <span class="key">def</span> <span class="nam">guess_stanza_classification_by_idx</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">stanza_idx</span><span class="op">:</span> <span class="nam">int</span><span class="op">)</span> <span class="op">-></span> <span class="nam">S</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2787" href="#t2787">2787</a></span><span class="t"> <span class="key">if</span> <span class="nam">stanza_idx</span> <span class="op">>=</span> <span class="num">0</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2788" href="#t2788">2788</a></span><span class="t"> <span class="key">return</span> <span class="nam">_DTESTSCTRL_STANZA</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2789" href="#t2789">2789</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"The stanza_idx must be 0 or greater"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2790" href="#t2790">2790</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2791" href="#t2791">2791</a></span><span class="t"> <span class="key">def</span> <span class="nam">stanza_types</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">S</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2792" href="#t2792">2792</a></span><span class="t"> <span class="key">yield</span> <span class="nam">_DTESTSCTRL_STANZA</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2793" href="#t2793">2793</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2794" href="#t2794">2794</a></span><span class="t"> <span class="key">def</span> <span class="nam">__getitem__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">item</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">S</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2795" href="#t2795">2795</a></span><span class="t"> <span class="key">if</span> <span class="nam">item</span> <span class="op">==</span> <span class="str">"Tests"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2796" href="#t2796">2796</a></span><span class="t"> <span class="key">return</span> <span class="nam">_DTESTSCTRL_STANZA</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2797" href="#t2797">2797</a></span><span class="t"> <span class="key">raise</span> <span class="nam">KeyError</span><span class="op">(</span><span class="nam">item</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_debian_control_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_debian_copyright_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_5d0ec0d5422112df_lsp_debian_copyright_py.html b/coverage-report/d_5d0ec0d5422112df_lsp_debian_copyright_py.html deleted file mode 100644 index 901b958..0000000 --- a/coverage-report/d_5d0ec0d5422112df_lsp_debian_copyright_py.html +++ /dev/null @@ -1,604 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/lsp/lsp_debian_copyright.py: 18%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/lsp/lsp_debian_copyright.py</b>: - <span class="pc_cov">18%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">173 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">36<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">137<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_debian_control_reference_data_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_debian_debputy_manifest_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">re</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> <span class="nam">Sequence</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="nam">Iterator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">Iterable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">Mapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">List</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"><span class="key">from</span> <span class="nam">lsprotocol</span><span class="op">.</span><span class="nam">types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">DiagnosticSeverity</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">Range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">Position</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">CompletionItem</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">CompletionList</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">CompletionParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">TEXT_DOCUMENT_WILL_SAVE_WAIT_UNTIL</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">DiagnosticRelatedInformation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="nam">Location</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">HoverParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="nam">Hover</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="nam">TEXT_DOCUMENT_CODE_ACTION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="nam">SemanticTokens</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="nam">SemanticTokensParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="nam">FoldingRangeParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="nam">FoldingRange</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">linting</span><span class="op">.</span><span class="nam">lint_util</span> <span class="key">import</span> <span class="nam">LintState</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">lsp_debian_control_reference_data</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="nam">_DEP5_HEADER_FIELDS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="nam">_DEP5_FILES_FIELDS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="nam">Deb822KnownField</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="nam">_DEP5_LICENSE_FIELDS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">Dep5FileMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">lsp_features</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">lint_diagnostics</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">lsp_completer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="nam">lsp_hover</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="nam">lsp_standard_handler</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="nam">lsp_folding_ranges</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="nam">lsp_semantic_tokens_full</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">lsp_generic_deb822</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="nam">deb822_completer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="nam">deb822_hover</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="nam">deb822_folding_ranges</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="nam">deb822_semantic_tokens_full</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">quickfixes</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">propose_correct_text_quick_fix</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">spellchecking</span> <span class="key">import</span> <span class="nam">default_spellchecker</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">text_util</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="nam">normalize_dctrl_field_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="nam">LintCapablePositionCodec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="nam">detect_possible_typo</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="nam">te_range_to_lsp</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">vendoring</span><span class="op">.</span><span class="nam">_deb822_repro</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="nam">parse_deb822_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="nam">Deb822FileElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="nam">Deb822ParagraphElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">vendoring</span><span class="op">.</span><span class="nam">_deb822_repro</span><span class="op">.</span><span class="nam">parsing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="nam">Deb822KeyValuePairElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="nam">LIST_SPACE_SEPARATED_INTERPRETATION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">vendoring</span><span class="op">.</span><span class="nam">_deb822_repro</span><span class="op">.</span><span class="nam">tokens</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="nam">Deb822Token</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"><span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">vendoring</span><span class="op">.</span><span class="nam">_deb822_repro</span><span class="op">.</span><span class="nam">locatable</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="nam">Position</span> <span class="key">as</span> <span class="nam">TEPosition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="nam">Range</span> <span class="key">as</span> <span class="nam">TERange</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="nam">START_POSITION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="key">from</span> <span class="nam">pygls</span><span class="op">.</span><span class="nam">server</span> <span class="key">import</span> <span class="nam">LanguageServer</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="key">from</span> <span class="nam">pygls</span><span class="op">.</span><span class="nam">workspace</span> <span class="key">import</span> <span class="nam">TextDocument</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"><span class="key">except</span> <span class="nam">ImportError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"><span class="nam">_CONTAINS_SPACE_OR_COLON</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r"[\s:]"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"><span class="nam">_LANGUAGE_IDS</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="str">"debian/copyright"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="com"># emacs's name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="str">"debian-copyright"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="com"># vim's name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="str">"debcopyright"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"><span class="nam">_DEP5_FILE_METADATA</span> <span class="op">=</span> <span class="nam">Dep5FileMetadata</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"><span class="nam">lsp_standard_handler</span><span class="op">(</span><span class="nam">_LANGUAGE_IDS</span><span class="op">,</span> <span class="nam">TEXT_DOCUMENT_CODE_ACTION</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"><span class="nam">lsp_standard_handler</span><span class="op">(</span><span class="nam">_LANGUAGE_IDS</span><span class="op">,</span> <span class="nam">TEXT_DOCUMENT_WILL_SAVE_WAIT_UNTIL</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"><span class="op">@</span><span class="nam">lsp_hover</span><span class="op">(</span><span class="nam">_LANGUAGE_IDS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"><span class="key">def</span> <span class="nam">_debian_copyright_hover</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="nam">ls</span><span class="op">:</span> <span class="str">"LanguageServer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="nam">params</span><span class="op">:</span> <span class="nam">HoverParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Hover</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="key">return</span> <span class="nam">deb822_hover</span><span class="op">(</span><span class="nam">ls</span><span class="op">,</span> <span class="nam">params</span><span class="op">,</span> <span class="nam">_DEP5_FILE_METADATA</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"><span class="op">@</span><span class="nam">lsp_completer</span><span class="op">(</span><span class="nam">_LANGUAGE_IDS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"><span class="key">def</span> <span class="nam">_debian_copyright_completions</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="nam">ls</span><span class="op">:</span> <span class="str">"LanguageServer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="nam">params</span><span class="op">:</span> <span class="nam">CompletionParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">CompletionList</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">CompletionItem</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="key">return</span> <span class="nam">deb822_completer</span><span class="op">(</span><span class="nam">ls</span><span class="op">,</span> <span class="nam">params</span><span class="op">,</span> <span class="nam">_DEP5_FILE_METADATA</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"><span class="op">@</span><span class="nam">lsp_folding_ranges</span><span class="op">(</span><span class="nam">_LANGUAGE_IDS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"><span class="key">def</span> <span class="nam">_debian_copyright_folding_ranges</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="nam">ls</span><span class="op">:</span> <span class="str">"LanguageServer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="nam">params</span><span class="op">:</span> <span class="nam">FoldingRangeParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Sequence</span><span class="op">[</span><span class="nam">FoldingRange</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="key">return</span> <span class="nam">deb822_folding_ranges</span><span class="op">(</span><span class="nam">ls</span><span class="op">,</span> <span class="nam">params</span><span class="op">,</span> <span class="nam">_DEP5_FILE_METADATA</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"><span class="key">def</span> <span class="nam">_deb822_token_iter</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="nam">tokens</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Deb822Token</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">Deb822Token</span><span class="op">,</span> <span class="nam">int</span><span class="op">,</span> <span class="nam">int</span><span class="op">,</span> <span class="nam">int</span><span class="op">,</span> <span class="nam">int</span><span class="op">,</span> <span class="nam">int</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="nam">line_no</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="nam">line_offset</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="key">for</span> <span class="nam">token</span> <span class="key">in</span> <span class="nam">tokens</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="nam">start_line</span> <span class="op">=</span> <span class="nam">line_no</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="nam">start_line_offset</span> <span class="op">=</span> <span class="nam">line_offset</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="nam">newlines</span> <span class="op">=</span> <span class="nam">token</span><span class="op">.</span><span class="nam">text</span><span class="op">.</span><span class="nam">count</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="nam">line_no</span> <span class="op">+=</span> <span class="nam">newlines</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="nam">text_len</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">token</span><span class="op">.</span><span class="nam">text</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="key">if</span> <span class="nam">newlines</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="key">if</span> <span class="nam">token</span><span class="op">.</span><span class="nam">text</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="nam">line_offset</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="com"># -2, one to remove the "\n" and one to get 0-offset</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="nam">line_offset</span> <span class="op">=</span> <span class="nam">text_len</span> <span class="op">-</span> <span class="nam">token</span><span class="op">.</span><span class="nam">text</span><span class="op">.</span><span class="nam">rindex</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span> <span class="op">-</span> <span class="num">2</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="nam">line_offset</span> <span class="op">+=</span> <span class="nam">text_len</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="key">yield</span> <span class="nam">token</span><span class="op">,</span> <span class="nam">start_line</span><span class="op">,</span> <span class="nam">start_line_offset</span><span class="op">,</span> <span class="nam">line_no</span><span class="op">,</span> <span class="nam">line_offset</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"><span class="key">def</span> <span class="nam">_paragraph_representation_field</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="nam">paragraph</span><span class="op">:</span> <span class="nam">Deb822ParagraphElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Deb822KeyValuePairElement</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="key">return</span> <span class="nam">next</span><span class="op">(</span><span class="nam">iter</span><span class="op">(</span><span class="nam">paragraph</span><span class="op">.</span><span class="nam">iter_parts_of_type</span><span class="op">(</span><span class="nam">Deb822KeyValuePairElement</span><span class="op">)</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"><span class="key">def</span> <span class="nam">_diagnostics_for_paragraph</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="nam">stanza</span><span class="op">:</span> <span class="nam">Deb822ParagraphElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="nam">stanza_position</span><span class="op">:</span> <span class="str">"TEPosition"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="nam">known_fields</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Deb822KnownField</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="nam">other_known_fields</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Deb822KnownField</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="nam">is_files_or_license_paragraph</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="nam">doc_reference</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">:</span> <span class="str">"LintCapablePositionCodec"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="nam">representation_field</span> <span class="op">=</span> <span class="nam">_paragraph_representation_field</span><span class="op">(</span><span class="nam">stanza</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">representation_field_pos</span> <span class="op">=</span> <span class="nam">representation_field</span><span class="op">.</span><span class="nam">position_in_parent</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="nam">stanza_position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="nam">representation_field_range_server_units</span> <span class="op">=</span> <span class="nam">te_range_to_lsp</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="nam">TERange</span><span class="op">.</span><span class="nam">from_position_and_size</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="nam">representation_field_pos</span><span class="op">,</span> <span class="nam">representation_field</span><span class="op">.</span><span class="nam">size</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="nam">representation_field_range</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="nam">representation_field_range_server_units</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="key">for</span> <span class="nam">known_field</span> <span class="key">in</span> <span class="nam">known_fields</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="nam">missing_field_severity</span> <span class="op">=</span> <span class="nam">known_field</span><span class="op">.</span><span class="nam">missing_field_severity</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="key">if</span> <span class="nam">missing_field_severity</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">known_field</span><span class="op">.</span><span class="nam">name</span> <span class="key">in</span> <span class="nam">stanza</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="nam">representation_field_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="str">f"Stanza is missing field {known_field.name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">missing_field_severity</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="nam">seen_fields</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="key">for</span> <span class="nam">kvpair</span> <span class="key">in</span> <span class="nam">stanza</span><span class="op">.</span><span class="nam">iter_parts_of_type</span><span class="op">(</span><span class="nam">Deb822KeyValuePairElement</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="nam">field_name_token</span> <span class="op">=</span> <span class="nam">kvpair</span><span class="op">.</span><span class="nam">field_token</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="nam">field_name</span> <span class="op">=</span> <span class="nam">field_name_token</span><span class="op">.</span><span class="nam">text</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="nam">field_name_lc</span> <span class="op">=</span> <span class="nam">field_name</span><span class="op">.</span><span class="nam">lower</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="nam">normalized_field_name_lc</span> <span class="op">=</span> <span class="nam">normalize_dctrl_field_name</span><span class="op">(</span><span class="nam">field_name_lc</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="nam">known_field</span> <span class="op">=</span> <span class="nam">known_fields</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">normalized_field_name_lc</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="nam">field_value</span> <span class="op">=</span> <span class="nam">stanza</span><span class="op">[</span><span class="nam">field_name</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="nam">field_range_te</span> <span class="op">=</span> <span class="nam">kvpair</span><span class="op">.</span><span class="nam">range_in_parent</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span><span class="nam">stanza_position</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="nam">field_position_te</span> <span class="op">=</span> <span class="nam">field_range_te</span><span class="op">.</span><span class="nam">start_pos</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="nam">field_range_server_units</span> <span class="op">=</span> <span class="nam">te_range_to_lsp</span><span class="op">(</span><span class="nam">field_range_te</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="nam">field_range</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="nam">field_range_server_units</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="nam">field_name_typo_detected</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="nam">existing_field_range</span> <span class="op">=</span> <span class="nam">seen_fields</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">normalized_field_name_lc</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing_field_range</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="nam">existing_field_range</span><span class="op">[</span><span class="num">3</span><span class="op">]</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">field_range</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="nam">normalized_field_name</span> <span class="op">=</span> <span class="nam">normalize_dctrl_field_name</span><span class="op">(</span><span class="nam">field_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="nam">seen_fields</span><span class="op">[</span><span class="nam">field_name_lc</span><span class="op">]</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="nam">field_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="nam">normalized_field_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="nam">field_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="op">[</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="key">if</span> <span class="nam">known_field</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="nam">candidates</span> <span class="op">=</span> <span class="nam">detect_possible_typo</span><span class="op">(</span><span class="nam">normalized_field_name_lc</span><span class="op">,</span> <span class="nam">known_fields</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="key">if</span> <span class="nam">candidates</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="nam">known_field</span> <span class="op">=</span> <span class="nam">known_fields</span><span class="op">[</span><span class="nam">candidates</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="nam">token_range_server_units</span> <span class="op">=</span> <span class="nam">te_range_to_lsp</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="nam">TERange</span><span class="op">.</span><span class="nam">from_position_and_size</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="nam">field_position_te</span><span class="op">,</span> <span class="nam">kvpair</span><span class="op">.</span><span class="nam">field_token</span><span class="op">.</span><span class="nam">size</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="nam">field_range</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="nam">token_range_server_units</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="nam">field_name_typo_detected</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="nam">field_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="str">f'The "{field_name}" looks like a typo of "{known_field.name}".'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Warning</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="nam">data</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="nam">propose_correct_text_quick_fix</span><span class="op">(</span><span class="nam">known_fields</span><span class="op">[</span><span class="nam">m</span><span class="op">]</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="key">for</span> <span class="nam">m</span> <span class="key">in</span> <span class="nam">candidates</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="key">if</span> <span class="nam">known_field</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="nam">known_else_where</span> <span class="op">=</span> <span class="nam">other_known_fields</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">normalized_field_name_lc</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="key">if</span> <span class="nam">known_else_where</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="nam">intended_usage</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="str">"Header"</span> <span class="key">if</span> <span class="nam">is_files_or_license_paragraph</span> <span class="key">else</span> <span class="str">"Files/License"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="nam">field_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="str">f'The {field_name} is defined for use in the "{intended_usage}" stanza.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="str">f" Please move it to the right place or remove it"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="key">if</span> <span class="nam">field_value</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span> <span class="op">==</span> <span class="str">""</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="nam">field_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="str">f"The {field_name} has no value. Either provide a value or remove it."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="nam">known_field</span><span class="op">.</span><span class="nam">field_diagnostics</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="nam">kvpair</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="nam">stanza</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="nam">stanza_position</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="nam">field_name_typo_reported</span><span class="op">=</span><span class="nam">field_name_typo_detected</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="key">if</span> <span class="nam">known_field</span><span class="op">.</span><span class="nam">spellcheck_value</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> <span class="nam">words</span> <span class="op">=</span> <span class="nam">kvpair</span><span class="op">.</span><span class="nam">interpret_as</span><span class="op">(</span><span class="nam">LIST_SPACE_SEPARATED_INTERPRETATION</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="nam">spell_checker</span> <span class="op">=</span> <span class="nam">default_spellchecker</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> <span class="nam">value_position</span> <span class="op">=</span> <span class="nam">kvpair</span><span class="op">.</span><span class="nam">value_element</span><span class="op">.</span><span class="nam">position_in_parent</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="nam">field_position_te</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="key">for</span> <span class="nam">word_ref</span> <span class="key">in</span> <span class="nam">words</span><span class="op">.</span><span class="nam">iter_value_references</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="nam">token</span> <span class="op">=</span> <span class="nam">word_ref</span><span class="op">.</span><span class="nam">value</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="key">for</span> <span class="nam">word</span><span class="op">,</span> <span class="nam">pos</span><span class="op">,</span> <span class="nam">endpos</span> <span class="key">in</span> <span class="nam">spell_checker</span><span class="op">.</span><span class="nam">iter_words</span><span class="op">(</span><span class="nam">token</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="nam">corrections</span> <span class="op">=</span> <span class="nam">spell_checker</span><span class="op">.</span><span class="nam">provide_corrections_for</span><span class="op">(</span><span class="nam">word</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">corrections</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="nam">word_loc</span> <span class="op">=</span> <span class="nam">word_ref</span><span class="op">.</span><span class="nam">locatable</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> <span class="nam">word_pos_te</span> <span class="op">=</span> <span class="nam">word_loc</span><span class="op">.</span><span class="nam">position_in_parent</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="nam">value_position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="key">if</span> <span class="nam">pos</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="nam">word_pos_te</span> <span class="op">=</span> <span class="nam">TEPosition</span><span class="op">(</span><span class="num">0</span><span class="op">,</span> <span class="nam">pos</span><span class="op">)</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span><span class="nam">word_pos_te</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="nam">word_range</span> <span class="op">=</span> <span class="nam">TERange</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="nam">START_POSITION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="nam">TEPosition</span><span class="op">(</span><span class="num">0</span><span class="op">,</span> <span class="nam">endpos</span> <span class="op">-</span> <span class="nam">pos</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="nam">word_range_server_units</span> <span class="op">=</span> <span class="nam">te_range_to_lsp</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="nam">TERange</span><span class="op">.</span><span class="nam">from_position_and_size</span><span class="op">(</span><span class="nam">word_pos_te</span><span class="op">,</span> <span class="nam">word_range</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="nam">word_range</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="nam">word_range_server_units</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="nam">word_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> <span class="str">f'Spelling "{word}"'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Hint</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> <span class="nam">data</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> <span class="nam">propose_correct_text_quick_fix</span><span class="op">(</span><span class="nam">c</span><span class="op">)</span> <span class="key">for</span> <span class="nam">c</span> <span class="key">in</span> <span class="nam">corrections</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> <span class="key">if</span> <span class="nam">known_field</span><span class="op">.</span><span class="nam">warn_if_default</span> <span class="key">and</span> <span class="nam">field_value</span> <span class="op">==</span> <span class="nam">known_field</span><span class="op">.</span><span class="nam">default_value</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> <span class="nam">field_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> <span class="str">f"The {field_name} is redundant as it is set to the default value and the field should only be"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> <span class="str">" used in exceptional cases."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Warning</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"> <span class="key">for</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"> <span class="nam">field_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"> <span class="nam">normalized_field_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> <span class="nam">field_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"> <span class="nam">duplicates</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"> <span class="op">)</span> <span class="key">in</span> <span class="nam">seen_fields</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">duplicates</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"> <span class="nam">related_information</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"> <span class="nam">DiagnosticRelatedInformation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"> <span class="nam">location</span><span class="op">=</span><span class="nam">Location</span><span class="op">(</span><span class="nam">doc_reference</span><span class="op">,</span> <span class="nam">field_range</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"> <span class="nam">message</span><span class="op">=</span><span class="str">f"First definition of {field_name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"> <span class="nam">related_information</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"> <span class="nam">DiagnosticRelatedInformation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"> <span class="nam">location</span><span class="op">=</span><span class="nam">Location</span><span class="op">(</span><span class="nam">doc_reference</span><span class="op">,</span> <span class="nam">r</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"> <span class="nam">message</span><span class="op">=</span><span class="str">f"Duplicate of {field_name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"> <span class="key">for</span> <span class="nam">r</span> <span class="key">in</span> <span class="nam">duplicates</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"> <span class="key">for</span> <span class="nam">dup_range</span> <span class="key">in</span> <span class="nam">duplicates</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"> <span class="nam">dup_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"> <span class="str">f"The {normalized_field_name} field name was used multiple times in this stanza."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"> <span class="str">f" Please ensure the field is only used once per stanza. Note that {normalized_field_name} and"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"> <span class="str">f" X[BCS]-{normalized_field_name} are considered the same field."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"> <span class="nam">related_information</span><span class="op">=</span><span class="nam">related_information</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"><span class="key">def</span> <span class="nam">_scan_for_syntax_errors_and_token_level_diagnostics</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"> <span class="nam">deb822_file</span><span class="op">:</span> <span class="nam">Deb822FileElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">:</span> <span class="nam">LintCapablePositionCodec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"> <span class="nam">first_error</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">lines</span><span class="op">)</span> <span class="op">+</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"> <span class="nam">spell_checker</span> <span class="op">=</span> <span class="nam">default_spellchecker</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"> <span class="key">for</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t385" href="#t385">385</a></span><span class="t"> <span class="nam">token</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t386" href="#t386">386</a></span><span class="t"> <span class="nam">start_line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t387" href="#t387">387</a></span><span class="t"> <span class="nam">start_offset</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t388" href="#t388">388</a></span><span class="t"> <span class="nam">end_line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t389" href="#t389">389</a></span><span class="t"> <span class="nam">end_offset</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t390" href="#t390">390</a></span><span class="t"> <span class="op">)</span> <span class="key">in</span> <span class="nam">_deb822_token_iter</span><span class="op">(</span><span class="nam">deb822_file</span><span class="op">.</span><span class="nam">iter_tokens</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t391" href="#t391">391</a></span><span class="t"> <span class="key">if</span> <span class="nam">token</span><span class="op">.</span><span class="nam">is_error</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t392" href="#t392">392</a></span><span class="t"> <span class="nam">first_error</span> <span class="op">=</span> <span class="nam">min</span><span class="op">(</span><span class="nam">first_error</span><span class="op">,</span> <span class="nam">start_line</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t393" href="#t393">393</a></span><span class="t"> <span class="nam">start_pos</span> <span class="op">=</span> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t394" href="#t394">394</a></span><span class="t"> <span class="nam">start_line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t395" href="#t395">395</a></span><span class="t"> <span class="nam">start_offset</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t396" href="#t396">396</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t397" href="#t397">397</a></span><span class="t"> <span class="nam">end_pos</span> <span class="op">=</span> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t398" href="#t398">398</a></span><span class="t"> <span class="nam">end_line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t399" href="#t399">399</a></span><span class="t"> <span class="nam">end_offset</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t400" href="#t400">400</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t401" href="#t401">401</a></span><span class="t"> <span class="nam">token_range</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t402" href="#t402">402</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> <span class="nam">Range</span><span class="op">(</span><span class="nam">start_pos</span><span class="op">,</span> <span class="nam">end_pos</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t403" href="#t403">403</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t404" href="#t404">404</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t405" href="#t405">405</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t406" href="#t406">406</a></span><span class="t"> <span class="nam">token_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t407" href="#t407">407</a></span><span class="t"> <span class="str">"Syntax error"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t408" href="#t408">408</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t409" href="#t409">409</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy (python-debian parser)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t410" href="#t410">410</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t411" href="#t411">411</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t412" href="#t412">412</a></span><span class="t"> <span class="key">elif</span> <span class="nam">token</span><span class="op">.</span><span class="nam">is_comment</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t413" href="#t413">413</a></span><span class="t"> <span class="key">for</span> <span class="nam">word</span><span class="op">,</span> <span class="nam">pos</span><span class="op">,</span> <span class="nam">end_pos</span> <span class="key">in</span> <span class="nam">spell_checker</span><span class="op">.</span><span class="nam">iter_words</span><span class="op">(</span><span class="nam">token</span><span class="op">.</span><span class="nam">text</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t414" href="#t414">414</a></span><span class="t"> <span class="nam">corrections</span> <span class="op">=</span> <span class="nam">spell_checker</span><span class="op">.</span><span class="nam">provide_corrections_for</span><span class="op">(</span><span class="nam">word</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t415" href="#t415">415</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">corrections</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t416" href="#t416">416</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t417" href="#t417">417</a></span><span class="t"> <span class="nam">start_pos</span> <span class="op">=</span> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t418" href="#t418">418</a></span><span class="t"> <span class="nam">start_line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t419" href="#t419">419</a></span><span class="t"> <span class="nam">pos</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t420" href="#t420">420</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t421" href="#t421">421</a></span><span class="t"> <span class="nam">end_pos</span> <span class="op">=</span> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t422" href="#t422">422</a></span><span class="t"> <span class="nam">start_line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t423" href="#t423">423</a></span><span class="t"> <span class="nam">end_pos</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t424" href="#t424">424</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t425" href="#t425">425</a></span><span class="t"> <span class="nam">word_range</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t426" href="#t426">426</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> <span class="nam">Range</span><span class="op">(</span><span class="nam">start_pos</span><span class="op">,</span> <span class="nam">end_pos</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t427" href="#t427">427</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t428" href="#t428">428</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t429" href="#t429">429</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t430" href="#t430">430</a></span><span class="t"> <span class="nam">word_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t431" href="#t431">431</a></span><span class="t"> <span class="str">f'Spelling "{word}"'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t432" href="#t432">432</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Hint</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t433" href="#t433">433</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t434" href="#t434">434</a></span><span class="t"> <span class="nam">data</span><span class="op">=</span><span class="op">[</span><span class="nam">propose_correct_text_quick_fix</span><span class="op">(</span><span class="nam">c</span><span class="op">)</span> <span class="key">for</span> <span class="nam">c</span> <span class="key">in</span> <span class="nam">corrections</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t435" href="#t435">435</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t436" href="#t436">436</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t437" href="#t437">437</a></span><span class="t"> <span class="key">return</span> <span class="nam">first_error</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t438" href="#t438">438</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t439" href="#t439">439</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t440" href="#t440">440</a></span><span class="t"><span class="op">@</span><span class="nam">lint_diagnostics</span><span class="op">(</span><span class="nam">_LANGUAGE_IDS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t441" href="#t441">441</a></span><span class="t"><span class="key">def</span> <span class="nam">_lint_debian_copyright</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t442" href="#t442">442</a></span><span class="t"> <span class="nam">lint_state</span><span class="op">:</span> <span class="nam">LintState</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t443" href="#t443">443</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t444" href="#t444">444</a></span><span class="t"> <span class="nam">lines</span> <span class="op">=</span> <span class="nam">lint_state</span><span class="op">.</span><span class="nam">lines</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t445" href="#t445">445</a></span><span class="t"> <span class="nam">position_codec</span> <span class="op">=</span> <span class="nam">lint_state</span><span class="op">.</span><span class="nam">position_codec</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t446" href="#t446">446</a></span><span class="t"> <span class="nam">doc_reference</span> <span class="op">=</span> <span class="nam">lint_state</span><span class="op">.</span><span class="nam">doc_uri</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t447" href="#t447">447</a></span><span class="t"> <span class="nam">diagnostics</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t448" href="#t448">448</a></span><span class="t"> <span class="nam">deb822_file</span> <span class="op">=</span> <span class="nam">parse_deb822_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t449" href="#t449">449</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t450" href="#t450">450</a></span><span class="t"> <span class="nam">accept_files_with_duplicated_fields</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t451" href="#t451">451</a></span><span class="t"> <span class="nam">accept_files_with_error_tokens</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t452" href="#t452">452</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t453" href="#t453">453</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t454" href="#t454">454</a></span><span class="t"> <span class="nam">first_error</span> <span class="op">=</span> <span class="nam">_scan_for_syntax_errors_and_token_level_diagnostics</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t455" href="#t455">455</a></span><span class="t"> <span class="nam">deb822_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t456" href="#t456">456</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t457" href="#t457">457</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t458" href="#t458">458</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t459" href="#t459">459</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t460" href="#t460">460</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t461" href="#t461">461</a></span><span class="t"> <span class="nam">paragraphs</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">deb822_file</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t462" href="#t462">462</a></span><span class="t"> <span class="nam">is_dep5</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t463" href="#t463">463</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t464" href="#t464">464</a></span><span class="t"> <span class="key">for</span> <span class="nam">paragraph_no</span><span class="op">,</span> <span class="nam">paragraph</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">paragraphs</span><span class="op">,</span> <span class="nam">start</span><span class="op">=</span><span class="num">1</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t465" href="#t465">465</a></span><span class="t"> <span class="nam">paragraph_pos</span> <span class="op">=</span> <span class="nam">paragraph</span><span class="op">.</span><span class="nam">position_in_file</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t466" href="#t466">466</a></span><span class="t"> <span class="key">if</span> <span class="nam">paragraph_pos</span><span class="op">.</span><span class="nam">line_position</span> <span class="op">>=</span> <span class="nam">first_error</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t467" href="#t467">467</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t468" href="#t468">468</a></span><span class="t"> <span class="nam">is_files_or_license_paragraph</span> <span class="op">=</span> <span class="nam">paragraph_no</span> <span class="op">!=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t469" href="#t469">469</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_files_or_license_paragraph</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t470" href="#t470">470</a></span><span class="t"> <span class="nam">known_fields</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t471" href="#t471">471</a></span><span class="t"> <span class="nam">_DEP5_FILES_FIELDS</span> <span class="key">if</span> <span class="str">"Files"</span> <span class="key">in</span> <span class="nam">paragraph</span> <span class="key">else</span> <span class="nam">_DEP5_LICENSE_FIELDS</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t472" href="#t472">472</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t473" href="#t473">473</a></span><span class="t"> <span class="nam">other_known_fields</span> <span class="op">=</span> <span class="nam">_DEP5_HEADER_FIELDS</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t474" href="#t474">474</a></span><span class="t"> <span class="key">elif</span> <span class="str">"Format"</span> <span class="key">in</span> <span class="nam">paragraph</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t475" href="#t475">475</a></span><span class="t"> <span class="nam">is_dep5</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t476" href="#t476">476</a></span><span class="t"> <span class="nam">known_fields</span> <span class="op">=</span> <span class="nam">_DEP5_HEADER_FIELDS</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t477" href="#t477">477</a></span><span class="t"> <span class="nam">other_known_fields</span> <span class="op">=</span> <span class="nam">_DEP5_FILES_FIELDS</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t478" href="#t478">478</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t479" href="#t479">479</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t480" href="#t480">480</a></span><span class="t"> <span class="nam">_diagnostics_for_paragraph</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t481" href="#t481">481</a></span><span class="t"> <span class="nam">paragraph</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t482" href="#t482">482</a></span><span class="t"> <span class="nam">paragraph_pos</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t483" href="#t483">483</a></span><span class="t"> <span class="nam">known_fields</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t484" href="#t484">484</a></span><span class="t"> <span class="nam">other_known_fields</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t485" href="#t485">485</a></span><span class="t"> <span class="nam">is_files_or_license_paragraph</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t486" href="#t486">486</a></span><span class="t"> <span class="nam">doc_reference</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t487" href="#t487">487</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t488" href="#t488">488</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t489" href="#t489">489</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t490" href="#t490">490</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t491" href="#t491">491</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">is_dep5</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t492" href="#t492">492</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t493" href="#t493">493</a></span><span class="t"> <span class="key">return</span> <span class="nam">diagnostics</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t494" href="#t494">494</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t495" href="#t495">495</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t496" href="#t496">496</a></span><span class="t"><span class="op">@</span><span class="nam">lsp_semantic_tokens_full</span><span class="op">(</span><span class="nam">_LANGUAGE_IDS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t497" href="#t497">497</a></span><span class="t"><span class="key">def</span> <span class="nam">_semantic_tokens_full</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t498" href="#t498">498</a></span><span class="t"> <span class="nam">ls</span><span class="op">:</span> <span class="str">"LanguageServer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t499" href="#t499">499</a></span><span class="t"> <span class="nam">request</span><span class="op">:</span> <span class="nam">SemanticTokensParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t500" href="#t500">500</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">SemanticTokens</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t501" href="#t501">501</a></span><span class="t"> <span class="key">return</span> <span class="nam">deb822_semantic_tokens_full</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t502" href="#t502">502</a></span><span class="t"> <span class="nam">ls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t503" href="#t503">503</a></span><span class="t"> <span class="nam">request</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t504" href="#t504">504</a></span><span class="t"> <span class="nam">_DEP5_FILE_METADATA</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t505" href="#t505">505</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_debian_control_reference_data_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_debian_debputy_manifest_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_5d0ec0d5422112df_lsp_debian_debputy_manifest_py.html b/coverage-report/d_5d0ec0d5422112df_lsp_debian_debputy_manifest_py.html deleted file mode 100644 index d21b364..0000000 --- a/coverage-report/d_5d0ec0d5422112df_lsp_debian_debputy_manifest_py.html +++ /dev/null @@ -1,1134 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/lsp/lsp_debian_debputy_manifest.py: 77%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/lsp/lsp_debian_debputy_manifest.py</b>: - <span class="pc_cov">77%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">467 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">372<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">95<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">43<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_debian_copyright_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_debian_rules_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"> <span class="nam">List</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">Iterable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">Sequence</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">Literal</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">get_args</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">get_origin</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"><span class="key">from</span> <span class="nam">lsprotocol</span><span class="op">.</span><span class="nam">types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">TEXT_DOCUMENT_WILL_SAVE_WAIT_UNTIL</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">Position</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">Range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">DiagnosticSeverity</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">HoverParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">Hover</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">MarkupKind</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="nam">MarkupContent</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">TEXT_DOCUMENT_CODE_ACTION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="nam">CompletionParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="nam">CompletionList</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="nam">CompletionItem</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="nam">DiagnosticRelatedInformation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="nam">Location</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">linting</span><span class="op">.</span><span class="nam">lint_util</span> <span class="key">import</span> <span class="nam">LintState</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">quickfixes</span> <span class="key">import</span> <span class="nam">propose_correct_text_quick_fix</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">base_types</span> <span class="key">import</span> <span class="nam">DebputyDispatchableType</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">feature_set</span> <span class="key">import</span> <span class="nam">PluginProvidedFeatureSet</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">yaml</span><span class="op">.</span><span class="nam">compat</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="nam">Node</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="nam">CommentedMap</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">LineCol</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="nam">CommentedSeq</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="nam">CommentedBase</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">MarkedYAMLError</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">YAMLError</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">highlevel_manifest</span> <span class="key">import</span> <span class="nam">MANIFEST_YAML</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">lsp_features</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="nam">lint_diagnostics</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="nam">lsp_standard_handler</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="nam">lsp_hover</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="nam">lsp_completer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">text_util</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="nam">LintCapablePositionCodec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="nam">detect_possible_typo</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">declarative_parser</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="nam">AttributeDescription</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="nam">ParserGenerator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="nam">DeclarativeNonMappingInputParser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">declarative_parser</span> <span class="key">import</span> <span class="nam">DeclarativeMappingInputParser</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">parser_doc</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="nam">render_rule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="nam">render_attribute_doc</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="nam">doc_args_for_parser_doc</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">AttributePath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">impl</span> <span class="key">import</span> <span class="nam">plugin_metadata_for_debputys_own_plugin</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">impl_types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="nam">OPARSER_MANIFEST_ROOT</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="nam">DeclarativeInputParser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="nam">DispatchingParserBase</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="nam">DebputyPluginMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="nam">ListWrappedDeclarativeInputParser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="nam">InPackageContextParser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="nam">DeclarativeValuelessKeywordInputParser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">_info</span><span class="op">,</span> <span class="nam">_warn</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"><span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="key">from</span> <span class="nam">pygls</span><span class="op">.</span><span class="nam">server</span> <span class="key">import</span> <span class="nam">LanguageServer</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">debputy_ls</span> <span class="key">import</span> <span class="nam">DebputyLanguageServer</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"><span class="key">except</span> <span class="nam">ImportError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"><span class="nam">_LANGUAGE_IDS</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="str">"debian/debputy.manifest"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="str">"debputy.manifest"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="com"># LSP's official language ID for YAML files</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="str">"yaml"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"><span class="nam">lsp_standard_handler</span><span class="op">(</span><span class="nam">_LANGUAGE_IDS</span><span class="op">,</span> <span class="nam">TEXT_DOCUMENT_CODE_ACTION</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"><span class="nam">lsp_standard_handler</span><span class="op">(</span><span class="nam">_LANGUAGE_IDS</span><span class="op">,</span> <span class="nam">TEXT_DOCUMENT_WILL_SAVE_WAIT_UNTIL</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"><span class="key">def</span> <span class="nam">is_valid_file</span><span class="op">(</span><span class="nam">path</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="com"># For debian/debputy.manifest, the language ID is often set to makefile meaning we get random</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="com"># "non-debian/debputy.manifest" YAML files here. Skip those.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="key">return</span> <span class="nam">path</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"debian/debputy.manifest"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"><span class="key">def</span> <span class="nam">_word_range_at_position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="nam">line_no</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="nam">char_offset</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Range</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="nam">line</span> <span class="op">=</span> <span class="nam">lines</span><span class="op">[</span><span class="nam">line_no</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="nam">line_len</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">line</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="nam">start_idx</span> <span class="op">=</span> <span class="nam">char_offset</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="nam">end_idx</span> <span class="op">=</span> <span class="nam">char_offset</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="key">while</span> <span class="nam">end_idx</span> <span class="op">+</span> <span class="num">1</span> <span class="op"><</span> <span class="nam">line_len</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">line</span><span class="op">[</span><span class="nam">end_idx</span> <span class="op">+</span> <span class="num">1</span><span class="op">]</span><span class="op">.</span><span class="nam">isspace</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="nam">end_idx</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="key">while</span> <span class="nam">start_idx</span> <span class="op">-</span> <span class="num">1</span> <span class="op">>=</span> <span class="num">0</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">line</span><span class="op">[</span><span class="nam">start_idx</span> <span class="op">-</span> <span class="num">1</span><span class="op">]</span><span class="op">.</span><span class="nam">isspace</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="nam">start_idx</span> <span class="op">-=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="key">return</span> <span class="nam">Range</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="nam">Position</span><span class="op">(</span><span class="nam">line_no</span><span class="op">,</span> <span class="nam">start_idx</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="nam">Position</span><span class="op">(</span><span class="nam">line_no</span><span class="op">,</span> <span class="nam">end_idx</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"><span class="op">@</span><span class="nam">lint_diagnostics</span><span class="op">(</span><span class="nam">_LANGUAGE_IDS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"><span class="key">def</span> <span class="nam">_lint_debian_debputy_manifest</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="nam">lint_state</span><span class="op">:</span> <span class="nam">LintState</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="nam">lines</span> <span class="op">=</span> <span class="nam">lint_state</span><span class="op">.</span><span class="nam">lines</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="nam">position_codec</span> <span class="op">=</span> <span class="nam">lint_state</span><span class="op">.</span><span class="nam">position_codec</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="nam">doc_reference</span> <span class="op">=</span> <span class="nam">lint_state</span><span class="op">.</span><span class="nam">doc_uri</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="nam">path</span> <span class="op">=</span> <span class="nam">lint_state</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">is_valid_file</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">136 ↛ 137</span><span class="annotate long">line 136 didn't jump to line 137, because the condition on line 136 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="nam">diagnostics</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="nam">content</span> <span class="op">=</span> <span class="nam">MANIFEST_YAML</span><span class="op">.</span><span class="nam">load</span><span class="op">(</span><span class="str">""</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">lines</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="key">except</span> <span class="nam">MarkedYAMLError</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="key">if</span> <span class="nam">e</span><span class="op">.</span><span class="nam">context_mark</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="nam">line</span> <span class="op">=</span> <span class="nam">e</span><span class="op">.</span><span class="nam">context_mark</span><span class="op">.</span><span class="nam">line</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="nam">column</span> <span class="op">=</span> <span class="nam">e</span><span class="op">.</span><span class="nam">context_mark</span><span class="op">.</span><span class="nam">column</span> <span class="op">+</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="nam">line</span> <span class="op">=</span> <span class="nam">e</span><span class="op">.</span><span class="nam">problem_mark</span><span class="op">.</span><span class="nam">line</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="nam">column</span> <span class="op">=</span> <span class="nam">e</span><span class="op">.</span><span class="nam">problem_mark</span><span class="op">.</span><span class="nam">column</span> <span class="op">+</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="nam">error_range</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="nam">_word_range_at_position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="nam">line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="nam">column</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="nam">error_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="str">f"YAML parse error: {e}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="key">except</span> <span class="nam">YAMLError</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="nam">error_range</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="nam">Range</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="nam">Position</span><span class="op">(</span><span class="num">0</span><span class="op">,</span> <span class="num">0</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="nam">Position</span><span class="op">(</span><span class="num">0</span><span class="op">,</span> <span class="nam">len</span><span class="op">(</span><span class="nam">lines</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">)</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">error_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="str">f"Unknown YAML parse error: {e} [{e!r}]"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="nam">feature_set</span> <span class="op">=</span> <span class="nam">lint_state</span><span class="op">.</span><span class="nam">plugin_feature_set</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="nam">pg</span> <span class="op">=</span> <span class="nam">feature_set</span><span class="op">.</span><span class="nam">manifest_parser_generator</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="nam">root_parser</span> <span class="op">=</span> <span class="nam">pg</span><span class="op">.</span><span class="nam">dispatchable_object_parsers</span><span class="op">[</span><span class="nam">OPARSER_MANIFEST_ROOT</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="nam">_lint_content</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="nam">doc_reference</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="nam">pg</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="nam">root_parser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="nam">content</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="key">return</span> <span class="nam">diagnostics</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"><span class="key">def</span> <span class="nam">_unknown_key</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="nam">key</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="nam">expected_keys</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="nam">line</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="nam">col</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">:</span> <span class="nam">LintCapablePositionCodec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="str">"Diagnostic"</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="nam">key_range</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="nam">Range</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="nam">line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="nam">col</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="nam">line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="nam">col</span> <span class="op">+</span> <span class="nam">len</span><span class="op">(</span><span class="nam">key</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="nam">candidates</span> <span class="op">=</span> <span class="nam">detect_possible_typo</span><span class="op">(</span><span class="nam">key</span><span class="op">,</span> <span class="nam">expected_keys</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="nam">extra</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="nam">corrected_key</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="key">if</span> <span class="nam">candidates</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="nam">extra</span> <span class="op">=</span> <span class="str">f' It looks like a typo of "{candidates[0]}".'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="com"># TODO: We should be able to tell that `install-doc` and `install-docs` are the same.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="com"># That would enable this to work in more cases.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="nam">corrected_key</span> <span class="op">=</span> <span class="nam">candidates</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">candidates</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span> <span class="key">else</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="nam">diagnostic</span> <span class="op">=</span> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="nam">key_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="str">f'Unknown or unsupported key "{key}".{extra}'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="nam">data</span><span class="op">=</span><span class="op">[</span><span class="nam">propose_correct_text_quick_fix</span><span class="op">(</span><span class="nam">n</span><span class="op">)</span> <span class="key">for</span> <span class="nam">n</span> <span class="key">in</span> <span class="nam">candidates</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="key">return</span> <span class="nam">diagnostic</span><span class="op">,</span> <span class="nam">corrected_key</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"><span class="key">def</span> <span class="nam">_conflicting_key</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="nam">uri</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="nam">key_a</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="nam">key_b</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="nam">key_a_line</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="nam">key_a_col</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="nam">key_b_line</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="nam">key_b_col</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">:</span> <span class="nam">LintCapablePositionCodec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="str">"Diagnostic"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="nam">key_a_range</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="nam">Range</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="nam">key_a_line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="nam">key_a_col</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="nam">key_a_line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="nam">key_a_col</span> <span class="op">+</span> <span class="nam">len</span><span class="op">(</span><span class="nam">key_a</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="nam">key_b_range</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="nam">Range</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="nam">key_b_line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="nam">key_b_col</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="nam">key_b_line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="nam">key_b_col</span> <span class="op">+</span> <span class="nam">len</span><span class="op">(</span><span class="nam">key_b</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="nam">key_a_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="str">f'The "{key_a}" cannot be used with "{key_b}".'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="nam">related_information</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="nam">DiagnosticRelatedInformation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="nam">location</span><span class="op">=</span><span class="nam">Location</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="nam">uri</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="nam">key_b_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="nam">message</span><span class="op">=</span><span class="str">f'The attribute "{key_b}" is used here.'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="nam">key_b_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="str">f'The "{key_b}" cannot be used with "{key_a}".'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> <span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> <span class="nam">related_information</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="nam">DiagnosticRelatedInformation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> <span class="nam">location</span><span class="op">=</span><span class="nam">Location</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="nam">uri</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="nam">key_a_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="nam">message</span><span class="op">=</span><span class="str">f'The attribute "{key_a}" is used here.'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"><span class="key">def</span> <span class="nam">_lint_attr_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="nam">uri</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="nam">attr</span><span class="op">:</span> <span class="nam">AttributeDescription</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="nam">pg</span><span class="op">:</span> <span class="nam">ParserGenerator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="nam">value</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">:</span> <span class="nam">LintCapablePositionCodec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="str">"Diagnostic"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="nam">attr_type</span> <span class="op">=</span> <span class="nam">attr</span><span class="op">.</span><span class="nam">attribute_type</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="nam">orig</span> <span class="op">=</span> <span class="nam">get_origin</span><span class="op">(</span><span class="nam">attr_type</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="nam">valid_values</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span> <span class="op">=</span> <span class="nam">tuple</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="key">if</span> <span class="nam">orig</span> <span class="op">==</span> <span class="nam">Literal</span><span class="op">:</span> </span><span class="r"><span class="annotate short">317 ↛ 318</span><span class="annotate long">line 317 didn't jump to line 318, because the condition on line 317 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="nam">valid_values</span> <span class="op">=</span> <span class="nam">get_args</span><span class="op">(</span><span class="nam">attr</span><span class="op">.</span><span class="nam">attribute_type</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="key">elif</span> <span class="nam">orig</span> <span class="op">==</span> <span class="nam">bool</span> <span class="key">or</span> <span class="nam">attr</span><span class="op">.</span><span class="nam">attribute_type</span> <span class="op">==</span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"><span class="annotate short">319 ↛ 320</span><span class="annotate long">line 319 didn't jump to line 320, because the condition on line 319 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="nam">valid_values</span> <span class="op">=</span> <span class="op">(</span><span class="str">"true"</span><span class="op">,</span> <span class="str">"false"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="key">elif</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">attr_type</span><span class="op">,</span> <span class="nam">type</span><span class="op">)</span> <span class="key">and</span> <span class="nam">issubclass</span><span class="op">(</span><span class="nam">attr_type</span><span class="op">,</span> <span class="nam">DebputyDispatchableType</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="nam">parser</span> <span class="op">=</span> <span class="nam">pg</span><span class="op">.</span><span class="nam">dispatch_parser_table_for</span><span class="op">(</span><span class="nam">attr_type</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">_lint_content</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> <span class="nam">uri</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> <span class="nam">pg</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> <span class="nam">parser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> <span class="nam">value</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> <span class="key">if</span> <span class="nam">value</span> <span class="key">in</span> <span class="nam">valid_values</span><span class="op">:</span> </span><span class="r"><span class="annotate short">333 ↛ 334</span><span class="annotate long">line 333 didn't jump to line 334, because the condition on line 333 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> <span class="com"># TODO: Emit diagnostic for broken values</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"><span class="key">def</span> <span class="nam">_lint_declarative_mapping_input_parser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> <span class="nam">uri</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"> <span class="nam">pg</span><span class="op">:</span> <span class="nam">ParserGenerator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"> <span class="nam">parser</span><span class="op">:</span> <span class="nam">DeclarativeMappingInputParser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"> <span class="nam">content</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">:</span> <span class="nam">LintCapablePositionCodec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="str">"Diagnostic"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">content</span><span class="op">,</span> <span class="nam">CommentedMap</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"> <span class="nam">lc</span> <span class="op">=</span> <span class="nam">content</span><span class="op">.</span><span class="nam">lc</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"> <span class="key">for</span> <span class="nam">key</span><span class="op">,</span> <span class="nam">value</span> <span class="key">in</span> <span class="nam">content</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"> <span class="nam">attr</span> <span class="op">=</span> <span class="nam">parser</span><span class="op">.</span><span class="nam">manifest_attributes</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"> <span class="nam">line</span><span class="op">,</span> <span class="nam">col</span> <span class="op">=</span> <span class="nam">lc</span><span class="op">.</span><span class="nam">key</span><span class="op">(</span><span class="nam">key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"> <span class="key">if</span> <span class="nam">attr</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"> <span class="nam">diag</span><span class="op">,</span> <span class="nam">corrected_key</span> <span class="op">=</span> <span class="nam">_unknown_key</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"> <span class="nam">key</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"> <span class="nam">parser</span><span class="op">.</span><span class="nam">manifest_attributes</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"> <span class="nam">line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"> <span class="nam">col</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"> <span class="key">yield</span> <span class="nam">diag</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"> <span class="key">if</span> <span class="nam">corrected_key</span><span class="op">:</span> </span><span class="r"><span class="annotate short">363 ↛ 364</span><span class="annotate long">line 363 didn't jump to line 364, because the condition on line 363 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"> <span class="nam">key</span> <span class="op">=</span> <span class="nam">corrected_key</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"> <span class="nam">attr</span> <span class="op">=</span> <span class="nam">parser</span><span class="op">.</span><span class="nam">manifest_attributes</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">corrected_key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"> <span class="key">if</span> <span class="nam">attr</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">_lint_attr_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"> <span class="nam">uri</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"> <span class="nam">attr</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"> <span class="nam">pg</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"> <span class="nam">value</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"> <span class="key">for</span> <span class="nam">forbidden_key</span> <span class="key">in</span> <span class="nam">attr</span><span class="op">.</span><span class="nam">conflicting_attributes</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"> <span class="key">if</span> <span class="nam">forbidden_key</span> <span class="key">in</span> <span class="nam">content</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"> <span class="nam">con_line</span><span class="op">,</span> <span class="nam">con_col</span> <span class="op">=</span> <span class="nam">lc</span><span class="op">.</span><span class="nam">key</span><span class="op">(</span><span class="nam">forbidden_key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">_conflicting_key</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"> <span class="nam">uri</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"> <span class="nam">key</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"> <span class="nam">forbidden_key</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t385" href="#t385">385</a></span><span class="t"> <span class="nam">line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t386" href="#t386">386</a></span><span class="t"> <span class="nam">col</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t387" href="#t387">387</a></span><span class="t"> <span class="nam">con_line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t388" href="#t388">388</a></span><span class="t"> <span class="nam">con_col</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t389" href="#t389">389</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t390" href="#t390">390</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t391" href="#t391">391</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t392" href="#t392">392</a></span><span class="t"> <span class="key">for</span> <span class="nam">mx</span> <span class="key">in</span> <span class="nam">parser</span><span class="op">.</span><span class="nam">mutually_exclusive_attributes</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t393" href="#t393">393</a></span><span class="t"> <span class="nam">matches</span> <span class="op">=</span> <span class="nam">content</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span> <span class="op">&</span> <span class="nam">mx</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t394" href="#t394">394</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">matches</span><span class="op">)</span> <span class="op"><</span> <span class="num">2</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t395" href="#t395">395</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t396" href="#t396">396</a></span><span class="t"> <span class="nam">key</span><span class="op">,</span> <span class="op">*</span><span class="nam">others</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">matches</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t397" href="#t397">397</a></span><span class="t"> <span class="nam">line</span><span class="op">,</span> <span class="nam">col</span> <span class="op">=</span> <span class="nam">lc</span><span class="op">.</span><span class="nam">key</span><span class="op">(</span><span class="nam">key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t398" href="#t398">398</a></span><span class="t"> <span class="key">for</span> <span class="nam">other</span> <span class="key">in</span> <span class="nam">others</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t399" href="#t399">399</a></span><span class="t"> <span class="nam">con_line</span><span class="op">,</span> <span class="nam">con_col</span> <span class="op">=</span> <span class="nam">lc</span><span class="op">.</span><span class="nam">key</span><span class="op">(</span><span class="nam">other</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t400" href="#t400">400</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">_conflicting_key</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t401" href="#t401">401</a></span><span class="t"> <span class="nam">uri</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t402" href="#t402">402</a></span><span class="t"> <span class="nam">key</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t403" href="#t403">403</a></span><span class="t"> <span class="nam">other</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t404" href="#t404">404</a></span><span class="t"> <span class="nam">line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t405" href="#t405">405</a></span><span class="t"> <span class="nam">col</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t406" href="#t406">406</a></span><span class="t"> <span class="nam">con_line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t407" href="#t407">407</a></span><span class="t"> <span class="nam">con_col</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t408" href="#t408">408</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t409" href="#t409">409</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t410" href="#t410">410</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t411" href="#t411">411</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t412" href="#t412">412</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t413" href="#t413">413</a></span><span class="t"><span class="key">def</span> <span class="nam">_lint_content</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t414" href="#t414">414</a></span><span class="t"> <span class="nam">uri</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t415" href="#t415">415</a></span><span class="t"> <span class="nam">pg</span><span class="op">:</span> <span class="nam">ParserGenerator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t416" href="#t416">416</a></span><span class="t"> <span class="nam">parser</span><span class="op">:</span> <span class="nam">DeclarativeInputParser</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t417" href="#t417">417</a></span><span class="t"> <span class="nam">content</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t418" href="#t418">418</a></span><span class="t"> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t419" href="#t419">419</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">:</span> <span class="nam">LintCapablePositionCodec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t420" href="#t420">420</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="str">"Diagnostic"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t421" href="#t421">421</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">parser</span><span class="op">,</span> <span class="nam">DispatchingParserBase</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t422" href="#t422">422</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">content</span><span class="op">,</span> <span class="nam">CommentedMap</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t423" href="#t423">423</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t424" href="#t424">424</a></span><span class="t"> <span class="nam">lc</span> <span class="op">=</span> <span class="nam">content</span><span class="op">.</span><span class="nam">lc</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t425" href="#t425">425</a></span><span class="t"> <span class="key">for</span> <span class="nam">key</span><span class="op">,</span> <span class="nam">value</span> <span class="key">in</span> <span class="nam">content</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t426" href="#t426">426</a></span><span class="t"> <span class="nam">is_known</span> <span class="op">=</span> <span class="nam">parser</span><span class="op">.</span><span class="nam">is_known_keyword</span><span class="op">(</span><span class="nam">key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t427" href="#t427">427</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">is_known</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t428" href="#t428">428</a></span><span class="t"> <span class="nam">line</span><span class="op">,</span> <span class="nam">col</span> <span class="op">=</span> <span class="nam">lc</span><span class="op">.</span><span class="nam">key</span><span class="op">(</span><span class="nam">key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t429" href="#t429">429</a></span><span class="t"> <span class="nam">diag</span><span class="op">,</span> <span class="nam">corrected_key</span> <span class="op">=</span> <span class="nam">_unknown_key</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t430" href="#t430">430</a></span><span class="t"> <span class="nam">key</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t431" href="#t431">431</a></span><span class="t"> <span class="nam">parser</span><span class="op">.</span><span class="nam">registered_keywords</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t432" href="#t432">432</a></span><span class="t"> <span class="nam">line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t433" href="#t433">433</a></span><span class="t"> <span class="nam">col</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t434" href="#t434">434</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t435" href="#t435">435</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t436" href="#t436">436</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t437" href="#t437">437</a></span><span class="t"> <span class="key">yield</span> <span class="nam">diag</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t438" href="#t438">438</a></span><span class="t"> <span class="key">if</span> <span class="nam">corrected_key</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t439" href="#t439">439</a></span><span class="t"> <span class="nam">key</span> <span class="op">=</span> <span class="nam">corrected_key</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t440" href="#t440">440</a></span><span class="t"> <span class="nam">is_known</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t441" href="#t441">441</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t442" href="#t442">442</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_known</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t443" href="#t443">443</a></span><span class="t"> <span class="nam">subparser</span> <span class="op">=</span> <span class="nam">parser</span><span class="op">.</span><span class="nam">parser_for</span><span class="op">(</span><span class="nam">key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t444" href="#t444">444</a></span><span class="t"> <span class="key">assert</span> <span class="nam">subparser</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t445" href="#t445">445</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">_lint_content</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t446" href="#t446">446</a></span><span class="t"> <span class="nam">uri</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t447" href="#t447">447</a></span><span class="t"> <span class="nam">pg</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t448" href="#t448">448</a></span><span class="t"> <span class="nam">subparser</span><span class="op">.</span><span class="nam">parser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t449" href="#t449">449</a></span><span class="t"> <span class="nam">value</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t450" href="#t450">450</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t451" href="#t451">451</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t452" href="#t452">452</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t453" href="#t453">453</a></span><span class="t"> <span class="key">elif</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">parser</span><span class="op">,</span> <span class="nam">ListWrappedDeclarativeInputParser</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t454" href="#t454">454</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">content</span><span class="op">,</span> <span class="nam">CommentedSeq</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">454 ↛ 455</span><span class="annotate long">line 454 didn't jump to line 455, because the condition on line 454 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t455" href="#t455">455</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t456" href="#t456">456</a></span><span class="t"> <span class="nam">subparser</span> <span class="op">=</span> <span class="nam">parser</span><span class="op">.</span><span class="nam">delegate</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t457" href="#t457">457</a></span><span class="t"> <span class="key">for</span> <span class="nam">value</span> <span class="key">in</span> <span class="nam">content</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t458" href="#t458">458</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">_lint_content</span><span class="op">(</span><span class="nam">uri</span><span class="op">,</span> <span class="nam">pg</span><span class="op">,</span> <span class="nam">subparser</span><span class="op">,</span> <span class="nam">value</span><span class="op">,</span> <span class="nam">lines</span><span class="op">,</span> <span class="nam">position_codec</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t459" href="#t459">459</a></span><span class="t"> <span class="key">elif</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">parser</span><span class="op">,</span> <span class="nam">InPackageContextParser</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t460" href="#t460">460</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">content</span><span class="op">,</span> <span class="nam">CommentedMap</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">460 ↛ 461</span><span class="annotate long">line 460 didn't jump to line 461, because the condition on line 460 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t461" href="#t461">461</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t462" href="#t462">462</a></span><span class="t"> <span class="key">for</span> <span class="nam">v</span> <span class="key">in</span> <span class="nam">content</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t463" href="#t463">463</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">_lint_content</span><span class="op">(</span><span class="nam">uri</span><span class="op">,</span> <span class="nam">pg</span><span class="op">,</span> <span class="nam">parser</span><span class="op">.</span><span class="nam">delegate</span><span class="op">,</span> <span class="nam">v</span><span class="op">,</span> <span class="nam">lines</span><span class="op">,</span> <span class="nam">position_codec</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t464" href="#t464">464</a></span><span class="t"> <span class="key">elif</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">parser</span><span class="op">,</span> <span class="nam">DeclarativeMappingInputParser</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t465" href="#t465">465</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">_lint_declarative_mapping_input_parser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t466" href="#t466">466</a></span><span class="t"> <span class="nam">uri</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t467" href="#t467">467</a></span><span class="t"> <span class="nam">pg</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t468" href="#t468">468</a></span><span class="t"> <span class="nam">parser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t469" href="#t469">469</a></span><span class="t"> <span class="nam">content</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t470" href="#t470">470</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t471" href="#t471">471</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t472" href="#t472">472</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t473" href="#t473">473</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t474" href="#t474">474</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t475" href="#t475">475</a></span><span class="t"><span class="key">def</span> <span class="nam">is_at</span><span class="op">(</span><span class="nam">position</span><span class="op">:</span> <span class="nam">Position</span><span class="op">,</span> <span class="nam">lc_pos</span><span class="op">:</span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">int</span><span class="op">,</span> <span class="nam">int</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t476" href="#t476">476</a></span><span class="t"> <span class="key">return</span> <span class="nam">position</span><span class="op">.</span><span class="nam">line</span> <span class="op">==</span> <span class="nam">lc_pos</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="key">and</span> <span class="nam">position</span><span class="op">.</span><span class="nam">character</span> <span class="op">==</span> <span class="nam">lc_pos</span><span class="op">[</span><span class="num">1</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t477" href="#t477">477</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t478" href="#t478">478</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t479" href="#t479">479</a></span><span class="t"><span class="key">def</span> <span class="nam">is_before</span><span class="op">(</span><span class="nam">position</span><span class="op">:</span> <span class="nam">Position</span><span class="op">,</span> <span class="nam">lc_pos</span><span class="op">:</span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">int</span><span class="op">,</span> <span class="nam">int</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t480" href="#t480">480</a></span><span class="t"> <span class="nam">line</span><span class="op">,</span> <span class="nam">column</span> <span class="op">=</span> <span class="nam">lc_pos</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t481" href="#t481">481</a></span><span class="t"> <span class="key">if</span> <span class="nam">position</span><span class="op">.</span><span class="nam">line</span> <span class="op"><</span> <span class="nam">line</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t482" href="#t482">482</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t483" href="#t483">483</a></span><span class="t"> <span class="key">if</span> <span class="nam">position</span><span class="op">.</span><span class="nam">line</span> <span class="op">==</span> <span class="nam">line</span> <span class="key">and</span> <span class="nam">position</span><span class="op">.</span><span class="nam">character</span> <span class="op"><</span> <span class="nam">column</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t484" href="#t484">484</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t485" href="#t485">485</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t486" href="#t486">486</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t487" href="#t487">487</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t488" href="#t488">488</a></span><span class="t"><span class="key">def</span> <span class="nam">is_after</span><span class="op">(</span><span class="nam">position</span><span class="op">:</span> <span class="nam">Position</span><span class="op">,</span> <span class="nam">lc_pos</span><span class="op">:</span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">int</span><span class="op">,</span> <span class="nam">int</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t489" href="#t489">489</a></span><span class="t"> <span class="nam">line</span><span class="op">,</span> <span class="nam">column</span> <span class="op">=</span> <span class="nam">lc_pos</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t490" href="#t490">490</a></span><span class="t"> <span class="key">if</span> <span class="nam">position</span><span class="op">.</span><span class="nam">line</span> <span class="op">></span> <span class="nam">line</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t491" href="#t491">491</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t492" href="#t492">492</a></span><span class="t"> <span class="key">if</span> <span class="nam">position</span><span class="op">.</span><span class="nam">line</span> <span class="op">==</span> <span class="nam">line</span> <span class="key">and</span> <span class="nam">position</span><span class="op">.</span><span class="nam">character</span> <span class="op">></span> <span class="nam">column</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t493" href="#t493">493</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t494" href="#t494">494</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t495" href="#t495">495</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t496" href="#t496">496</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t497" href="#t497">497</a></span><span class="t"><span class="key">def</span> <span class="nam">_trace_cursor</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t498" href="#t498">498</a></span><span class="t"> <span class="nam">content</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t499" href="#t499">499</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t500" href="#t500">500</a></span><span class="t"> <span class="nam">server_position</span><span class="op">:</span> <span class="nam">Position</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t501" href="#t501">501</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">bool</span><span class="op">,</span> <span class="nam">AttributePath</span><span class="op">,</span> <span class="nam">Any</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t502" href="#t502">502</a></span><span class="t"> <span class="nam">matched_key</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">int</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t503" href="#t503">503</a></span><span class="t"> <span class="nam">matched</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Node</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t504" href="#t504">504</a></span><span class="t"> <span class="nam">matched_was_key</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t505" href="#t505">505</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t506" href="#t506">506</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">content</span><span class="op">,</span> <span class="nam">CommentedMap</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t507" href="#t507">507</a></span><span class="t"> <span class="nam">dict_lc</span><span class="op">:</span> <span class="nam">LineCol</span> <span class="op">=</span> <span class="nam">content</span><span class="op">.</span><span class="nam">lc</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t508" href="#t508">508</a></span><span class="t"> <span class="key">for</span> <span class="nam">k</span><span class="op">,</span> <span class="nam">v</span> <span class="key">in</span> <span class="nam">content</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t509" href="#t509">509</a></span><span class="t"> <span class="nam">k_lc</span> <span class="op">=</span> <span class="nam">dict_lc</span><span class="op">.</span><span class="nam">key</span><span class="op">(</span><span class="nam">k</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t510" href="#t510">510</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_before</span><span class="op">(</span><span class="nam">server_position</span><span class="op">,</span> <span class="nam">k_lc</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">510 ↛ 511</span><span class="annotate long">line 510 didn't jump to line 511, because the condition on line 510 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t511" href="#t511">511</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t512" href="#t512">512</a></span><span class="t"> <span class="nam">v_lc</span> <span class="op">=</span> <span class="nam">dict_lc</span><span class="op">.</span><span class="nam">value</span><span class="op">(</span><span class="nam">k</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t513" href="#t513">513</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_before</span><span class="op">(</span><span class="nam">server_position</span><span class="op">,</span> <span class="nam">v_lc</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t514" href="#t514">514</a></span><span class="t"> <span class="com"># TODO: Handle ":" and "whitespace"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t515" href="#t515">515</a></span><span class="t"> <span class="nam">matched</span> <span class="op">=</span> <span class="nam">k</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t516" href="#t516">516</a></span><span class="t"> <span class="nam">matched_key</span> <span class="op">=</span> <span class="nam">k</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t517" href="#t517">517</a></span><span class="t"> <span class="nam">matched_was_key</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t518" href="#t518">518</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t519" href="#t519">519</a></span><span class="t"> <span class="nam">matched</span> <span class="op">=</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t520" href="#t520">520</a></span><span class="t"> <span class="nam">matched_key</span> <span class="op">=</span> <span class="nam">k</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t521" href="#t521">521</a></span><span class="t"> <span class="key">elif</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">content</span><span class="op">,</span> <span class="nam">CommentedSeq</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">521 ↛ 530</span><span class="annotate long">line 521 didn't jump to line 530, because the condition on line 521 was never false</span></span></p> - <p class="run"><span class="n"><a id="t522" href="#t522">522</a></span><span class="t"> <span class="nam">list_lc</span><span class="op">:</span> <span class="nam">LineCol</span> <span class="op">=</span> <span class="nam">content</span><span class="op">.</span><span class="nam">lc</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t523" href="#t523">523</a></span><span class="t"> <span class="key">for</span> <span class="nam">idx</span><span class="op">,</span> <span class="nam">value</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">content</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t524" href="#t524">524</a></span><span class="t"> <span class="nam">i_lc</span> <span class="op">=</span> <span class="nam">list_lc</span><span class="op">.</span><span class="nam">item</span><span class="op">(</span><span class="nam">idx</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t525" href="#t525">525</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_before</span><span class="op">(</span><span class="nam">server_position</span><span class="op">,</span> <span class="nam">i_lc</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">525 ↛ 526</span><span class="annotate long">line 525 didn't jump to line 526, because the condition on line 525 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t526" href="#t526">526</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t527" href="#t527">527</a></span><span class="t"> <span class="nam">matched_key</span> <span class="op">=</span> <span class="nam">idx</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t528" href="#t528">528</a></span><span class="t"> <span class="nam">matched</span> <span class="op">=</span> <span class="nam">value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t529" href="#t529">529</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t530" href="#t530">530</a></span><span class="t"> <span class="key">if</span> <span class="nam">matched</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">530 ↛ 536</span><span class="annotate long">line 530 didn't jump to line 536, because the condition on line 530 was never false</span></span></p> - <p class="run"><span class="n"><a id="t531" href="#t531">531</a></span><span class="t"> <span class="key">assert</span> <span class="nam">matched_key</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t532" href="#t532">532</a></span><span class="t"> <span class="nam">sub_path</span> <span class="op">=</span> <span class="nam">attribute_path</span><span class="op">[</span><span class="nam">matched_key</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t533" href="#t533">533</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">matched_was_key</span> <span class="key">and</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">matched</span><span class="op">,</span> <span class="nam">CommentedBase</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t534" href="#t534">534</a></span><span class="t"> <span class="key">return</span> <span class="nam">_trace_cursor</span><span class="op">(</span><span class="nam">matched</span><span class="op">,</span> <span class="nam">sub_path</span><span class="op">,</span> <span class="nam">server_position</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t535" href="#t535">535</a></span><span class="t"> <span class="key">return</span> <span class="nam">matched_was_key</span><span class="op">,</span> <span class="nam">sub_path</span><span class="op">,</span> <span class="nam">matched</span><span class="op">,</span> <span class="nam">content</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t536" href="#t536">536</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t537" href="#t537">537</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t538" href="#t538">538</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t539" href="#t539">539</a></span><span class="t"><span class="nam">_COMPLETION_HINT_KEY</span> <span class="op">=</span> <span class="str">"___COMPLETE:"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t540" href="#t540">540</a></span><span class="t"><span class="nam">_COMPLETION_HINT_VALUE</span> <span class="op">=</span> <span class="str">"___COMPLETE"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t541" href="#t541">541</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t542" href="#t542">542</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t543" href="#t543">543</a></span><span class="t"><span class="key">def</span> <span class="nam">resolve_keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t544" href="#t544">544</a></span><span class="t"> <span class="nam">current_parser</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">DeclarativeInputParser</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">,</span> <span class="nam">DispatchingParserBase</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t545" href="#t545">545</a></span><span class="t"> <span class="nam">current_plugin</span><span class="op">:</span> <span class="nam">DebputyPluginMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t546" href="#t546">546</a></span><span class="t"> <span class="nam">segments</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">int</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t547" href="#t547">547</a></span><span class="t"> <span class="nam">segment_idx</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t548" href="#t548">548</a></span><span class="t"> <span class="nam">parser_generator</span><span class="op">:</span> <span class="nam">ParserGenerator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t549" href="#t549">549</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t550" href="#t550">550</a></span><span class="t"> <span class="nam">is_completion_attempt</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t551" href="#t551">551</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t552" href="#t552">552</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t553" href="#t553">553</a></span><span class="t"> <span class="nam">Union</span><span class="op">[</span><span class="nam">DeclarativeInputParser</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">,</span> <span class="nam">DispatchingParserBase</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t554" href="#t554">554</a></span><span class="t"> <span class="nam">DebputyPluginMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t555" href="#t555">555</a></span><span class="t"> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t556" href="#t556">556</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t557" href="#t557">557</a></span><span class="t"><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t558" href="#t558">558</a></span><span class="t"> <span class="key">if</span> <span class="nam">segment_idx</span> <span class="op">>=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">segments</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t559" href="#t559">559</a></span><span class="t"> <span class="key">return</span> <span class="nam">current_parser</span><span class="op">,</span> <span class="nam">current_plugin</span><span class="op">,</span> <span class="nam">segment_idx</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t560" href="#t560">560</a></span><span class="t"> <span class="nam">current_segment</span> <span class="op">=</span> <span class="nam">segments</span><span class="op">[</span><span class="nam">segment_idx</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t561" href="#t561">561</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">current_parser</span><span class="op">,</span> <span class="nam">ListWrappedDeclarativeInputParser</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t562" href="#t562">562</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">current_segment</span><span class="op">,</span> <span class="nam">int</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">562 ↛ 569</span><span class="annotate long">line 562 didn't jump to line 569, because the condition on line 562 was never false</span></span></p> - <p class="run"><span class="n"><a id="t563" href="#t563">563</a></span><span class="t"> <span class="nam">current_parser</span> <span class="op">=</span> <span class="nam">current_parser</span><span class="op">.</span><span class="nam">delegate</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t564" href="#t564">564</a></span><span class="t"> <span class="nam">segment_idx</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t565" href="#t565">565</a></span><span class="t"> <span class="key">if</span> <span class="nam">segment_idx</span> <span class="op">>=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">segments</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">565 ↛ 566</span><span class="annotate long">line 565 didn't jump to line 566, because the condition on line 565 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t566" href="#t566">566</a></span><span class="t"> <span class="key">return</span> <span class="nam">current_parser</span><span class="op">,</span> <span class="nam">current_plugin</span><span class="op">,</span> <span class="nam">segment_idx</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t567" href="#t567">567</a></span><span class="t"> <span class="nam">current_segment</span> <span class="op">=</span> <span class="nam">segments</span><span class="op">[</span><span class="nam">segment_idx</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t568" href="#t568">568</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t569" href="#t569">569</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">current_segment</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">569 ↛ 570</span><span class="annotate long">line 569 didn't jump to line 570, because the condition on line 569 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t570" href="#t570">570</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t571" href="#t571">571</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t572" href="#t572">572</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_completion_attempt</span> <span class="key">and</span> <span class="nam">current_segment</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t573" href="#t573">573</a></span><span class="t"> <span class="op">(</span><span class="nam">_COMPLETION_HINT_KEY</span><span class="op">,</span> <span class="nam">_COMPLETION_HINT_VALUE</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t574" href="#t574">574</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t575" href="#t575">575</a></span><span class="t"> <span class="key">return</span> <span class="nam">current_parser</span><span class="op">,</span> <span class="nam">current_plugin</span><span class="op">,</span> <span class="nam">segment_idx</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t576" href="#t576">576</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t577" href="#t577">577</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">current_parser</span><span class="op">,</span> <span class="nam">InPackageContextParser</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t578" href="#t578">578</a></span><span class="t"> <span class="key">return</span> <span class="nam">resolve_keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t579" href="#t579">579</a></span><span class="t"> <span class="nam">current_parser</span><span class="op">.</span><span class="nam">delegate</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t580" href="#t580">580</a></span><span class="t"> <span class="nam">current_plugin</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t581" href="#t581">581</a></span><span class="t"> <span class="nam">segments</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t582" href="#t582">582</a></span><span class="t"> <span class="nam">segment_idx</span> <span class="op">+</span> <span class="num">1</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t583" href="#t583">583</a></span><span class="t"> <span class="nam">parser_generator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t584" href="#t584">584</a></span><span class="t"> <span class="nam">is_completion_attempt</span><span class="op">=</span><span class="nam">is_completion_attempt</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t585" href="#t585">585</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t586" href="#t586">586</a></span><span class="t"> <span class="key">elif</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">current_parser</span><span class="op">,</span> <span class="nam">DispatchingParserBase</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t587" href="#t587">587</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">current_parser</span><span class="op">.</span><span class="nam">is_known_keyword</span><span class="op">(</span><span class="nam">current_segment</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">587 ↛ 588</span><span class="annotate long">line 587 didn't jump to line 588, because the condition on line 587 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t588" href="#t588">588</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_completion_attempt</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t589" href="#t589">589</a></span><span class="t"> <span class="key">return</span> <span class="nam">current_parser</span><span class="op">,</span> <span class="nam">current_plugin</span><span class="op">,</span> <span class="nam">segment_idx</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t590" href="#t590">590</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t591" href="#t591">591</a></span><span class="t"> <span class="nam">subparser</span> <span class="op">=</span> <span class="nam">current_parser</span><span class="op">.</span><span class="nam">parser_for</span><span class="op">(</span><span class="nam">current_segment</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t592" href="#t592">592</a></span><span class="t"> <span class="nam">segment_idx</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t593" href="#t593">593</a></span><span class="t"> <span class="key">if</span> <span class="nam">segment_idx</span> <span class="op"><</span> <span class="nam">len</span><span class="op">(</span><span class="nam">segments</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t594" href="#t594">594</a></span><span class="t"> <span class="key">return</span> <span class="nam">resolve_keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t595" href="#t595">595</a></span><span class="t"> <span class="nam">subparser</span><span class="op">.</span><span class="nam">parser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t596" href="#t596">596</a></span><span class="t"> <span class="nam">subparser</span><span class="op">.</span><span class="nam">plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t597" href="#t597">597</a></span><span class="t"> <span class="nam">segments</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t598" href="#t598">598</a></span><span class="t"> <span class="nam">segment_idx</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t599" href="#t599">599</a></span><span class="t"> <span class="nam">parser_generator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t600" href="#t600">600</a></span><span class="t"> <span class="nam">is_completion_attempt</span><span class="op">=</span><span class="nam">is_completion_attempt</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t601" href="#t601">601</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t602" href="#t602">602</a></span><span class="t"> <span class="key">return</span> <span class="nam">subparser</span><span class="op">.</span><span class="nam">parser</span><span class="op">,</span> <span class="nam">subparser</span><span class="op">.</span><span class="nam">plugin_metadata</span><span class="op">,</span> <span class="nam">segment_idx</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t603" href="#t603">603</a></span><span class="t"> <span class="key">elif</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">current_parser</span><span class="op">,</span> <span class="nam">DeclarativeMappingInputParser</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">603 ↛ 625</span><span class="annotate long">line 603 didn't jump to line 625, because the condition on line 603 was never false</span></span></p> - <p class="run"><span class="n"><a id="t604" href="#t604">604</a></span><span class="t"> <span class="nam">attr</span> <span class="op">=</span> <span class="nam">current_parser</span><span class="op">.</span><span class="nam">manifest_attributes</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">current_segment</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t605" href="#t605">605</a></span><span class="t"> <span class="nam">attr_type</span> <span class="op">=</span> <span class="nam">attr</span><span class="op">.</span><span class="nam">attribute_type</span> <span class="key">if</span> <span class="nam">attr</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">else</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t606" href="#t606">606</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t607" href="#t607">607</a></span><span class="t"> <span class="nam">attr_type</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t608" href="#t608">608</a></span><span class="t"> <span class="key">and</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">attr_type</span><span class="op">,</span> <span class="nam">type</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t609" href="#t609">609</a></span><span class="t"> <span class="key">and</span> <span class="nam">issubclass</span><span class="op">(</span><span class="nam">attr_type</span><span class="op">,</span> <span class="nam">DebputyDispatchableType</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t610" href="#t610">610</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t611" href="#t611">611</a></span><span class="t"> <span class="nam">subparser</span> <span class="op">=</span> <span class="nam">parser_generator</span><span class="op">.</span><span class="nam">dispatch_parser_table_for</span><span class="op">(</span><span class="nam">attr_type</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t612" href="#t612">612</a></span><span class="t"> <span class="key">if</span> <span class="nam">subparser</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t613" href="#t613">613</a></span><span class="t"> <span class="nam">is_completion_attempt</span> <span class="key">or</span> <span class="nam">segment_idx</span> <span class="op">+</span> <span class="num">1</span> <span class="op"><</span> <span class="nam">len</span><span class="op">(</span><span class="nam">segments</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t614" href="#t614">614</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t615" href="#t615">615</a></span><span class="t"> <span class="key">return</span> <span class="nam">resolve_keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t616" href="#t616">616</a></span><span class="t"> <span class="nam">subparser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t617" href="#t617">617</a></span><span class="t"> <span class="nam">current_plugin</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t618" href="#t618">618</a></span><span class="t"> <span class="nam">segments</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t619" href="#t619">619</a></span><span class="t"> <span class="nam">segment_idx</span> <span class="op">+</span> <span class="num">1</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t620" href="#t620">620</a></span><span class="t"> <span class="nam">parser_generator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t621" href="#t621">621</a></span><span class="t"> <span class="nam">is_completion_attempt</span><span class="op">=</span><span class="nam">is_completion_attempt</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t622" href="#t622">622</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t623" href="#t623">623</a></span><span class="t"> <span class="key">return</span> <span class="nam">current_parser</span><span class="op">,</span> <span class="nam">current_plugin</span><span class="op">,</span> <span class="nam">segment_idx</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t624" href="#t624">624</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t625" href="#t625">625</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"Unknown parser: {current_parser.__class__}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t626" href="#t626">626</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t627" href="#t627">627</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t628" href="#t628">628</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t629" href="#t629">629</a></span><span class="t"><span class="key">def</span> <span class="nam">_render_param_doc</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t630" href="#t630">630</a></span><span class="t"> <span class="nam">rule_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t631" href="#t631">631</a></span><span class="t"> <span class="nam">declarative_parser</span><span class="op">:</span> <span class="nam">DeclarativeMappingInputParser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t632" href="#t632">632</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">:</span> <span class="nam">DebputyPluginMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t633" href="#t633">633</a></span><span class="t"> <span class="nam">attribute</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t634" href="#t634">634</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t635" href="#t635">635</a></span><span class="t"> <span class="nam">attr</span> <span class="op">=</span> <span class="nam">declarative_parser</span><span class="op">.</span><span class="nam">source_attributes</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">attribute</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t636" href="#t636">636</a></span><span class="t"> <span class="key">if</span> <span class="nam">attr</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">636 ↛ 637</span><span class="annotate long">line 636 didn't jump to line 637, because the condition on line 636 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t637" href="#t637">637</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t638" href="#t638">638</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t639" href="#t639">639</a></span><span class="t"> <span class="nam">doc_args</span><span class="op">,</span> <span class="nam">parser_doc</span> <span class="op">=</span> <span class="nam">doc_args_for_parser_doc</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t640" href="#t640">640</a></span><span class="t"> <span class="nam">rule_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t641" href="#t641">641</a></span><span class="t"> <span class="nam">declarative_parser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t642" href="#t642">642</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t643" href="#t643">643</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t644" href="#t644">644</a></span><span class="t"> <span class="nam">rendered_docs</span> <span class="op">=</span> <span class="nam">render_attribute_doc</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t645" href="#t645">645</a></span><span class="t"> <span class="nam">declarative_parser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t646" href="#t646">646</a></span><span class="t"> <span class="nam">declarative_parser</span><span class="op">.</span><span class="nam">source_attributes</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t647" href="#t647">647</a></span><span class="t"> <span class="nam">declarative_parser</span><span class="op">.</span><span class="nam">input_time_required_parameters</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t648" href="#t648">648</a></span><span class="t"> <span class="nam">declarative_parser</span><span class="op">.</span><span class="nam">at_least_one_of</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t649" href="#t649">649</a></span><span class="t"> <span class="nam">parser_doc</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t650" href="#t650">650</a></span><span class="t"> <span class="nam">doc_args</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t651" href="#t651">651</a></span><span class="t"> <span class="nam">is_interactive</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t652" href="#t652">652</a></span><span class="t"> <span class="nam">rule_name</span><span class="op">=</span><span class="nam">rule_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t653" href="#t653">653</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t654" href="#t654">654</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t655" href="#t655">655</a></span><span class="t"> <span class="key">for</span> <span class="nam">attributes</span><span class="op">,</span> <span class="nam">rendered_doc</span> <span class="key">in</span> <span class="nam">rendered_docs</span><span class="op">:</span> </span><span class="r"><span class="annotate short">655 ↛ 664</span><span class="annotate long">line 655 didn't jump to line 664, because the loop on line 655 didn't complete</span></span></p> - <p class="run"><span class="n"><a id="t656" href="#t656">656</a></span><span class="t"> <span class="key">if</span> <span class="nam">attribute</span> <span class="key">in</span> <span class="nam">attributes</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t657" href="#t657">657</a></span><span class="t"> <span class="nam">full_doc</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t658" href="#t658">658</a></span><span class="t"> <span class="str">f"# Attribute `{attribute}`"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t659" href="#t659">659</a></span><span class="t"> <span class="str">""</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t660" href="#t660">660</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t661" href="#t661">661</a></span><span class="t"> <span class="nam">full_doc</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">rendered_doc</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t662" href="#t662">662</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t663" href="#t663">663</a></span><span class="t"> <span class="key">return</span> <span class="str">"\n"</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">full_doc</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t664" href="#t664">664</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t665" href="#t665">665</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t666" href="#t666">666</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t667" href="#t667">667</a></span><span class="t"><span class="nam">DEBPUTY_PLUGIN_METADATA</span> <span class="op">=</span> <span class="nam">plugin_metadata_for_debputys_own_plugin</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t668" href="#t668">668</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t669" href="#t669">669</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t670" href="#t670">670</a></span><span class="t"><span class="key">def</span> <span class="nam">_guess_rule_name</span><span class="op">(</span><span class="nam">segments</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">int</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> <span class="nam">idx</span><span class="op">:</span> <span class="nam">int</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t671" href="#t671">671</a></span><span class="t"> <span class="nam">orig_idx</span> <span class="op">=</span> <span class="nam">idx</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t672" href="#t672">672</a></span><span class="t"> <span class="nam">idx</span> <span class="op">-=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t673" href="#t673">673</a></span><span class="t"> <span class="key">while</span> <span class="nam">idx</span> <span class="op">>=</span> <span class="num">0</span><span class="op">:</span> </span><span class="r"><span class="annotate short">673 ↛ 678</span><span class="annotate long">line 673 didn't jump to line 678, because the condition on line 673 was never false</span></span></p> - <p class="run"><span class="n"><a id="t674" href="#t674">674</a></span><span class="t"> <span class="nam">segment</span> <span class="op">=</span> <span class="nam">segments</span><span class="op">[</span><span class="nam">idx</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t675" href="#t675">675</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">segment</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t676" href="#t676">676</a></span><span class="t"> <span class="key">return</span> <span class="nam">segment</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t677" href="#t677">677</a></span><span class="t"> <span class="nam">idx</span> <span class="op">-=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t678" href="#t678">678</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span><span class="str">f"Unable to derive rule name from {segments} [{orig_idx}]"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t679" href="#t679">679</a></span><span class="t"> <span class="key">return</span> <span class="str">"<Bug: unknown rule name>"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t680" href="#t680">680</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t681" href="#t681">681</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t682" href="#t682">682</a></span><span class="t"><span class="key">def</span> <span class="nam">_escape</span><span class="op">(</span><span class="nam">v</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t683" href="#t683">683</a></span><span class="t"> <span class="key">return</span> <span class="str">'"'</span> <span class="op">+</span> <span class="nam">v</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">"\n"</span><span class="op">,</span> <span class="str">"\\n"</span><span class="op">)</span> <span class="op">+</span> <span class="str">'"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t684" href="#t684">684</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t685" href="#t685">685</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t686" href="#t686">686</a></span><span class="t"><span class="key">def</span> <span class="nam">_insert_snippet</span><span class="op">(</span><span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">server_position</span><span class="op">:</span> <span class="nam">Position</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t687" href="#t687">687</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"Complete at {server_position}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t688" href="#t688">688</a></span><span class="t"> <span class="nam">line_no</span> <span class="op">=</span> <span class="nam">server_position</span><span class="op">.</span><span class="nam">line</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t689" href="#t689">689</a></span><span class="t"> <span class="nam">line</span> <span class="op">=</span> <span class="nam">lines</span><span class="op">[</span><span class="nam">line_no</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t690" href="#t690">690</a></span><span class="t"> <span class="nam">pos_rhs</span> <span class="op">=</span> <span class="nam">line</span><span class="op">[</span><span class="nam">server_position</span><span class="op">.</span><span class="nam">character</span> <span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t691" href="#t691">691</a></span><span class="t"> <span class="key">if</span> <span class="nam">pos_rhs</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">pos_rhs</span><span class="op">.</span><span class="nam">isspace</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">691 ↛ 692</span><span class="annotate long">line 691 didn't jump to line 692, because the condition on line 691 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t692" href="#t692">692</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"No insertion: {_escape(line[server_position.character:])}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t693" href="#t693">693</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t694" href="#t694">694</a></span><span class="t"> <span class="nam">lhs_ws</span> <span class="op">=</span> <span class="nam">line</span><span class="op">[</span><span class="op">:</span> <span class="nam">server_position</span><span class="op">.</span><span class="nam">character</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t695" href="#t695">695</a></span><span class="t"> <span class="nam">lhs</span> <span class="op">=</span> <span class="nam">lhs_ws</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t696" href="#t696">696</a></span><span class="t"> <span class="key">if</span> <span class="nam">lhs</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">":"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t697" href="#t697">697</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">"Insertion of value (key seen)"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t698" href="#t698">698</a></span><span class="t"> <span class="nam">new_line</span> <span class="op">=</span> <span class="nam">line</span><span class="op">[</span><span class="op">:</span> <span class="nam">server_position</span><span class="op">.</span><span class="nam">character</span><span class="op">]</span> <span class="op">+</span> <span class="nam">_COMPLETION_HINT_VALUE</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t699" href="#t699">699</a></span><span class="t"> <span class="key">elif</span> <span class="nam">lhs</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"-"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t700" href="#t700">700</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">"Insertion of key or value (list item)"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t701" href="#t701">701</a></span><span class="t"> <span class="com"># Respect the provided indentation</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t702" href="#t702">702</a></span><span class="t"> <span class="nam">snippet</span> <span class="op">=</span> <span class="nam">_COMPLETION_HINT_KEY</span> <span class="key">if</span> <span class="str">":"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">lhs</span> <span class="key">else</span> <span class="nam">_COMPLETION_HINT_VALUE</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t703" href="#t703">703</a></span><span class="t"> <span class="nam">new_line</span> <span class="op">=</span> <span class="nam">line</span><span class="op">[</span><span class="op">:</span> <span class="nam">server_position</span><span class="op">.</span><span class="nam">character</span><span class="op">]</span> <span class="op">+</span> <span class="nam">snippet</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t704" href="#t704">704</a></span><span class="t"> <span class="key">elif</span> <span class="key">not</span> <span class="nam">lhs</span> <span class="key">or</span> <span class="op">(</span><span class="nam">lhs_ws</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">lhs_ws</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">.</span><span class="nam">isspace</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t705" href="#t705">705</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"Insertion of key or value: {_escape(line[server_position.character:])}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t706" href="#t706">706</a></span><span class="t"> <span class="com"># Respect the provided indentation</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t707" href="#t707">707</a></span><span class="t"> <span class="nam">snippet</span> <span class="op">=</span> <span class="nam">_COMPLETION_HINT_KEY</span> <span class="key">if</span> <span class="str">":"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">lhs</span> <span class="key">else</span> <span class="nam">_COMPLETION_HINT_VALUE</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t708" href="#t708">708</a></span><span class="t"> <span class="nam">new_line</span> <span class="op">=</span> <span class="nam">line</span><span class="op">[</span><span class="op">:</span> <span class="nam">server_position</span><span class="op">.</span><span class="nam">character</span><span class="op">]</span> <span class="op">+</span> <span class="nam">snippet</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t709" href="#t709">709</a></span><span class="t"> <span class="key">elif</span> <span class="nam">lhs</span><span class="op">.</span><span class="nam">isalpha</span><span class="op">(</span><span class="op">)</span> <span class="key">and</span> <span class="str">":"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">lhs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t710" href="#t710">710</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"Expanding value to a key: {_escape(line[server_position.character:])}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t711" href="#t711">711</a></span><span class="t"> <span class="com"># Respect the provided indentation</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t712" href="#t712">712</a></span><span class="t"> <span class="nam">new_line</span> <span class="op">=</span> <span class="nam">line</span><span class="op">[</span><span class="op">:</span> <span class="nam">server_position</span><span class="op">.</span><span class="nam">character</span><span class="op">]</span> <span class="op">+</span> <span class="nam">_COMPLETION_HINT_KEY</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t713" href="#t713">713</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t714" href="#t714">714</a></span><span class="t"> <span class="nam">c</span> <span class="op">=</span> <span class="nam">line</span><span class="op">[</span><span class="nam">server_position</span><span class="op">.</span><span class="nam">character</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t715" href="#t715">715</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"Not touching line: {_escape(line)} -- {_escape(c)}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t716" href="#t716">716</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t717" href="#t717">717</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f'Evaluating complete on synthetic line: "{new_line}"'</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t718" href="#t718">718</a></span><span class="t"> <span class="nam">lines</span><span class="op">[</span><span class="nam">line_no</span><span class="op">]</span> <span class="op">=</span> <span class="nam">new_line</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t719" href="#t719">719</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t720" href="#t720">720</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t721" href="#t721">721</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t722" href="#t722">722</a></span><span class="t"><span class="op">@</span><span class="nam">lsp_completer</span><span class="op">(</span><span class="nam">_LANGUAGE_IDS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t723" href="#t723">723</a></span><span class="t"><span class="key">def</span> <span class="nam">debputy_manifest_completer</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t724" href="#t724">724</a></span><span class="t"> <span class="nam">ls</span><span class="op">:</span> <span class="str">"DebputyLanguageServer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t725" href="#t725">725</a></span><span class="t"> <span class="nam">params</span><span class="op">:</span> <span class="nam">CompletionParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t726" href="#t726">726</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">CompletionList</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">CompletionItem</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t727" href="#t727">727</a></span><span class="t"> <span class="nam">doc</span> <span class="op">=</span> <span class="nam">ls</span><span class="op">.</span><span class="nam">workspace</span><span class="op">.</span><span class="nam">get_text_document</span><span class="op">(</span><span class="nam">params</span><span class="op">.</span><span class="nam">text_document</span><span class="op">.</span><span class="nam">uri</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t728" href="#t728">728</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">is_valid_file</span><span class="op">(</span><span class="nam">doc</span><span class="op">.</span><span class="nam">path</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">728 ↛ 729</span><span class="annotate long">line 728 didn't jump to line 729, because the condition on line 728 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t729" href="#t729">729</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t730" href="#t730">730</a></span><span class="t"> <span class="nam">lines</span> <span class="op">=</span> <span class="nam">doc</span><span class="op">.</span><span class="nam">lines</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t731" href="#t731">731</a></span><span class="t"> <span class="nam">server_position</span> <span class="op">=</span> <span class="nam">doc</span><span class="op">.</span><span class="nam">position_codec</span><span class="op">.</span><span class="nam">position_from_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t732" href="#t732">732</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> <span class="nam">params</span><span class="op">.</span><span class="nam">position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t733" href="#t733">733</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t734" href="#t734">734</a></span><span class="t"> <span class="nam">attribute_root_path</span> <span class="op">=</span> <span class="nam">AttributePath</span><span class="op">.</span><span class="nam">root_path</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t735" href="#t735">735</a></span><span class="t"> <span class="nam">added_key</span> <span class="op">=</span> <span class="nam">_insert_snippet</span><span class="op">(</span><span class="nam">lines</span><span class="op">,</span> <span class="nam">server_position</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t736" href="#t736">736</a></span><span class="t"> <span class="nam">attempts</span> <span class="op">=</span> <span class="num">1</span> <span class="key">if</span> <span class="nam">added_key</span> <span class="key">else</span> <span class="num">2</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t737" href="#t737">737</a></span><span class="t"> <span class="nam">content</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t738" href="#t738">738</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t739" href="#t739">739</a></span><span class="t"> <span class="key">while</span> <span class="nam">attempts</span> <span class="op">></span> <span class="num">0</span><span class="op">:</span> </span><span class="r"><span class="annotate short">739 ↛ 767</span><span class="annotate long">line 739 didn't jump to line 767, because the condition on line 739 was never false</span></span></p> - <p class="run"><span class="n"><a id="t740" href="#t740">740</a></span><span class="t"> <span class="nam">attempts</span> <span class="op">-=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t741" href="#t741">741</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t742" href="#t742">742</a></span><span class="t"> <span class="nam">content</span> <span class="op">=</span> <span class="nam">MANIFEST_YAML</span><span class="op">.</span><span class="nam">load</span><span class="op">(</span><span class="str">""</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">lines</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t743" href="#t743">743</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t744" href="#t744">744</a></span><span class="t"> <span class="key">except</span> <span class="nam">MarkedYAMLError</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t745" href="#t745">745</a></span><span class="t"> <span class="nam">context_line</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t746" href="#t746">746</a></span><span class="t"> <span class="nam">e</span><span class="op">.</span><span class="nam">context_mark</span><span class="op">.</span><span class="nam">line</span> <span class="key">if</span> <span class="nam">e</span><span class="op">.</span><span class="nam">context_mark</span> <span class="key">else</span> <span class="nam">e</span><span class="op">.</span><span class="nam">problem_mark</span><span class="op">.</span><span class="nam">line</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t747" href="#t747">747</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t748" href="#t748">748</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t749" href="#t749">749</a></span><span class="t"> <span class="nam">e</span><span class="op">.</span><span class="nam">problem_mark</span><span class="op">.</span><span class="nam">line</span> <span class="op">!=</span> <span class="nam">server_position</span><span class="op">.</span><span class="nam">line</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t750" href="#t750">750</a></span><span class="t"> <span class="key">and</span> <span class="nam">context_line</span> <span class="op">!=</span> <span class="nam">server_position</span><span class="op">.</span><span class="nam">line</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t751" href="#t751">751</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t752" href="#t752">752</a></span><span class="t"> <span class="nam">l_data</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t753" href="#t753">753</a></span><span class="t"> <span class="nam">lines</span><span class="op">[</span><span class="nam">e</span><span class="op">.</span><span class="nam">problem_mark</span><span class="op">.</span><span class="nam">line</span><span class="op">]</span><span class="op">.</span><span class="nam">rstrip</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t754" href="#t754">754</a></span><span class="t"> <span class="key">if</span> <span class="nam">e</span><span class="op">.</span><span class="nam">problem_mark</span><span class="op">.</span><span class="nam">line</span> <span class="op"><</span> <span class="nam">len</span><span class="op">(</span><span class="nam">lines</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t755" href="#t755">755</a></span><span class="t"> <span class="key">else</span> <span class="str">"N/A (OOB)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t756" href="#t756">756</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t757" href="#t757">757</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t758" href="#t758">758</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"Parse error on line: {e.problem_mark.line}: {l_data}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t759" href="#t759">759</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t760" href="#t760">760</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t761" href="#t761">761</a></span><span class="t"> <span class="key">if</span> <span class="nam">attempts</span> <span class="op">></span> <span class="num">0</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t762" href="#t762">762</a></span><span class="t"> <span class="com"># Try to make it a key and see if that fixes the problem</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t763" href="#t763">763</a></span><span class="t"> <span class="nam">new_line</span> <span class="op">=</span> <span class="nam">lines</span><span class="op">[</span><span class="nam">server_position</span><span class="op">.</span><span class="nam">line</span><span class="op">]</span><span class="op">.</span><span class="nam">rstrip</span><span class="op">(</span><span class="op">)</span> <span class="op">+</span> <span class="nam">_COMPLETION_HINT_KEY</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t764" href="#t764">764</a></span><span class="t"> <span class="nam">lines</span><span class="op">[</span><span class="nam">server_position</span><span class="op">.</span><span class="nam">line</span><span class="op">]</span> <span class="op">=</span> <span class="nam">new_line</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t765" href="#t765">765</a></span><span class="t"> <span class="key">except</span> <span class="nam">YAMLError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t766" href="#t766">766</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t767" href="#t767">767</a></span><span class="t"> <span class="key">if</span> <span class="nam">content</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">767 ↛ 768</span><span class="annotate long">line 767 didn't jump to line 768, because the condition on line 767 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t768" href="#t768">768</a></span><span class="t"> <span class="nam">context</span> <span class="op">=</span> <span class="nam">lines</span><span class="op">[</span><span class="nam">server_position</span><span class="op">.</span><span class="nam">line</span><span class="op">]</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">"\n"</span><span class="op">,</span> <span class="str">"\\n"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t769" href="#t769">769</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"Completion failed: parse error: Line in question: {context}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t770" href="#t770">770</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t771" href="#t771">771</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="nam">_trace_cursor</span><span class="op">(</span><span class="nam">content</span><span class="op">,</span> <span class="nam">attribute_root_path</span><span class="op">,</span> <span class="nam">server_position</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t772" href="#t772">772</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t773" href="#t773">773</a></span><span class="t"> <span class="key">if</span> <span class="nam">m</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">773 ↛ 774</span><span class="annotate long">line 773 didn't jump to line 774, because the condition on line 773 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t774" href="#t774">774</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">"No match"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t775" href="#t775">775</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t776" href="#t776">776</a></span><span class="t"> <span class="nam">matched_key</span><span class="op">,</span> <span class="nam">attr_path</span><span class="op">,</span> <span class="nam">matched</span><span class="op">,</span> <span class="nam">parent</span> <span class="op">=</span> <span class="nam">m</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t777" href="#t777">777</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"Matched path: {matched} (path: {attr_path.path}) [{matched_key=}]"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t778" href="#t778">778</a></span><span class="t"> <span class="nam">feature_set</span> <span class="op">=</span> <span class="nam">ls</span><span class="op">.</span><span class="nam">plugin_feature_set</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t779" href="#t779">779</a></span><span class="t"> <span class="nam">root_parser</span> <span class="op">=</span> <span class="nam">feature_set</span><span class="op">.</span><span class="nam">manifest_parser_generator</span><span class="op">.</span><span class="nam">dispatchable_object_parsers</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t780" href="#t780">780</a></span><span class="t"> <span class="nam">OPARSER_MANIFEST_ROOT</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t781" href="#t781">781</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t782" href="#t782">782</a></span><span class="t"> <span class="nam">segments</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">attr_path</span><span class="op">.</span><span class="nam">path_segments</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t783" href="#t783">783</a></span><span class="t"> <span class="nam">km</span> <span class="op">=</span> <span class="nam">resolve_keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t784" href="#t784">784</a></span><span class="t"> <span class="nam">root_parser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t785" href="#t785">785</a></span><span class="t"> <span class="nam">DEBPUTY_PLUGIN_METADATA</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t786" href="#t786">786</a></span><span class="t"> <span class="nam">segments</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t787" href="#t787">787</a></span><span class="t"> <span class="num">0</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t788" href="#t788">788</a></span><span class="t"> <span class="nam">feature_set</span><span class="op">.</span><span class="nam">manifest_parser_generator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t789" href="#t789">789</a></span><span class="t"> <span class="nam">is_completion_attempt</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t790" href="#t790">790</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t791" href="#t791">791</a></span><span class="t"> <span class="key">if</span> <span class="nam">km</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">791 ↛ 792</span><span class="annotate long">line 791 didn't jump to line 792, because the condition on line 791 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t792" href="#t792">792</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t793" href="#t793">793</a></span><span class="t"> <span class="nam">parser</span><span class="op">,</span> <span class="nam">_</span><span class="op">,</span> <span class="nam">at_depth_idx</span> <span class="op">=</span> <span class="nam">km</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t794" href="#t794">794</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"Match leaf parser {at_depth_idx} -- {parser.__class__}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t795" href="#t795">795</a></span><span class="t"> <span class="nam">items</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t796" href="#t796">796</a></span><span class="t"> <span class="key">if</span> <span class="nam">at_depth_idx</span> <span class="op">+</span> <span class="num">1</span> <span class="op">>=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">segments</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">796 ↛ 859</span><span class="annotate long">line 796 didn't jump to line 859, because the condition on line 796 was never false</span></span></p> - <p class="run"><span class="n"><a id="t797" href="#t797">797</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">parser</span><span class="op">,</span> <span class="nam">DispatchingParserBase</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t798" href="#t798">798</a></span><span class="t"> <span class="key">if</span> <span class="nam">matched_key</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t799" href="#t799">799</a></span><span class="t"> <span class="nam">items</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t800" href="#t800">800</a></span><span class="t"> <span class="nam">CompletionItem</span><span class="op">(</span><span class="str">f"{k}:"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t801" href="#t801">801</a></span><span class="t"> <span class="key">for</span> <span class="nam">k</span> <span class="key">in</span> <span class="nam">parser</span><span class="op">.</span><span class="nam">registered_keywords</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t802" href="#t802">802</a></span><span class="t"> <span class="key">if</span> <span class="nam">k</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">parent</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t803" href="#t803">803</a></span><span class="t"> <span class="key">and</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t804" href="#t804">804</a></span><span class="t"> <span class="nam">parser</span><span class="op">.</span><span class="nam">parser_for</span><span class="op">(</span><span class="nam">k</span><span class="op">)</span><span class="op">.</span><span class="nam">parser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t805" href="#t805">805</a></span><span class="t"> <span class="nam">DeclarativeValuelessKeywordInputParser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t806" href="#t806">806</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t807" href="#t807">807</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t808" href="#t808">808</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t809" href="#t809">809</a></span><span class="t"> <span class="nam">items</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t810" href="#t810">810</a></span><span class="t"> <span class="nam">CompletionItem</span><span class="op">(</span><span class="nam">k</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t811" href="#t811">811</a></span><span class="t"> <span class="key">for</span> <span class="nam">k</span> <span class="key">in</span> <span class="nam">parser</span><span class="op">.</span><span class="nam">registered_keywords</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t812" href="#t812">812</a></span><span class="t"> <span class="key">if</span> <span class="nam">k</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">parent</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t813" href="#t813">813</a></span><span class="t"> <span class="key">and</span> <span class="nam">isinstance</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t814" href="#t814">814</a></span><span class="t"> <span class="nam">parser</span><span class="op">.</span><span class="nam">parser_for</span><span class="op">(</span><span class="nam">k</span><span class="op">)</span><span class="op">.</span><span class="nam">parser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t815" href="#t815">815</a></span><span class="t"> <span class="nam">DeclarativeValuelessKeywordInputParser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t816" href="#t816">816</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t817" href="#t817">817</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t818" href="#t818">818</a></span><span class="t"> <span class="key">elif</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">parser</span><span class="op">,</span> <span class="nam">InPackageContextParser</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">818 ↛ 820</span><span class="annotate long">line 818 didn't jump to line 820, because the condition on line 818 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t819" href="#t819">819</a></span><span class="t"> <span class="com"># doc = ls.workspace.get_text_document(params.text_document.uri)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t820" href="#t820">820</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"TODO: Match package - {parent} -- {matched} -- {matched_key=}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t821" href="#t821">821</a></span><span class="t"> <span class="key">elif</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">parser</span><span class="op">,</span> <span class="nam">DeclarativeMappingInputParser</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t822" href="#t822">822</a></span><span class="t"> <span class="key">if</span> <span class="nam">matched_key</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t823" href="#t823">823</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">"Match attributes"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t824" href="#t824">824</a></span><span class="t"> <span class="nam">locked</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="nam">parent</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t825" href="#t825">825</a></span><span class="t"> <span class="key">for</span> <span class="nam">mx</span> <span class="key">in</span> <span class="nam">parser</span><span class="op">.</span><span class="nam">mutually_exclusive_attributes</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t826" href="#t826">826</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">mx</span><span class="op">.</span><span class="nam">isdisjoint</span><span class="op">(</span><span class="nam">parent</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t827" href="#t827">827</a></span><span class="t"> <span class="nam">locked</span><span class="op">.</span><span class="nam">update</span><span class="op">(</span><span class="nam">mx</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t828" href="#t828">828</a></span><span class="t"> <span class="key">for</span> <span class="nam">attr_name</span><span class="op">,</span> <span class="nam">attr</span> <span class="key">in</span> <span class="nam">parser</span><span class="op">.</span><span class="nam">manifest_attributes</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t829" href="#t829">829</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">attr</span><span class="op">.</span><span class="nam">conflicting_attributes</span><span class="op">.</span><span class="nam">isdisjoint</span><span class="op">(</span><span class="nam">parent</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t830" href="#t830">830</a></span><span class="t"> <span class="nam">locked</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">attr_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t831" href="#t831">831</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t832" href="#t832">832</a></span><span class="t"> <span class="nam">items</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t833" href="#t833">833</a></span><span class="t"> <span class="nam">CompletionItem</span><span class="op">(</span><span class="str">f"{k}:"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t834" href="#t834">834</a></span><span class="t"> <span class="key">for</span> <span class="nam">k</span> <span class="key">in</span> <span class="nam">parser</span><span class="op">.</span><span class="nam">manifest_attributes</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t835" href="#t835">835</a></span><span class="t"> <span class="key">if</span> <span class="nam">k</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">locked</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t836" href="#t836">836</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t837" href="#t837">837</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t838" href="#t838">838</a></span><span class="t"> <span class="com"># Value</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t839" href="#t839">839</a></span><span class="t"> <span class="nam">key</span> <span class="op">=</span> <span class="nam">segments</span><span class="op">[</span><span class="nam">at_depth_idx</span><span class="op">]</span> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">segments</span><span class="op">)</span> <span class="op">></span> <span class="nam">at_depth_idx</span> <span class="key">else</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t840" href="#t840">840</a></span><span class="t"> <span class="nam">attr</span> <span class="op">=</span> <span class="nam">parser</span><span class="op">.</span><span class="nam">manifest_attributes</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t841" href="#t841">841</a></span><span class="t"> <span class="key">if</span> <span class="nam">attr</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">841 ↛ 849</span><span class="annotate long">line 841 didn't jump to line 849, because the condition on line 841 was never false</span></span></p> - <p class="run"><span class="n"><a id="t842" href="#t842">842</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"Expand value / key: {key} -- {attr.attribute_type}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t843" href="#t843">843</a></span><span class="t"> <span class="nam">items</span> <span class="op">=</span> <span class="nam">_completion_from_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t844" href="#t844">844</a></span><span class="t"> <span class="nam">attr</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t845" href="#t845">845</a></span><span class="t"> <span class="nam">feature_set</span><span class="op">.</span><span class="nam">manifest_parser_generator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t846" href="#t846">846</a></span><span class="t"> <span class="nam">matched</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t847" href="#t847">847</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t848" href="#t848">848</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t849" href="#t849">849</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t850" href="#t850">850</a></span><span class="t"> <span class="str">f"Expand value / key: {key} -- !! {list(parser.manifest_attributes)}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t851" href="#t851">851</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t852" href="#t852">852</a></span><span class="t"> <span class="key">elif</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">parser</span><span class="op">,</span> <span class="nam">DeclarativeNonMappingInputParser</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">852 ↛ 859</span><span class="annotate long">line 852 didn't jump to line 859, because the condition on line 852 was never false</span></span></p> - <p class="run"><span class="n"><a id="t853" href="#t853">853</a></span><span class="t"> <span class="nam">attr</span> <span class="op">=</span> <span class="nam">parser</span><span class="op">.</span><span class="nam">alt_form_parser</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t854" href="#t854">854</a></span><span class="t"> <span class="nam">items</span> <span class="op">=</span> <span class="nam">_completion_from_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t855" href="#t855">855</a></span><span class="t"> <span class="nam">attr</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t856" href="#t856">856</a></span><span class="t"> <span class="nam">feature_set</span><span class="op">.</span><span class="nam">manifest_parser_generator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t857" href="#t857">857</a></span><span class="t"> <span class="nam">matched</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t858" href="#t858">858</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t859" href="#t859">859</a></span><span class="t"> <span class="key">return</span> <span class="nam">items</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t860" href="#t860">860</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t861" href="#t861">861</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t862" href="#t862">862</a></span><span class="t"><span class="key">def</span> <span class="nam">_completion_from_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t863" href="#t863">863</a></span><span class="t"> <span class="nam">attr</span><span class="op">:</span> <span class="nam">AttributeDescription</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t864" href="#t864">864</a></span><span class="t"> <span class="nam">pg</span><span class="op">:</span> <span class="nam">ParserGenerator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t865" href="#t865">865</a></span><span class="t"> <span class="nam">matched</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t866" href="#t866">866</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">CompletionList</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">CompletionItem</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t867" href="#t867">867</a></span><span class="t"> <span class="nam">orig</span> <span class="op">=</span> <span class="nam">get_origin</span><span class="op">(</span><span class="nam">attr</span><span class="op">.</span><span class="nam">attribute_type</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t868" href="#t868">868</a></span><span class="t"> <span class="nam">valid_values</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span> <span class="op">=</span> <span class="nam">tuple</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t869" href="#t869">869</a></span><span class="t"> <span class="key">if</span> <span class="nam">orig</span> <span class="op">==</span> <span class="nam">Literal</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t870" href="#t870">870</a></span><span class="t"> <span class="nam">valid_values</span> <span class="op">=</span> <span class="nam">get_args</span><span class="op">(</span><span class="nam">attr</span><span class="op">.</span><span class="nam">attribute_type</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t871" href="#t871">871</a></span><span class="t"> <span class="key">elif</span> <span class="nam">orig</span> <span class="op">==</span> <span class="nam">bool</span> <span class="key">or</span> <span class="nam">attr</span><span class="op">.</span><span class="nam">attribute_type</span> <span class="op">==</span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"><span class="annotate short">871 ↛ 873</span><span class="annotate long">line 871 didn't jump to line 873, because the condition on line 871 was never false</span></span></p> - <p class="run"><span class="n"><a id="t872" href="#t872">872</a></span><span class="t"> <span class="nam">valid_values</span> <span class="op">=</span> <span class="op">(</span><span class="str">"true"</span><span class="op">,</span> <span class="str">"false"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t873" href="#t873">873</a></span><span class="t"> <span class="key">elif</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">orig</span><span class="op">,</span> <span class="nam">type</span><span class="op">)</span> <span class="key">and</span> <span class="nam">issubclass</span><span class="op">(</span><span class="nam">orig</span><span class="op">,</span> <span class="nam">DebputyDispatchableType</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t874" href="#t874">874</a></span><span class="t"> <span class="nam">parser</span> <span class="op">=</span> <span class="nam">pg</span><span class="op">.</span><span class="nam">dispatch_parser_table_for</span><span class="op">(</span><span class="nam">orig</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t875" href="#t875">875</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"M: {parser}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t876" href="#t876">876</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t877" href="#t877">877</a></span><span class="t"> <span class="key">if</span> <span class="nam">matched</span> <span class="key">in</span> <span class="nam">valid_values</span><span class="op">:</span> </span><span class="r"><span class="annotate short">877 ↛ 878</span><span class="annotate long">line 877 didn't jump to line 878, because the condition on line 877 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t878" href="#t878">878</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"Already filled: {matched} is one of {valid_values}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t879" href="#t879">879</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t880" href="#t880">880</a></span><span class="t"> <span class="key">if</span> <span class="nam">valid_values</span><span class="op">:</span> </span><span class="r"><span class="annotate short">880 ↛ 882</span><span class="annotate long">line 880 didn't jump to line 882, because the condition on line 880 was never false</span></span></p> - <p class="run"><span class="n"><a id="t881" href="#t881">881</a></span><span class="t"> <span class="key">return</span> <span class="op">[</span><span class="nam">CompletionItem</span><span class="op">(</span><span class="nam">x</span><span class="op">)</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">valid_values</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t882" href="#t882">882</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t883" href="#t883">883</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t884" href="#t884">884</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t885" href="#t885">885</a></span><span class="t"><span class="op">@</span><span class="nam">lsp_hover</span><span class="op">(</span><span class="nam">_LANGUAGE_IDS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t886" href="#t886">886</a></span><span class="t"><span class="key">def</span> <span class="nam">debputy_manifest_hover</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t887" href="#t887">887</a></span><span class="t"> <span class="nam">ls</span><span class="op">:</span> <span class="str">"DebputyLanguageServer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t888" href="#t888">888</a></span><span class="t"> <span class="nam">params</span><span class="op">:</span> <span class="nam">HoverParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t889" href="#t889">889</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Hover</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t890" href="#t890">890</a></span><span class="t"> <span class="nam">doc</span> <span class="op">=</span> <span class="nam">ls</span><span class="op">.</span><span class="nam">workspace</span><span class="op">.</span><span class="nam">get_text_document</span><span class="op">(</span><span class="nam">params</span><span class="op">.</span><span class="nam">text_document</span><span class="op">.</span><span class="nam">uri</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t891" href="#t891">891</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">is_valid_file</span><span class="op">(</span><span class="nam">doc</span><span class="op">.</span><span class="nam">path</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">891 ↛ 892</span><span class="annotate long">line 891 didn't jump to line 892, because the condition on line 891 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t892" href="#t892">892</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t893" href="#t893">893</a></span><span class="t"> <span class="nam">lines</span> <span class="op">=</span> <span class="nam">doc</span><span class="op">.</span><span class="nam">lines</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t894" href="#t894">894</a></span><span class="t"> <span class="nam">position_codec</span> <span class="op">=</span> <span class="nam">doc</span><span class="op">.</span><span class="nam">position_codec</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t895" href="#t895">895</a></span><span class="t"> <span class="nam">attribute_root_path</span> <span class="op">=</span> <span class="nam">AttributePath</span><span class="op">.</span><span class="nam">root_path</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t896" href="#t896">896</a></span><span class="t"> <span class="nam">server_position</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">position_from_client_units</span><span class="op">(</span><span class="nam">lines</span><span class="op">,</span> <span class="nam">params</span><span class="op">.</span><span class="nam">position</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t897" href="#t897">897</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t898" href="#t898">898</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t899" href="#t899">899</a></span><span class="t"> <span class="nam">content</span> <span class="op">=</span> <span class="nam">MANIFEST_YAML</span><span class="op">.</span><span class="nam">load</span><span class="op">(</span><span class="str">""</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">lines</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t900" href="#t900">900</a></span><span class="t"> <span class="key">except</span> <span class="nam">YAMLError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t901" href="#t901">901</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t902" href="#t902">902</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="nam">_trace_cursor</span><span class="op">(</span><span class="nam">content</span><span class="op">,</span> <span class="nam">attribute_root_path</span><span class="op">,</span> <span class="nam">server_position</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t903" href="#t903">903</a></span><span class="t"> <span class="key">if</span> <span class="nam">m</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">903 ↛ 904</span><span class="annotate long">line 903 didn't jump to line 904, because the condition on line 903 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t904" href="#t904">904</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">"No match"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t905" href="#t905">905</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t906" href="#t906">906</a></span><span class="t"> <span class="nam">matched_key</span><span class="op">,</span> <span class="nam">attr_path</span><span class="op">,</span> <span class="nam">matched</span><span class="op">,</span> <span class="nam">_</span> <span class="op">=</span> <span class="nam">m</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t907" href="#t907">907</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"Matched path: {matched} (path: {attr_path.path}) [{matched_key=}]"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t908" href="#t908">908</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t909" href="#t909">909</a></span><span class="t"> <span class="nam">feature_set</span> <span class="op">=</span> <span class="nam">ls</span><span class="op">.</span><span class="nam">plugin_feature_set</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t910" href="#t910">910</a></span><span class="t"> <span class="nam">parser_generator</span> <span class="op">=</span> <span class="nam">feature_set</span><span class="op">.</span><span class="nam">manifest_parser_generator</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t911" href="#t911">911</a></span><span class="t"> <span class="nam">root_parser</span> <span class="op">=</span> <span class="nam">parser_generator</span><span class="op">.</span><span class="nam">dispatchable_object_parsers</span><span class="op">[</span><span class="nam">OPARSER_MANIFEST_ROOT</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t912" href="#t912">912</a></span><span class="t"> <span class="nam">segments</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">attr_path</span><span class="op">.</span><span class="nam">path_segments</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t913" href="#t913">913</a></span><span class="t"> <span class="nam">km</span> <span class="op">=</span> <span class="nam">resolve_keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t914" href="#t914">914</a></span><span class="t"> <span class="nam">root_parser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t915" href="#t915">915</a></span><span class="t"> <span class="nam">DEBPUTY_PLUGIN_METADATA</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t916" href="#t916">916</a></span><span class="t"> <span class="nam">segments</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t917" href="#t917">917</a></span><span class="t"> <span class="num">0</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t918" href="#t918">918</a></span><span class="t"> <span class="nam">parser_generator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t919" href="#t919">919</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t920" href="#t920">920</a></span><span class="t"> <span class="key">if</span> <span class="nam">km</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">920 ↛ 921</span><span class="annotate long">line 920 didn't jump to line 921, because the condition on line 920 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t921" href="#t921">921</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">"No keyword match"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t922" href="#t922">922</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t923" href="#t923">923</a></span><span class="t"> <span class="nam">parser</span><span class="op">,</span> <span class="nam">plugin_metadata</span><span class="op">,</span> <span class="nam">at_depth_idx</span> <span class="op">=</span> <span class="nam">km</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t924" href="#t924">924</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"Match leaf parser {at_depth_idx}/{len(segments)} -- {parser.__class__}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t925" href="#t925">925</a></span><span class="t"> <span class="nam">hover_doc_text</span> <span class="op">=</span> <span class="nam">resolve_hover_text</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t926" href="#t926">926</a></span><span class="t"> <span class="nam">feature_set</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t927" href="#t927">927</a></span><span class="t"> <span class="nam">parser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t928" href="#t928">928</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t929" href="#t929">929</a></span><span class="t"> <span class="nam">segments</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t930" href="#t930">930</a></span><span class="t"> <span class="nam">at_depth_idx</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t931" href="#t931">931</a></span><span class="t"> <span class="nam">matched</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t932" href="#t932">932</a></span><span class="t"> <span class="nam">matched_key</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t933" href="#t933">933</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t934" href="#t934">934</a></span><span class="t"> <span class="key">return</span> <span class="nam">_hover_doc</span><span class="op">(</span><span class="nam">ls</span><span class="op">,</span> <span class="nam">hover_doc_text</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t935" href="#t935">935</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t936" href="#t936">936</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t937" href="#t937">937</a></span><span class="t"><span class="key">def</span> <span class="nam">resolve_hover_text_for_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t938" href="#t938">938</a></span><span class="t"> <span class="nam">feature_set</span><span class="op">:</span> <span class="nam">PluginProvidedFeatureSet</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t939" href="#t939">939</a></span><span class="t"> <span class="nam">parser</span><span class="op">:</span> <span class="nam">DeclarativeMappingInputParser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t940" href="#t940">940</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">:</span> <span class="nam">DebputyPluginMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t941" href="#t941">941</a></span><span class="t"> <span class="nam">segment</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">int</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t942" href="#t942">942</a></span><span class="t"> <span class="nam">matched</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t943" href="#t943">943</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t944" href="#t944">944</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t945" href="#t945">945</a></span><span class="t"> <span class="nam">hover_doc_text</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t946" href="#t946">946</a></span><span class="t"> <span class="nam">attr</span> <span class="op">=</span> <span class="nam">parser</span><span class="op">.</span><span class="nam">manifest_attributes</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">segment</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t947" href="#t947">947</a></span><span class="t"> <span class="nam">attr_type</span> <span class="op">=</span> <span class="nam">attr</span><span class="op">.</span><span class="nam">attribute_type</span> <span class="key">if</span> <span class="nam">attr</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">else</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t948" href="#t948">948</a></span><span class="t"> <span class="key">if</span> <span class="nam">attr_type</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">948 ↛ 949</span><span class="annotate long">line 948 didn't jump to line 949, because the condition on line 948 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t949" href="#t949">949</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"Matched value for {segment} -- No attr or type"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t950" href="#t950">950</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t951" href="#t951">951</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">attr_type</span><span class="op">,</span> <span class="nam">type</span><span class="op">)</span> <span class="key">and</span> <span class="nam">issubclass</span><span class="op">(</span><span class="nam">attr_type</span><span class="op">,</span> <span class="nam">DebputyDispatchableType</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">951 ↛ 969</span><span class="annotate long">line 951 didn't jump to line 969, because the condition on line 951 was never false</span></span></p> - <p class="run"><span class="n"><a id="t952" href="#t952">952</a></span><span class="t"> <span class="nam">parser_generator</span> <span class="op">=</span> <span class="nam">feature_set</span><span class="op">.</span><span class="nam">manifest_parser_generator</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t953" href="#t953">953</a></span><span class="t"> <span class="nam">parser</span> <span class="op">=</span> <span class="nam">parser_generator</span><span class="op">.</span><span class="nam">dispatch_parser_table_for</span><span class="op">(</span><span class="nam">attr_type</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t954" href="#t954">954</a></span><span class="t"> <span class="key">if</span> <span class="nam">parser</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">matched</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">954 ↛ 955</span><span class="annotate long">line 954 didn't jump to line 955, because the condition on line 954 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t955" href="#t955">955</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t956" href="#t956">956</a></span><span class="t"> <span class="str">f"Unknown parser for {segment} or matched is not a str -- {attr_type} {type(matched)=}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t957" href="#t957">957</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t958" href="#t958">958</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t959" href="#t959">959</a></span><span class="t"> <span class="nam">subparser</span> <span class="op">=</span> <span class="nam">parser</span><span class="op">.</span><span class="nam">parser_for</span><span class="op">(</span><span class="nam">matched</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t960" href="#t960">960</a></span><span class="t"> <span class="key">if</span> <span class="nam">subparser</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">960 ↛ 961</span><span class="annotate long">line 960 didn't jump to line 961, because the condition on line 960 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t961" href="#t961">961</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"Unknown parser for {matched} (subparser)"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t962" href="#t962">962</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t963" href="#t963">963</a></span><span class="t"> <span class="nam">hover_doc_text</span> <span class="op">=</span> <span class="nam">render_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t964" href="#t964">964</a></span><span class="t"> <span class="nam">matched</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t965" href="#t965">965</a></span><span class="t"> <span class="nam">subparser</span><span class="op">.</span><span class="nam">parser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t966" href="#t966">966</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t967" href="#t967">967</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t968" href="#t968">968</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t969" href="#t969">969</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"Unknown value: {matched} -- {segment}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t970" href="#t970">970</a></span><span class="t"> <span class="key">return</span> <span class="nam">hover_doc_text</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t971" href="#t971">971</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t972" href="#t972">972</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t973" href="#t973">973</a></span><span class="t"><span class="key">def</span> <span class="nam">resolve_hover_text</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t974" href="#t974">974</a></span><span class="t"> <span class="nam">feature_set</span><span class="op">:</span> <span class="nam">PluginProvidedFeatureSet</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t975" href="#t975">975</a></span><span class="t"> <span class="nam">parser</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">DeclarativeInputParser</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">,</span> <span class="nam">DispatchingParserBase</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t976" href="#t976">976</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">:</span> <span class="nam">DebputyPluginMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t977" href="#t977">977</a></span><span class="t"> <span class="nam">segments</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">int</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t978" href="#t978">978</a></span><span class="t"> <span class="nam">at_depth_idx</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t979" href="#t979">979</a></span><span class="t"> <span class="nam">matched</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t980" href="#t980">980</a></span><span class="t"> <span class="nam">matched_key</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t981" href="#t981">981</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t982" href="#t982">982</a></span><span class="t"> <span class="nam">hover_doc_text</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t983" href="#t983">983</a></span><span class="t"> <span class="key">if</span> <span class="nam">at_depth_idx</span> <span class="op">==</span> <span class="nam">len</span><span class="op">(</span><span class="nam">segments</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t984" href="#t984">984</a></span><span class="t"> <span class="nam">segment</span> <span class="op">=</span> <span class="nam">segments</span><span class="op">[</span><span class="nam">at_depth_idx</span> <span class="op">-</span> <span class="num">1</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t985" href="#t985">985</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"Matched {segment} at ==, {matched_key=} "</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t986" href="#t986">986</a></span><span class="t"> <span class="nam">hover_doc_text</span> <span class="op">=</span> <span class="nam">render_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t987" href="#t987">987</a></span><span class="t"> <span class="nam">segment</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t988" href="#t988">988</a></span><span class="t"> <span class="nam">parser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t989" href="#t989">989</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t990" href="#t990">990</a></span><span class="t"> <span class="nam">is_root_rule</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t991" href="#t991">991</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t992" href="#t992">992</a></span><span class="t"> <span class="key">elif</span> <span class="nam">at_depth_idx</span> <span class="op">+</span> <span class="num">1</span> <span class="op">==</span> <span class="nam">len</span><span class="op">(</span><span class="nam">segments</span><span class="op">)</span> <span class="key">and</span> <span class="nam">isinstance</span><span class="op">(</span> </span><span class="r"><span class="annotate short">992 ↛ 1015</span><span class="annotate long">line 992 didn't jump to line 1015, because the condition on line 992 was never false</span></span></p> - <p class="pln"><span class="n"><a id="t993" href="#t993">993</a></span><span class="t"> <span class="nam">parser</span><span class="op">,</span> <span class="nam">DeclarativeMappingInputParser</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t994" href="#t994">994</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t995" href="#t995">995</a></span><span class="t"> <span class="nam">segment</span> <span class="op">=</span> <span class="nam">segments</span><span class="op">[</span><span class="nam">at_depth_idx</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t996" href="#t996">996</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"Matched {segment} at -1, {matched_key=} "</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t997" href="#t997">997</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">segment</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">997 ↛ 1017</span><span class="annotate long">line 997 didn't jump to line 1017, because the condition on line 997 was never false</span></span></p> - <p class="run"><span class="n"><a id="t998" href="#t998">998</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">matched_key</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t999" href="#t999">999</a></span><span class="t"> <span class="nam">hover_doc_text</span> <span class="op">=</span> <span class="nam">resolve_hover_text_for_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1000" href="#t1000">1000</a></span><span class="t"> <span class="nam">feature_set</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1001" href="#t1001">1001</a></span><span class="t"> <span class="nam">parser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1002" href="#t1002">1002</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1003" href="#t1003">1003</a></span><span class="t"> <span class="nam">segment</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1004" href="#t1004">1004</a></span><span class="t"> <span class="nam">matched</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1005" href="#t1005">1005</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1006" href="#t1006">1006</a></span><span class="t"> <span class="key">if</span> <span class="nam">matched_key</span> <span class="key">or</span> <span class="nam">hover_doc_text</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1007" href="#t1007">1007</a></span><span class="t"> <span class="nam">rule_name</span> <span class="op">=</span> <span class="nam">_guess_rule_name</span><span class="op">(</span><span class="nam">segments</span><span class="op">,</span> <span class="nam">at_depth_idx</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1008" href="#t1008">1008</a></span><span class="t"> <span class="nam">hover_doc_text</span> <span class="op">=</span> <span class="nam">_render_param_doc</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1009" href="#t1009">1009</a></span><span class="t"> <span class="nam">rule_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1010" href="#t1010">1010</a></span><span class="t"> <span class="nam">parser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1011" href="#t1011">1011</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1012" href="#t1012">1012</a></span><span class="t"> <span class="nam">segment</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1013" href="#t1013">1013</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1014" href="#t1014">1014</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1015" href="#t1015">1015</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"No doc: {at_depth_idx=} {len(segments)=}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1016" href="#t1016">1016</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1017" href="#t1017">1017</a></span><span class="t"> <span class="key">return</span> <span class="nam">hover_doc_text</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1018" href="#t1018">1018</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1019" href="#t1019">1019</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1020" href="#t1020">1020</a></span><span class="t"><span class="key">def</span> <span class="nam">_hover_doc</span><span class="op">(</span><span class="nam">ls</span><span class="op">:</span> <span class="str">"LanguageServer"</span><span class="op">,</span> <span class="nam">hover_doc_text</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Hover</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1021" href="#t1021">1021</a></span><span class="t"> <span class="key">if</span> <span class="nam">hover_doc_text</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1021 ↛ 1022</span><span class="annotate long">line 1021 didn't jump to line 1022, because the condition on line 1021 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1022" href="#t1022">1022</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1023" href="#t1023">1023</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1024" href="#t1024">1024</a></span><span class="t"> <span class="nam">supported_formats</span> <span class="op">=</span> <span class="nam">ls</span><span class="op">.</span><span class="nam">client_capabilities</span><span class="op">.</span><span class="nam">text_document</span><span class="op">.</span><span class="nam">hover</span><span class="op">.</span><span class="nam">content_format</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1025" href="#t1025">1025</a></span><span class="t"> <span class="key">except</span> <span class="nam">AttributeError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1026" href="#t1026">1026</a></span><span class="t"> <span class="nam">supported_formats</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1027" href="#t1027">1027</a></span><span class="t"> <span class="nam">markup_kind</span> <span class="op">=</span> <span class="nam">MarkupKind</span><span class="op">.</span><span class="nam">Markdown</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1028" href="#t1028">1028</a></span><span class="t"> <span class="key">if</span> <span class="nam">markup_kind</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">supported_formats</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1028 ↛ 1030</span><span class="annotate long">line 1028 didn't jump to line 1030, because the condition on line 1028 was never false</span></span></p> - <p class="run"><span class="n"><a id="t1029" href="#t1029">1029</a></span><span class="t"> <span class="nam">markup_kind</span> <span class="op">=</span> <span class="nam">MarkupKind</span><span class="op">.</span><span class="nam">PlainText</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1030" href="#t1030">1030</a></span><span class="t"> <span class="key">return</span> <span class="nam">Hover</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1031" href="#t1031">1031</a></span><span class="t"> <span class="nam">contents</span><span class="op">=</span><span class="nam">MarkupContent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1032" href="#t1032">1032</a></span><span class="t"> <span class="nam">kind</span><span class="op">=</span><span class="nam">markup_kind</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1033" href="#t1033">1033</a></span><span class="t"> <span class="nam">value</span><span class="op">=</span><span class="nam">hover_doc_text</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1034" href="#t1034">1034</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1035" href="#t1035">1035</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_debian_copyright_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_debian_rules_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_5d0ec0d5422112df_lsp_debian_rules_py.html b/coverage-report/d_5d0ec0d5422112df_lsp_debian_rules_py.html deleted file mode 100644 index 46ad221..0000000 --- a/coverage-report/d_5d0ec0d5422112df_lsp_debian_rules_py.html +++ /dev/null @@ -1,483 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/lsp/lsp_debian_rules.py: 18%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/lsp/lsp_debian_rules.py</b>: - <span class="pc_cov">18%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">188 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">42<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">146<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_debian_debputy_manifest_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_debian_tests_control_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">functools</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">itertools</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">json</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">import</span> <span class="nam">re</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">import</span> <span class="nam">subprocess</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">Sequence</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">Iterable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">List</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">Iterator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"><span class="key">from</span> <span class="nam">lsprotocol</span><span class="op">.</span><span class="nam">types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">CompletionItem</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">Range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">Position</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">DiagnosticSeverity</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="nam">CompletionList</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">CompletionParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="nam">TEXT_DOCUMENT_WILL_SAVE_WAIT_UNTIL</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="nam">TEXT_DOCUMENT_CODE_ACTION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">debhelper_emulation</span> <span class="key">import</span> <span class="nam">parse_drules_for_addons</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">linting</span><span class="op">.</span><span class="nam">lint_util</span> <span class="key">import</span> <span class="nam">LintState</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">lsp_features</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="nam">lint_diagnostics</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="nam">lsp_standard_handler</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="nam">lsp_completer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">quickfixes</span> <span class="key">import</span> <span class="nam">propose_correct_text_quick_fix</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">spellchecking</span> <span class="key">import</span> <span class="nam">spellcheck_line</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">text_util</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">LintCapablePositionCodec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">_warn</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"><span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="key">from</span> <span class="nam">debian</span><span class="op">.</span><span class="nam">_deb822_repro</span><span class="op">.</span><span class="nam">locatable</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="nam">Position</span> <span class="key">as</span> <span class="nam">TEPosition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="nam">Range</span> <span class="key">as</span> <span class="nam">TERange</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="nam">START_POSITION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="key">from</span> <span class="nam">pygls</span><span class="op">.</span><span class="nam">server</span> <span class="key">import</span> <span class="nam">LanguageServer</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="key">from</span> <span class="nam">pygls</span><span class="op">.</span><span class="nam">workspace</span> <span class="key">import</span> <span class="nam">TextDocument</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"><span class="key">except</span> <span class="nam">ImportError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"><span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="key">from</span> <span class="nam">Levenshtein</span> <span class="key">import</span> <span class="nam">distance</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"><span class="key">except</span> <span class="nam">ImportError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="key">def</span> <span class="nam">_detect_possible_typo</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="nam">provided_value</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="nam">known_values</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="key">return</span> <span class="nam">tuple</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"><span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="key">def</span> <span class="nam">_detect_possible_typo</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="nam">provided_value</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="nam">known_values</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="nam">k_len</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">provided_value</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="nam">candidates</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="key">for</span> <span class="nam">known_value</span> <span class="key">in</span> <span class="nam">known_values</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="key">if</span> <span class="nam">abs</span><span class="op">(</span><span class="nam">k_len</span> <span class="op">-</span> <span class="nam">len</span><span class="op">(</span><span class="nam">known_value</span><span class="op">)</span><span class="op">)</span> <span class="op">></span> <span class="num">2</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="nam">d</span> <span class="op">=</span> <span class="nam">distance</span><span class="op">(</span><span class="nam">provided_value</span><span class="op">,</span> <span class="nam">known_value</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="key">if</span> <span class="nam">d</span> <span class="op">></span> <span class="num">2</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="nam">candidates</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">known_value</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="key">return</span> <span class="nam">candidates</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"><span class="nam">_CONTAINS_TAB_OR_COLON</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r"[\t:]"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"><span class="nam">_WORDS_RE</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">"([a-zA-Z0-9_-]+)"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"><span class="nam">_MAKE_ERROR_RE</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r"^[^:]+:(\d+):\s*(\S.+)"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"><span class="nam">_KNOWN_TARGETS</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="str">"binary"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="str">"binary-arch"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="str">"binary-indep"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="str">"build"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="str">"build-arch"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="str">"build-indep"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="str">"clean"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"><span class="nam">_COMMAND_WORDS</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="str">"export"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="str">"ifeq"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="str">"ifneq"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="str">"ifdef"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="str">"ifndef"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="str">"endif"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="str">"else"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"><span class="nam">_LANGUAGE_IDS</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="str">"debian/rules"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="com"># LSP's official language ID for Makefile</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="str">"makefile"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="com"># emacs's name (there is no debian-rules mode)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="str">"makefile-gmake"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="com"># vim's name (there is no debrules)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="str">"make"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"><span class="key">def</span> <span class="nam">_as_hook_targets</span><span class="op">(</span><span class="nam">command_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="key">for</span> <span class="nam">prefix</span><span class="op">,</span> <span class="nam">suffix</span> <span class="key">in</span> <span class="nam">itertools</span><span class="op">.</span><span class="nam">product</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="op">[</span><span class="str">"override_"</span><span class="op">,</span> <span class="str">"execute_before_"</span><span class="op">,</span> <span class="str">"execute_after_"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="op">[</span><span class="str">""</span><span class="op">,</span> <span class="str">"-arch"</span><span class="op">,</span> <span class="str">"-indep"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="key">yield</span> <span class="str">f"{prefix}{command_name}{suffix}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"><span class="nam">lsp_standard_handler</span><span class="op">(</span><span class="nam">_LANGUAGE_IDS</span><span class="op">,</span> <span class="nam">TEXT_DOCUMENT_CODE_ACTION</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"><span class="nam">lsp_standard_handler</span><span class="op">(</span><span class="nam">_LANGUAGE_IDS</span><span class="op">,</span> <span class="nam">TEXT_DOCUMENT_WILL_SAVE_WAIT_UNTIL</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"><span class="key">def</span> <span class="nam">is_valid_file</span><span class="op">(</span><span class="nam">path</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="com"># For debian/rules, the language ID is often set to makefile meaning we get random "non-debian/rules"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="com"># makefiles here. Skip those.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="key">return</span> <span class="nam">path</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"debian/rules"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"><span class="op">@</span><span class="nam">lint_diagnostics</span><span class="op">(</span><span class="nam">_LANGUAGE_IDS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"><span class="key">def</span> <span class="nam">_lint_debian_rules</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="nam">doc_reference</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">:</span> <span class="nam">LintCapablePositionCodec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">is_valid_file</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="key">return</span> <span class="nam">_lint_debian_rules_impl</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="nam">doc_reference</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"><span class="op">@</span><span class="nam">functools</span><span class="op">.</span><span class="nam">lru_cache</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"><span class="key">def</span> <span class="nam">_is_project_trusted</span><span class="op">(</span><span class="nam">source_root</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="key">return</span> <span class="nam">os</span><span class="op">.</span><span class="nam">environ</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"DEBPUTY_TRUST_PROJECT"</span><span class="op">,</span> <span class="str">"0"</span><span class="op">)</span> <span class="op">==</span> <span class="str">"1"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"><span class="key">def</span> <span class="nam">_run_make_dryrun</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="nam">source_root</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">_is_project_trusted</span><span class="op">(</span><span class="nam">source_root</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="nam">make_res</span> <span class="op">=</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">run</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="op">[</span><span class="str">"make"</span><span class="op">,</span> <span class="str">"--dry-run"</span><span class="op">,</span> <span class="str">"-f"</span><span class="op">,</span> <span class="str">"-"</span><span class="op">,</span> <span class="str">"debhelper-fail-me"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="nam">input</span><span class="op">=</span><span class="str">""</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">lines</span><span class="op">)</span><span class="op">.</span><span class="nam">encode</span><span class="op">(</span><span class="str">"utf-8"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="nam">stdout</span><span class="op">=</span><span class="nam">subprocess</span><span class="op">.</span><span class="nam">DEVNULL</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">stderr</span><span class="op">=</span><span class="nam">subprocess</span><span class="op">.</span><span class="nam">PIPE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="nam">cwd</span><span class="op">=</span><span class="nam">source_root</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="nam">timeout</span><span class="op">=</span><span class="num">1</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="key">except</span> <span class="op">(</span><span class="nam">FileNotFoundError</span><span class="op">,</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">TimeoutExpired</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="key">if</span> <span class="nam">make_res</span><span class="op">.</span><span class="nam">returncode</span> <span class="op">!=</span> <span class="num">0</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="nam">make_output</span> <span class="op">=</span> <span class="nam">make_res</span><span class="op">.</span><span class="nam">stderr</span><span class="op">.</span><span class="nam">decode</span><span class="op">(</span><span class="str">"utf-8"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="nam">_MAKE_ERROR_RE</span><span class="op">.</span><span class="nam">match</span><span class="op">(</span><span class="nam">make_output</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="key">if</span> <span class="nam">m</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="com"># We want it zero-based and make reports it one-based</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="nam">line_of_error</span> <span class="op">=</span> <span class="nam">int</span><span class="op">(</span><span class="nam">m</span><span class="op">.</span><span class="nam">group</span><span class="op">(</span><span class="num">1</span><span class="op">)</span><span class="op">)</span> <span class="op">-</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="nam">msg</span> <span class="op">=</span> <span class="nam">m</span><span class="op">.</span><span class="nam">group</span><span class="op">(</span><span class="num">2</span><span class="op">)</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="nam">error_range</span> <span class="op">=</span> <span class="nam">Range</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="nam">line_of_error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="num">0</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="nam">line_of_error</span> <span class="op">+</span> <span class="num">1</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="num">0</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="com"># No conversion needed; it is pure line numbers</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="key">return</span> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="nam">error_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="str">f"make error: {msg}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy (make)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"><span class="key">def</span> <span class="nam">iter_make_lines</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">:</span> <span class="nam">LintCapablePositionCodec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">int</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="nam">skip_next_line</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="nam">is_extended_comment</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="key">for</span> <span class="nam">line_no</span><span class="op">,</span> <span class="nam">line</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">lines</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="nam">skip_this</span> <span class="op">=</span> <span class="nam">skip_next_line</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="nam">skip_next_line</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="key">if</span> <span class="nam">line</span><span class="op">.</span><span class="nam">rstrip</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"\\"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="nam">skip_next_line</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="key">if</span> <span class="nam">skip_this</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_extended_comment</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="nam">spellcheck_line</span><span class="op">(</span><span class="nam">lines</span><span class="op">,</span> <span class="nam">position_codec</span><span class="op">,</span> <span class="nam">line_no</span><span class="op">,</span> <span class="nam">line</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="key">if</span> <span class="nam">line</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"#"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">spellcheck_line</span><span class="op">(</span><span class="nam">lines</span><span class="op">,</span> <span class="nam">position_codec</span><span class="op">,</span> <span class="nam">line_no</span><span class="op">,</span> <span class="nam">line</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="nam">is_extended_comment</span> <span class="op">=</span> <span class="nam">skip_next_line</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="nam">is_extended_comment</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="key">if</span> <span class="nam">line</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"\t"</span><span class="op">)</span> <span class="key">or</span> <span class="nam">line</span><span class="op">.</span><span class="nam">isspace</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="nam">is_extended_comment</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="com"># We are not really dealing with extension lines at the moment (other than for spellchecking),</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="com"># since nothing needs it</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="key">yield</span> <span class="nam">line_no</span><span class="op">,</span> <span class="nam">line</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"><span class="key">def</span> <span class="nam">_lint_debian_rules_impl</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="nam">lint_state</span><span class="op">:</span> <span class="nam">LintState</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="nam">lines</span> <span class="op">=</span> <span class="nam">lint_state</span><span class="op">.</span><span class="nam">lines</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="nam">position_codec</span> <span class="op">=</span> <span class="nam">lint_state</span><span class="op">.</span><span class="nam">position_codec</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="nam">path</span> <span class="op">=</span> <span class="nam">lint_state</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="nam">source_root</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">dirname</span><span class="op">(</span><span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">dirname</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="key">if</span> <span class="nam">source_root</span> <span class="op">==</span> <span class="str">""</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="nam">source_root</span> <span class="op">=</span> <span class="str">"."</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="nam">diagnostics</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="nam">make_error</span> <span class="op">=</span> <span class="nam">_run_make_dryrun</span><span class="op">(</span><span class="nam">source_root</span><span class="op">,</span> <span class="nam">lines</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="key">if</span> <span class="nam">make_error</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">make_error</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="nam">all_dh_commands</span> <span class="op">=</span> <span class="nam">_all_dh_commands</span><span class="op">(</span><span class="nam">source_root</span><span class="op">,</span> <span class="nam">lines</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="key">if</span> <span class="nam">all_dh_commands</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="nam">all_hook_targets</span> <span class="op">=</span> <span class="op">{</span><span class="nam">ht</span> <span class="key">for</span> <span class="nam">c</span> <span class="key">in</span> <span class="nam">all_dh_commands</span> <span class="key">for</span> <span class="nam">ht</span> <span class="key">in</span> <span class="nam">_as_hook_targets</span><span class="op">(</span><span class="nam">c</span><span class="op">)</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="nam">all_hook_targets</span><span class="op">.</span><span class="nam">update</span><span class="op">(</span><span class="nam">_KNOWN_TARGETS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="nam">source</span> <span class="op">=</span> <span class="str">"debputy (dh_assistant)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="nam">all_hook_targets</span> <span class="op">=</span> <span class="nam">_KNOWN_TARGETS</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="nam">source</span> <span class="op">=</span> <span class="str">"debputy"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="nam">missing_targets</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="key">for</span> <span class="nam">line_no</span><span class="op">,</span> <span class="nam">line</span> <span class="key">in</span> <span class="nam">iter_make_lines</span><span class="op">(</span><span class="nam">lines</span><span class="op">,</span> <span class="nam">position_codec</span><span class="op">,</span> <span class="nam">diagnostics</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="nam">colon_idx</span> <span class="op">=</span> <span class="nam">line</span><span class="op">.</span><span class="nam">index</span><span class="op">(</span><span class="str">":"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">line</span><span class="op">)</span> <span class="op">></span> <span class="nam">colon_idx</span> <span class="op">+</span> <span class="num">1</span> <span class="key">and</span> <span class="nam">line</span><span class="op">[</span><span class="nam">colon_idx</span> <span class="op">+</span> <span class="num">1</span><span class="op">]</span> <span class="op">==</span> <span class="str">"="</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="key">except</span> <span class="nam">ValueError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="nam">target_substring</span> <span class="op">=</span> <span class="nam">line</span><span class="op">[</span><span class="num">0</span><span class="op">:</span><span class="nam">colon_idx</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="key">if</span> <span class="str">"="</span> <span class="key">in</span> <span class="nam">target_substring</span> <span class="key">or</span> <span class="str">"$(for"</span> <span class="key">in</span> <span class="nam">target_substring</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="key">for</span> <span class="nam">i</span><span class="op">,</span> <span class="nam">m</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">_WORDS_RE</span><span class="op">.</span><span class="nam">finditer</span><span class="op">(</span><span class="nam">target_substring</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="nam">target</span> <span class="op">=</span> <span class="nam">m</span><span class="op">.</span><span class="nam">group</span><span class="op">(</span><span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="key">if</span> <span class="nam">i</span> <span class="op">==</span> <span class="num">0</span> <span class="key">and</span> <span class="op">(</span><span class="nam">target</span> <span class="key">in</span> <span class="nam">_COMMAND_WORDS</span> <span class="key">or</span> <span class="nam">target</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"("</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="key">if</span> <span class="str">"%"</span> <span class="key">in</span> <span class="nam">target</span> <span class="key">or</span> <span class="str">"$"</span> <span class="key">in</span> <span class="nam">target</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="key">if</span> <span class="nam">target</span> <span class="key">in</span> <span class="nam">all_hook_targets</span> <span class="key">or</span> <span class="nam">target</span> <span class="key">in</span> <span class="nam">missing_targets</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="nam">pos</span><span class="op">,</span> <span class="nam">endpos</span> <span class="op">=</span> <span class="nam">m</span><span class="op">.</span><span class="nam">span</span><span class="op">(</span><span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="nam">hook_location</span> <span class="op">=</span> <span class="nam">line_no</span><span class="op">,</span> <span class="nam">pos</span><span class="op">,</span> <span class="nam">endpos</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="nam">missing_targets</span><span class="op">[</span><span class="nam">target</span><span class="op">]</span> <span class="op">=</span> <span class="nam">hook_location</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="key">for</span> <span class="nam">target</span><span class="op">,</span> <span class="op">(</span><span class="nam">line_no</span><span class="op">,</span> <span class="nam">pos</span><span class="op">,</span> <span class="nam">endpos</span><span class="op">)</span> <span class="key">in</span> <span class="nam">missing_targets</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="nam">candidates</span> <span class="op">=</span> <span class="nam">_detect_possible_typo</span><span class="op">(</span><span class="nam">target</span><span class="op">,</span> <span class="nam">all_hook_targets</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">candidates</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">target</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="op">(</span><span class="str">"override_"</span><span class="op">,</span> <span class="str">"execute_before_"</span><span class="op">,</span> <span class="str">"execute_after_"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="nam">r_server_units</span> <span class="op">=</span> <span class="nam">Range</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="nam">line_no</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="nam">pos</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="nam">line_no</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> <span class="nam">endpos</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="nam">r</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span><span class="nam">lines</span><span class="op">,</span> <span class="nam">r_server_units</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="key">if</span> <span class="nam">candidates</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="nam">msg</span> <span class="op">=</span> <span class="str">f"Target {target} looks like a typo of a known target"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="nam">msg</span> <span class="op">=</span> <span class="str">f"Unknown rules dh hook target {target}"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="key">if</span> <span class="nam">candidates</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="nam">fixes</span> <span class="op">=</span> <span class="op">[</span><span class="nam">propose_correct_text_quick_fix</span><span class="op">(</span><span class="nam">c</span><span class="op">)</span> <span class="key">for</span> <span class="nam">c</span> <span class="key">in</span> <span class="nam">candidates</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="nam">fixes</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="nam">r</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="nam">msg</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Warning</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="nam">data</span><span class="op">=</span><span class="nam">fixes</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="nam">source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> <span class="key">return</span> <span class="nam">diagnostics</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"><span class="key">def</span> <span class="nam">_all_dh_commands</span><span class="op">(</span><span class="nam">source_root</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> <span class="nam">drules_sequences</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> <span class="nam">parse_drules_for_addons</span><span class="op">(</span><span class="nam">lines</span><span class="op">,</span> <span class="nam">drules_sequences</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> <span class="nam">cmd</span> <span class="op">=</span> <span class="op">[</span><span class="str">"dh_assistant"</span><span class="op">,</span> <span class="str">"list-commands"</span><span class="op">,</span> <span class="str">"--output-format=json"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> <span class="key">if</span> <span class="nam">drules_sequences</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> <span class="nam">cmd</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">f"--with={','.join(drules_sequences)}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> <span class="nam">output</span> <span class="op">=</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_output</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> <span class="nam">cmd</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> <span class="nam">stderr</span><span class="op">=</span><span class="nam">subprocess</span><span class="op">.</span><span class="nam">DEVNULL</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> <span class="nam">cwd</span><span class="op">=</span><span class="nam">source_root</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> <span class="key">except</span> <span class="op">(</span><span class="nam">FileNotFoundError</span><span class="op">,</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">CalledProcessError</span><span class="op">)</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span><span class="str">f"dh_assistant failed (dir: {source_root}): {str(e)}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"> <span class="nam">data</span> <span class="op">=</span> <span class="nam">json</span><span class="op">.</span><span class="nam">loads</span><span class="op">(</span><span class="nam">output</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> <span class="nam">commands_raw</span> <span class="op">=</span> <span class="nam">data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"commands"</span><span class="op">)</span> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">data</span><span class="op">,</span> <span class="nam">dict</span><span class="op">)</span> <span class="key">else</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">commands_raw</span><span class="op">,</span> <span class="nam">list</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"> <span class="nam">commands</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"> <span class="key">for</span> <span class="nam">command</span> <span class="key">in</span> <span class="nam">commands_raw</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">command</span><span class="op">,</span> <span class="nam">dict</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"> <span class="nam">command_name</span> <span class="op">=</span> <span class="nam">command</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"command"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">command_name</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"> <span class="nam">commands</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">command_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"> <span class="key">return</span> <span class="nam">commands</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"><span class="op">@</span><span class="nam">lsp_completer</span><span class="op">(</span><span class="nam">_LANGUAGE_IDS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"><span class="key">def</span> <span class="nam">_debian_rules_completions</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"> <span class="nam">ls</span><span class="op">:</span> <span class="str">"LanguageServer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"> <span class="nam">params</span><span class="op">:</span> <span class="nam">CompletionParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">CompletionList</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">CompletionItem</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"> <span class="nam">doc</span> <span class="op">=</span> <span class="nam">ls</span><span class="op">.</span><span class="nam">workspace</span><span class="op">.</span><span class="nam">get_text_document</span><span class="op">(</span><span class="nam">params</span><span class="op">.</span><span class="nam">text_document</span><span class="op">.</span><span class="nam">uri</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">is_valid_file</span><span class="op">(</span><span class="nam">doc</span><span class="op">.</span><span class="nam">path</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"> <span class="nam">lines</span> <span class="op">=</span> <span class="nam">doc</span><span class="op">.</span><span class="nam">lines</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"> <span class="nam">server_position</span> <span class="op">=</span> <span class="nam">doc</span><span class="op">.</span><span class="nam">position_codec</span><span class="op">.</span><span class="nam">position_from_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> <span class="nam">params</span><span class="op">.</span><span class="nam">position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"> <span class="nam">line</span> <span class="op">=</span> <span class="nam">lines</span><span class="op">[</span><span class="nam">server_position</span><span class="op">.</span><span class="nam">line</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"> <span class="nam">line_start</span> <span class="op">=</span> <span class="nam">line</span><span class="op">[</span><span class="num">0</span> <span class="op">:</span> <span class="nam">server_position</span><span class="op">.</span><span class="nam">character</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"> <span class="key">if</span> <span class="nam">_CONTAINS_TAB_OR_COLON</span><span class="op">.</span><span class="nam">search</span><span class="op">(</span><span class="nam">line_start</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"> <span class="nam">source_root</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">dirname</span><span class="op">(</span><span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">dirname</span><span class="op">(</span><span class="nam">doc</span><span class="op">.</span><span class="nam">path</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"> <span class="nam">all_commands</span> <span class="op">=</span> <span class="nam">_all_dh_commands</span><span class="op">(</span><span class="nam">source_root</span><span class="op">,</span> <span class="nam">lines</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"> <span class="nam">items</span> <span class="op">=</span> <span class="op">[</span><span class="nam">CompletionItem</span><span class="op">(</span><span class="nam">ht</span><span class="op">)</span> <span class="key">for</span> <span class="nam">c</span> <span class="key">in</span> <span class="nam">all_commands</span> <span class="key">for</span> <span class="nam">ht</span> <span class="key">in</span> <span class="nam">_as_hook_targets</span><span class="op">(</span><span class="nam">c</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"> <span class="key">return</span> <span class="nam">items</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_debian_debputy_manifest_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_debian_tests_control_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_5d0ec0d5422112df_lsp_debian_tests_control_py.html b/coverage-report/d_5d0ec0d5422112df_lsp_debian_tests_control_py.html deleted file mode 100644 index 14e3902..0000000 --- a/coverage-report/d_5d0ec0d5422112df_lsp_debian_tests_control_py.html +++ /dev/null @@ -1,585 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/lsp/lsp_debian_tests_control.py: 20%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/lsp/lsp_debian_tests_control.py</b>: - <span class="pc_cov">20%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">160 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">36<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">124<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_debian_rules_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_dispatch_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">re</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> <span class="nam">Sequence</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="nam">Iterator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">Iterable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">Mapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">List</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"><span class="key">from</span> <span class="nam">lsprotocol</span><span class="op">.</span><span class="nam">types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">DiagnosticSeverity</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">Range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">Position</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">CompletionItem</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">CompletionList</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">CompletionParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">TEXT_DOCUMENT_WILL_SAVE_WAIT_UNTIL</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">DiagnosticRelatedInformation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="nam">Location</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">HoverParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="nam">Hover</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="nam">TEXT_DOCUMENT_CODE_ACTION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="nam">SemanticTokens</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="nam">SemanticTokensParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="nam">FoldingRangeParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="nam">FoldingRange</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">linting</span><span class="op">.</span><span class="nam">lint_util</span> <span class="key">import</span> <span class="nam">LintState</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">lsp_debian_control_reference_data</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="nam">Deb822KnownField</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="nam">DTestsCtrlFileMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="nam">_DTESTSCTRL_FIELDS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">lsp_features</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="nam">lint_diagnostics</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="nam">lsp_completer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">lsp_hover</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">lsp_standard_handler</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="nam">lsp_folding_ranges</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="nam">lsp_semantic_tokens_full</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">lsp_generic_deb822</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="nam">deb822_completer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="nam">deb822_hover</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="nam">deb822_folding_ranges</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="nam">deb822_semantic_tokens_full</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">quickfixes</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="nam">propose_correct_text_quick_fix</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">spellchecking</span> <span class="key">import</span> <span class="nam">default_spellchecker</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">text_util</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="nam">normalize_dctrl_field_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="nam">LintCapablePositionCodec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="nam">detect_possible_typo</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="nam">te_range_to_lsp</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">vendoring</span><span class="op">.</span><span class="nam">_deb822_repro</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="nam">parse_deb822_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="nam">Deb822FileElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="nam">Deb822ParagraphElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">vendoring</span><span class="op">.</span><span class="nam">_deb822_repro</span><span class="op">.</span><span class="nam">parsing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="nam">Deb822KeyValuePairElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="nam">LIST_SPACE_SEPARATED_INTERPRETATION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">vendoring</span><span class="op">.</span><span class="nam">_deb822_repro</span><span class="op">.</span><span class="nam">tokens</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="nam">Deb822Token</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"><span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">vendoring</span><span class="op">.</span><span class="nam">_deb822_repro</span><span class="op">.</span><span class="nam">locatable</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="nam">Position</span> <span class="key">as</span> <span class="nam">TEPosition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="nam">Range</span> <span class="key">as</span> <span class="nam">TERange</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="nam">START_POSITION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="key">from</span> <span class="nam">pygls</span><span class="op">.</span><span class="nam">server</span> <span class="key">import</span> <span class="nam">LanguageServer</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="key">from</span> <span class="nam">pygls</span><span class="op">.</span><span class="nam">workspace</span> <span class="key">import</span> <span class="nam">TextDocument</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"><span class="key">except</span> <span class="nam">ImportError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"><span class="nam">_CONTAINS_SPACE_OR_COLON</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r"[\s:]"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"><span class="nam">_LANGUAGE_IDS</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="str">"debian/tests/control"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="com"># emacs's name - expected in elpa-dpkg-dev-el (>> 37.11)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="str">"debian-autopkgtest-control-mode"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="com"># Likely to be vim's name if it had support</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="str">"debtestscontrol"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"><span class="nam">_DEP5_FILE_METADATA</span> <span class="op">=</span> <span class="nam">DTestsCtrlFileMetadata</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"><span class="nam">lsp_standard_handler</span><span class="op">(</span><span class="nam">_LANGUAGE_IDS</span><span class="op">,</span> <span class="nam">TEXT_DOCUMENT_CODE_ACTION</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"><span class="nam">lsp_standard_handler</span><span class="op">(</span><span class="nam">_LANGUAGE_IDS</span><span class="op">,</span> <span class="nam">TEXT_DOCUMENT_WILL_SAVE_WAIT_UNTIL</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"><span class="op">@</span><span class="nam">lsp_hover</span><span class="op">(</span><span class="nam">_LANGUAGE_IDS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"><span class="key">def</span> <span class="nam">debian_tests_control_hover</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="nam">ls</span><span class="op">:</span> <span class="str">"LanguageServer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="nam">params</span><span class="op">:</span> <span class="nam">HoverParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Hover</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="key">return</span> <span class="nam">deb822_hover</span><span class="op">(</span><span class="nam">ls</span><span class="op">,</span> <span class="nam">params</span><span class="op">,</span> <span class="nam">_DEP5_FILE_METADATA</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"><span class="op">@</span><span class="nam">lsp_completer</span><span class="op">(</span><span class="nam">_LANGUAGE_IDS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"><span class="key">def</span> <span class="nam">debian_tests_control_completions</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="nam">ls</span><span class="op">:</span> <span class="str">"LanguageServer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="nam">params</span><span class="op">:</span> <span class="nam">CompletionParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">CompletionList</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">CompletionItem</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="key">return</span> <span class="nam">deb822_completer</span><span class="op">(</span><span class="nam">ls</span><span class="op">,</span> <span class="nam">params</span><span class="op">,</span> <span class="nam">_DEP5_FILE_METADATA</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"><span class="op">@</span><span class="nam">lsp_folding_ranges</span><span class="op">(</span><span class="nam">_LANGUAGE_IDS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"><span class="key">def</span> <span class="nam">debian_tests_control_folding_ranges</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="nam">ls</span><span class="op">:</span> <span class="str">"LanguageServer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="nam">params</span><span class="op">:</span> <span class="nam">FoldingRangeParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Sequence</span><span class="op">[</span><span class="nam">FoldingRange</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="key">return</span> <span class="nam">deb822_folding_ranges</span><span class="op">(</span><span class="nam">ls</span><span class="op">,</span> <span class="nam">params</span><span class="op">,</span> <span class="nam">_DEP5_FILE_METADATA</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"><span class="key">def</span> <span class="nam">_deb822_token_iter</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="nam">tokens</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Deb822Token</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">Deb822Token</span><span class="op">,</span> <span class="nam">int</span><span class="op">,</span> <span class="nam">int</span><span class="op">,</span> <span class="nam">int</span><span class="op">,</span> <span class="nam">int</span><span class="op">,</span> <span class="nam">int</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="nam">line_no</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="nam">line_offset</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="key">for</span> <span class="nam">token</span> <span class="key">in</span> <span class="nam">tokens</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="nam">start_line</span> <span class="op">=</span> <span class="nam">line_no</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="nam">start_line_offset</span> <span class="op">=</span> <span class="nam">line_offset</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="nam">newlines</span> <span class="op">=</span> <span class="nam">token</span><span class="op">.</span><span class="nam">text</span><span class="op">.</span><span class="nam">count</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="nam">line_no</span> <span class="op">+=</span> <span class="nam">newlines</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="nam">text_len</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">token</span><span class="op">.</span><span class="nam">text</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="key">if</span> <span class="nam">newlines</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="key">if</span> <span class="nam">token</span><span class="op">.</span><span class="nam">text</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="nam">line_offset</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="com"># -2, one to remove the "\n" and one to get 0-offset</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="nam">line_offset</span> <span class="op">=</span> <span class="nam">text_len</span> <span class="op">-</span> <span class="nam">token</span><span class="op">.</span><span class="nam">text</span><span class="op">.</span><span class="nam">rindex</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span> <span class="op">-</span> <span class="num">2</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="nam">line_offset</span> <span class="op">+=</span> <span class="nam">text_len</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="key">yield</span> <span class="nam">token</span><span class="op">,</span> <span class="nam">start_line</span><span class="op">,</span> <span class="nam">start_line_offset</span><span class="op">,</span> <span class="nam">line_no</span><span class="op">,</span> <span class="nam">line_offset</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"><span class="key">def</span> <span class="nam">_paragraph_representation_field</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="nam">paragraph</span><span class="op">:</span> <span class="nam">Deb822ParagraphElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Deb822KeyValuePairElement</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="key">return</span> <span class="nam">next</span><span class="op">(</span><span class="nam">iter</span><span class="op">(</span><span class="nam">paragraph</span><span class="op">.</span><span class="nam">iter_parts_of_type</span><span class="op">(</span><span class="nam">Deb822KeyValuePairElement</span><span class="op">)</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"><span class="key">def</span> <span class="nam">_diagnostics_for_paragraph</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="nam">stanza</span><span class="op">:</span> <span class="nam">Deb822ParagraphElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="nam">stanza_position</span><span class="op">:</span> <span class="str">"TEPosition"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="nam">known_fields</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Deb822KnownField</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="nam">doc_reference</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">:</span> <span class="str">"LintCapablePositionCodec"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="nam">representation_field</span> <span class="op">=</span> <span class="nam">_paragraph_representation_field</span><span class="op">(</span><span class="nam">stanza</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="nam">representation_field_pos</span> <span class="op">=</span> <span class="nam">representation_field</span><span class="op">.</span><span class="nam">position_in_parent</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="nam">stanza_position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="nam">representation_field_range_server_units</span> <span class="op">=</span> <span class="nam">te_range_to_lsp</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">TERange</span><span class="op">.</span><span class="nam">from_position_and_size</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="nam">representation_field_pos</span><span class="op">,</span> <span class="nam">representation_field</span><span class="op">.</span><span class="nam">size</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="nam">representation_field_range</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="nam">representation_field_range_server_units</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="key">for</span> <span class="nam">known_field</span> <span class="key">in</span> <span class="nam">known_fields</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="nam">missing_field_severity</span> <span class="op">=</span> <span class="nam">known_field</span><span class="op">.</span><span class="nam">missing_field_severity</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="key">if</span> <span class="nam">missing_field_severity</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">known_field</span><span class="op">.</span><span class="nam">name</span> <span class="key">in</span> <span class="nam">stanza</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="nam">representation_field_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="str">f"Stanza is missing field {known_field.name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">missing_field_severity</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="key">if</span> <span class="str">"Tests"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">stanza</span> <span class="key">and</span> <span class="str">"Test-Command"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">stanza</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="nam">representation_field_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="str">f'Stanza must have either a "Tests" or a "Test-Command" field'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="key">if</span> <span class="str">"Tests"</span> <span class="key">in</span> <span class="nam">stanza</span> <span class="key">and</span> <span class="str">"Test-Command"</span> <span class="key">in</span> <span class="nam">stanza</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="nam">representation_field_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="str">'Stanza cannot have both a "Tests" and a "Test-Command" field'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="nam">seen_fields</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="key">for</span> <span class="nam">kvpair</span> <span class="key">in</span> <span class="nam">stanza</span><span class="op">.</span><span class="nam">iter_parts_of_type</span><span class="op">(</span><span class="nam">Deb822KeyValuePairElement</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="nam">field_name_token</span> <span class="op">=</span> <span class="nam">kvpair</span><span class="op">.</span><span class="nam">field_token</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="nam">field_name</span> <span class="op">=</span> <span class="nam">field_name_token</span><span class="op">.</span><span class="nam">text</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="nam">field_name_lc</span> <span class="op">=</span> <span class="nam">field_name</span><span class="op">.</span><span class="nam">lower</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="nam">normalized_field_name_lc</span> <span class="op">=</span> <span class="nam">normalize_dctrl_field_name</span><span class="op">(</span><span class="nam">field_name_lc</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="nam">known_field</span> <span class="op">=</span> <span class="nam">known_fields</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">normalized_field_name_lc</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="nam">field_value</span> <span class="op">=</span> <span class="nam">stanza</span><span class="op">[</span><span class="nam">field_name</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="nam">field_range_te</span> <span class="op">=</span> <span class="nam">kvpair</span><span class="op">.</span><span class="nam">range_in_parent</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span><span class="nam">stanza_position</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="nam">field_position_te</span> <span class="op">=</span> <span class="nam">field_range_te</span><span class="op">.</span><span class="nam">start_pos</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="nam">field_range_server_units</span> <span class="op">=</span> <span class="nam">te_range_to_lsp</span><span class="op">(</span><span class="nam">field_range_te</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="nam">field_range</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="nam">field_range_server_units</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="nam">field_name_typo_detected</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="nam">existing_field_range</span> <span class="op">=</span> <span class="nam">seen_fields</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">normalized_field_name_lc</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing_field_range</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="nam">existing_field_range</span><span class="op">[</span><span class="num">3</span><span class="op">]</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">field_range</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="nam">normalized_field_name</span> <span class="op">=</span> <span class="nam">normalize_dctrl_field_name</span><span class="op">(</span><span class="nam">field_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="nam">seen_fields</span><span class="op">[</span><span class="nam">field_name_lc</span><span class="op">]</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="nam">field_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="nam">normalized_field_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="nam">field_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="op">[</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="key">if</span> <span class="nam">known_field</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="nam">candidates</span> <span class="op">=</span> <span class="nam">detect_possible_typo</span><span class="op">(</span><span class="nam">normalized_field_name_lc</span><span class="op">,</span> <span class="nam">known_fields</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="key">if</span> <span class="nam">candidates</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="nam">known_field</span> <span class="op">=</span> <span class="nam">known_fields</span><span class="op">[</span><span class="nam">candidates</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="nam">token_range_server_units</span> <span class="op">=</span> <span class="nam">te_range_to_lsp</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="nam">TERange</span><span class="op">.</span><span class="nam">from_position_and_size</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="nam">field_position_te</span><span class="op">,</span> <span class="nam">kvpair</span><span class="op">.</span><span class="nam">field_token</span><span class="op">.</span><span class="nam">size</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="nam">field_range</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="nam">token_range_server_units</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="nam">field_name_typo_detected</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="nam">field_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="str">f'The "{field_name}" looks like a typo of "{known_field.name}".'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Warning</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="nam">data</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="nam">propose_correct_text_quick_fix</span><span class="op">(</span><span class="nam">known_fields</span><span class="op">[</span><span class="nam">m</span><span class="op">]</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="key">for</span> <span class="nam">m</span> <span class="key">in</span> <span class="nam">candidates</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="key">if</span> <span class="nam">field_value</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span> <span class="op">==</span> <span class="str">""</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="nam">field_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="str">f"The {field_name} has no value. Either provide a value or remove it."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="nam">known_field</span><span class="op">.</span><span class="nam">field_diagnostics</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="nam">kvpair</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="nam">stanza</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="nam">stanza_position</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="nam">field_name_typo_reported</span><span class="op">=</span><span class="nam">field_name_typo_detected</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="key">if</span> <span class="nam">known_field</span><span class="op">.</span><span class="nam">spellcheck_value</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="nam">words</span> <span class="op">=</span> <span class="nam">kvpair</span><span class="op">.</span><span class="nam">interpret_as</span><span class="op">(</span><span class="nam">LIST_SPACE_SEPARATED_INTERPRETATION</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="nam">spell_checker</span> <span class="op">=</span> <span class="nam">default_spellchecker</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> <span class="nam">value_position</span> <span class="op">=</span> <span class="nam">kvpair</span><span class="op">.</span><span class="nam">value_element</span><span class="op">.</span><span class="nam">position_in_parent</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="nam">field_position_te</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="key">for</span> <span class="nam">word_ref</span> <span class="key">in</span> <span class="nam">words</span><span class="op">.</span><span class="nam">iter_value_references</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> <span class="nam">token</span> <span class="op">=</span> <span class="nam">word_ref</span><span class="op">.</span><span class="nam">value</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="key">for</span> <span class="nam">word</span><span class="op">,</span> <span class="nam">pos</span><span class="op">,</span> <span class="nam">endpos</span> <span class="key">in</span> <span class="nam">spell_checker</span><span class="op">.</span><span class="nam">iter_words</span><span class="op">(</span><span class="nam">token</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="nam">corrections</span> <span class="op">=</span> <span class="nam">spell_checker</span><span class="op">.</span><span class="nam">provide_corrections_for</span><span class="op">(</span><span class="nam">word</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">corrections</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="nam">word_loc</span> <span class="op">=</span> <span class="nam">word_ref</span><span class="op">.</span><span class="nam">locatable</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="nam">word_pos_te</span> <span class="op">=</span> <span class="nam">word_loc</span><span class="op">.</span><span class="nam">position_in_parent</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="nam">value_position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="key">if</span> <span class="nam">pos</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> <span class="nam">word_pos_te</span> <span class="op">=</span> <span class="nam">TEPosition</span><span class="op">(</span><span class="num">0</span><span class="op">,</span> <span class="nam">pos</span><span class="op">)</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span><span class="nam">word_pos_te</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="nam">word_range</span> <span class="op">=</span> <span class="nam">TERange</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="nam">START_POSITION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="nam">TEPosition</span><span class="op">(</span><span class="num">0</span><span class="op">,</span> <span class="nam">endpos</span> <span class="op">-</span> <span class="nam">pos</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="nam">word_range_server_units</span> <span class="op">=</span> <span class="nam">te_range_to_lsp</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="nam">TERange</span><span class="op">.</span><span class="nam">from_position_and_size</span><span class="op">(</span><span class="nam">word_pos_te</span><span class="op">,</span> <span class="nam">word_range</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="nam">word_range</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="nam">word_range_server_units</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="nam">word_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="str">f'Spelling "{word}"'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Hint</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> <span class="nam">data</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> <span class="nam">propose_correct_text_quick_fix</span><span class="op">(</span><span class="nam">c</span><span class="op">)</span> <span class="key">for</span> <span class="nam">c</span> <span class="key">in</span> <span class="nam">corrections</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> <span class="key">if</span> <span class="nam">known_field</span><span class="op">.</span><span class="nam">warn_if_default</span> <span class="key">and</span> <span class="nam">field_value</span> <span class="op">==</span> <span class="nam">known_field</span><span class="op">.</span><span class="nam">default_value</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> <span class="nam">field_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> <span class="str">f"The {field_name} is redundant as it is set to the default value and the field should only be"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> <span class="str">" used in exceptional cases."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Warning</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"> <span class="key">for</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> <span class="nam">field_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"> <span class="nam">normalized_field_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"> <span class="nam">field_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"> <span class="nam">duplicates</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> <span class="op">)</span> <span class="key">in</span> <span class="nam">seen_fields</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">duplicates</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"> <span class="nam">related_information</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"> <span class="nam">DiagnosticRelatedInformation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"> <span class="nam">location</span><span class="op">=</span><span class="nam">Location</span><span class="op">(</span><span class="nam">doc_reference</span><span class="op">,</span> <span class="nam">field_range</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"> <span class="nam">message</span><span class="op">=</span><span class="str">f"First definition of {field_name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"> <span class="nam">related_information</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"> <span class="nam">DiagnosticRelatedInformation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"> <span class="nam">location</span><span class="op">=</span><span class="nam">Location</span><span class="op">(</span><span class="nam">doc_reference</span><span class="op">,</span> <span class="nam">r</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"> <span class="nam">message</span><span class="op">=</span><span class="str">f"Duplicate of {field_name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"> <span class="key">for</span> <span class="nam">r</span> <span class="key">in</span> <span class="nam">duplicates</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"> <span class="key">for</span> <span class="nam">dup_range</span> <span class="key">in</span> <span class="nam">duplicates</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"> <span class="nam">dup_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"> <span class="str">f"The {normalized_field_name} field name was used multiple times in this stanza."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"> <span class="str">f" Please ensure the field is only used once per stanza."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"> <span class="nam">related_information</span><span class="op">=</span><span class="nam">related_information</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"><span class="key">def</span> <span class="nam">_scan_for_syntax_errors_and_token_level_diagnostics</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"> <span class="nam">deb822_file</span><span class="op">:</span> <span class="nam">Deb822FileElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">:</span> <span class="nam">LintCapablePositionCodec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"> <span class="nam">first_error</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">lines</span><span class="op">)</span> <span class="op">+</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"> <span class="nam">spell_checker</span> <span class="op">=</span> <span class="nam">default_spellchecker</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"> <span class="key">for</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"> <span class="nam">token</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"> <span class="nam">start_line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"> <span class="nam">start_offset</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t385" href="#t385">385</a></span><span class="t"> <span class="nam">end_line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t386" href="#t386">386</a></span><span class="t"> <span class="nam">end_offset</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t387" href="#t387">387</a></span><span class="t"> <span class="op">)</span> <span class="key">in</span> <span class="nam">_deb822_token_iter</span><span class="op">(</span><span class="nam">deb822_file</span><span class="op">.</span><span class="nam">iter_tokens</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t388" href="#t388">388</a></span><span class="t"> <span class="key">if</span> <span class="nam">token</span><span class="op">.</span><span class="nam">is_error</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t389" href="#t389">389</a></span><span class="t"> <span class="nam">first_error</span> <span class="op">=</span> <span class="nam">min</span><span class="op">(</span><span class="nam">first_error</span><span class="op">,</span> <span class="nam">start_line</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t390" href="#t390">390</a></span><span class="t"> <span class="nam">start_pos</span> <span class="op">=</span> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t391" href="#t391">391</a></span><span class="t"> <span class="nam">start_line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t392" href="#t392">392</a></span><span class="t"> <span class="nam">start_offset</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t393" href="#t393">393</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t394" href="#t394">394</a></span><span class="t"> <span class="nam">end_pos</span> <span class="op">=</span> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t395" href="#t395">395</a></span><span class="t"> <span class="nam">end_line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t396" href="#t396">396</a></span><span class="t"> <span class="nam">end_offset</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t397" href="#t397">397</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t398" href="#t398">398</a></span><span class="t"> <span class="nam">token_range</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t399" href="#t399">399</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> <span class="nam">Range</span><span class="op">(</span><span class="nam">start_pos</span><span class="op">,</span> <span class="nam">end_pos</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t400" href="#t400">400</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t401" href="#t401">401</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t402" href="#t402">402</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t403" href="#t403">403</a></span><span class="t"> <span class="nam">token_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t404" href="#t404">404</a></span><span class="t"> <span class="str">"Syntax error"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t405" href="#t405">405</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t406" href="#t406">406</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy (python-debian parser)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t407" href="#t407">407</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t408" href="#t408">408</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t409" href="#t409">409</a></span><span class="t"> <span class="key">elif</span> <span class="nam">token</span><span class="op">.</span><span class="nam">is_comment</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t410" href="#t410">410</a></span><span class="t"> <span class="key">for</span> <span class="nam">word</span><span class="op">,</span> <span class="nam">pos</span><span class="op">,</span> <span class="nam">end_pos</span> <span class="key">in</span> <span class="nam">spell_checker</span><span class="op">.</span><span class="nam">iter_words</span><span class="op">(</span><span class="nam">token</span><span class="op">.</span><span class="nam">text</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t411" href="#t411">411</a></span><span class="t"> <span class="nam">corrections</span> <span class="op">=</span> <span class="nam">spell_checker</span><span class="op">.</span><span class="nam">provide_corrections_for</span><span class="op">(</span><span class="nam">word</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t412" href="#t412">412</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">corrections</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t413" href="#t413">413</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t414" href="#t414">414</a></span><span class="t"> <span class="nam">start_pos</span> <span class="op">=</span> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t415" href="#t415">415</a></span><span class="t"> <span class="nam">start_line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t416" href="#t416">416</a></span><span class="t"> <span class="nam">pos</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t417" href="#t417">417</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t418" href="#t418">418</a></span><span class="t"> <span class="nam">end_pos</span> <span class="op">=</span> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t419" href="#t419">419</a></span><span class="t"> <span class="nam">start_line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t420" href="#t420">420</a></span><span class="t"> <span class="nam">end_pos</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t421" href="#t421">421</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t422" href="#t422">422</a></span><span class="t"> <span class="nam">word_range</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t423" href="#t423">423</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> <span class="nam">Range</span><span class="op">(</span><span class="nam">start_pos</span><span class="op">,</span> <span class="nam">end_pos</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t424" href="#t424">424</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t425" href="#t425">425</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t426" href="#t426">426</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t427" href="#t427">427</a></span><span class="t"> <span class="nam">word_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t428" href="#t428">428</a></span><span class="t"> <span class="str">f'Spelling "{word}"'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t429" href="#t429">429</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Hint</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t430" href="#t430">430</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t431" href="#t431">431</a></span><span class="t"> <span class="nam">data</span><span class="op">=</span><span class="op">[</span><span class="nam">propose_correct_text_quick_fix</span><span class="op">(</span><span class="nam">c</span><span class="op">)</span> <span class="key">for</span> <span class="nam">c</span> <span class="key">in</span> <span class="nam">corrections</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t432" href="#t432">432</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t433" href="#t433">433</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t434" href="#t434">434</a></span><span class="t"> <span class="key">return</span> <span class="nam">first_error</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t435" href="#t435">435</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t436" href="#t436">436</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t437" href="#t437">437</a></span><span class="t"><span class="op">@</span><span class="nam">lint_diagnostics</span><span class="op">(</span><span class="nam">_LANGUAGE_IDS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t438" href="#t438">438</a></span><span class="t"><span class="key">def</span> <span class="nam">_lint_debian_tests_control</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t439" href="#t439">439</a></span><span class="t"> <span class="nam">lint_state</span><span class="op">:</span> <span class="nam">LintState</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t440" href="#t440">440</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t441" href="#t441">441</a></span><span class="t"> <span class="nam">lines</span> <span class="op">=</span> <span class="nam">lint_state</span><span class="op">.</span><span class="nam">lines</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t442" href="#t442">442</a></span><span class="t"> <span class="nam">position_codec</span> <span class="op">=</span> <span class="nam">lint_state</span><span class="op">.</span><span class="nam">position_codec</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t443" href="#t443">443</a></span><span class="t"> <span class="nam">doc_reference</span> <span class="op">=</span> <span class="nam">lint_state</span><span class="op">.</span><span class="nam">doc_uri</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t444" href="#t444">444</a></span><span class="t"> <span class="nam">diagnostics</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t445" href="#t445">445</a></span><span class="t"> <span class="nam">deb822_file</span> <span class="op">=</span> <span class="nam">parse_deb822_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t446" href="#t446">446</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t447" href="#t447">447</a></span><span class="t"> <span class="nam">accept_files_with_duplicated_fields</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t448" href="#t448">448</a></span><span class="t"> <span class="nam">accept_files_with_error_tokens</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t449" href="#t449">449</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t450" href="#t450">450</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t451" href="#t451">451</a></span><span class="t"> <span class="nam">first_error</span> <span class="op">=</span> <span class="nam">_scan_for_syntax_errors_and_token_level_diagnostics</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t452" href="#t452">452</a></span><span class="t"> <span class="nam">deb822_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t453" href="#t453">453</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t454" href="#t454">454</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t455" href="#t455">455</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t456" href="#t456">456</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t457" href="#t457">457</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t458" href="#t458">458</a></span><span class="t"> <span class="nam">paragraphs</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">deb822_file</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t459" href="#t459">459</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t460" href="#t460">460</a></span><span class="t"> <span class="key">for</span> <span class="nam">paragraph_no</span><span class="op">,</span> <span class="nam">paragraph</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">paragraphs</span><span class="op">,</span> <span class="nam">start</span><span class="op">=</span><span class="num">1</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t461" href="#t461">461</a></span><span class="t"> <span class="nam">paragraph_pos</span> <span class="op">=</span> <span class="nam">paragraph</span><span class="op">.</span><span class="nam">position_in_file</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t462" href="#t462">462</a></span><span class="t"> <span class="key">if</span> <span class="nam">paragraph_pos</span><span class="op">.</span><span class="nam">line_position</span> <span class="op">>=</span> <span class="nam">first_error</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t463" href="#t463">463</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t464" href="#t464">464</a></span><span class="t"> <span class="nam">known_fields</span> <span class="op">=</span> <span class="nam">_DTESTSCTRL_FIELDS</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t465" href="#t465">465</a></span><span class="t"> <span class="nam">_diagnostics_for_paragraph</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t466" href="#t466">466</a></span><span class="t"> <span class="nam">paragraph</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t467" href="#t467">467</a></span><span class="t"> <span class="nam">paragraph_pos</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t468" href="#t468">468</a></span><span class="t"> <span class="nam">known_fields</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t469" href="#t469">469</a></span><span class="t"> <span class="nam">doc_reference</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t470" href="#t470">470</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t471" href="#t471">471</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t472" href="#t472">472</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t473" href="#t473">473</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t474" href="#t474">474</a></span><span class="t"> <span class="key">return</span> <span class="nam">diagnostics</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t475" href="#t475">475</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t476" href="#t476">476</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t477" href="#t477">477</a></span><span class="t"><span class="op">@</span><span class="nam">lsp_semantic_tokens_full</span><span class="op">(</span><span class="nam">_LANGUAGE_IDS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t478" href="#t478">478</a></span><span class="t"><span class="key">def</span> <span class="nam">_semantic_tokens_full</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t479" href="#t479">479</a></span><span class="t"> <span class="nam">ls</span><span class="op">:</span> <span class="str">"LanguageServer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t480" href="#t480">480</a></span><span class="t"> <span class="nam">request</span><span class="op">:</span> <span class="nam">SemanticTokensParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t481" href="#t481">481</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">SemanticTokens</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t482" href="#t482">482</a></span><span class="t"> <span class="key">return</span> <span class="nam">deb822_semantic_tokens_full</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t483" href="#t483">483</a></span><span class="t"> <span class="nam">ls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t484" href="#t484">484</a></span><span class="t"> <span class="nam">request</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t485" href="#t485">485</a></span><span class="t"> <span class="nam">_DEP5_FILE_METADATA</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t486" href="#t486">486</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_debian_rules_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_dispatch_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_5d0ec0d5422112df_lsp_dispatch_py.html b/coverage-report/d_5d0ec0d5422112df_lsp_dispatch_py.html deleted file mode 100644 index 75cd711..0000000 --- a/coverage-report/d_5d0ec0d5422112df_lsp_dispatch_py.html +++ /dev/null @@ -1,330 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/lsp/lsp_dispatch.py: 43%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/lsp/lsp_dispatch.py</b>: - <span class="pc_cov">43%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">82 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">32<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">50<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_debian_tests_control_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_features_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">asyncio</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> <span class="nam">Dict</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> <span class="nam">Sequence</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">TypeVar</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">Callable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">Mapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">List</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"><span class="key">from</span> <span class="nam">lsprotocol</span><span class="op">.</span><span class="nam">types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">DidOpenTextDocumentParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">DidChangeTextDocumentParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">TEXT_DOCUMENT_DID_CHANGE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">TEXT_DOCUMENT_DID_OPEN</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">TEXT_DOCUMENT_COMPLETION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">CompletionList</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">CompletionItem</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="nam">CompletionParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">TEXT_DOCUMENT_HOVER</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="nam">TEXT_DOCUMENT_FOLDING_RANGE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="nam">FoldingRange</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="nam">FoldingRangeParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="nam">TEXT_DOCUMENT_SEMANTIC_TOKENS_FULL</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="nam">SemanticTokensParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="nam">SemanticTokens</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="nam">Hover</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="nam">TEXT_DOCUMENT_CODE_ACTION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="nam">Command</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="nam">CodeAction</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="nam">CodeActionParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="nam">SemanticTokensRegistrationOptions</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span> <span class="key">import</span> <span class="nam">__version__</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">lsp_features</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="nam">DIAGNOSTIC_HANDLERS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">COMPLETER_HANDLERS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">HOVER_HANDLERS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="nam">SEMANTIC_TOKENS_FULL_HANDLERS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="nam">CODE_ACTION_HANDLERS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="nam">SEMANTIC_TOKENS_LEGEND</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">_info</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"><span class="nam">_DOCUMENT_VERSION_TABLE</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">int</span><span class="op">]</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"><span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="key">from</span> <span class="nam">pygls</span><span class="op">.</span><span class="nam">server</span> <span class="key">import</span> <span class="nam">LanguageServer</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="key">from</span> <span class="nam">pygls</span><span class="op">.</span><span class="nam">workspace</span> <span class="key">import</span> <span class="nam">TextDocument</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">debputy_ls</span> <span class="key">import</span> <span class="nam">DebputyLanguageServer</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="nam">DEBPUTY_LANGUAGE_SERVER</span> <span class="op">=</span> <span class="nam">DebputyLanguageServer</span><span class="op">(</span><span class="str">"debputy"</span><span class="op">,</span> <span class="str">f"v{__version__}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"><span class="key">except</span> <span class="nam">ImportError</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="key">class</span> <span class="nam">Mock</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="key">def</span> <span class="nam">feature</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">*</span><span class="nam">args</span><span class="op">,</span> <span class="op">**</span><span class="nam">kwargs</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="key">return</span> <span class="key">lambda</span> <span class="nam">x</span><span class="op">:</span> <span class="nam">x</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="nam">DEBPUTY_LANGUAGE_SERVER</span> <span class="op">=</span> <span class="nam">Mock</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"><span class="nam">P</span> <span class="op">=</span> <span class="nam">TypeVar</span><span class="op">(</span><span class="str">"P"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"><span class="nam">R</span> <span class="op">=</span> <span class="nam">TypeVar</span><span class="op">(</span><span class="str">"R"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"><span class="nam">L</span> <span class="op">=</span> <span class="nam">TypeVar</span><span class="op">(</span><span class="str">"L"</span><span class="op">,</span> <span class="str">"LanguageServer"</span><span class="op">,</span> <span class="str">"DebputyLanguageServer"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"><span class="key">def</span> <span class="nam">is_doc_at_version</span><span class="op">(</span><span class="nam">uri</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">version</span><span class="op">:</span> <span class="nam">int</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="nam">dv</span> <span class="op">=</span> <span class="nam">_DOCUMENT_VERSION_TABLE</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">uri</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="key">return</span> <span class="nam">dv</span> <span class="op">==</span> <span class="nam">version</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"><span class="key">def</span> <span class="nam">determine_language_id</span><span class="op">(</span><span class="nam">doc</span><span class="op">:</span> <span class="str">"TextDocument"</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="nam">lang_id</span> <span class="op">=</span> <span class="nam">doc</span><span class="op">.</span><span class="nam">language_id</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="key">if</span> <span class="nam">lang_id</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">lang_id</span><span class="op">.</span><span class="nam">isspace</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="key">return</span> <span class="str">"declared"</span><span class="op">,</span> <span class="nam">lang_id</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="nam">path</span> <span class="op">=</span> <span class="nam">doc</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="nam">last_idx</span> <span class="op">=</span> <span class="nam">path</span><span class="op">.</span><span class="nam">rindex</span><span class="op">(</span><span class="str">"debian/"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="key">except</span> <span class="nam">ValueError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="key">return</span> <span class="str">"filename"</span><span class="op">,</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">basename</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="nam">guess_language_id</span> <span class="op">=</span> <span class="nam">path</span><span class="op">[</span><span class="nam">last_idx</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="key">return</span> <span class="str">"filename"</span><span class="op">,</span> <span class="nam">guess_language_id</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"><span class="op">@</span><span class="nam">DEBPUTY_LANGUAGE_SERVER</span><span class="op">.</span><span class="nam">feature</span><span class="op">(</span><span class="nam">TEXT_DOCUMENT_DID_OPEN</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"><span class="op">@</span><span class="nam">DEBPUTY_LANGUAGE_SERVER</span><span class="op">.</span><span class="nam">feature</span><span class="op">(</span><span class="nam">TEXT_DOCUMENT_DID_CHANGE</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"><span class="key">async</span> <span class="key">def</span> <span class="nam">_open_or_changed_document</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="nam">ls</span><span class="op">:</span> <span class="str">"DebputyLanguageServer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="nam">params</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">DidOpenTextDocumentParams</span><span class="op">,</span> <span class="nam">DidChangeTextDocumentParams</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="nam">version</span> <span class="op">=</span> <span class="nam">params</span><span class="op">.</span><span class="nam">text_document</span><span class="op">.</span><span class="nam">version</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="nam">doc_uri</span> <span class="op">=</span> <span class="nam">params</span><span class="op">.</span><span class="nam">text_document</span><span class="op">.</span><span class="nam">uri</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="nam">doc</span> <span class="op">=</span> <span class="nam">ls</span><span class="op">.</span><span class="nam">workspace</span><span class="op">.</span><span class="nam">get_text_document</span><span class="op">(</span><span class="nam">doc_uri</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="nam">_DOCUMENT_VERSION_TABLE</span><span class="op">[</span><span class="nam">doc_uri</span><span class="op">]</span> <span class="op">=</span> <span class="nam">version</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="nam">id_source</span><span class="op">,</span> <span class="nam">language_id</span> <span class="op">=</span> <span class="nam">determine_language_id</span><span class="op">(</span><span class="nam">doc</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="nam">handler</span> <span class="op">=</span> <span class="nam">DIAGNOSTIC_HANDLERS</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">language_id</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="key">if</span> <span class="nam">handler</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="str">f"Opened/Changed document: {doc.path} ({language_id}, {id_source}) - no diagnostics handler"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="str">f"Opened/Changed document: {doc.path} ({language_id}, {id_source}) - running diagnostics for doc version {version}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="nam">last_publish_count</span> <span class="op">=</span> <span class="op">-</span><span class="num">1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="nam">diagnostics_scanner</span> <span class="op">=</span> <span class="nam">handler</span><span class="op">(</span><span class="nam">ls</span><span class="op">,</span> <span class="nam">params</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="key">async</span> <span class="key">for</span> <span class="nam">diagnostics</span> <span class="key">in</span> <span class="nam">diagnostics_scanner</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="key">await</span> <span class="nam">asyncio</span><span class="op">.</span><span class="nam">sleep</span><span class="op">(</span><span class="num">0</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">is_doc_at_version</span><span class="op">(</span><span class="nam">doc_uri</span><span class="op">,</span> <span class="nam">version</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="com"># This basically happens with very edit, so lets not notify the client</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="com"># for that.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="str">f"Cancel (obsolete) diagnostics for doc version {version}: document version changed"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="key">if</span> <span class="nam">diagnostics</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">last_publish_count</span> <span class="op">!=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">diagnostics</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="nam">last_publish_count</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">diagnostics</span><span class="op">)</span> <span class="key">if</span> <span class="nam">diagnostics</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">else</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="nam">ls</span><span class="op">.</span><span class="nam">publish_diagnostics</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="nam">doc</span><span class="op">.</span><span class="nam">uri</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"><span class="op">@</span><span class="nam">DEBPUTY_LANGUAGE_SERVER</span><span class="op">.</span><span class="nam">feature</span><span class="op">(</span><span class="nam">TEXT_DOCUMENT_COMPLETION</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"><span class="key">def</span> <span class="nam">_completions</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="nam">ls</span><span class="op">:</span> <span class="str">"DebputyLanguageServer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="nam">params</span><span class="op">:</span> <span class="nam">CompletionParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">CompletionList</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">CompletionItem</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="key">return</span> <span class="nam">_dispatch_standard_handler</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="nam">ls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="nam">params</span><span class="op">.</span><span class="nam">text_document</span><span class="op">.</span><span class="nam">uri</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="nam">params</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="nam">COMPLETER_HANDLERS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="str">"Complete request"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"><span class="op">@</span><span class="nam">DEBPUTY_LANGUAGE_SERVER</span><span class="op">.</span><span class="nam">feature</span><span class="op">(</span><span class="nam">TEXT_DOCUMENT_HOVER</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"><span class="key">def</span> <span class="nam">_hover</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="nam">ls</span><span class="op">:</span> <span class="str">"DebputyLanguageServer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="nam">params</span><span class="op">:</span> <span class="nam">CompletionParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Hover</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="key">return</span> <span class="nam">_dispatch_standard_handler</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="nam">ls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="nam">params</span><span class="op">.</span><span class="nam">text_document</span><span class="op">.</span><span class="nam">uri</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="nam">params</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="nam">HOVER_HANDLERS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="str">"Hover doc request"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"><span class="op">@</span><span class="nam">DEBPUTY_LANGUAGE_SERVER</span><span class="op">.</span><span class="nam">feature</span><span class="op">(</span><span class="nam">TEXT_DOCUMENT_CODE_ACTION</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"><span class="key">def</span> <span class="nam">_code_actions</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="nam">ls</span><span class="op">:</span> <span class="str">"DebputyLanguageServer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="nam">params</span><span class="op">:</span> <span class="nam">CodeActionParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">Command</span><span class="op">,</span> <span class="nam">CodeAction</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="key">return</span> <span class="nam">_dispatch_standard_handler</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="nam">ls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="nam">params</span><span class="op">.</span><span class="nam">text_document</span><span class="op">.</span><span class="nam">uri</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="nam">params</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="nam">CODE_ACTION_HANDLERS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="str">"Code action request"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"><span class="op">@</span><span class="nam">DEBPUTY_LANGUAGE_SERVER</span><span class="op">.</span><span class="nam">feature</span><span class="op">(</span><span class="nam">TEXT_DOCUMENT_FOLDING_RANGE</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"><span class="key">def</span> <span class="nam">_folding_ranges</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="nam">ls</span><span class="op">:</span> <span class="str">"DebputyLanguageServer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="nam">params</span><span class="op">:</span> <span class="nam">FoldingRangeParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Sequence</span><span class="op">[</span><span class="nam">FoldingRange</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="key">return</span> <span class="nam">_dispatch_standard_handler</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="nam">ls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="nam">params</span><span class="op">.</span><span class="nam">text_document</span><span class="op">.</span><span class="nam">uri</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="nam">params</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="nam">HOVER_HANDLERS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="str">"Folding range request"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"><span class="op">@</span><span class="nam">DEBPUTY_LANGUAGE_SERVER</span><span class="op">.</span><span class="nam">feature</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="nam">TEXT_DOCUMENT_SEMANTIC_TOKENS_FULL</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="nam">SemanticTokensRegistrationOptions</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="nam">SEMANTIC_TOKENS_LEGEND</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="nam">full</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"><span class="key">def</span> <span class="nam">_semantic_tokens_full</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="nam">ls</span><span class="op">:</span> <span class="str">"DebputyLanguageServer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="nam">params</span><span class="op">:</span> <span class="nam">SemanticTokensParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">SemanticTokens</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="key">return</span> <span class="nam">_dispatch_standard_handler</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="nam">ls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="nam">params</span><span class="op">.</span><span class="nam">text_document</span><span class="op">.</span><span class="nam">uri</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="nam">params</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="nam">SEMANTIC_TOKENS_FULL_HANDLERS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="str">"Semantic tokens request"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"><span class="key">def</span> <span class="nam">_dispatch_standard_handler</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="nam">ls</span><span class="op">:</span> <span class="str">"DebputyLanguageServer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="nam">doc_uri</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="nam">params</span><span class="op">:</span> <span class="nam">P</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="nam">handler_table</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">L</span><span class="op">,</span> <span class="nam">P</span><span class="op">]</span><span class="op">,</span> <span class="nam">R</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="nam">request_type</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">R</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="nam">doc</span> <span class="op">=</span> <span class="nam">ls</span><span class="op">.</span><span class="nam">workspace</span><span class="op">.</span><span class="nam">get_text_document</span><span class="op">(</span><span class="nam">doc_uri</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="nam">id_source</span><span class="op">,</span> <span class="nam">language_id</span> <span class="op">=</span> <span class="nam">determine_language_id</span><span class="op">(</span><span class="nam">doc</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="nam">handler</span> <span class="op">=</span> <span class="nam">handler_table</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">language_id</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="key">if</span> <span class="nam">handler</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="str">f"{request_type} for document: {doc.path} ({language_id}, {id_source}) - no handler"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="str">f"{request_type} for document: {doc.path} ({language_id}, {id_source}) - delegating to handler"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="key">return</span> <span class="nam">handler</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="nam">ls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="nam">params</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_debian_tests_control_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_features_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_5d0ec0d5422112df_lsp_features_py.html b/coverage-report/d_5d0ec0d5422112df_lsp_features_py.html deleted file mode 100644 index 32b1e00..0000000 --- a/coverage-report/d_5d0ec0d5422112df_lsp_features_py.html +++ /dev/null @@ -1,316 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/lsp/lsp_features.py: 57%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/lsp/lsp_features.py</b>: - <span class="pc_cov">57%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">107 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">69<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">38<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">2<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">6<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_dispatch_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_generic_deb822_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">collections</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">inspect</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Callable</span><span class="op">,</span> <span class="nam">TypeVar</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">,</span> <span class="nam">Union</span><span class="op">,</span> <span class="nam">Dict</span><span class="op">,</span> <span class="nam">List</span><span class="op">,</span> <span class="nam">Optional</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">from</span> <span class="nam">lsprotocol</span><span class="op">.</span><span class="nam">types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="nam">TEXT_DOCUMENT_WILL_SAVE_WAIT_UNTIL</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">TEXT_DOCUMENT_CODE_ACTION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">DidChangeTextDocumentParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">DidOpenTextDocumentParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">SemanticTokensLegend</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">feature_set</span> <span class="key">import</span> <span class="nam">PluginProvidedFeatureSet</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"><span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="key">from</span> <span class="nam">pygls</span><span class="op">.</span><span class="nam">server</span> <span class="key">import</span> <span class="nam">LanguageServer</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">debputy_ls</span> <span class="key">import</span> <span class="nam">DebputyLanguageServer</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"><span class="key">except</span> <span class="nam">ImportError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">linting</span><span class="op">.</span><span class="nam">lint_util</span> <span class="key">import</span> <span class="nam">LinterImpl</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">quickfixes</span> <span class="key">import</span> <span class="nam">provide_standard_quickfixes_from_diagnostics</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">text_util</span> <span class="key">import</span> <span class="nam">on_save_trim_end_of_line_whitespace</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"><span class="nam">C</span> <span class="op">=</span> <span class="nam">TypeVar</span><span class="op">(</span><span class="str">"C"</span><span class="op">,</span> <span class="nam">bound</span><span class="op">=</span><span class="nam">Callable</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"><span class="nam">SEMANTIC_TOKENS_LEGEND</span> <span class="op">=</span> <span class="nam">SemanticTokensLegend</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="nam">token_types</span><span class="op">=</span><span class="op">[</span><span class="str">"keyword"</span><span class="op">,</span> <span class="str">"enumMember"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="nam">token_modifiers</span><span class="op">=</span><span class="op">[</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"><span class="nam">SEMANTIC_TOKEN_TYPES_IDS</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="nam">t</span><span class="op">:</span> <span class="nam">idx</span> <span class="key">for</span> <span class="nam">idx</span><span class="op">,</span> <span class="nam">t</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">SEMANTIC_TOKENS_LEGEND</span><span class="op">.</span><span class="nam">token_types</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"><span class="nam">DIAGNOSTIC_HANDLERS</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="nam">COMPLETER_HANDLERS</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"><span class="nam">HOVER_HANDLERS</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"><span class="nam">CODE_ACTION_HANDLERS</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"><span class="nam">FOLDING_RANGE_HANDLERS</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"><span class="nam">SEMANTIC_TOKENS_FULL_HANDLERS</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"><span class="nam">WILL_SAVE_WAIT_UNTIL_HANDLERS</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"><span class="nam">_ALIAS_OF</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"><span class="nam">_STANDARD_HANDLERS</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"><span class="annotate short">45 ↛ exit</span><span class="annotate long">line 45 didn't jump to the function exit</span></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="nam">TEXT_DOCUMENT_CODE_ACTION</span><span class="op">:</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="nam">CODE_ACTION_HANDLERS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="key">lambda</span> <span class="nam">ls</span><span class="op">,</span> <span class="nam">params</span><span class="op">:</span> <span class="nam">provide_standard_quickfixes_from_diagnostics</span><span class="op">(</span><span class="nam">params</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="nam">TEXT_DOCUMENT_WILL_SAVE_WAIT_UNTIL</span><span class="op">:</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="nam">WILL_SAVE_WAIT_UNTIL_HANDLERS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="nam">on_save_trim_end_of_line_whitespace</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"><span class="key">def</span> <span class="nam">lint_diagnostics</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="nam">file_formats</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">LinterImpl</span><span class="op">]</span><span class="op">,</span> <span class="nam">LinterImpl</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="key">def</span> <span class="nam">_wrapper</span><span class="op">(</span><span class="nam">func</span><span class="op">:</span> <span class="nam">C</span><span class="op">)</span> <span class="op">-></span> <span class="nam">C</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">inspect</span><span class="op">.</span><span class="nam">iscoroutinefunction</span><span class="op">(</span><span class="nam">func</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">62 ↛ 76</span><span class="annotate long">line 62 didn't jump to line 76, because the condition on line 62 was never false</span></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="key">async</span> <span class="key">def</span> <span class="nam">_lint_wrapper</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="nam">ls</span><span class="op">:</span> <span class="str">"DebputyLanguageServer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="nam">params</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="nam">DidOpenTextDocumentParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="nam">DidChangeTextDocumentParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="nam">doc</span> <span class="op">=</span> <span class="nam">ls</span><span class="op">.</span><span class="nam">workspace</span><span class="op">.</span><span class="nam">get_text_document</span><span class="op">(</span><span class="nam">params</span><span class="op">.</span><span class="nam">text_document</span><span class="op">.</span><span class="nam">uri</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="nam">lint_state</span> <span class="op">=</span> <span class="nam">ls</span><span class="op">.</span><span class="nam">lint_state</span><span class="op">(</span><span class="nam">doc</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="key">yield</span> <span class="nam">func</span><span class="op">(</span><span class="nam">lint_state</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"Linters are all non-async at the moment"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="key">for</span> <span class="nam">file_format</span> <span class="key">in</span> <span class="nam">file_formats</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="key">if</span> <span class="nam">file_format</span> <span class="key">in</span> <span class="nam">DIAGNOSTIC_HANDLERS</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="key">raise</span> <span class="nam">AssertionError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="str">"There is already a diagnostics handler for "</span> <span class="op">+</span> <span class="nam">file_format</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="nam">DIAGNOSTIC_HANDLERS</span><span class="op">[</span><span class="nam">file_format</span><span class="op">]</span> <span class="op">=</span> <span class="nam">_lint_wrapper</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="key">return</span> <span class="nam">func</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="key">return</span> <span class="nam">_wrapper</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"><span class="key">def</span> <span class="nam">lsp_diagnostics</span><span class="op">(</span><span class="nam">file_formats</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">C</span><span class="op">]</span><span class="op">,</span> <span class="nam">C</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="key">def</span> <span class="nam">_wrapper</span><span class="op">(</span><span class="nam">func</span><span class="op">:</span> <span class="nam">C</span><span class="op">)</span> <span class="op">-></span> <span class="nam">C</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">inspect</span><span class="op">.</span><span class="nam">iscoroutinefunction</span><span class="op">(</span><span class="nam">func</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">94 ↛ 106</span><span class="annotate long">line 94 didn't jump to line 106, because the condition on line 94 was never false</span></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="key">async</span> <span class="key">def</span> <span class="nam">_linter</span><span class="op">(</span><span class="op">*</span><span class="nam">args</span><span class="op">,</span> <span class="op">**</span><span class="nam">kwargs</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="nam">res</span> <span class="op">=</span> <span class="nam">func</span><span class="op">(</span><span class="op">*</span><span class="nam">args</span><span class="op">,</span> <span class="op">**</span><span class="nam">kwargs</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="key">if</span> <span class="nam">inspect</span><span class="op">.</span><span class="nam">isgenerator</span><span class="op">(</span><span class="nam">res</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="key">for</span> <span class="nam">r</span> <span class="key">in</span> <span class="nam">res</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="key">yield</span> <span class="nam">r</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="key">yield</span> <span class="nam">res</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="nam">_linter</span> <span class="op">=</span> <span class="nam">func</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="nam">_register_handler</span><span class="op">(</span><span class="nam">file_formats</span><span class="op">,</span> <span class="nam">DIAGNOSTIC_HANDLERS</span><span class="op">,</span> <span class="nam">_linter</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="key">return</span> <span class="nam">func</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="key">return</span> <span class="nam">_wrapper</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"><span class="key">def</span> <span class="nam">lsp_completer</span><span class="op">(</span><span class="nam">file_formats</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">C</span><span class="op">]</span><span class="op">,</span> <span class="nam">C</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="key">return</span> <span class="nam">_registering_wrapper</span><span class="op">(</span><span class="nam">file_formats</span><span class="op">,</span> <span class="nam">COMPLETER_HANDLERS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"><span class="key">def</span> <span class="nam">lsp_hover</span><span class="op">(</span><span class="nam">file_formats</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">C</span><span class="op">]</span><span class="op">,</span> <span class="nam">C</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="key">return</span> <span class="nam">_registering_wrapper</span><span class="op">(</span><span class="nam">file_formats</span><span class="op">,</span> <span class="nam">HOVER_HANDLERS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"><span class="key">def</span> <span class="nam">lsp_folding_ranges</span><span class="op">(</span><span class="nam">file_formats</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">C</span><span class="op">]</span><span class="op">,</span> <span class="nam">C</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="key">return</span> <span class="nam">_registering_wrapper</span><span class="op">(</span><span class="nam">file_formats</span><span class="op">,</span> <span class="nam">FOLDING_RANGE_HANDLERS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"><span class="key">def</span> <span class="nam">lsp_semantic_tokens_full</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="nam">file_formats</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">C</span><span class="op">]</span><span class="op">,</span> <span class="nam">C</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="key">return</span> <span class="nam">_registering_wrapper</span><span class="op">(</span><span class="nam">file_formats</span><span class="op">,</span> <span class="nam">SEMANTIC_TOKENS_FULL_HANDLERS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"><span class="key">def</span> <span class="nam">lsp_standard_handler</span><span class="op">(</span><span class="nam">file_formats</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> <span class="nam">topic</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="nam">res</span> <span class="op">=</span> <span class="nam">_STANDARD_HANDLERS</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">topic</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="key">if</span> <span class="nam">res</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">135 ↛ 136</span><span class="annotate long">line 135 didn't jump to line 136, because the condition on line 135 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">f"No standard handler for {topic}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="nam">table</span><span class="op">,</span> <span class="nam">handler</span> <span class="op">=</span> <span class="nam">res</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="nam">_register_handler</span><span class="op">(</span><span class="nam">file_formats</span><span class="op">,</span> <span class="nam">table</span><span class="op">,</span> <span class="nam">handler</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"><span class="key">def</span> <span class="nam">_registering_wrapper</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="nam">file_formats</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> <span class="nam">handler_dict</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">C</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">C</span><span class="op">]</span><span class="op">,</span> <span class="nam">C</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="key">def</span> <span class="nam">_wrapper</span><span class="op">(</span><span class="nam">func</span><span class="op">:</span> <span class="nam">C</span><span class="op">)</span> <span class="op">-></span> <span class="nam">C</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="nam">_register_handler</span><span class="op">(</span><span class="nam">file_formats</span><span class="op">,</span> <span class="nam">handler_dict</span><span class="op">,</span> <span class="nam">func</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="key">return</span> <span class="nam">func</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="key">return</span> <span class="nam">_wrapper</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"><span class="key">def</span> <span class="nam">_register_handler</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="nam">file_formats</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="nam">handler_dict</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">C</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="nam">handler</span><span class="op">:</span> <span class="nam">C</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">file_formats</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">158 ↛ 159</span><span class="annotate long">line 158 didn't jump to line 159, because the condition on line 158 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="nam">file_formats</span> <span class="op">=</span> <span class="op">[</span><span class="nam">file_formats</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">file_formats</span><span class="op">:</span> </span><span class="r"><span class="annotate short">161 ↛ 162</span><span class="annotate long">line 161 didn't jump to line 162, because the condition on line 161 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"At least one language ID (file format) must be provided"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="nam">main</span> <span class="op">=</span> <span class="nam">file_formats</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="key">for</span> <span class="nam">alias</span> <span class="key">in</span> <span class="nam">file_formats</span><span class="op">[</span><span class="num">1</span><span class="op">:</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="key">if</span> <span class="nam">alias</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">_ALIAS_OF</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="nam">_ALIAS_OF</span><span class="op">[</span><span class="nam">alias</span><span class="op">]</span> <span class="op">=</span> <span class="nam">main</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="key">for</span> <span class="nam">file_format</span> <span class="key">in</span> <span class="nam">file_formats</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="key">if</span> <span class="nam">file_format</span> <span class="key">in</span> <span class="nam">handler_dict</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="key">raise</span> <span class="nam">AssertionError</span><span class="op">(</span><span class="str">f"There is already a handler for {file_format}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="nam">handler_dict</span><span class="op">[</span><span class="nam">file_format</span><span class="op">]</span> <span class="op">=</span> <span class="nam">handler</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"><span class="key">def</span> <span class="nam">ensure_lsp_features_are_loaded</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="com"># FIXME: This import is needed to force loading of the LSP files. But it only works</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="com"># for files with a linter (which currently happens to be all of them, but this is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="com"># a bit fragile).</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">linting</span><span class="op">.</span><span class="nam">lint_impl</span> <span class="key">import</span> <span class="nam">LINTER_FORMATS</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="key">assert</span> <span class="nam">LINTER_FORMATS</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"><span class="key">def</span> <span class="nam">describe_lsp_features</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="nam">ensure_lsp_features_are_loaded</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="nam">feature_list</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="op">(</span><span class="str">"diagnostics (lint)"</span><span class="op">,</span> <span class="nam">DIAGNOSTIC_HANDLERS</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="op">(</span><span class="str">"code actions/quickfixes"</span><span class="op">,</span> <span class="nam">CODE_ACTION_HANDLERS</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="op">(</span><span class="str">"completion suggestions"</span><span class="op">,</span> <span class="nam">COMPLETER_HANDLERS</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="op">(</span><span class="str">"hover docs"</span><span class="op">,</span> <span class="nam">HOVER_HANDLERS</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="op">(</span><span class="str">"folding ranges"</span><span class="op">,</span> <span class="nam">FOLDING_RANGE_HANDLERS</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="op">(</span><span class="str">"semantic tokens"</span><span class="op">,</span> <span class="nam">SEMANTIC_TOKENS_FULL_HANDLERS</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="op">(</span><span class="str">"on-save handler"</span><span class="op">,</span> <span class="nam">WILL_SAVE_WAIT_UNTIL_HANDLERS</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">"LSP language IDs and their features:"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="nam">all_ids</span> <span class="op">=</span> <span class="nam">sorted</span><span class="op">(</span><span class="nam">set</span><span class="op">(</span><span class="nam">lid</span> <span class="key">for</span> <span class="nam">_</span><span class="op">,</span> <span class="nam">t</span> <span class="key">in</span> <span class="nam">feature_list</span> <span class="key">for</span> <span class="nam">lid</span> <span class="key">in</span> <span class="nam">t</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="key">for</span> <span class="nam">lang_id</span> <span class="key">in</span> <span class="nam">all_ids</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="key">if</span> <span class="nam">lang_id</span> <span class="key">in</span> <span class="nam">_ALIAS_OF</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="nam">features</span> <span class="op">=</span> <span class="op">[</span><span class="nam">n</span> <span class="key">for</span> <span class="nam">n</span><span class="op">,</span> <span class="nam">t</span> <span class="key">in</span> <span class="nam">feature_list</span> <span class="key">if</span> <span class="nam">lang_id</span> <span class="key">in</span> <span class="nam">t</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">f" * {lang_id}:"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="key">for</span> <span class="nam">feature</span> <span class="key">in</span> <span class="nam">features</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">f" - {feature}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="nam">aliases</span> <span class="op">=</span> <span class="nam">collections</span><span class="op">.</span><span class="nam">defaultdict</span><span class="op">(</span><span class="nam">list</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="key">for</span> <span class="nam">lang_id</span> <span class="key">in</span> <span class="nam">all_ids</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="nam">main_lang</span> <span class="op">=</span> <span class="nam">_ALIAS_OF</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">lang_id</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="key">if</span> <span class="nam">main_lang</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="nam">aliases</span><span class="op">[</span><span class="nam">main_lang</span><span class="op">]</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">lang_id</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">"Aliases:"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="key">for</span> <span class="nam">main_id</span><span class="op">,</span> <span class="nam">aliases</span> <span class="key">in</span> <span class="nam">aliases</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">f" * {main_id}: {', '.join(aliases)}"</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_dispatch_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_generic_deb822_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_5d0ec0d5422112df_lsp_generic_deb822_py.html b/coverage-report/d_5d0ec0d5422112df_lsp_generic_deb822_py.html deleted file mode 100644 index 44685c8..0000000 --- a/coverage-report/d_5d0ec0d5422112df_lsp_generic_deb822_py.html +++ /dev/null @@ -1,481 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/lsp/lsp_generic_deb822.py: 46%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/lsp/lsp_generic_deb822.py</b>: - <span class="pc_cov">46%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">203 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">102<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">101<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">11<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_features_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_5d0ec0d5422112df_quickfixes_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">re</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> <span class="nam">Sequence</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">Set</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">Container</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">List</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">Iterable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">Iterator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"><span class="key">from</span> <span class="nam">lsprotocol</span><span class="op">.</span><span class="nam">types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">CompletionParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">CompletionList</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">CompletionItem</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">Position</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">CompletionItemTag</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">MarkupContent</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">Hover</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="nam">MarkupKind</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">HoverParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="nam">FoldingRangeParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="nam">FoldingRange</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="nam">FoldingRangeKind</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="nam">SemanticTokensParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="nam">SemanticTokens</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">lsp_debian_control_reference_data</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="nam">Deb822FileMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="nam">Deb822KnownField</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="nam">StanzaMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">lsp_features</span> <span class="key">import</span> <span class="nam">SEMANTIC_TOKEN_TYPES_IDS</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">text_util</span> <span class="key">import</span> <span class="nam">normalize_dctrl_field_name</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">vendoring</span><span class="op">.</span><span class="nam">_deb822_repro</span> <span class="key">import</span> <span class="nam">parse_deb822_file</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">vendoring</span><span class="op">.</span><span class="nam">_deb822_repro</span><span class="op">.</span><span class="nam">parsing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">Deb822KeyValuePairElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">LIST_SPACE_SEPARATED_INTERPRETATION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">vendoring</span><span class="op">.</span><span class="nam">_deb822_repro</span><span class="op">.</span><span class="nam">tokens</span> <span class="key">import</span> <span class="nam">tokenize_deb822_file</span><span class="op">,</span> <span class="nam">Deb822Token</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">_info</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"><span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="key">from</span> <span class="nam">pygls</span><span class="op">.</span><span class="nam">server</span> <span class="key">import</span> <span class="nam">LanguageServer</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="key">from</span> <span class="nam">pygls</span><span class="op">.</span><span class="nam">workspace</span> <span class="key">import</span> <span class="nam">TextDocument</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"><span class="key">except</span> <span class="nam">ImportError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"><span class="nam">_CONTAINS_SPACE_OR_COLON</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r"[\s:]"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"><span class="key">def</span> <span class="nam">_at_cursor</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="nam">doc</span><span class="op">:</span> <span class="str">"TextDocument"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="nam">client_position</span><span class="op">:</span> <span class="nam">Position</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">bool</span><span class="op">,</span> <span class="nam">int</span><span class="op">,</span> <span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="nam">paragraph_no</span> <span class="op">=</span> <span class="op">-</span><span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="nam">paragraph_started</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="nam">seen_fields</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="nam">last_field_seen</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="nam">current_field</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="nam">server_position</span> <span class="op">=</span> <span class="nam">doc</span><span class="op">.</span><span class="nam">position_codec</span><span class="op">.</span><span class="nam">position_from_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="nam">client_position</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="nam">position_line_no</span> <span class="op">=</span> <span class="nam">server_position</span><span class="op">.</span><span class="nam">line</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="nam">line_at_position</span> <span class="op">=</span> <span class="nam">lines</span><span class="op">[</span><span class="nam">position_line_no</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="nam">line_start</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="key">if</span> <span class="nam">server_position</span><span class="op">.</span><span class="nam">character</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="nam">line_start</span> <span class="op">=</span> <span class="nam">line_at_position</span><span class="op">[</span><span class="num">0</span> <span class="op">:</span> <span class="nam">server_position</span><span class="op">.</span><span class="nam">character</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="key">for</span> <span class="nam">line_no</span><span class="op">,</span> <span class="nam">line</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">lines</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">line</span> <span class="key">or</span> <span class="nam">line</span><span class="op">.</span><span class="nam">isspace</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="key">if</span> <span class="nam">line_no</span> <span class="op">==</span> <span class="nam">position_line_no</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="nam">current_field</span> <span class="op">=</span> <span class="nam">last_field_seen</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="nam">last_field_seen</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="key">if</span> <span class="nam">line_no</span> <span class="op">></span> <span class="nam">position_line_no</span><span class="op">:</span> </span><span class="r"><span class="annotate short">85 ↛ 86</span><span class="annotate long">line 85 didn't jump to line 86, because the condition on line 85 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="nam">paragraph_started</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="key">elif</span> <span class="nam">line</span> <span class="key">and</span> <span class="nam">line</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="op">==</span> <span class="str">"#"</span><span class="op">:</span> </span><span class="r"><span class="annotate short">88 ↛ 89</span><span class="annotate long">line 88 didn't jump to line 89, because the condition on line 88 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="key">elif</span> <span class="nam">line</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">line</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">.</span><span class="nam">isspace</span><span class="op">(</span><span class="op">)</span> <span class="key">and</span> <span class="str">":"</span> <span class="key">in</span> <span class="nam">line</span><span class="op">:</span> </span><span class="r"><span class="annotate short">90 ↛ 79</span><span class="annotate long">line 90 didn't jump to line 79, because the condition on line 90 was never false</span></span></p> - <p class="run"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">paragraph_started</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="nam">paragraph_started</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="nam">seen_fields</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="nam">paragraph_no</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="nam">key</span><span class="op">,</span> <span class="nam">_</span> <span class="op">=</span> <span class="nam">line</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="str">":"</span><span class="op">,</span> <span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="nam">key_lc</span> <span class="op">=</span> <span class="nam">key</span><span class="op">.</span><span class="nam">lower</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="nam">last_field_seen</span> <span class="op">=</span> <span class="nam">key_lc</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="key">if</span> <span class="nam">line_no</span> <span class="op">==</span> <span class="nam">position_line_no</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="nam">current_field</span> <span class="op">=</span> <span class="nam">key_lc</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="nam">seen_fields</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">key_lc</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="nam">in_value</span> <span class="op">=</span> <span class="nam">bool</span><span class="op">(</span><span class="nam">_CONTAINS_SPACE_OR_COLON</span><span class="op">.</span><span class="nam">search</span><span class="op">(</span><span class="nam">line_start</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="nam">current_word</span> <span class="op">=</span> <span class="nam">doc</span><span class="op">.</span><span class="nam">word_at_position</span><span class="op">(</span><span class="nam">client_position</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="key">if</span> <span class="nam">current_field</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">104 ↛ 106</span><span class="annotate long">line 104 didn't jump to line 106, because the condition on line 104 was never false</span></span></p> - <p class="run"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="nam">current_field</span> <span class="op">=</span> <span class="nam">normalize_dctrl_field_name</span><span class="op">(</span><span class="nam">current_field</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="key">return</span> <span class="nam">current_field</span><span class="op">,</span> <span class="nam">current_word</span><span class="op">,</span> <span class="nam">in_value</span><span class="op">,</span> <span class="nam">paragraph_no</span><span class="op">,</span> <span class="nam">seen_fields</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"><span class="key">def</span> <span class="nam">deb822_completer</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="nam">ls</span><span class="op">:</span> <span class="str">"LanguageServer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="nam">params</span><span class="op">:</span> <span class="nam">CompletionParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="nam">file_metadata</span><span class="op">:</span> <span class="nam">Deb822FileMetadata</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">CompletionList</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">CompletionItem</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="nam">doc</span> <span class="op">=</span> <span class="nam">ls</span><span class="op">.</span><span class="nam">workspace</span><span class="op">.</span><span class="nam">get_text_document</span><span class="op">(</span><span class="nam">params</span><span class="op">.</span><span class="nam">text_document</span><span class="op">.</span><span class="nam">uri</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="nam">lines</span> <span class="op">=</span> <span class="nam">doc</span><span class="op">.</span><span class="nam">lines</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="nam">current_field</span><span class="op">,</span> <span class="nam">_</span><span class="op">,</span> <span class="nam">in_value</span><span class="op">,</span> <span class="nam">paragraph_no</span><span class="op">,</span> <span class="nam">seen_fields</span> <span class="op">=</span> <span class="nam">_at_cursor</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="nam">doc</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="nam">params</span><span class="op">.</span><span class="nam">position</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="nam">stanza_metadata</span> <span class="op">=</span> <span class="nam">file_metadata</span><span class="op">.</span><span class="nam">guess_stanza_classification_by_idx</span><span class="op">(</span><span class="nam">paragraph_no</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="key">if</span> <span class="nam">in_value</span><span class="op">:</span> </span><span class="r"><span class="annotate short">125 ↛ 126</span><span class="annotate long">line 125 didn't jump to line 126, because the condition on line 125 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"Completion for field value {current_field}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="key">if</span> <span class="nam">current_field</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="nam">known_field</span> <span class="op">=</span> <span class="nam">stanza_metadata</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">current_field</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="key">if</span> <span class="nam">known_field</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="nam">items</span> <span class="op">=</span> <span class="nam">_complete_field_value</span><span class="op">(</span><span class="nam">known_field</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">"Completing field name"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="nam">items</span> <span class="op">=</span> <span class="nam">_complete_field_name</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="nam">stanza_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="nam">seen_fields</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"Completion candidates: {items}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="key">return</span> <span class="nam">items</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"><span class="key">def</span> <span class="nam">deb822_hover</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="nam">ls</span><span class="op">:</span> <span class="str">"LanguageServer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="nam">params</span><span class="op">:</span> <span class="nam">HoverParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="nam">file_metadata</span><span class="op">:</span> <span class="nam">Deb822FileMetadata</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Hover</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="nam">doc</span> <span class="op">=</span> <span class="nam">ls</span><span class="op">.</span><span class="nam">workspace</span><span class="op">.</span><span class="nam">get_text_document</span><span class="op">(</span><span class="nam">params</span><span class="op">.</span><span class="nam">text_document</span><span class="op">.</span><span class="nam">uri</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="nam">lines</span> <span class="op">=</span> <span class="nam">doc</span><span class="op">.</span><span class="nam">lines</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="nam">current_field</span><span class="op">,</span> <span class="nam">word_at_position</span><span class="op">,</span> <span class="nam">in_value</span><span class="op">,</span> <span class="nam">paragraph_no</span><span class="op">,</span> <span class="nam">_</span> <span class="op">=</span> <span class="nam">_at_cursor</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="nam">doc</span><span class="op">,</span> <span class="nam">lines</span><span class="op">,</span> <span class="nam">params</span><span class="op">.</span><span class="nam">position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="nam">stanza_metadata</span> <span class="op">=</span> <span class="nam">file_metadata</span><span class="op">.</span><span class="nam">guess_stanza_classification_by_idx</span><span class="op">(</span><span class="nam">paragraph_no</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="key">if</span> <span class="nam">current_field</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">157 ↛ 158</span><span class="annotate long">line 157 didn't jump to line 158, because the condition on line 157 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">"No hover information as we cannot determine which field it is for"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="nam">known_field</span> <span class="op">=</span> <span class="nam">stanza_metadata</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">current_field</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="key">if</span> <span class="nam">known_field</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">162 ↛ 163</span><span class="annotate long">line 162 didn't jump to line 163, because the condition on line 162 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="key">if</span> <span class="nam">in_value</span><span class="op">:</span> </span><span class="r"><span class="annotate short">164 ↛ 165</span><span class="annotate long">line 164 didn't jump to line 165, because the condition on line 164 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">known_field</span><span class="op">.</span><span class="nam">known_values</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="nam">keyword</span> <span class="op">=</span> <span class="nam">known_field</span><span class="op">.</span><span class="nam">known_values</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">word_at_position</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="key">if</span> <span class="nam">keyword</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="nam">hover_text</span> <span class="op">=</span> <span class="nam">keyword</span><span class="op">.</span><span class="nam">hover_text</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="nam">hover_text</span> <span class="op">=</span> <span class="nam">known_field</span><span class="op">.</span><span class="nam">hover_text</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="key">if</span> <span class="nam">hover_text</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">173 ↛ 174</span><span class="annotate long">line 173 didn't jump to line 174, because the condition on line 173 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="nam">hover_text</span> <span class="op">=</span> <span class="str">f"The field {current_field} had no documentation."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="nam">supported_formats</span> <span class="op">=</span> <span class="nam">ls</span><span class="op">.</span><span class="nam">client_capabilities</span><span class="op">.</span><span class="nam">text_document</span><span class="op">.</span><span class="nam">hover</span><span class="op">.</span><span class="nam">content_format</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="key">except</span> <span class="nam">AttributeError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="nam">supported_formats</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"Supported formats {supported_formats}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="nam">markup_kind</span> <span class="op">=</span> <span class="nam">MarkupKind</span><span class="op">.</span><span class="nam">Markdown</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="key">if</span> <span class="nam">markup_kind</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">supported_formats</span><span class="op">:</span> </span><span class="r"><span class="annotate short">183 ↛ 185</span><span class="annotate long">line 183 didn't jump to line 185, because the condition on line 183 was never false</span></span></p> - <p class="run"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="nam">markup_kind</span> <span class="op">=</span> <span class="nam">MarkupKind</span><span class="op">.</span><span class="nam">PlainText</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="key">return</span> <span class="nam">Hover</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="nam">contents</span><span class="op">=</span><span class="nam">MarkupContent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="nam">kind</span><span class="op">=</span><span class="nam">markup_kind</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="nam">value</span><span class="op">=</span><span class="nam">hover_text</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"><span class="key">def</span> <span class="nam">_deb822_token_iter</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="nam">tokens</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Deb822Token</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">Deb822Token</span><span class="op">,</span> <span class="nam">int</span><span class="op">,</span> <span class="nam">int</span><span class="op">,</span> <span class="nam">int</span><span class="op">,</span> <span class="nam">int</span><span class="op">,</span> <span class="nam">int</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="nam">line_no</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="nam">line_offset</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="key">for</span> <span class="nam">token</span> <span class="key">in</span> <span class="nam">tokens</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="nam">start_line</span> <span class="op">=</span> <span class="nam">line_no</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="nam">start_line_offset</span> <span class="op">=</span> <span class="nam">line_offset</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="nam">newlines</span> <span class="op">=</span> <span class="nam">token</span><span class="op">.</span><span class="nam">text</span><span class="op">.</span><span class="nam">count</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="nam">line_no</span> <span class="op">+=</span> <span class="nam">newlines</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="nam">text_len</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">token</span><span class="op">.</span><span class="nam">text</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="key">if</span> <span class="nam">newlines</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="key">if</span> <span class="nam">token</span><span class="op">.</span><span class="nam">text</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="nam">line_offset</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="com"># -2, one to remove the "\n" and one to get 0-offset</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="nam">line_offset</span> <span class="op">=</span> <span class="nam">text_len</span> <span class="op">-</span> <span class="nam">token</span><span class="op">.</span><span class="nam">text</span><span class="op">.</span><span class="nam">rindex</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span> <span class="op">-</span> <span class="num">2</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="nam">line_offset</span> <span class="op">+=</span> <span class="nam">text_len</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="key">yield</span> <span class="nam">token</span><span class="op">,</span> <span class="nam">start_line</span><span class="op">,</span> <span class="nam">start_line_offset</span><span class="op">,</span> <span class="nam">line_no</span><span class="op">,</span> <span class="nam">line_offset</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"><span class="key">def</span> <span class="nam">deb822_folding_ranges</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="nam">ls</span><span class="op">:</span> <span class="str">"LanguageServer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="nam">params</span><span class="op">:</span> <span class="nam">FoldingRangeParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="com"># Unused for now: might be relevant for supporting folding for some fields</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="nam">_file_metadata</span><span class="op">:</span> <span class="nam">Deb822FileMetadata</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Sequence</span><span class="op">[</span><span class="nam">FoldingRange</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="nam">doc</span> <span class="op">=</span> <span class="nam">ls</span><span class="op">.</span><span class="nam">workspace</span><span class="op">.</span><span class="nam">get_text_document</span><span class="op">(</span><span class="nam">params</span><span class="op">.</span><span class="nam">text_document</span><span class="op">.</span><span class="nam">uri</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="nam">comment_start</span> <span class="op">=</span> <span class="op">-</span><span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="nam">folding_ranges</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="key">for</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="nam">token</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="nam">start_line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="nam">start_offset</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="nam">end_line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="nam">end_offset</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="op">)</span> <span class="key">in</span> <span class="nam">_deb822_token_iter</span><span class="op">(</span><span class="nam">tokenize_deb822_file</span><span class="op">(</span><span class="nam">doc</span><span class="op">.</span><span class="nam">lines</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="key">if</span> <span class="nam">token</span><span class="op">.</span><span class="nam">is_comment</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="key">if</span> <span class="nam">comment_start</span> <span class="op"><</span> <span class="num">0</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="nam">comment_start</span> <span class="op">=</span> <span class="nam">start_line</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="key">elif</span> <span class="nam">comment_start</span> <span class="op">></span> <span class="op">-</span><span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="nam">comment_start</span> <span class="op">=</span> <span class="op">-</span><span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="nam">folding_range</span> <span class="op">=</span> <span class="nam">FoldingRange</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="nam">comment_start</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="nam">end_line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="nam">kind</span><span class="op">=</span><span class="nam">FoldingRangeKind</span><span class="op">.</span><span class="nam">Comment</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="nam">folding_ranges</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">folding_range</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="key">return</span> <span class="nam">folding_ranges</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"><span class="key">def</span> <span class="nam">deb822_semantic_tokens_full</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="nam">ls</span><span class="op">:</span> <span class="str">"LanguageServer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="nam">request</span><span class="op">:</span> <span class="nam">SemanticTokensParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="nam">file_metadata</span><span class="op">:</span> <span class="nam">Deb822FileMetadata</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">SemanticTokens</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="nam">doc</span> <span class="op">=</span> <span class="nam">ls</span><span class="op">.</span><span class="nam">workspace</span><span class="op">.</span><span class="nam">get_text_document</span><span class="op">(</span><span class="nam">request</span><span class="op">.</span><span class="nam">text_document</span><span class="op">.</span><span class="nam">uri</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="nam">lines</span> <span class="op">=</span> <span class="nam">doc</span><span class="op">.</span><span class="nam">lines</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="nam">deb822_file</span> <span class="op">=</span> <span class="nam">parse_deb822_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="nam">accept_files_with_duplicated_fields</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="nam">accept_files_with_error_tokens</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="nam">tokens</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="nam">previous_line</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="nam">keyword_token_code</span> <span class="op">=</span> <span class="nam">SEMANTIC_TOKEN_TYPES_IDS</span><span class="op">[</span><span class="str">"keyword"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="nam">known_value_token_code</span> <span class="op">=</span> <span class="nam">SEMANTIC_TOKEN_TYPES_IDS</span><span class="op">[</span><span class="str">"enumMember"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="nam">no_modifiers</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="com"># TODO: Add comment support; slightly complicated by how we parse the file.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="key">for</span> <span class="nam">stanza_idx</span><span class="op">,</span> <span class="nam">stanza</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">deb822_file</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="nam">stanza_position</span> <span class="op">=</span> <span class="nam">stanza</span><span class="op">.</span><span class="nam">position_in_file</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="nam">stanza_metadata</span> <span class="op">=</span> <span class="nam">file_metadata</span><span class="op">.</span><span class="nam">classify_stanza</span><span class="op">(</span><span class="nam">stanza</span><span class="op">,</span> <span class="nam">stanza_idx</span><span class="op">=</span><span class="nam">stanza_idx</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="key">for</span> <span class="nam">kvpair</span> <span class="key">in</span> <span class="nam">stanza</span><span class="op">.</span><span class="nam">iter_parts_of_type</span><span class="op">(</span><span class="nam">Deb822KeyValuePairElement</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="nam">kvpair_pos</span> <span class="op">=</span> <span class="nam">kvpair</span><span class="op">.</span><span class="nam">position_in_parent</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span><span class="nam">stanza_position</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="com"># These two happen to be the same; the indirection is to make it explicit that the two</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="com"># positions for different tokens are the same.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="nam">field_position_without_comments</span> <span class="op">=</span> <span class="nam">kvpair_pos</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="nam">field_size</span> <span class="op">=</span> <span class="nam">doc</span><span class="op">.</span><span class="nam">position_codec</span><span class="op">.</span><span class="nam">client_num_units</span><span class="op">(</span><span class="nam">kvpair</span><span class="op">.</span><span class="nam">field_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="nam">current_line</span> <span class="op">=</span> <span class="nam">field_position_without_comments</span><span class="op">.</span><span class="nam">line_position</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="nam">line_delta</span> <span class="op">=</span> <span class="nam">current_line</span> <span class="op">-</span> <span class="nam">previous_line</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="nam">previous_line</span> <span class="op">=</span> <span class="nam">current_line</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="nam">tokens</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">line_delta</span><span class="op">)</span> <span class="com"># Line delta</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="nam">tokens</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="num">0</span><span class="op">)</span> <span class="com"># Token column delta</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="nam">tokens</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">field_size</span><span class="op">)</span> <span class="com"># Token length</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="nam">tokens</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">keyword_token_code</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="nam">tokens</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">no_modifiers</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="nam">known_field</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Deb822KnownField</span><span class="op">]</span> <span class="op">=</span> <span class="nam">stanza_metadata</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="nam">kvpair</span><span class="op">.</span><span class="nam">field_name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> <span class="nam">known_field</span> <span class="key">is</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="key">or</span> <span class="key">not</span> <span class="nam">known_field</span><span class="op">.</span><span class="nam">known_values</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> <span class="key">or</span> <span class="nam">known_field</span><span class="op">.</span><span class="nam">spellcheck_value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="key">if</span> <span class="nam">known_field</span><span class="op">.</span><span class="nam">field_value_class</span> <span class="key">not</span> <span class="key">in</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SINGLE_VALUE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="nam">FieldValueClass</span><span class="op">.</span><span class="nam">SPACE_SEPARATED_LIST</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="nam">value_element_pos</span> <span class="op">=</span> <span class="nam">kvpair</span><span class="op">.</span><span class="nam">value_element</span><span class="op">.</span><span class="nam">position_in_parent</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> <span class="nam">kvpair_pos</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="nam">last_token_start_column</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="key">for</span> <span class="nam">value_ref</span> <span class="key">in</span> <span class="nam">kvpair</span><span class="op">.</span><span class="nam">interpret_as</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="nam">LIST_SPACE_SEPARATED_INTERPRETATION</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="op">)</span><span class="op">.</span><span class="nam">iter_value_references</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="key">if</span> <span class="nam">value_ref</span><span class="op">.</span><span class="nam">value</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">known_field</span><span class="op">.</span><span class="nam">known_values</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="nam">value_loc</span> <span class="op">=</span> <span class="nam">value_ref</span><span class="op">.</span><span class="nam">locatable</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="nam">value_range_te</span> <span class="op">=</span> <span class="nam">value_loc</span><span class="op">.</span><span class="nam">range_in_parent</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="nam">value_element_pos</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="nam">start_line</span> <span class="op">=</span> <span class="nam">value_range_te</span><span class="op">.</span><span class="nam">start_pos</span><span class="op">.</span><span class="nam">line_position</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="nam">line_delta</span> <span class="op">=</span> <span class="nam">start_line</span> <span class="op">-</span> <span class="nam">current_line</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="nam">current_line</span> <span class="op">=</span> <span class="nam">start_line</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="key">if</span> <span class="nam">line_delta</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="nam">last_token_start_column</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> <span class="nam">value_start_column</span> <span class="op">=</span> <span class="nam">value_range_te</span><span class="op">.</span><span class="nam">start_pos</span><span class="op">.</span><span class="nam">cursor_position</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> <span class="nam">column_delta</span> <span class="op">=</span> <span class="nam">value_start_column</span> <span class="op">-</span> <span class="nam">last_token_start_column</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> <span class="nam">last_token_start_column</span> <span class="op">=</span> <span class="nam">value_start_column</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> <span class="nam">tokens</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">line_delta</span><span class="op">)</span> <span class="com"># Line delta</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> <span class="nam">tokens</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">column_delta</span><span class="op">)</span> <span class="com"># Token column delta</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> <span class="nam">tokens</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">field_size</span><span class="op">)</span> <span class="com"># Token length</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> <span class="nam">tokens</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">known_value_token_code</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> <span class="nam">tokens</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">no_modifiers</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">tokens</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> <span class="key">return</span> <span class="nam">SemanticTokens</span><span class="op">(</span><span class="nam">tokens</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"><span class="key">def</span> <span class="nam">_should_complete_field_with_value</span><span class="op">(</span><span class="nam">cand</span><span class="op">:</span> <span class="nam">Deb822KnownField</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> <span class="key">return</span> <span class="nam">cand</span><span class="op">.</span><span class="nam">known_values</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"> <span class="nam">len</span><span class="op">(</span><span class="nam">cand</span><span class="op">.</span><span class="nam">known_values</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"> <span class="key">or</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"> <span class="nam">len</span><span class="op">(</span><span class="nam">cand</span><span class="op">.</span><span class="nam">known_values</span><span class="op">)</span> <span class="op">==</span> <span class="num">2</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> <span class="key">and</span> <span class="nam">cand</span><span class="op">.</span><span class="nam">warn_if_default</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"> <span class="key">and</span> <span class="nam">cand</span><span class="op">.</span><span class="nam">default_value</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"><span class="key">def</span> <span class="nam">_complete_field_name</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"> <span class="nam">fields</span><span class="op">:</span> <span class="nam">StanzaMetadata</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"> <span class="nam">seen_fields</span><span class="op">:</span> <span class="nam">Container</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">CompletionList</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">CompletionItem</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"> <span class="nam">items</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"> <span class="key">for</span> <span class="nam">cand_key</span><span class="op">,</span> <span class="nam">cand</span> <span class="key">in</span> <span class="nam">fields</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"> <span class="key">if</span> <span class="nam">cand_key</span><span class="op">.</span><span class="nam">lower</span><span class="op">(</span><span class="op">)</span> <span class="key">in</span> <span class="nam">seen_fields</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"> <span class="nam">name</span> <span class="op">=</span> <span class="nam">cand</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"> <span class="nam">complete_as</span> <span class="op">=</span> <span class="nam">name</span> <span class="op">+</span> <span class="str">": "</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"> <span class="key">if</span> <span class="nam">_should_complete_field_with_value</span><span class="op">(</span><span class="nam">cand</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"> <span class="nam">value</span> <span class="op">=</span> <span class="nam">next</span><span class="op">(</span><span class="nam">iter</span><span class="op">(</span><span class="nam">v</span> <span class="key">for</span> <span class="nam">v</span> <span class="key">in</span> <span class="nam">cand</span><span class="op">.</span><span class="nam">known_values</span> <span class="key">if</span> <span class="nam">v</span> <span class="op">!=</span> <span class="nam">cand</span><span class="op">.</span><span class="nam">default_value</span><span class="op">)</span><span class="op">)</span> </span><span class="r"><span class="annotate short">361 ↛ exit</span><span class="annotate long">line 361 didn't finish the generator expression on line 361</span></span></p> - <p class="run"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"> <span class="nam">complete_as</span> <span class="op">+=</span> <span class="nam">value</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"> <span class="nam">tags</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"> <span class="key">if</span> <span class="nam">cand</span><span class="op">.</span><span class="nam">replaced_by</span> <span class="key">or</span> <span class="nam">cand</span><span class="op">.</span><span class="nam">deprecated_with_no_replacement</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"> <span class="nam">tags</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">CompletionItemTag</span><span class="op">.</span><span class="nam">Deprecated</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"> <span class="nam">items</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"> <span class="nam">CompletionItem</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"> <span class="nam">name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"> <span class="nam">insert_text</span><span class="op">=</span><span class="nam">complete_as</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"> <span class="nam">tags</span><span class="op">=</span><span class="nam">tags</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"> <span class="key">return</span> <span class="nam">items</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"><span class="key">def</span> <span class="nam">_complete_field_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"> <span class="nam">field</span><span class="op">:</span> <span class="nam">Deb822KnownField</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">CompletionList</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">CompletionItem</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"> <span class="key">if</span> <span class="nam">field</span><span class="op">.</span><span class="nam">known_values</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"> <span class="key">return</span> <span class="op">[</span><span class="nam">CompletionItem</span><span class="op">(</span><span class="nam">v</span><span class="op">)</span> <span class="key">for</span> <span class="nam">v</span> <span class="key">in</span> <span class="nam">field</span><span class="op">.</span><span class="nam">known_values</span><span class="op">]</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_features_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_5d0ec0d5422112df_quickfixes_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_5d0ec0d5422112df_quickfixes_py.html b/coverage-report/d_5d0ec0d5422112df_quickfixes_py.html deleted file mode 100644 index b62166d..0000000 --- a/coverage-report/d_5d0ec0d5422112df_quickfixes_py.html +++ /dev/null @@ -1,301 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/lsp/quickfixes.py: 42%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/lsp/quickfixes.py</b>: - <span class="pc_cov">42%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">63 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">31<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">32<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_generic_deb822_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_5d0ec0d5422112df_spellchecking_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"> <span class="nam">Literal</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"> <span class="nam">TypedDict</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> <span class="nam">Callable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> <span class="nam">Iterable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">TypeVar</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">Mapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">Dict</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">List</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">cast</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"><span class="key">from</span> <span class="nam">lsprotocol</span><span class="op">.</span><span class="nam">types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">CodeAction</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">Command</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">CodeActionParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">Diagnostic</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">CodeActionDisabledType</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">TextEdit</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">WorkspaceEdit</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="nam">TextDocumentEdit</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">OptionalVersionedTextDocumentIdentifier</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="nam">Range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="nam">Position</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="nam">CodeActionKind</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">_warn</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"><span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="key">from</span> <span class="nam">debian</span><span class="op">.</span><span class="nam">_deb822_repro</span><span class="op">.</span><span class="nam">locatable</span> <span class="key">import</span> <span class="nam">Position</span> <span class="key">as</span> <span class="nam">TEPosition</span><span class="op">,</span> <span class="nam">Range</span> <span class="key">as</span> <span class="nam">TERange</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="key">from</span> <span class="nam">pygls</span><span class="op">.</span><span class="nam">server</span> <span class="key">import</span> <span class="nam">LanguageServer</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="key">from</span> <span class="nam">pygls</span><span class="op">.</span><span class="nam">workspace</span> <span class="key">import</span> <span class="nam">TextDocument</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="key">except</span> <span class="nam">ImportError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"><span class="nam">CodeActionName</span> <span class="op">=</span> <span class="nam">Literal</span><span class="op">[</span><span class="str">"correct-text"</span><span class="op">,</span> <span class="str">"remove-line"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"><span class="key">class</span> <span class="nam">CorrectTextCodeAction</span><span class="op">(</span><span class="nam">TypedDict</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="nam">code_action</span><span class="op">:</span> <span class="nam">Literal</span><span class="op">[</span><span class="str">"correct-text"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="nam">correct_value</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"><span class="key">class</span> <span class="nam">RemoveLineCodeAction</span><span class="op">(</span><span class="nam">TypedDict</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="nam">code_action</span><span class="op">:</span> <span class="nam">Literal</span><span class="op">[</span><span class="str">"remove-line"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"><span class="key">def</span> <span class="nam">propose_correct_text_quick_fix</span><span class="op">(</span><span class="nam">correct_value</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">CorrectTextCodeAction</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="key">return</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="str">"code_action"</span><span class="op">:</span> <span class="str">"correct-text"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="str">"correct_value"</span><span class="op">:</span> <span class="nam">correct_value</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"><span class="key">def</span> <span class="nam">propose_remove_line_quick_fix</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="nam">RemoveLineCodeAction</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="key">return</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="str">"code_action"</span><span class="op">:</span> <span class="str">"remove-line"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"><span class="nam">CODE_ACTION_HANDLERS</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="nam">CodeActionName</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="nam">Callable</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="op">[</span><span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">CodeActionParams</span><span class="op">,</span> <span class="nam">Diagnostic</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">CodeAction</span><span class="op">,</span> <span class="nam">Command</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"><span class="op">]</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"><span class="nam">M</span> <span class="op">=</span> <span class="nam">TypeVar</span><span class="op">(</span><span class="str">"M"</span><span class="op">,</span> <span class="nam">bound</span><span class="op">=</span><span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"><span class="nam">Handler</span> <span class="op">=</span> <span class="nam">Callable</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="op">[</span><span class="nam">M</span><span class="op">,</span> <span class="nam">CodeActionParams</span><span class="op">,</span> <span class="nam">Diagnostic</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">CodeAction</span><span class="op">,</span> <span class="nam">Command</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"><span class="key">def</span> <span class="nam">_code_handler_for</span><span class="op">(</span><span class="nam">action_name</span><span class="op">:</span> <span class="nam">CodeActionName</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">Handler</span><span class="op">]</span><span class="op">,</span> <span class="nam">Handler</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="key">def</span> <span class="nam">_wrapper</span><span class="op">(</span><span class="nam">func</span><span class="op">:</span> <span class="nam">Handler</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Handler</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="key">assert</span> <span class="nam">action_name</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">CODE_ACTION_HANDLERS</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="nam">CODE_ACTION_HANDLERS</span><span class="op">[</span><span class="nam">action_name</span><span class="op">]</span> <span class="op">=</span> <span class="nam">func</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="key">return</span> <span class="nam">func</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="key">return</span> <span class="nam">_wrapper</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"><span class="op">@</span><span class="nam">_code_handler_for</span><span class="op">(</span><span class="str">"correct-text"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"><span class="key">def</span> <span class="nam">_correct_value_code_action</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="nam">code_action_data</span><span class="op">:</span> <span class="nam">CorrectTextCodeAction</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="nam">code_action_params</span><span class="op">:</span> <span class="nam">CodeActionParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="nam">diagnostic</span><span class="op">:</span> <span class="nam">Diagnostic</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">CodeAction</span><span class="op">,</span> <span class="nam">Command</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="nam">corrected_value</span> <span class="op">=</span> <span class="nam">code_action_data</span><span class="op">[</span><span class="str">"correct_value"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="nam">edits</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="nam">TextEdit</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="nam">diagnostic</span><span class="op">.</span><span class="nam">range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="nam">corrected_value</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="key">yield</span> <span class="nam">CodeAction</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="nam">title</span><span class="op">=</span><span class="str">f'Replace with "{corrected_value}"'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="nam">kind</span><span class="op">=</span><span class="nam">CodeActionKind</span><span class="op">.</span><span class="nam">QuickFix</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">=</span><span class="op">[</span><span class="nam">diagnostic</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="nam">edit</span><span class="op">=</span><span class="nam">WorkspaceEdit</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="nam">changes</span><span class="op">=</span><span class="op">{</span><span class="nam">code_action_params</span><span class="op">.</span><span class="nam">text_document</span><span class="op">.</span><span class="nam">uri</span><span class="op">:</span> <span class="nam">edits</span><span class="op">}</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="nam">document_changes</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="nam">TextDocumentEdit</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="nam">text_document</span><span class="op">=</span><span class="nam">OptionalVersionedTextDocumentIdentifier</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="nam">uri</span><span class="op">=</span><span class="nam">code_action_params</span><span class="op">.</span><span class="nam">text_document</span><span class="op">.</span><span class="nam">uri</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="nam">edits</span><span class="op">=</span><span class="nam">edits</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"><span class="key">def</span> <span class="nam">range_compatible_with_remove_line_fix</span><span class="op">(</span><span class="nam">range_</span><span class="op">:</span> <span class="nam">Range</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="nam">start</span> <span class="op">=</span> <span class="nam">range_</span><span class="op">.</span><span class="nam">start</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="nam">end</span> <span class="op">=</span> <span class="nam">range_</span><span class="op">.</span><span class="nam">end</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="key">if</span> <span class="nam">start</span><span class="op">.</span><span class="nam">line</span> <span class="op">!=</span> <span class="nam">end</span><span class="op">.</span><span class="nam">line</span> <span class="key">and</span> <span class="op">(</span><span class="nam">start</span><span class="op">.</span><span class="nam">line</span> <span class="op">+</span> <span class="num">1</span> <span class="op">!=</span> <span class="nam">end</span><span class="op">.</span><span class="nam">line</span> <span class="key">or</span> <span class="nam">end</span><span class="op">.</span><span class="nam">character</span> <span class="op">></span> <span class="num">0</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"><span class="op">@</span><span class="nam">_code_handler_for</span><span class="op">(</span><span class="str">"remove-line"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"><span class="key">def</span> <span class="nam">_correct_value_code_action</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="nam">_code_action_data</span><span class="op">:</span> <span class="nam">RemoveLineCodeAction</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="nam">code_action_params</span><span class="op">:</span> <span class="nam">CodeActionParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="nam">diagnostic</span><span class="op">:</span> <span class="nam">Diagnostic</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">CodeAction</span><span class="op">,</span> <span class="nam">Command</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="nam">start</span> <span class="op">=</span> <span class="nam">code_action_params</span><span class="op">.</span><span class="nam">range</span><span class="op">.</span><span class="nam">start</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="key">if</span> <span class="nam">range_compatible_with_remove_line_fix</span><span class="op">(</span><span class="nam">code_action_params</span><span class="op">.</span><span class="nam">range</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="str">"Bug: the quick was used for a diagnostic that spanned multiple lines and would corrupt the file."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="nam">edits</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="nam">TextEdit</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="nam">Range</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="nam">start</span><span class="op">=</span><span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="nam">line</span><span class="op">=</span><span class="nam">start</span><span class="op">.</span><span class="nam">line</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="nam">character</span><span class="op">=</span><span class="num">0</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="nam">end</span><span class="op">=</span><span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="nam">line</span><span class="op">=</span><span class="nam">start</span><span class="op">.</span><span class="nam">line</span> <span class="op">+</span> <span class="num">1</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="nam">character</span><span class="op">=</span><span class="num">0</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="str">""</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="key">yield</span> <span class="nam">CodeAction</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="nam">title</span><span class="op">=</span><span class="str">"Remove the line"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="nam">kind</span><span class="op">=</span><span class="nam">CodeActionKind</span><span class="op">.</span><span class="nam">QuickFix</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="nam">diagnostics</span><span class="op">=</span><span class="op">[</span><span class="nam">diagnostic</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="nam">edit</span><span class="op">=</span><span class="nam">WorkspaceEdit</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="nam">changes</span><span class="op">=</span><span class="op">{</span><span class="nam">code_action_params</span><span class="op">.</span><span class="nam">text_document</span><span class="op">.</span><span class="nam">uri</span><span class="op">:</span> <span class="nam">edits</span><span class="op">}</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="nam">document_changes</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="nam">TextDocumentEdit</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="nam">text_document</span><span class="op">=</span><span class="nam">OptionalVersionedTextDocumentIdentifier</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="nam">uri</span><span class="op">=</span><span class="nam">code_action_params</span><span class="op">.</span><span class="nam">text_document</span><span class="op">.</span><span class="nam">uri</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="nam">edits</span><span class="op">=</span><span class="nam">edits</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"><span class="key">def</span> <span class="nam">provide_standard_quickfixes_from_diagnostics</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="nam">code_action_params</span><span class="op">:</span> <span class="nam">CodeActionParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">Command</span><span class="op">,</span> <span class="nam">CodeAction</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="nam">actions</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="key">for</span> <span class="nam">diagnostic</span> <span class="key">in</span> <span class="nam">code_action_params</span><span class="op">.</span><span class="nam">context</span><span class="op">.</span><span class="nam">diagnostics</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="nam">data</span> <span class="op">=</span> <span class="nam">diagnostic</span><span class="op">.</span><span class="nam">data</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">data</span><span class="op">,</span> <span class="nam">list</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="nam">data</span> <span class="op">=</span> <span class="op">[</span><span class="nam">data</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="key">for</span> <span class="nam">action_suggestion</span> <span class="key">in</span> <span class="nam">data</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="nam">action_suggestion</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="key">and</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">action_suggestion</span><span class="op">,</span> <span class="nam">Mapping</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="key">and</span> <span class="str">"code_action"</span> <span class="key">in</span> <span class="nam">action_suggestion</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="nam">action_name</span><span class="op">:</span> <span class="nam">CodeActionName</span> <span class="op">=</span> <span class="nam">action_suggestion</span><span class="op">[</span><span class="str">"code_action"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="nam">handler</span> <span class="op">=</span> <span class="nam">CODE_ACTION_HANDLERS</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">action_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="key">if</span> <span class="nam">handler</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="nam">actions</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="nam">handler</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="nam">cast</span><span class="op">(</span><span class="str">"Mapping[str, str]"</span><span class="op">,</span> <span class="nam">action_suggestion</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="nam">code_action_params</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="nam">diagnostic</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span><span class="str">f"No codeAction handler for {action_name} !?"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">actions</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="key">return</span> <span class="nam">actions</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_5d0ec0d5422112df_lsp_generic_deb822_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_5d0ec0d5422112df_spellchecking_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_5d0ec0d5422112df_spellchecking_py.html b/coverage-report/d_5d0ec0d5422112df_spellchecking_py.html deleted file mode 100644 index 2474783..0000000 --- a/coverage-report/d_5d0ec0d5422112df_spellchecking_py.html +++ /dev/null @@ -1,403 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/lsp/spellchecking.py: 71%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/lsp/spellchecking.py</b>: - <span class="pc_cov">71%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">152 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">110<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">42<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">2<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">14<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_5d0ec0d5422112df_quickfixes_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_5d0ec0d5422112df_text_edit_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">functools</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">itertools</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">import</span> <span class="nam">re</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">import</span> <span class="nam">subprocess</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Iterable</span><span class="op">,</span> <span class="nam">FrozenSet</span><span class="op">,</span> <span class="nam">Tuple</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">,</span> <span class="nam">List</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="key">from</span> <span class="nam">debian</span><span class="op">.</span><span class="nam">debian_support</span> <span class="key">import</span> <span class="nam">Release</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="key">from</span> <span class="nam">lsprotocol</span><span class="op">.</span><span class="nam">types</span> <span class="key">import</span> <span class="nam">Diagnostic</span><span class="op">,</span> <span class="nam">Range</span><span class="op">,</span> <span class="nam">Position</span><span class="op">,</span> <span class="nam">DiagnosticSeverity</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">quickfixes</span> <span class="key">import</span> <span class="nam">propose_correct_text_quick_fix</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">text_util</span> <span class="key">import</span> <span class="nam">LintCapablePositionCodec</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">_info</span><span class="op">,</span> <span class="nam">_warn</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"><span class="nam">_SPELL_CHECKER_DICT</span> <span class="op">=</span> <span class="str">"/usr/share/hunspell/en_US.dic"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"><span class="nam">_SPELL_CHECKER_AFF</span> <span class="op">=</span> <span class="str">"/usr/share/hunspell/en_US.aff"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"><span class="nam">_WORD_PARTS</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r"(\S+)"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"><span class="nam">_PRUNE_SYMBOLS_RE</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r"(\w+(?:-\w+|'\w+)?)"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"><span class="nam">_FIND_QUOTE_CHAR</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r'["`]'</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"><span class="nam">_LOOKS_LIKE_FILENAME</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="str">r"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"><span class="str"> [.]{0,3}/[a-z0-9]+(/[a-z0-9]+)+/*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"><span class="str"> | [a-z0-9-_]+(/[a-z0-9]+)+/*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"><span class="str"> | [a-z0-9_]+(/[a-z0-9_]+){2,}/*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"><span class="str"> | (?:\S+)?[.][a-z]{1,3}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"><span class="str">"""</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="nam">re</span><span class="op">.</span><span class="nam">VERBOSE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"><span class="nam">_LOOKS_LIKE_PROGRAMMING_TERM</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="str">r"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"><span class="str"> (</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"><span class="str"> # Java identifier Camel Case</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"><span class="str"> [a-z][a-z0-9]*(?:[A-Z]{1,3}[a-z0-9]+)+</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"><span class="str"> # Type name Camel Case</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"><span class="str"> | [A-Z]{1,3}[a-z0-9]+(?:[A-Z]{1,3}[a-z0-9]+)+</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="str"> # Type name Camel Case with underscore (seen in Dh_Lib.pm among other</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"><span class="str"> | [A-Z]{1,3}[a-z0-9]+(?:_[A-Z]{1,3}[a-z0-9]+)+</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"><span class="str"> # Perl module</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"><span class="str"> | [A-Z]{1,3}[a-z0-9]+(?:_[A-Z]{1,3}[a-z0-9]+)*(::[A-Z]{1,3}[a-z0-9]+(?:_[A-Z]{1,3}[a-z0-9]+)*)+</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"><span class="str"> # Probably an abbreviation</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"><span class="str"> | [A-Z]{3,}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"><span class="str"> # Perl/Python identifiers or Jinja templates</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"><span class="str"> | [$%&@_]?[{]?[{]?[a-z][a-z0-9]*(?:_[a-z0-9]+)+(?:(?:->)?[\[{]\S+|}}?)?</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"><span class="str"> # SCREAMING_SNAKE_CASE (environment variables plus -DVAR=B or $FOO)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"><span class="str"> | [-$%&*_]{0,2}[A-Z][A-Z0-9]*(_[A-Z0-9]+)+(?:=\S+)?</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"><span class="str"> | \#[A-Z][A-Z0-9]*(_[A-Z0-9]+)+\#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"><span class="str"> # Subcommand names. Require at least two "-" to avoid skipping hyphenated words</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"><span class="str"> | [a-z][a-z0-9]*(-[a-z0-9]+){2,}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"><span class="str"> # Short args</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"><span class="str"> | -[a-z0-9]+</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"><span class="str"> # Things like 32bit</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"><span class="str"> | \d{2,}-?[a-z]+</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"><span class="str"> # Source package (we do not have a package without prefix/suffix because it covers 95% of all lowercase words)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"><span class="str"> | src:[a-z0-9][-+.a-z0-9]+</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"><span class="str"> | [a-z0-9][-+.a-z0-9]+:(?:any|native)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"><span class="str"> # Version</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"><span class="str"> | v\d+(?:[.]\S+)?</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"><span class="str"> # chmod symbolic mode or math</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"><span class="str"> | \S*=\S+</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"><span class="str"> )</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"><span class="str">"""</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="nam">re</span><span class="op">.</span><span class="nam">VERBOSE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"><span class="nam">_LOOKS_LIKE_EMAIL</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="str">r"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"><span class="str"> <[^>@\s]+@[^>@\s]+></span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"><span class="str">"""</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="nam">re</span><span class="op">.</span><span class="nam">VERBOSE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"><span class="nam">_NO_CORRECTIONS</span> <span class="op">=</span> <span class="nam">tuple</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"><span class="nam">_WORDLISTS</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="str">"debian-wordlist.dic"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"><span class="nam">_NAMELISTS</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="str">"logins-and-people.dic"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"><span class="nam">_PERSONAL_DICTS</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="str">"${HOME}/.hunspell_default"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="str">"${HOME}/.hunspell_en_US"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"><span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">lexists</span><span class="op">(</span><span class="nam">_SPELL_CHECKER_DICT</span><span class="op">)</span> <span class="key">or</span> <span class="key">not</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">lexists</span><span class="op">(</span> </span><span class="r"><span class="annotate short">85 ↛ 88</span><span class="annotate long">line 85 didn't jump to line 88, because the condition on line 85 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="nam">_SPELL_CHECKER_AFF</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ImportError</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="key">from</span> <span class="nam">hunspell</span> <span class="key">import</span> <span class="nam">HunSpell</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="nam">_HAS_HUNSPELL</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"><span class="key">except</span> <span class="nam">ImportError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="nam">_HAS_HUNSPELL</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"><span class="key">def</span> <span class="nam">_read_wordlist</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="nam">base_dir</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">wordlist_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">namelist</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="key">with</span> <span class="nam">open</span><span class="op">(</span><span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">base_dir</span><span class="op">,</span> <span class="nam">wordlist_name</span><span class="op">)</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="nam">w</span> <span class="op">=</span> <span class="op">[</span><span class="nam">w</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span> <span class="key">for</span> <span class="nam">w</span> <span class="key">in</span> <span class="nam">fd</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">w</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="key">if</span> <span class="nam">namelist</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="op">(</span><span class="str">f"{n}'s"</span> <span class="key">for</span> <span class="nam">n</span> <span class="key">in</span> <span class="nam">w</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"><span class="key">def</span> <span class="nam">_all_debian_archs</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="nam">output</span> <span class="op">=</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_output</span><span class="op">(</span><span class="op">[</span><span class="str">"dpkg-architecture"</span><span class="op">,</span> <span class="str">"-L"</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="key">except</span> <span class="op">(</span><span class="nam">FileNotFoundError</span><span class="op">,</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">CalledProcessError</span><span class="op">)</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span><span class="str">f"dpkg-architecture -L failed: {e}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="key">return</span> <span class="nam">tuple</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="key">return</span> <span class="op">(</span><span class="nam">x</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">output</span><span class="op">.</span><span class="nam">decode</span><span class="op">(</span><span class="str">"utf-8"</span><span class="op">)</span><span class="op">.</span><span class="nam">splitlines</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"><span class="op">@</span><span class="nam">functools</span><span class="op">.</span><span class="nam">lru_cache</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"><span class="key">def</span> <span class="nam">_builtin_exception_words</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="nam">basedirs</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">dirname</span><span class="op">(</span><span class="nam">__file__</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="nam">release_names</span> <span class="op">=</span> <span class="op">(</span><span class="nam">x</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">Release</span><span class="op">.</span><span class="nam">releases</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="key">return</span> <span class="nam">frozenset</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="nam">itertools</span><span class="op">.</span><span class="nam">chain</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="nam">itertools</span><span class="op">.</span><span class="nam">chain</span><span class="op">.</span><span class="nam">from_iterable</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="nam">_read_wordlist</span><span class="op">(</span><span class="nam">basedirs</span><span class="op">,</span> <span class="nam">wl</span><span class="op">)</span> <span class="key">for</span> <span class="nam">wl</span> <span class="key">in</span> <span class="nam">_WORDLISTS</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="nam">itertools</span><span class="op">.</span><span class="nam">chain</span><span class="op">.</span><span class="nam">from_iterable</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="nam">_read_wordlist</span><span class="op">(</span><span class="nam">basedirs</span><span class="op">,</span> <span class="nam">wl</span><span class="op">,</span> <span class="nam">namelist</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> <span class="key">for</span> <span class="nam">wl</span> <span class="key">in</span> <span class="nam">_NAMELISTS</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="nam">release_names</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="nam">_all_debian_archs</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"><span class="nam">_DEFAULT_SPELL_CHECKER</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"Spellchecker"</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"><span class="key">def</span> <span class="nam">spellcheck_line</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="nam">position_codec</span><span class="op">:</span> <span class="nam">LintCapablePositionCodec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="nam">line_no</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="nam">line</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="nam">spell_checker</span> <span class="op">=</span> <span class="nam">default_spellchecker</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="key">for</span> <span class="nam">word</span><span class="op">,</span> <span class="nam">pos</span><span class="op">,</span> <span class="nam">endpos</span> <span class="key">in</span> <span class="nam">spell_checker</span><span class="op">.</span><span class="nam">iter_words</span><span class="op">(</span><span class="nam">line</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="nam">corrections</span> <span class="op">=</span> <span class="nam">spell_checker</span><span class="op">.</span><span class="nam">provide_corrections_for</span><span class="op">(</span><span class="nam">word</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">corrections</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="nam">word_range_server_units</span> <span class="op">=</span> <span class="nam">Range</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="nam">Position</span><span class="op">(</span><span class="nam">line_no</span><span class="op">,</span> <span class="nam">pos</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="nam">Position</span><span class="op">(</span><span class="nam">line_no</span><span class="op">,</span> <span class="nam">endpos</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="nam">word_range</span> <span class="op">=</span> <span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="nam">word_range_server_units</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="nam">word_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="str">f'Spelling "{word}"'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="nam">severity</span><span class="op">=</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Hint</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="nam">source</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="nam">data</span><span class="op">=</span><span class="op">[</span><span class="nam">propose_correct_text_quick_fix</span><span class="op">(</span><span class="nam">c</span><span class="op">)</span> <span class="key">for</span> <span class="nam">c</span> <span class="key">in</span> <span class="nam">corrections</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"><span class="key">def</span> <span class="nam">default_spellchecker</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="str">"Spellchecker"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="key">global</span> <span class="nam">_DEFAULT_SPELL_CHECKER</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="nam">spellchecker</span> <span class="op">=</span> <span class="nam">_DEFAULT_SPELL_CHECKER</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="key">if</span> <span class="nam">spellchecker</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="key">if</span> <span class="nam">_HAS_HUNSPELL</span><span class="op">:</span> </span><span class="r"><span class="annotate short">169 ↛ 172</span><span class="annotate long">line 169 didn't jump to line 172, because the condition on line 169 was never false</span></span></p> - <p class="run"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="nam">spellchecker</span> <span class="op">=</span> <span class="nam">HunspellSpellchecker</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="nam">spellchecker</span> <span class="op">=</span> <span class="nam">_do_nothing_spellchecker</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">_DEFAULT_SPELL_CHECKER</span> <span class="op">=</span> <span class="nam">spellchecker</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="key">return</span> <span class="nam">spellchecker</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"><span class="op">@</span><span class="nam">functools</span><span class="op">.</span><span class="nam">lru_cache</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"><span class="key">def</span> <span class="nam">_do_nothing_spellchecker</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="str">"Spellchecker"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="key">return</span> <span class="nam">EverythingIsCorrectSpellchecker</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"><span class="key">def</span> <span class="nam">disable_spellchecking</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="key">global</span> <span class="nam">_DEFAULT_SPELL_CHECKER</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="nam">_DEFAULT_SPELL_CHECKER</span> <span class="op">=</span> <span class="nam">_do_nothing_spellchecker</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"><span class="key">def</span> <span class="nam">_skip_quoted_parts</span><span class="op">(</span><span class="nam">line</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">int</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="nam">current_pos</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="key">while</span> <span class="key">True</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="nam">_FIND_QUOTE_CHAR</span><span class="op">.</span><span class="nam">search</span><span class="op">(</span><span class="nam">line</span><span class="op">,</span> <span class="nam">current_pos</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="key">if</span> <span class="nam">m</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">192 ↛ 198</span><span class="annotate long">line 192 didn't jump to line 198, because the condition on line 192 was never false</span></span></p> - <p class="par run show_par"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="key">if</span> <span class="nam">current_pos</span> <span class="op">==</span> <span class="num">0</span><span class="op">:</span> </span><span class="r"><span class="annotate short">193 ↛ 196</span><span class="annotate long">line 193 didn't jump to line 196, because the condition on line 193 was never false</span></span></p> - <p class="run"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="key">yield</span> <span class="nam">line</span><span class="op">,</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="key">yield</span> <span class="nam">line</span><span class="op">[</span><span class="nam">current_pos</span><span class="op">:</span><span class="op">]</span><span class="op">,</span> <span class="nam">current_pos</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="nam">starting_marker_pos</span> <span class="op">=</span> <span class="nam">m</span><span class="op">.</span><span class="nam">span</span><span class="op">(</span><span class="op">)</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="nam">quote_char</span> <span class="op">=</span> <span class="nam">m</span><span class="op">.</span><span class="nam">group</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="nam">end_marker_pos</span> <span class="op">=</span> <span class="nam">line</span><span class="op">.</span><span class="nam">index</span><span class="op">(</span><span class="nam">quote_char</span><span class="op">,</span> <span class="nam">starting_marker_pos</span> <span class="op">+</span> <span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="key">except</span> <span class="nam">ValueError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="key">yield</span> <span class="nam">line</span><span class="op">[</span><span class="nam">current_pos</span><span class="op">:</span><span class="op">]</span><span class="op">,</span> <span class="nam">current_pos</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="nam">part</span> <span class="op">=</span> <span class="nam">line</span><span class="op">[</span><span class="nam">current_pos</span><span class="op">:</span><span class="nam">starting_marker_pos</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">part</span><span class="op">.</span><span class="nam">isspace</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="key">yield</span> <span class="nam">part</span><span class="op">,</span> <span class="nam">current_pos</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="nam">current_pos</span> <span class="op">=</span> <span class="nam">end_marker_pos</span> <span class="op">+</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"><span class="key">def</span> <span class="nam">_split_line_to_words</span><span class="op">(</span><span class="nam">line</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">int</span><span class="op">,</span> <span class="nam">int</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="key">for</span> <span class="nam">line_part</span><span class="op">,</span> <span class="nam">part_pos</span> <span class="key">in</span> <span class="nam">_skip_quoted_parts</span><span class="op">(</span><span class="nam">line</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="key">for</span> <span class="nam">m</span> <span class="key">in</span> <span class="nam">_WORD_PARTS</span><span class="op">.</span><span class="nam">finditer</span><span class="op">(</span><span class="nam">line_part</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="nam">fullword</span> <span class="op">=</span> <span class="nam">m</span><span class="op">.</span><span class="nam">group</span><span class="op">(</span><span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="key">if</span> <span class="nam">fullword</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"--"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">216 ↛ 218</span><span class="annotate long">line 216 didn't jump to line 218, because the condition on line 216 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="com"># CLI arg</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="key">if</span> <span class="nam">_LOOKS_LIKE_PROGRAMMING_TERM</span><span class="op">.</span><span class="nam">match</span><span class="op">(</span><span class="nam">fullword</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">219 ↛ 220</span><span class="annotate long">line 219 didn't jump to line 220, because the condition on line 219 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="key">if</span> <span class="nam">_LOOKS_LIKE_FILENAME</span><span class="op">.</span><span class="nam">match</span><span class="op">(</span><span class="nam">fullword</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">221 ↛ 222</span><span class="annotate long">line 221 didn't jump to line 222, because the condition on line 221 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="key">if</span> <span class="nam">_LOOKS_LIKE_EMAIL</span><span class="op">.</span><span class="nam">match</span><span class="op">(</span><span class="nam">fullword</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">223 ↛ 224</span><span class="annotate long">line 223 didn't jump to line 224, because the condition on line 223 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="nam">mpos</span> <span class="op">=</span> <span class="nam">m</span><span class="op">.</span><span class="nam">span</span><span class="op">(</span><span class="num">1</span><span class="op">)</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="key">for</span> <span class="nam">sm</span> <span class="key">in</span> <span class="nam">_PRUNE_SYMBOLS_RE</span><span class="op">.</span><span class="nam">finditer</span><span class="op">(</span><span class="nam">fullword</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="nam">pos</span><span class="op">,</span> <span class="nam">endpos</span> <span class="op">=</span> <span class="nam">sm</span><span class="op">.</span><span class="nam">span</span><span class="op">(</span><span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="nam">offset</span> <span class="op">=</span> <span class="nam">part_pos</span> <span class="op">+</span> <span class="nam">mpos</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="key">yield</span> <span class="nam">sm</span><span class="op">.</span><span class="nam">group</span><span class="op">(</span><span class="num">1</span><span class="op">)</span><span class="op">,</span> <span class="nam">pos</span> <span class="op">+</span> <span class="nam">offset</span><span class="op">,</span> <span class="nam">endpos</span> <span class="op">+</span> <span class="nam">offset</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"><span class="key">class</span> <span class="nam">Spellchecker</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="op">@</span><span class="nam">staticmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="key">def</span> <span class="nam">do_nothing_spellchecker</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="str">"Spellchecker"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="key">return</span> <span class="nam">EverythingIsCorrectSpellchecker</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="key">def</span> <span class="nam">iter_words</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">line</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">int</span><span class="op">,</span> <span class="nam">int</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">_split_line_to_words</span><span class="op">(</span><span class="nam">line</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="key">def</span> <span class="nam">provide_corrections_for</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">word</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="key">def</span> <span class="nam">ignore_word</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">word</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"><span class="key">class</span> <span class="nam">EverythingIsCorrectSpellchecker</span><span class="op">(</span><span class="nam">Spellchecker</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="key">def</span> <span class="nam">provide_corrections_for</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">word</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="key">return</span> <span class="nam">_NO_CORRECTIONS</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="key">def</span> <span class="nam">ignore_word</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">word</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="com"># It is hard to ignore words, when you never check them in the fist place.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"><span class="key">class</span> <span class="nam">HunspellSpellchecker</span><span class="op">(</span><span class="nam">Spellchecker</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_checker</span> <span class="op">=</span> <span class="nam">HunSpell</span><span class="op">(</span><span class="nam">_SPELL_CHECKER_DICT</span><span class="op">,</span> <span class="nam">_SPELL_CHECKER_AFF</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="key">for</span> <span class="nam">w</span> <span class="key">in</span> <span class="nam">_builtin_exception_words</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_checker</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">w</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_load_personal_exclusions</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="key">def</span> <span class="nam">provide_corrections_for</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">word</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="key">if</span> <span class="nam">word</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span> </span><span class="r"><span class="annotate short">266 ↛ 278</span><span class="annotate long">line 266 didn't jump to line 278, because the condition on line 266 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="str">"dpkg-"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="str">"dh-"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="str">"dh_"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="str">"debian-"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="str">"debconf-"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="str">"update-"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="str">"DEB_"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="str">"DPKG_"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="key">return</span> <span class="nam">_NO_CORRECTIONS</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="com"># 'ing is deliberately forcing a word into another word-class</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="key">if</span> <span class="nam">word</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="op">(</span><span class="str">"'ing"</span><span class="op">,</span> <span class="str">"-nss"</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">280 ↛ 281</span><span class="annotate long">line 280 didn't jump to line 281, because the condition on line 280 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="key">return</span> <span class="nam">_NO_CORRECTIONS</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_lookup</span><span class="op">(</span><span class="nam">word</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="op">@</span><span class="nam">functools</span><span class="op">.</span><span class="nam">lru_cache</span><span class="op">(</span><span class="num">128</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="key">def</span> <span class="nam">_lookup</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">word</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_checker</span><span class="op">.</span><span class="nam">spell</span><span class="op">(</span><span class="nam">word</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">286 ↛ 288</span><span class="annotate long">line 286 didn't jump to line 288, because the condition on line 286 was never false</span></span></p> - <p class="run"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="key">return</span> <span class="nam">_NO_CORRECTIONS</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_checker</span><span class="op">.</span><span class="nam">suggest</span><span class="op">(</span><span class="nam">word</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="key">def</span> <span class="nam">ignore_word</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">word</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_checker</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">word</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="key">def</span> <span class="nam">_load_personal_exclusions</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> <span class="key">for</span> <span class="nam">filename</span> <span class="key">in</span> <span class="nam">_PERSONAL_DICTS</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="key">if</span> <span class="nam">filename</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"${"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">295 ↛ 302</span><span class="annotate long">line 295 didn't jump to line 302, because the condition on line 295 was never false</span></span></p> - <p class="run"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> <span class="nam">end_index</span> <span class="op">=</span> <span class="nam">filename</span><span class="op">.</span><span class="nam">index</span><span class="op">(</span><span class="str">"}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="nam">varname</span> <span class="op">=</span> <span class="nam">filename</span><span class="op">[</span><span class="num">2</span><span class="op">:</span><span class="nam">end_index</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="nam">value</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">environ</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">varname</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="key">if</span> <span class="nam">value</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">299 ↛ 300</span><span class="annotate long">line 299 didn't jump to line 300, because the condition on line 299 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="nam">filename</span> <span class="op">=</span> <span class="nam">value</span> <span class="op">+</span> <span class="nam">filename</span><span class="op">[</span><span class="nam">end_index</span> <span class="op">+</span> <span class="num">1</span> <span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="key">if</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">isfile</span><span class="op">(</span><span class="nam">filename</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">302 ↛ 303</span><span class="annotate long">line 302 didn't jump to line 303, because the condition on line 302 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"Loading personal spelling dictionary from {filename}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_checker</span><span class="op">.</span><span class="nam">add_dic</span><span class="op">(</span><span class="nam">filename</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_5d0ec0d5422112df_quickfixes_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_5d0ec0d5422112df_text_edit_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_5d0ec0d5422112df_text_edit_py.html b/coverage-report/d_5d0ec0d5422112df_text_edit_py.html deleted file mode 100644 index f78ee63..0000000 --- a/coverage-report/d_5d0ec0d5422112df_text_edit_py.html +++ /dev/null @@ -1,209 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/lsp/text_edit.py: 10%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/lsp/text_edit.py</b>: - <span class="pc_cov">10%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">66 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">9<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">57<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_5d0ec0d5422112df_spellchecking_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_5d0ec0d5422112df_text_util_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="pln"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="com"># Copied and adapted from on python-lsp-server</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="com"># Copyright 2017-2020 Palantir Technologies, Inc.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="com"># Copyright 2021- Python Language Server Contributors.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="com"># License: Expat (MIT/X11)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="com">#</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">List</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="key">from</span> <span class="nam">lsprotocol</span><span class="op">.</span><span class="nam">types</span> <span class="key">import</span> <span class="nam">Range</span><span class="op">,</span> <span class="nam">TextEdit</span><span class="op">,</span> <span class="nam">Position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="key">def</span> <span class="nam">get_well_formatted_range</span><span class="op">(</span><span class="nam">lsp_range</span><span class="op">:</span> <span class="nam">Range</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Range</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">start</span> <span class="op">=</span> <span class="nam">lsp_range</span><span class="op">.</span><span class="nam">start</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">end</span> <span class="op">=</span> <span class="nam">lsp_range</span><span class="op">.</span><span class="nam">end</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="key">if</span> <span class="nam">start</span><span class="op">.</span><span class="nam">line</span> <span class="op">></span> <span class="nam">end</span><span class="op">.</span><span class="nam">line</span> <span class="key">or</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">start</span><span class="op">.</span><span class="nam">line</span> <span class="op">==</span> <span class="nam">end</span><span class="op">.</span><span class="nam">line</span> <span class="key">and</span> <span class="nam">start</span><span class="op">.</span><span class="nam">character</span> <span class="op">></span> <span class="nam">end</span><span class="op">.</span><span class="nam">character</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="key">return</span> <span class="nam">Range</span><span class="op">(</span><span class="nam">end</span><span class="op">,</span> <span class="nam">start</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="key">return</span> <span class="nam">lsp_range</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"><span class="key">def</span> <span class="nam">get_well_formatted_edit</span><span class="op">(</span><span class="nam">text_edit</span><span class="op">:</span> <span class="nam">TextEdit</span><span class="op">)</span> <span class="op">-></span> <span class="nam">TextEdit</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="nam">lsp_range</span> <span class="op">=</span> <span class="nam">get_well_formatted_range</span><span class="op">(</span><span class="nam">text_edit</span><span class="op">.</span><span class="nam">range</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="key">if</span> <span class="nam">lsp_range</span> <span class="op">!=</span> <span class="nam">text_edit</span><span class="op">.</span><span class="nam">range</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="key">return</span> <span class="nam">TextEdit</span><span class="op">(</span><span class="nam">new_text</span><span class="op">=</span><span class="nam">text_edit</span><span class="op">.</span><span class="nam">new_text</span><span class="op">,</span> <span class="nam">range</span><span class="op">=</span><span class="nam">lsp_range</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="key">return</span> <span class="nam">text_edit</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"><span class="key">def</span> <span class="nam">compare_text_edits</span><span class="op">(</span><span class="nam">a</span><span class="op">:</span> <span class="nam">TextEdit</span><span class="op">,</span> <span class="nam">b</span><span class="op">:</span> <span class="nam">TextEdit</span><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="nam">diff</span> <span class="op">=</span> <span class="nam">a</span><span class="op">.</span><span class="nam">range</span><span class="op">.</span><span class="nam">start</span><span class="op">.</span><span class="nam">line</span> <span class="op">-</span> <span class="nam">b</span><span class="op">.</span><span class="nam">range</span><span class="op">.</span><span class="nam">start</span><span class="op">.</span><span class="nam">line</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="key">if</span> <span class="nam">diff</span> <span class="op">==</span> <span class="num">0</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="key">return</span> <span class="nam">a</span><span class="op">.</span><span class="nam">range</span><span class="op">.</span><span class="nam">start</span><span class="op">.</span><span class="nam">character</span> <span class="op">-</span> <span class="nam">b</span><span class="op">.</span><span class="nam">range</span><span class="op">.</span><span class="nam">start</span><span class="op">.</span><span class="nam">character</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="key">return</span> <span class="nam">diff</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"><span class="key">def</span> <span class="nam">merge_sort_text_edits</span><span class="op">(</span><span class="nam">text_edits</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">TextEdit</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="nam">List</span><span class="op">[</span><span class="nam">TextEdit</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">text_edits</span><span class="op">)</span> <span class="op"><=</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="key">return</span> <span class="nam">text_edits</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="nam">p</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">text_edits</span><span class="op">)</span> <span class="op">//</span> <span class="num">2</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="nam">left</span> <span class="op">=</span> <span class="nam">text_edits</span><span class="op">[</span><span class="op">:</span><span class="nam">p</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="nam">right</span> <span class="op">=</span> <span class="nam">text_edits</span><span class="op">[</span><span class="nam">p</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="nam">merge_sort_text_edits</span><span class="op">(</span><span class="nam">left</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="nam">merge_sort_text_edits</span><span class="op">(</span><span class="nam">right</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="nam">left_idx</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="nam">right_idx</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="nam">i</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="key">while</span> <span class="nam">left_idx</span> <span class="op"><</span> <span class="nam">len</span><span class="op">(</span><span class="nam">left</span><span class="op">)</span> <span class="key">and</span> <span class="nam">right_idx</span> <span class="op"><</span> <span class="nam">len</span><span class="op">(</span><span class="nam">right</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="nam">ret</span> <span class="op">=</span> <span class="nam">compare_text_edits</span><span class="op">(</span><span class="nam">left</span><span class="op">[</span><span class="nam">left_idx</span><span class="op">]</span><span class="op">,</span> <span class="nam">right</span><span class="op">[</span><span class="nam">right_idx</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="key">if</span> <span class="nam">ret</span> <span class="op"><=</span> <span class="num">0</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="com"># smaller_equal -> take left to preserve order</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="nam">text_edits</span><span class="op">[</span><span class="nam">i</span><span class="op">]</span> <span class="op">=</span> <span class="nam">left</span><span class="op">[</span><span class="nam">left_idx</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="nam">i</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="nam">left_idx</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="com"># greater -> take right</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="nam">text_edits</span><span class="op">[</span><span class="nam">i</span><span class="op">]</span> <span class="op">=</span> <span class="nam">right</span><span class="op">[</span><span class="nam">right_idx</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="nam">i</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="nam">right_idx</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="key">while</span> <span class="nam">left_idx</span> <span class="op"><</span> <span class="nam">len</span><span class="op">(</span><span class="nam">left</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="nam">text_edits</span><span class="op">[</span><span class="nam">i</span><span class="op">]</span> <span class="op">=</span> <span class="nam">left</span><span class="op">[</span><span class="nam">left_idx</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="nam">i</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="nam">left_idx</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="key">while</span> <span class="nam">right_idx</span> <span class="op"><</span> <span class="nam">len</span><span class="op">(</span><span class="nam">right</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="nam">text_edits</span><span class="op">[</span><span class="nam">i</span><span class="op">]</span> <span class="op">=</span> <span class="nam">right</span><span class="op">[</span><span class="nam">right_idx</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="nam">i</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="nam">right_idx</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="key">return</span> <span class="nam">text_edits</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"><span class="key">class</span> <span class="nam">OverLappingTextEditException</span><span class="op">(</span><span class="nam">Exception</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="str">"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"><span class="str"> Text edits are expected to be sorted</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"><span class="str"> and compressed instead of overlapping.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"><span class="str"> This error is raised when two edits</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"><span class="str"> are overlapping.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"><span class="key">def</span> <span class="nam">offset_at_position</span><span class="op">(</span><span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">server_position</span><span class="op">:</span> <span class="nam">Position</span><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="nam">row</span><span class="op">,</span> <span class="nam">col</span> <span class="op">=</span> <span class="nam">server_position</span><span class="op">.</span><span class="nam">line</span><span class="op">,</span> <span class="nam">server_position</span><span class="op">.</span><span class="nam">character</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="key">return</span> <span class="nam">col</span> <span class="op">+</span> <span class="nam">sum</span><span class="op">(</span><span class="nam">len</span><span class="op">(</span><span class="nam">line</span><span class="op">)</span> <span class="key">for</span> <span class="nam">line</span> <span class="key">in</span> <span class="nam">lines</span><span class="op">[</span><span class="op">:</span><span class="nam">row</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"><span class="key">def</span> <span class="nam">apply_text_edits</span><span class="op">(</span><span class="nam">text</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">text_edits</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">TextEdit</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="nam">sorted_edits</span> <span class="op">=</span> <span class="nam">merge_sort_text_edits</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="op">[</span><span class="nam">get_well_formatted_edit</span><span class="op">(</span><span class="nam">e</span><span class="op">)</span> <span class="key">for</span> <span class="nam">e</span> <span class="key">in</span> <span class="nam">text_edits</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="nam">last_modified_offset</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="nam">spans</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="key">for</span> <span class="nam">e</span> <span class="key">in</span> <span class="nam">sorted_edits</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="nam">start_offset</span> <span class="op">=</span> <span class="nam">offset_at_position</span><span class="op">(</span><span class="nam">lines</span><span class="op">,</span> <span class="nam">e</span><span class="op">.</span><span class="nam">range</span><span class="op">.</span><span class="nam">start</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="key">if</span> <span class="nam">start_offset</span> <span class="op"><</span> <span class="nam">last_modified_offset</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="key">raise</span> <span class="nam">OverLappingTextEditException</span><span class="op">(</span><span class="str">"overlapping edit"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="key">if</span> <span class="nam">start_offset</span> <span class="op">></span> <span class="nam">last_modified_offset</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="nam">spans</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">text</span><span class="op">[</span><span class="nam">last_modified_offset</span><span class="op">:</span><span class="nam">start_offset</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="key">if</span> <span class="nam">e</span><span class="op">.</span><span class="nam">new_text</span> <span class="op">!=</span> <span class="str">""</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="nam">spans</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">e</span><span class="op">.</span><span class="nam">new_text</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="nam">last_modified_offset</span> <span class="op">=</span> <span class="nam">offset_at_position</span><span class="op">(</span><span class="nam">lines</span><span class="op">,</span> <span class="nam">e</span><span class="op">.</span><span class="nam">range</span><span class="op">.</span><span class="nam">end</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="nam">spans</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">text</span><span class="op">[</span><span class="nam">last_modified_offset</span><span class="op">:</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="key">return</span> <span class="str">""</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">spans</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_5d0ec0d5422112df_spellchecking_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_5d0ec0d5422112df_text_util_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_5d0ec0d5422112df_text_util_py.html b/coverage-report/d_5d0ec0d5422112df_text_util_py.html deleted file mode 100644 index a8877ef..0000000 --- a/coverage-report/d_5d0ec0d5422112df_text_util_py.html +++ /dev/null @@ -1,221 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/lsp/text_util.py: 67%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/lsp/text_util.py</b>: - <span class="pc_cov">67%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">59 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">41<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">18<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">2<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_5d0ec0d5422112df_text_edit_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_50e3cc0df0cc5f51___init___py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">List</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">,</span> <span class="nam">Union</span><span class="op">,</span> <span class="nam">Iterable</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">from</span> <span class="nam">lsprotocol</span><span class="op">.</span><span class="nam">types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> <span class="nam">TextEdit</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> <span class="nam">Position</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="nam">Range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">WillSaveTextDocumentParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">linting</span><span class="op">.</span><span class="nam">lint_util</span> <span class="key">import</span> <span class="nam">LinterPositionCodec</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="key">from</span> <span class="nam">debian</span><span class="op">.</span><span class="nam">_deb822_repro</span><span class="op">.</span><span class="nam">locatable</span> <span class="key">import</span> <span class="nam">Position</span> <span class="key">as</span> <span class="nam">TEPosition</span><span class="op">,</span> <span class="nam">Range</span> <span class="key">as</span> <span class="nam">TERange</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"><span class="key">except</span> <span class="nam">ImportError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"><span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="key">from</span> <span class="nam">pygls</span><span class="op">.</span><span class="nam">workspace</span> <span class="key">import</span> <span class="nam">LanguageServer</span><span class="op">,</span> <span class="nam">TextDocument</span><span class="op">,</span> <span class="nam">PositionCodec</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">LintCapablePositionCodec</span> <span class="op">=</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">LinterPositionCodec</span><span class="op">,</span> <span class="nam">PositionCodec</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"><span class="key">except</span> <span class="nam">ImportError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">LintCapablePositionCodec</span> <span class="op">=</span> <span class="nam">LinterPositionCodec</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"><span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="key">from</span> <span class="nam">Levenshtein</span> <span class="key">import</span> <span class="nam">distance</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"><span class="key">except</span> <span class="nam">ImportError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="key">def</span> <span class="nam">detect_possible_typo</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="nam">provided_value</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="nam">known_values</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="key">return</span> <span class="nam">tuple</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"><span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="key">def</span> <span class="nam">detect_possible_typo</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="nam">provided_value</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">known_values</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="nam">k_len</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">provided_value</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">candidates</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="key">for</span> <span class="nam">known_value</span> <span class="key">in</span> <span class="nam">known_values</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="key">if</span> <span class="nam">abs</span><span class="op">(</span><span class="nam">k_len</span> <span class="op">-</span> <span class="nam">len</span><span class="op">(</span><span class="nam">known_value</span><span class="op">)</span><span class="op">)</span> <span class="op">></span> <span class="num">2</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="nam">d</span> <span class="op">=</span> <span class="nam">distance</span><span class="op">(</span><span class="nam">provided_value</span><span class="op">,</span> <span class="nam">known_value</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="key">if</span> <span class="nam">d</span> <span class="op">></span> <span class="num">2</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="nam">candidates</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">known_value</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="key">return</span> <span class="nam">candidates</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"><span class="key">def</span> <span class="nam">normalize_dctrl_field_name</span><span class="op">(</span><span class="nam">f</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">f</span> <span class="key">or</span> <span class="key">not</span> <span class="nam">f</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="op">(</span><span class="str">"x"</span><span class="op">,</span> <span class="str">"X"</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="key">return</span> <span class="nam">f</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">i</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="key">for</span> <span class="nam">i</span> <span class="key">in</span> <span class="nam">range</span><span class="op">(</span><span class="num">1</span><span class="op">,</span> <span class="nam">len</span><span class="op">(</span><span class="nam">f</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">57 ↛ 63</span><span class="annotate long">line 57 didn't jump to line 63, because the loop on line 57 didn't complete</span></span></p> - <p class="run"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="key">if</span> <span class="nam">f</span><span class="op">[</span><span class="nam">i</span><span class="op">]</span> <span class="op">==</span> <span class="str">"-"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="nam">i</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="key">if</span> <span class="nam">f</span><span class="op">[</span><span class="nam">i</span><span class="op">]</span> <span class="key">not</span> <span class="key">in</span> <span class="op">(</span><span class="str">"b"</span><span class="op">,</span> <span class="str">"B"</span><span class="op">,</span> <span class="str">"s"</span><span class="op">,</span> <span class="str">"S"</span><span class="op">,</span> <span class="str">"c"</span><span class="op">,</span> <span class="str">"C"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">61 ↛ 62</span><span class="annotate long">line 61 didn't jump to line 62, because the condition on line 61 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="key">return</span> <span class="nam">f</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="key">assert</span> <span class="nam">i</span> <span class="op">></span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="key">return</span> <span class="nam">f</span><span class="op">[</span><span class="nam">i</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"><span class="key">def</span> <span class="nam">on_save_trim_end_of_line_whitespace</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="nam">ls</span><span class="op">:</span> <span class="str">"LanguageServer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="nam">params</span><span class="op">:</span> <span class="nam">WillSaveTextDocumentParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Sequence</span><span class="op">[</span><span class="nam">TextEdit</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="nam">doc</span> <span class="op">=</span> <span class="nam">ls</span><span class="op">.</span><span class="nam">workspace</span><span class="op">.</span><span class="nam">get_text_document</span><span class="op">(</span><span class="nam">params</span><span class="op">.</span><span class="nam">text_document</span><span class="op">.</span><span class="nam">uri</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="key">return</span> <span class="nam">trim_end_of_line_whitespace</span><span class="op">(</span><span class="nam">doc</span><span class="op">,</span> <span class="nam">doc</span><span class="op">.</span><span class="nam">lines</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"><span class="key">def</span> <span class="nam">trim_end_of_line_whitespace</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="nam">doc</span><span class="op">:</span> <span class="str">"TextDocument"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Sequence</span><span class="op">[</span><span class="nam">TextEdit</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="nam">edits</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="key">for</span> <span class="nam">line_no</span><span class="op">,</span> <span class="nam">orig_line</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">lines</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="nam">orig_len</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">orig_line</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="key">if</span> <span class="nam">orig_line</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="nam">orig_len</span> <span class="op">-=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="nam">stripped_len</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">orig_line</span><span class="op">.</span><span class="nam">rstrip</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="key">if</span> <span class="nam">stripped_len</span> <span class="op">==</span> <span class="nam">orig_len</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="nam">edit_range</span> <span class="op">=</span> <span class="nam">doc</span><span class="op">.</span><span class="nam">position_codec</span><span class="op">.</span><span class="nam">range_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="nam">Range</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="nam">line_no</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="nam">stripped_len</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="nam">line_no</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="nam">orig_len</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="nam">edits</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="nam">TextEdit</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="nam">edit_range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="str">""</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="key">return</span> <span class="nam">edits</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"><span class="key">def</span> <span class="nam">te_position_to_lsp</span><span class="op">(</span><span class="nam">te_position</span><span class="op">:</span> <span class="str">"TEPosition"</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Position</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="key">return</span> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="nam">te_position</span><span class="op">.</span><span class="nam">line_position</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="nam">te_position</span><span class="op">.</span><span class="nam">cursor_position</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"><span class="key">def</span> <span class="nam">te_range_to_lsp</span><span class="op">(</span><span class="nam">te_range</span><span class="op">:</span> <span class="str">"TERange"</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Range</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="key">return</span> <span class="nam">Range</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="nam">te_position_to_lsp</span><span class="op">(</span><span class="nam">te_range</span><span class="op">.</span><span class="nam">start_pos</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="nam">te_position_to_lsp</span><span class="op">(</span><span class="nam">te_range</span><span class="op">.</span><span class="nam">end_pos</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_5d0ec0d5422112df_text_edit_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_50e3cc0df0cc5f51___init___py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_64287305fe0c6642___init___py.html b/coverage-report/d_64287305fe0c6642___init___py.html deleted file mode 100644 index 6ff82c5..0000000 --- a/coverage-report/d_64287305fe0c6642___init___py.html +++ /dev/null @@ -1,136 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/plugin/api/__init__.py: 100%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/plugin/api/__init__.py</b>: - <span class="pc_cov">100%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">3 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">3<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">0<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_4faea183f900b252___init___py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_64287305fe0c6642_example_processing_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">from</span> <span class="op">...</span><span class="nam">exceptions</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"> <span class="nam">DebputyPluginRuntimeError</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"> <span class="nam">DebputyMetadataAccessError</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">spec</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="nam">DebputyPluginInitializer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">MetadataAutoDetector</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">DpkgTriggerType</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">Maintscript</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">BinaryCtrlAccessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">PluginInitializationEntryPoint</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">undocumented_attr</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">reference_documentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">virtual_path_def</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">packager_provided_file_reference_documentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"><span class="nam">__all__</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="str">"DebputyPluginInitializer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="str">"PackageProcessingContext"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="str">"MetadataAutoDetector"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="str">"DpkgTriggerType"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="str">"Maintscript"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="str">"BinaryCtrlAccessor"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="str">"VirtualPath"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="str">"PluginInitializationEntryPoint"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="str">"documented_attr"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="str">"undocumented_attr"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="str">"reference_documentation"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="str">"virtual_path_def"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="str">"DebputyPluginRuntimeError"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="str">"DebputyMetadataAccessError"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="str">"packager_provided_file_reference_documentation"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_4faea183f900b252___init___py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_64287305fe0c6642_example_processing_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_64287305fe0c6642_example_processing_py.html b/coverage-report/d_64287305fe0c6642_example_processing_py.html deleted file mode 100644 index 8f26489..0000000 --- a/coverage-report/d_64287305fe0c6642_example_processing_py.html +++ /dev/null @@ -1,198 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/plugin/api/example_processing.py: 96%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/plugin/api/example_processing.py</b>: - <span class="pc_cov">96%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">62 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">58<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">4<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_64287305fe0c6642___init___py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_64287305fe0c6642_feature_set_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">dataclasses</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">from</span> <span class="nam">enum</span> <span class="key">import</span> <span class="nam">Enum</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Set</span><span class="op">,</span> <span class="nam">Tuple</span><span class="op">,</span> <span class="nam">List</span><span class="op">,</span> <span class="nam">cast</span><span class="op">,</span> <span class="nam">Dict</span><span class="op">,</span> <span class="nam">Sequence</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">filesystem_scan</span> <span class="key">import</span> <span class="nam">build_virtual_fs</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="nam">VirtualPath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">impl_types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">AutomaticDiscardRuleExample</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">PluginProvidedDiscardRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">_normalize_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"><span class="key">class</span> <span class="nam">DiscardVerdict</span><span class="op">(</span><span class="nam">Enum</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">INCONSISTENT_CODE_KEPT</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="str">"INCONSISTENT (code kept the path, but should have discarded)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">INCONSISTENT_CODE_DISCARDED</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="str">"INCONSISTENT (code discarded the path, but should have kept it)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="nam">KEPT</span> <span class="op">=</span> <span class="op">(</span><span class="key">False</span><span class="op">,</span> <span class="str">"Kept"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">DISCARDED_BY_CODE</span> <span class="op">=</span> <span class="op">(</span><span class="key">True</span><span class="op">,</span> <span class="str">"Discarded (directly by the rule)"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="nam">DISCARDED_BY_DIRECTORY</span> <span class="op">=</span> <span class="op">(</span><span class="key">True</span><span class="op">,</span> <span class="str">"Discarded (directory was discarded)"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="key">def</span> <span class="nam">message</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="key">return</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"str"</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">value</span><span class="op">[</span><span class="num">1</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_consistent</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">value</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_discarded</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">value</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="key">is</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_kept</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">value</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="key">is</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"><span class="key">class</span> <span class="nam">ProcessedDiscardRuleExample</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="nam">rendered_paths</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">,</span> <span class="nam">DiscardVerdict</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="nam">inconsistent_paths</span><span class="op">:</span> <span class="nam">Set</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="com"># To avoid the parents being garbage collected</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"><span class="key">def</span> <span class="nam">process_discard_rule_example</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="nam">discard_rule</span><span class="op">:</span> <span class="nam">PluginProvidedDiscardRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="nam">example</span><span class="op">:</span> <span class="nam">AutomaticDiscardRuleExample</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">ProcessedDiscardRuleExample</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span> <span class="op">=</span> <span class="nam">build_virtual_fs</span><span class="op">(</span><span class="op">[</span><span class="nam">p</span> <span class="key">for</span> <span class="nam">p</span><span class="op">,</span> <span class="nam">_</span> <span class="key">in</span> <span class="nam">example</span><span class="op">.</span><span class="nam">content</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="nam">actual_discarded</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">bool</span><span class="op">]</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="nam">expected_output</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="str">"/"</span> <span class="op">+</span> <span class="nam">_normalize_path</span><span class="op">(</span><span class="nam">p</span><span class="op">.</span><span class="nam">path_name</span><span class="op">,</span> <span class="nam">with_prefix</span><span class="op">=</span><span class="key">False</span><span class="op">)</span><span class="op">:</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="key">for</span> <span class="nam">p</span><span class="op">,</span> <span class="nam">v</span> <span class="key">in</span> <span class="nam">example</span><span class="op">.</span><span class="nam">content</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="nam">inconsistent_paths</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="nam">rendered_paths</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">all_paths</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="nam">parent</span> <span class="op">=</span> <span class="nam">p</span><span class="op">.</span><span class="nam">parent_dir</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="nam">discard_carry_over</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="nam">path_name</span> <span class="op">=</span> <span class="nam">p</span><span class="op">.</span><span class="nam">absolute</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="key">if</span> <span class="nam">parent</span> <span class="key">and</span> <span class="nam">actual_discarded</span><span class="op">[</span><span class="nam">parent</span><span class="op">.</span><span class="nam">absolute</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="nam">verdict</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="nam">discard_carry_over</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="nam">verdict</span> <span class="op">=</span> <span class="nam">discard_rule</span><span class="op">.</span><span class="nam">should_discard</span><span class="op">(</span><span class="nam">p</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="nam">actual_discarded</span><span class="op">[</span><span class="nam">path_name</span><span class="op">]</span> <span class="op">=</span> <span class="nam">verdict</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="nam">expected</span> <span class="op">=</span> <span class="nam">expected_output</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">path_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="key">if</span> <span class="nam">expected</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="nam">inconsistent</span> <span class="op">=</span> <span class="nam">expected</span> <span class="op">!=</span> <span class="nam">verdict</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="key">if</span> <span class="nam">inconsistent</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="nam">inconsistent_paths</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">p</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="key">if</span> <span class="nam">inconsistent</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="key">if</span> <span class="nam">verdict</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="nam">verdict_code</span> <span class="op">=</span> <span class="nam">DiscardVerdict</span><span class="op">.</span><span class="nam">INCONSISTENT_CODE_DISCARDED</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="nam">verdict_code</span> <span class="op">=</span> <span class="nam">DiscardVerdict</span><span class="op">.</span><span class="nam">INCONSISTENT_CODE_KEPT</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="key">elif</span> <span class="nam">verdict</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="key">if</span> <span class="nam">discard_carry_over</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="nam">verdict_code</span> <span class="op">=</span> <span class="nam">DiscardVerdict</span><span class="op">.</span><span class="nam">DISCARDED_BY_DIRECTORY</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="nam">verdict_code</span> <span class="op">=</span> <span class="nam">DiscardVerdict</span><span class="op">.</span><span class="nam">DISCARDED_BY_CODE</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="nam">verdict_code</span> <span class="op">=</span> <span class="nam">DiscardVerdict</span><span class="op">.</span><span class="nam">KEPT</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="nam">rendered_paths</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="op">(</span><span class="nam">p</span><span class="op">,</span> <span class="nam">verdict_code</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="key">return</span> <span class="nam">ProcessedDiscardRuleExample</span><span class="op">(</span><span class="nam">rendered_paths</span><span class="op">,</span> <span class="nam">inconsistent_paths</span><span class="op">,</span> <span class="nam">fs_root</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_64287305fe0c6642___init___py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_64287305fe0c6642_feature_set_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_64287305fe0c6642_feature_set_py.html b/coverage-report/d_64287305fe0c6642_feature_set_py.html deleted file mode 100644 index 0c259e6..0000000 --- a/coverage-report/d_64287305fe0c6642_feature_set_py.html +++ /dev/null @@ -1,191 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/plugin/api/feature_set.py: 73%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/plugin/api/feature_set.py</b>: - <span class="pc_cov">73%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">35 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">27<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">8<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_64287305fe0c6642_example_processing_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_64287305fe0c6642_impl_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">dataclasses</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">textwrap</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Dict</span><span class="op">,</span> <span class="nam">List</span><span class="op">,</span> <span class="nam">Tuple</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">,</span> <span class="nam">Any</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span> <span class="key">import</span> <span class="nam">DEBPUTY_DOC_ROOT_DIR</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">declarative_parser</span> <span class="key">import</span> <span class="nam">ParserGenerator</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="nam">reference_documentation</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">impl_types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">DebputyPluginMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">PackagerProvidedFileClassSpec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">MetadataOrMaintscriptDetector</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">TTP</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">DispatchingTableParser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">TP</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">SUPPORTED_DISPATCHABLE_TABLE_PARSERS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">DispatchingObjectParser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">SUPPORTED_DISPATCHABLE_OBJECT_PARSERS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">PluginProvidedManifestVariable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">PluginProvidedPackageProcessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">PluginProvidedDiscardRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">ServiceManagerDetails</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">PluginProvidedKnownPackagingFile</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="nam">PluginProvidedTypeMapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">OPARSER_PACKAGES</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="nam">OPARSER_PACKAGES_ROOT</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"><span class="key">def</span> <span class="nam">_initialize_parser_generator</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="nam">ParserGenerator</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="nam">pg</span> <span class="op">=</span> <span class="nam">ParserGenerator</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="key">for</span> <span class="nam">path</span><span class="op">,</span> <span class="nam">ref_doc</span> <span class="key">in</span> <span class="nam">SUPPORTED_DISPATCHABLE_OBJECT_PARSERS</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="nam">pg</span><span class="op">.</span><span class="nam">add_object_parser</span><span class="op">(</span><span class="nam">path</span><span class="op">,</span> <span class="nam">parser_documentation</span><span class="op">=</span><span class="nam">ref_doc</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="key">for</span> <span class="nam">rt</span><span class="op">,</span> <span class="nam">path</span> <span class="key">in</span> <span class="nam">SUPPORTED_DISPATCHABLE_TABLE_PARSERS</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="nam">pg</span><span class="op">.</span><span class="nam">add_table_parser</span><span class="op">(</span><span class="nam">rt</span><span class="op">,</span> <span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="key">return</span> <span class="nam">pg</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"><span class="key">class</span> <span class="nam">PluginProvidedFeatureSet</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">plugin_data</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">DebputyPluginMetadata</span><span class="op">]</span> <span class="op">=</span> <span class="nam">dataclasses</span><span class="op">.</span><span class="nam">field</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="nam">default_factory</span><span class="op">=</span><span class="nam">dict</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="nam">packager_provided_files</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">PackagerProvidedFileClassSpec</span><span class="op">]</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="nam">dataclasses</span><span class="op">.</span><span class="nam">field</span><span class="op">(</span><span class="nam">default_factory</span><span class="op">=</span><span class="nam">dict</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="nam">metadata_maintscript_detectors</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">MetadataOrMaintscriptDetector</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="nam">dataclasses</span><span class="op">.</span><span class="nam">field</span><span class="op">(</span><span class="nam">default_factory</span><span class="op">=</span><span class="nam">dict</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="nam">manifest_variables</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">PluginProvidedManifestVariable</span><span class="op">]</span> <span class="op">=</span> <span class="nam">dataclasses</span><span class="op">.</span><span class="nam">field</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="nam">default_factory</span><span class="op">=</span><span class="nam">dict</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="nam">all_package_processors</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">PluginProvidedPackageProcessor</span><span class="op">]</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">dataclasses</span><span class="op">.</span><span class="nam">field</span><span class="op">(</span><span class="nam">default_factory</span><span class="op">=</span><span class="nam">dict</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="nam">auto_discard_rules</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">PluginProvidedDiscardRule</span><span class="op">]</span> <span class="op">=</span> <span class="nam">dataclasses</span><span class="op">.</span><span class="nam">field</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="nam">default_factory</span><span class="op">=</span><span class="nam">dict</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="nam">service_managers</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">ServiceManagerDetails</span><span class="op">]</span> <span class="op">=</span> <span class="nam">dataclasses</span><span class="op">.</span><span class="nam">field</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="nam">default_factory</span><span class="op">=</span><span class="nam">dict</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="nam">known_packaging_files</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">PluginProvidedKnownPackagingFile</span><span class="op">]</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="nam">dataclasses</span><span class="op">.</span><span class="nam">field</span><span class="op">(</span><span class="nam">default_factory</span><span class="op">=</span><span class="nam">dict</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="nam">mapped_types</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">Any</span><span class="op">,</span> <span class="nam">PluginProvidedTypeMapping</span><span class="op">]</span> <span class="op">=</span> <span class="nam">dataclasses</span><span class="op">.</span><span class="nam">field</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="nam">default_factory</span><span class="op">=</span><span class="nam">dict</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="nam">manifest_parser_generator</span><span class="op">:</span> <span class="nam">ParserGenerator</span> <span class="op">=</span> <span class="nam">dataclasses</span><span class="op">.</span><span class="nam">field</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="nam">default_factory</span><span class="op">=</span><span class="nam">_initialize_parser_generator</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="key">def</span> <span class="nam">package_processors_in_order</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">PluginProvidedPackageProcessor</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="nam">order</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="nam">delayed</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="key">for</span> <span class="nam">plugin_processor</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">all_package_processors</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">plugin_processor</span><span class="op">.</span><span class="nam">dependencies</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="nam">order</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">plugin_processor</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="nam">delayed</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">plugin_processor</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="com"># At the time of writing, insert order will work as a plugin cannot declare</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="com"># dependencies out of order in the current version. However, we want to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="com"># ensure dependencies are taken a bit seriously, so we ensure that processors</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="com"># without dependencies are run first. This should weed out anything that</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="com"># needs dependencies but do not add them.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="com"># It is still far from as any dependency issues will be hidden if you just</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="com"># add a single dependency.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="nam">order</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">delayed</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="key">return</span> <span class="nam">order</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_64287305fe0c6642_example_processing_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_64287305fe0c6642_impl_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_64287305fe0c6642_impl_py.html b/coverage-report/d_64287305fe0c6642_impl_py.html deleted file mode 100644 index c2c961d..0000000 --- a/coverage-report/d_64287305fe0c6642_impl_py.html +++ /dev/null @@ -1,2060 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/plugin/api/impl.py: 55%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/plugin/api/impl.py</b>: - <span class="pc_cov">55%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">753 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">451<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">302<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">2<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">52<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_64287305fe0c6642_feature_set_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_64287305fe0c6642_impl_types_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">contextlib</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">dataclasses</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">functools</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">import</span> <span class="nam">importlib</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">import</span> <span class="nam">importlib</span><span class="op">.</span><span class="nam">util</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">import</span> <span class="nam">itertools</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">import</span> <span class="nam">json</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="key">import</span> <span class="nam">re</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"><span class="key">import</span> <span class="nam">subprocess</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"><span class="key">import</span> <span class="nam">sys</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="key">from</span> <span class="nam">abc</span> <span class="key">import</span> <span class="nam">ABC</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"><span class="key">from</span> <span class="nam">json</span> <span class="key">import</span> <span class="nam">JSONDecodeError</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">Callable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">Dict</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">Iterable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">Sequence</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">Type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">List</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">Set</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="nam">Iterator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="nam">IO</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="nam">Mapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="nam">AbstractSet</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="nam">cast</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="nam">FrozenSet</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="nam">Literal</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span> <span class="key">import</span> <span class="nam">DEBPUTY_DOC_ROOT_DIR</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">exceptions</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="nam">DebputySubstitutionError</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="nam">PluginConflictError</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">PluginMetadataError</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="nam">PluginBaseError</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="nam">PluginInitializationError</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">PluginAPIViolationError</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">PluginNotFoundError</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">maintscript_snippet</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="nam">STD_CONTROL_SCRIPTS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="nam">MaintscriptSnippetContainer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="nam">MaintscriptSnippet</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">base_types</span> <span class="key">import</span> <span class="nam">TypeMapping</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">exceptions</span> <span class="key">import</span> <span class="nam">ManifestParseException</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">parser_data</span> <span class="key">import</span> <span class="nam">ParserContextData</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">AttributePath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">feature_set</span> <span class="key">import</span> <span class="nam">PluginProvidedFeatureSet</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">impl_types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">DebputyPluginMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="nam">PackagerProvidedFileClassSpec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="nam">MetadataOrMaintscriptDetector</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="nam">PluginProvidedTrigger</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="nam">TTP</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="nam">DIPHandler</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="nam">PF</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="nam">SF</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="nam">DIPKWHandler</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="nam">PluginProvidedManifestVariable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="nam">PluginProvidedPackageProcessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="nam">PluginProvidedDiscardRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="nam">AutomaticDiscardRuleExample</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="nam">PPFFormatParam</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="nam">ServiceManagerDetails</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="nam">resolve_package_type_selectors</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="nam">KnownPackagingFileInfo</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="nam">PluginProvidedKnownPackagingFile</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="nam">InstallPatternDHCompatRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="nam">PluginProvidedTypeMapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">plugin_parser</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="nam">PLUGIN_METADATA_PARSER</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="nam">PluginJsonMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="nam">PLUGIN_PPF_PARSER</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="nam">PackagerProvidedFileJsonDescription</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="nam">PLUGIN_MANIFEST_VARS_PARSER</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="nam">PLUGIN_KNOWN_PACKAGING_FILES_PARSER</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">spec</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="nam">MaintscriptAccessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="nam">Maintscript</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="nam">DpkgTriggerType</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="nam">BinaryCtrlAccessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="nam">MetadataAutoDetector</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="nam">PluginInitializationEntryPoint</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="nam">DebputyPluginInitializer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="nam">PackageTypeSelector</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="nam">FlushableSubstvars</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="nam">ParserDocumentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="nam">PackageProcessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="nam">ServiceIntegrator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="nam">ServiceDetector</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="nam">ServiceRegistry</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="nam">ServiceDefinition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="nam">DSD</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="nam">ServiceUpgradeRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="nam">PackagerProvidedFileReferenceDocumentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="nam">packager_provided_file_reference_documentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="nam">TypeMappingDocumentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">substitution</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="nam">Substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="nam">VariableNameState</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="nam">SUBST_VAR_RE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="nam">VariableContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="nam">_normalize_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="nam">POSTINST_DEFAULT_CONDITION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="nam">_error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="nam">print_command</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="nam">_warn</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"><span class="nam">PLUGIN_TEST_SUFFIX</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r"_(?:t|test|check)(?:_([a-z0-9_]+))?[.]py$"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"><span class="key">def</span> <span class="nam">_validate_known_packaging_file_dh_compat_rules</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="nam">dh_compat_rules</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">InstallPatternDHCompatRule</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="nam">max_compat</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">dh_compat_rules</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="nam">dh_compat_rule</span><span class="op">:</span> <span class="nam">InstallPatternDHCompatRule</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="key">for</span> <span class="nam">idx</span><span class="op">,</span> <span class="nam">dh_compat_rule</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">dh_compat_rules</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="nam">dh_version</span> <span class="op">=</span> <span class="nam">dh_compat_rule</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"starting_with_debhelper_version"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="nam">compat</span> <span class="op">=</span> <span class="nam">dh_compat_rule</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"starting_with_compat_level"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="nam">remaining</span> <span class="op">=</span> <span class="nam">dh_compat_rule</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span> <span class="op">-</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="str">"after_debhelper_version"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="str">"starting_with_compat_level"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">remaining</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="str">f"The dh compat-rule at index {idx} does not affect anything not have any rules!? So why have it?"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="key">if</span> <span class="nam">dh_version</span> <span class="key">is</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">compat</span> <span class="key">is</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">idx</span> <span class="op"><</span> <span class="nam">len</span><span class="op">(</span><span class="nam">dh_compat_rules</span><span class="op">)</span> <span class="op">-</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="str">f"The dh compat-rule at index {idx} is not the last and is missing either"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="str">" before-debhelper-version or before-compat-level"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="key">if</span> <span class="nam">compat</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">compat</span> <span class="op"><</span> <span class="num">0</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="str">f"There is no compat below 1 but dh compat-rule at {idx} wants to declare some rule"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="str">f" for something that appeared when migrating from {compat} to {compat + 1}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="key">if</span> <span class="nam">max_compat</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="nam">max_compat</span> <span class="op">=</span> <span class="nam">compat</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="key">elif</span> <span class="nam">compat</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="key">if</span> <span class="nam">compat</span> <span class="op">>=</span> <span class="nam">max_compat</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="str">f"The dh compat-rule at {idx} should be moved earlier than the entry for compat {max_compat}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="nam">max_compat</span> <span class="op">=</span> <span class="nam">compat</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="nam">install_pattern</span> <span class="op">=</span> <span class="nam">dh_compat_rule</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"install_pattern"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="nam">install_pattern</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="key">and</span> <span class="nam">_normalize_path</span><span class="op">(</span><span class="nam">install_pattern</span><span class="op">,</span> <span class="nam">with_prefix</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> <span class="op">!=</span> <span class="nam">install_pattern</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="str">f"The install-pattern in dh compat-rule at {idx} must be normalized as"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="str">f' "{_normalize_path(install_pattern, with_prefix=False)}".'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"><span class="key">class</span> <span class="nam">DebputyPluginInitializerProvider</span><span class="op">(</span><span class="nam">DebputyPluginInitializer</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="str">"_plugin_metadata"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="str">"_feature_set"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="str">"_plugin_detector_ids"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="str">"_substitution"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="str">"_unloaders"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="str">"_load_started"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">:</span> <span class="nam">DebputyPluginMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="nam">feature_set</span><span class="op">:</span> <span class="nam">PluginProvidedFeatureSet</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="nam">substitution</span><span class="op">:</span> <span class="nam">Substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_metadata</span><span class="op">:</span> <span class="nam">DebputyPluginMetadata</span> <span class="op">=</span> <span class="nam">plugin_metadata</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_feature_set</span> <span class="op">=</span> <span class="nam">feature_set</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_detector_ids</span><span class="op">:</span> <span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_substitution</span> <span class="op">=</span> <span class="nam">substitution</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_unloaders</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="op">]</span><span class="op">,</span> <span class="key">None</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_load_started</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="key">def</span> <span class="nam">unload_plugin</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_load_started</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="key">for</span> <span class="nam">unloader</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_unloaders</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="nam">unloader</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="key">del</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_feature_set</span><span class="op">.</span><span class="nam">plugin_data</span><span class="op">[</span><span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_name</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="key">def</span> <span class="nam">load_plugin</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="nam">metadata</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_metadata</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="key">if</span> <span class="nam">metadata</span><span class="op">.</span><span class="nam">plugin_name</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_feature_set</span><span class="op">.</span><span class="nam">plugin_data</span><span class="op">:</span> </span><span class="r"><span class="annotate short">207 ↛ 208</span><span class="annotate long">line 207 didn't jump to line 208, because the condition on line 207 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginConflictError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="str">f'The plugin "{metadata.plugin_name}" has already been loaded!?'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="key">assert</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="nam">metadata</span><span class="op">.</span><span class="nam">api_compat_version</span> <span class="op">==</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> <span class="str">f"Unsupported plugin API compat version {metadata.api_compat_version}"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_feature_set</span><span class="op">.</span><span class="nam">plugin_data</span><span class="op">[</span><span class="nam">metadata</span><span class="op">.</span><span class="nam">plugin_name</span><span class="op">]</span> <span class="op">=</span> <span class="nam">metadata</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_load_started</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="key">assert</span> <span class="key">not</span> <span class="nam">metadata</span><span class="op">.</span><span class="nam">is_initialized</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="nam">metadata</span><span class="op">.</span><span class="nam">initialize_plugin</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="key">except</span> <span class="nam">Exception</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="nam">initializer</span> <span class="op">=</span> <span class="nam">metadata</span><span class="op">.</span><span class="nam">plugin_initializer</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"><span class="annotate short">221 ↛ 226</span><span class="annotate long">line 221 didn't jump to line 226</span></span></p> - <p class="pln"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">e</span><span class="op">,</span> <span class="nam">TypeError</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="key">and</span> <span class="nam">initializer</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="key">and</span> <span class="key">not</span> <span class="nam">callable</span><span class="op">(</span><span class="nam">initializer</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginMetadataError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="str">f"The specified entry point for plugin {metadata.plugin_name} does not appear to be a"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="str">f" callable (callable returns False). The specified entry point identifies"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="str">f' itself as "{initializer.__qualname__}".'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="op">)</span> <span class="key">from</span> <span class="nam">e</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="key">elif</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">e</span><span class="op">,</span> <span class="nam">PluginBaseError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">231 ↛ 233</span><span class="annotate long">line 231 didn't jump to line 233, because the condition on line 231 was never false</span></span></p> - <p class="run"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="key">raise</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginInitializationError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="str">f"Exception while attempting to load plugin {metadata.plugin_name}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="op">)</span> <span class="key">from</span> <span class="nam">e</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="key">def</span> <span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="nam">stem</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="nam">installed_path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="nam">default_mode</span><span class="op">:</span> <span class="nam">int</span> <span class="op">=</span> <span class="num">0o0644</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="nam">default_priority</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="nam">allow_name_segment</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="nam">allow_architecture_segment</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="nam">post_formatting_rewrite</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="nam">packageless_is_fallback_for_all_packages</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="nam">reservation_only</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="nam">format_callback</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">PPFFormatParam</span><span class="op">,</span> <span class="nam">VirtualPath</span><span class="op">]</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="nam">reference_documentation</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="nam">PackagerProvidedFileReferenceDocumentation</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="nam">packager_provided_files</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_feature_set</span><span class="op">.</span><span class="nam">packager_provided_files</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="nam">existing</span> <span class="op">=</span> <span class="nam">packager_provided_files</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">stem</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="key">if</span> <span class="nam">format_callback</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_name</span> <span class="op">!=</span> <span class="str">"debputy"</span><span class="op">:</span> </span><span class="r"><span class="annotate short">259 ↛ 260</span><span class="annotate long">line 259 didn't jump to line 260, because the condition on line 259 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="str">"Sorry; Using format_callback is a debputy-internal"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="str">f" API. Triggered by plugin {self._plugin_name}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="key">if</span> <span class="nam">installed_path</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">265 ↛ 266</span><span class="annotate long">line 265 didn't jump to line 266, because the condition on line 265 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="str">f'The installed_path ends with "/" indicating it is a directory, but it must be a file.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="str">f" Triggered by plugin {self._plugin_name}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="nam">installed_path</span> <span class="op">=</span> <span class="nam">_normalize_path</span><span class="op">(</span><span class="nam">installed_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="nam">has_name_var</span> <span class="op">=</span> <span class="str">"{name}"</span> <span class="key">in</span> <span class="nam">installed_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="key">if</span> <span class="nam">installed_path</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"./DEBIAN"</span><span class="op">)</span> <span class="key">or</span> <span class="nam">reservation_only</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="com"># Special-case, used for control files.</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_name</span> <span class="op">!=</span> <span class="str">"debputy"</span><span class="op">:</span> </span><span class="r"><span class="annotate short">277 ↛ 278</span><span class="annotate long">line 277 didn't jump to line 278, because the condition on line 277 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="str">"Sorry; Using DEBIAN as install path or/and reservation_only is a debputy-internal"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="str">f" API. Triggered by plugin {self._plugin_name}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="key">elif</span> <span class="key">not</span> <span class="nam">has_name_var</span> <span class="key">and</span> <span class="str">"{owning_package}"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">installed_path</span><span class="op">:</span> </span><span class="r"><span class="annotate short">282 ↛ 283</span><span class="annotate long">line 282 didn't jump to line 283, because the condition on line 282 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="str">'The installed_path must contain a "{name}" (preferred) or a "{owning_package}"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="str">" substitution (or have installed_path end with a slash). Otherwise, the installed"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="str">f" path would caused file-conflicts. Triggered by plugin {self._plugin_name}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="key">if</span> <span class="nam">allow_name_segment</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">has_name_var</span><span class="op">:</span> </span><span class="r"><span class="annotate short">289 ↛ 290</span><span class="annotate long">line 289 didn't jump to line 290, because the condition on line 289 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="str">'When allow_name_segment is True, the installed_path must have a "{name}" substitution'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> <span class="str">" variable. Otherwise, the name segment will not work properly. Triggered by"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="str">f" plugin {self._plugin_name}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"><span class="annotate short">296 ↛ 301</span><span class="annotate long">line 296 didn't jump to line 301</span></span></p> - <p class="pln"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="nam">default_priority</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="key">and</span> <span class="str">"{priority}"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">installed_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="key">and</span> <span class="str">"{priority:02}"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">installed_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="str">'When default_priority is not None, the installed_path should have a "{priority}"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="str">' or a "{priority:02}" substitution variable. Otherwise, the priority would be lost.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> <span class="str">f" Triggered by plugin {self._plugin_name}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing</span><span class="op">.</span><span class="nam">debputy_plugin_metadata</span><span class="op">.</span><span class="nam">plugin_name</span> <span class="op">!=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_name</span><span class="op">:</span> </span><span class="r"><span class="annotate short">308 ↛ 315</span><span class="annotate long">line 308 didn't jump to line 315</span></span></p> - <p class="run"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="nam">message</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="str">f'The stem "{stem}" is registered twice for packager provided files.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="str">f" Once by {existing.debputy_plugin_metadata.plugin_name} and once"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="str">f" by {self._plugin_name}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="nam">message</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="str">f"Bug in the plugin {self._plugin_name}: It tried to register the"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="str">f' stem "{stem}" twice for packager provided files.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginConflictError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="nam">message</span><span class="op">,</span> <span class="nam">existing</span><span class="op">.</span><span class="nam">debputy_plugin_metadata</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_metadata</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="nam">packager_provided_files</span><span class="op">[</span><span class="nam">stem</span><span class="op">]</span> <span class="op">=</span> <span class="nam">PackagerProvidedFileClassSpec</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> <span class="nam">stem</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> <span class="nam">installed_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> <span class="nam">default_mode</span><span class="op">=</span><span class="nam">default_mode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> <span class="nam">default_priority</span><span class="op">=</span><span class="nam">default_priority</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> <span class="nam">allow_name_segment</span><span class="op">=</span><span class="nam">allow_name_segment</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> <span class="nam">allow_architecture_segment</span><span class="op">=</span><span class="nam">allow_architecture_segment</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> <span class="nam">post_formatting_rewrite</span><span class="op">=</span><span class="nam">post_formatting_rewrite</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> <span class="nam">packageless_is_fallback_for_all_packages</span><span class="op">=</span><span class="nam">packageless_is_fallback_for_all_packages</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> <span class="nam">reservation_only</span><span class="op">=</span><span class="nam">reservation_only</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> <span class="nam">formatting_callback</span><span class="op">=</span><span class="nam">format_callback</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> <span class="nam">reference_documentation</span><span class="op">=</span><span class="nam">reference_documentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> <span class="key">def</span> <span class="nam">_unload</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> <span class="key">del</span> <span class="nam">packager_provided_files</span><span class="op">[</span><span class="nam">stem</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_unloaders</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">_unload</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"> <span class="key">def</span> <span class="nam">metadata_or_maintscript_detector</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> <span class="nam">auto_detector_id</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"> <span class="nam">auto_detector</span><span class="op">:</span> <span class="nam">MetadataAutoDetector</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"> <span class="nam">package_type</span><span class="op">:</span> <span class="nam">PackageTypeSelector</span> <span class="op">=</span> <span class="str">"deb"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"> <span class="key">if</span> <span class="nam">auto_detector_id</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_detector_ids</span><span class="op">:</span> </span><span class="r"><span class="annotate short">349 ↛ 350</span><span class="annotate long">line 349 didn't jump to line 350, because the condition on line 349 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"> <span class="str">f"The plugin {self._plugin_name} tried to register"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"> <span class="str">f' "{auto_detector_id}" twice'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_detector_ids</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">auto_detector_id</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"> <span class="nam">all_detectors</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_feature_set</span><span class="op">.</span><span class="nam">metadata_maintscript_detectors</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_name</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">all_detectors</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"> <span class="nam">all_detectors</span><span class="op">[</span><span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_name</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"> <span class="nam">package_types</span> <span class="op">=</span> <span class="nam">resolve_package_type_selectors</span><span class="op">(</span><span class="nam">package_type</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"> <span class="nam">all_detectors</span><span class="op">[</span><span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_name</span><span class="op">]</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"> <span class="nam">MetadataOrMaintscriptDetector</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"> <span class="nam">detector_id</span><span class="op">=</span><span class="nam">auto_detector_id</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"> <span class="nam">detector</span><span class="op">=</span><span class="nam">auto_detector</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"> <span class="nam">applies_to_package_types</span><span class="op">=</span><span class="nam">package_types</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"> <span class="nam">enabled</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"> <span class="key">def</span> <span class="nam">_unload</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_name</span> <span class="key">in</span> <span class="nam">all_detectors</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"> <span class="key">del</span> <span class="nam">all_detectors</span><span class="op">[</span><span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_name</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_unloaders</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">_unload</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"> <span class="key">def</span> <span class="nam">document_builtin_variable</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"> <span class="nam">variable_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"> <span class="nam">variable_reference_documentation</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"> <span class="nam">is_context_specific</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"> <span class="nam">is_for_special_case</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"> <span class="nam">manifest_variables</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_feature_set</span><span class="op">.</span><span class="nam">manifest_variables</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_restricted_api</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t385" href="#t385">385</a></span><span class="t"> <span class="nam">state</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_substitution</span><span class="op">.</span><span class="nam">variable_state</span><span class="op">(</span><span class="nam">variable_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t386" href="#t386">386</a></span><span class="t"> <span class="key">if</span> <span class="nam">state</span> <span class="op">==</span> <span class="nam">VariableNameState</span><span class="op">.</span><span class="nam">UNDEFINED</span><span class="op">:</span> </span><span class="r"><span class="annotate short">386 ↛ 387</span><span class="annotate long">line 386 didn't jump to line 387, because the condition on line 386 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t387" href="#t387">387</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t388" href="#t388">388</a></span><span class="t"> <span class="str">f"The plugin {self._plugin_name} attempted to document built-in {variable_name},"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t389" href="#t389">389</a></span><span class="t"> <span class="str">f" but it is not known to be a variable"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t390" href="#t390">390</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t391" href="#t391">391</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t392" href="#t392">392</a></span><span class="t"> <span class="key">assert</span> <span class="nam">variable_name</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">manifest_variables</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t393" href="#t393">393</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t394" href="#t394">394</a></span><span class="t"> <span class="nam">manifest_variables</span><span class="op">[</span><span class="nam">variable_name</span><span class="op">]</span> <span class="op">=</span> <span class="nam">PluginProvidedManifestVariable</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t395" href="#t395">395</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t396" href="#t396">396</a></span><span class="t"> <span class="nam">variable_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t397" href="#t397">397</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t398" href="#t398">398</a></span><span class="t"> <span class="nam">is_context_specific_variable</span><span class="op">=</span><span class="nam">is_context_specific</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t399" href="#t399">399</a></span><span class="t"> <span class="nam">variable_reference_documentation</span><span class="op">=</span><span class="nam">variable_reference_documentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t400" href="#t400">400</a></span><span class="t"> <span class="nam">is_documentation_placeholder</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t401" href="#t401">401</a></span><span class="t"> <span class="nam">is_for_special_case</span><span class="op">=</span><span class="nam">is_for_special_case</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t402" href="#t402">402</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t403" href="#t403">403</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t404" href="#t404">404</a></span><span class="t"> <span class="key">def</span> <span class="nam">_unload</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t405" href="#t405">405</a></span><span class="t"> <span class="key">del</span> <span class="nam">manifest_variables</span><span class="op">[</span><span class="nam">variable_name</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t406" href="#t406">406</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t407" href="#t407">407</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_unloaders</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">_unload</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t408" href="#t408">408</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t409" href="#t409">409</a></span><span class="t"> <span class="key">def</span> <span class="nam">manifest_variable_provider</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t410" href="#t410">410</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t411" href="#t411">411</a></span><span class="t"> <span class="nam">provider</span><span class="op">:</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">VariableContext</span><span class="op">]</span><span class="op">,</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t412" href="#t412">412</a></span><span class="t"> <span class="nam">variables</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t413" href="#t413">413</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t414" href="#t414">414</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_restricted_api</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t415" href="#t415">415</a></span><span class="t"> <span class="nam">cached_provider</span> <span class="op">=</span> <span class="nam">functools</span><span class="op">.</span><span class="nam">lru_cache</span><span class="op">(</span><span class="key">None</span><span class="op">)</span><span class="op">(</span><span class="nam">provider</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t416" href="#t416">416</a></span><span class="t"> <span class="nam">permitted_variables</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span><span class="nam">variables</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t417" href="#t417">417</a></span><span class="t"> <span class="nam">variables_iter</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t418" href="#t418">418</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">variables</span><span class="op">,</span> <span class="nam">Mapping</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">418 ↛ 419</span><span class="annotate long">line 418 didn't jump to line 419, because the condition on line 418 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t419" href="#t419">419</a></span><span class="t"> <span class="nam">variables_iter</span> <span class="op">=</span> <span class="nam">zip</span><span class="op">(</span><span class="nam">variables</span><span class="op">,</span> <span class="nam">itertools</span><span class="op">.</span><span class="nam">repeat</span><span class="op">(</span><span class="key">None</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t420" href="#t420">420</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t421" href="#t421">421</a></span><span class="t"> <span class="nam">variables_iter</span> <span class="op">=</span> <span class="nam">variables</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t422" href="#t422">422</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t423" href="#t423">423</a></span><span class="t"> <span class="nam">checked_vars</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t424" href="#t424">424</a></span><span class="t"> <span class="nam">manifest_variables</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_feature_set</span><span class="op">.</span><span class="nam">manifest_variables</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t425" href="#t425">425</a></span><span class="t"> <span class="nam">plugin_name</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t426" href="#t426">426</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t427" href="#t427">427</a></span><span class="t"> <span class="key">def</span> <span class="nam">_value_resolver_generator</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t428" href="#t428">428</a></span><span class="t"> <span class="nam">variable_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t429" href="#t429">429</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">VariableContext</span><span class="op">]</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t430" href="#t430">430</a></span><span class="t"> <span class="key">def</span> <span class="nam">_value_resolver</span><span class="op">(</span><span class="nam">variable_context</span><span class="op">:</span> <span class="nam">VariableContext</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t431" href="#t431">431</a></span><span class="t"> <span class="nam">res</span> <span class="op">=</span> <span class="nam">cached_provider</span><span class="op">(</span><span class="nam">variable_context</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t432" href="#t432">432</a></span><span class="t"> <span class="key">nonlocal</span> <span class="nam">checked_vars</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t433" href="#t433">433</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">checked_vars</span><span class="op">:</span> </span><span class="r"><span class="annotate short">433 ↛ 444</span><span class="annotate long">line 433 didn't jump to line 444, because the condition on line 433 was never false</span></span></p> - <p class="par run show_par"><span class="n"><a id="t434" href="#t434">434</a></span><span class="t"> <span class="key">if</span> <span class="nam">permitted_variables</span> <span class="op">!=</span> <span class="nam">res</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">434 ↛ 435</span><span class="annotate long">line 434 didn't jump to line 435, because the condition on line 434 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t435" href="#t435">435</a></span><span class="t"> <span class="nam">expected</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">sorted</span><span class="op">(</span><span class="nam">permitted_variables</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t436" href="#t436">436</a></span><span class="t"> <span class="nam">actual</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">sorted</span><span class="op">(</span><span class="nam">res</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t437" href="#t437">437</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginAPIViolationError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t438" href="#t438">438</a></span><span class="t"> <span class="str">f"The plugin {plugin_name} claimed to provide"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t439" href="#t439">439</a></span><span class="t"> <span class="str">f" the following variables {expected},"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t440" href="#t440">440</a></span><span class="t"> <span class="str">f" but when resolving the variables, the plugin provided"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t441" href="#t441">441</a></span><span class="t"> <span class="str">f" {actual}. These two lists should have been the same."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t442" href="#t442">442</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t443" href="#t443">443</a></span><span class="t"> <span class="nam">checked_vars</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t444" href="#t444">444</a></span><span class="t"> <span class="key">return</span> <span class="nam">res</span><span class="op">[</span><span class="nam">variable_name</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t445" href="#t445">445</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t446" href="#t446">446</a></span><span class="t"> <span class="key">return</span> <span class="nam">_value_resolver</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t447" href="#t447">447</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t448" href="#t448">448</a></span><span class="t"> <span class="key">for</span> <span class="nam">varname</span><span class="op">,</span> <span class="nam">vardoc</span> <span class="key">in</span> <span class="nam">variables_iter</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t449" href="#t449">449</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_check_variable_name</span><span class="op">(</span><span class="nam">varname</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t450" href="#t450">450</a></span><span class="t"> <span class="nam">manifest_variables</span><span class="op">[</span><span class="nam">varname</span><span class="op">]</span> <span class="op">=</span> <span class="nam">PluginProvidedManifestVariable</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t451" href="#t451">451</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t452" href="#t452">452</a></span><span class="t"> <span class="nam">varname</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t453" href="#t453">453</a></span><span class="t"> <span class="nam">_value_resolver_generator</span><span class="op">(</span><span class="nam">varname</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t454" href="#t454">454</a></span><span class="t"> <span class="nam">is_context_specific_variable</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t455" href="#t455">455</a></span><span class="t"> <span class="nam">variable_reference_documentation</span><span class="op">=</span><span class="nam">vardoc</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t456" href="#t456">456</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t457" href="#t457">457</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t458" href="#t458">458</a></span><span class="t"> <span class="key">def</span> <span class="nam">_unload</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t459" href="#t459">459</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginInitializationError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t460" href="#t460">460</a></span><span class="t"> <span class="str">"Cannot unload manifest_variable_provider (not implemented)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t461" href="#t461">461</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t462" href="#t462">462</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t463" href="#t463">463</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_unloaders</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">_unload</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t464" href="#t464">464</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t465" href="#t465">465</a></span><span class="t"> <span class="key">def</span> <span class="nam">_check_variable_name</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">variable_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t466" href="#t466">466</a></span><span class="t"> <span class="nam">manifest_variables</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_feature_set</span><span class="op">.</span><span class="nam">manifest_variables</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t467" href="#t467">467</a></span><span class="t"> <span class="nam">existing</span> <span class="op">=</span> <span class="nam">manifest_variables</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">variable_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t468" href="#t468">468</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t469" href="#t469">469</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t470" href="#t470">470</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing</span><span class="op">.</span><span class="nam">plugin_metadata</span><span class="op">.</span><span class="nam">plugin_name</span> <span class="op">==</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_name</span><span class="op">:</span> </span><span class="r"><span class="annotate short">470 ↛ 476</span><span class="annotate long">line 470 didn't jump to line 476</span></span></p> - <p class="run"><span class="n"><a id="t471" href="#t471">471</a></span><span class="t"> <span class="nam">message</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t472" href="#t472">472</a></span><span class="t"> <span class="str">f"Bug in the plugin {self._plugin_name}: It tried to register the"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t473" href="#t473">473</a></span><span class="t"> <span class="str">f' manifest variable "{variable_name}" twice.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t474" href="#t474">474</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t475" href="#t475">475</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t476" href="#t476">476</a></span><span class="t"> <span class="nam">message</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t477" href="#t477">477</a></span><span class="t"> <span class="str">f"The plugins {existing.plugin_metadata.plugin_name} and {self._plugin_name}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t478" href="#t478">478</a></span><span class="t"> <span class="str">f" both tried to provide the manifest variable {variable_name}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t479" href="#t479">479</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t480" href="#t480">480</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginConflictError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t481" href="#t481">481</a></span><span class="t"> <span class="nam">message</span><span class="op">,</span> <span class="nam">existing</span><span class="op">.</span><span class="nam">plugin_metadata</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_metadata</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t482" href="#t482">482</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t483" href="#t483">483</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">SUBST_VAR_RE</span><span class="op">.</span><span class="nam">match</span><span class="op">(</span><span class="str">"{{"</span> <span class="op">+</span> <span class="nam">variable_name</span> <span class="op">+</span> <span class="str">"}}"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t484" href="#t484">484</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t485" href="#t485">485</a></span><span class="t"> <span class="str">f"The plugin {self._plugin_name} attempted to declare {variable_name},"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t486" href="#t486">486</a></span><span class="t"> <span class="str">f" which is not a valid variable name"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t487" href="#t487">487</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t488" href="#t488">488</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t489" href="#t489">489</a></span><span class="t"> <span class="nam">namespace</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t490" href="#t490">490</a></span><span class="t"> <span class="nam">variable_basename</span> <span class="op">=</span> <span class="nam">variable_name</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t491" href="#t491">491</a></span><span class="t"> <span class="key">if</span> <span class="str">":"</span> <span class="key">in</span> <span class="nam">variable_name</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t492" href="#t492">492</a></span><span class="t"> <span class="nam">namespace</span><span class="op">,</span> <span class="nam">variable_basename</span> <span class="op">=</span> <span class="nam">variable_name</span><span class="op">.</span><span class="nam">rsplit</span><span class="op">(</span><span class="str">":"</span><span class="op">,</span> <span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t493" href="#t493">493</a></span><span class="t"> <span class="key">assert</span> <span class="nam">namespace</span> <span class="op">!=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t494" href="#t494">494</a></span><span class="t"> <span class="key">assert</span> <span class="nam">variable_name</span> <span class="op">!=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t495" href="#t495">495</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t496" href="#t496">496</a></span><span class="t"> <span class="key">if</span> <span class="nam">namespace</span> <span class="op">!=</span> <span class="str">""</span> <span class="key">and</span> <span class="nam">namespace</span> <span class="key">not</span> <span class="key">in</span> <span class="op">(</span><span class="str">"token"</span><span class="op">,</span> <span class="str">"path"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t497" href="#t497">497</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t498" href="#t498">498</a></span><span class="t"> <span class="str">f"The plugin {self._plugin_name} attempted to declare {variable_name},"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t499" href="#t499">499</a></span><span class="t"> <span class="str">f" which is in the reserved namespace {namespace}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t500" href="#t500">500</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t501" href="#t501">501</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t502" href="#t502">502</a></span><span class="t"> <span class="nam">variable_name_upper</span> <span class="op">=</span> <span class="nam">variable_name</span><span class="op">.</span><span class="nam">upper</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t503" href="#t503">503</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t504" href="#t504">504</a></span><span class="t"> <span class="nam">variable_name_upper</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="op">(</span><span class="str">"DEB_"</span><span class="op">,</span> <span class="str">"DPKG_"</span><span class="op">,</span> <span class="str">"DEBPUTY"</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t505" href="#t505">505</a></span><span class="t"> <span class="key">or</span> <span class="nam">variable_basename</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"_"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t506" href="#t506">506</a></span><span class="t"> <span class="key">or</span> <span class="nam">variable_basename</span><span class="op">.</span><span class="nam">upper</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"DEBPUTY"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t507" href="#t507">507</a></span><span class="t"> <span class="op">)</span> <span class="key">and</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_name</span> <span class="op">!=</span> <span class="str">"debputy"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t508" href="#t508">508</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t509" href="#t509">509</a></span><span class="t"> <span class="str">f"The plugin {self._plugin_name} attempted to declare {variable_name},"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t510" href="#t510">510</a></span><span class="t"> <span class="str">f" which is a variable name reserved by debputy"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t511" href="#t511">511</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t512" href="#t512">512</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t513" href="#t513">513</a></span><span class="t"> <span class="nam">state</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_substitution</span><span class="op">.</span><span class="nam">variable_state</span><span class="op">(</span><span class="nam">variable_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t514" href="#t514">514</a></span><span class="t"> <span class="key">if</span> <span class="nam">state</span> <span class="op">!=</span> <span class="nam">VariableNameState</span><span class="op">.</span><span class="nam">UNDEFINED</span> <span class="key">and</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_name</span> <span class="op">!=</span> <span class="str">"debputy"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t515" href="#t515">515</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t516" href="#t516">516</a></span><span class="t"> <span class="str">f"The plugin {self._plugin_name} attempted to declare {variable_name},"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t517" href="#t517">517</a></span><span class="t"> <span class="str">f" which would shadow a built-in variable"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t518" href="#t518">518</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t519" href="#t519">519</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t520" href="#t520">520</a></span><span class="t"> <span class="key">def</span> <span class="nam">package_processor</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t521" href="#t521">521</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t522" href="#t522">522</a></span><span class="t"> <span class="nam">processor_id</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t523" href="#t523">523</a></span><span class="t"> <span class="nam">processor</span><span class="op">:</span> <span class="nam">PackageProcessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t524" href="#t524">524</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t525" href="#t525">525</a></span><span class="t"> <span class="nam">depends_on_processor</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="nam">tuple</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t526" href="#t526">526</a></span><span class="t"> <span class="nam">package_type</span><span class="op">:</span> <span class="nam">PackageTypeSelector</span> <span class="op">=</span> <span class="str">"deb"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t527" href="#t527">527</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t528" href="#t528">528</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_restricted_api</span><span class="op">(</span><span class="nam">allowed_plugins</span><span class="op">=</span><span class="op">{</span><span class="str">"lua"</span><span class="op">}</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t529" href="#t529">529</a></span><span class="t"> <span class="nam">package_processors</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_feature_set</span><span class="op">.</span><span class="nam">all_package_processors</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t530" href="#t530">530</a></span><span class="t"> <span class="nam">dependencies</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t531" href="#t531">531</a></span><span class="t"> <span class="nam">processor_key</span> <span class="op">=</span> <span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_name</span><span class="op">,</span> <span class="nam">processor_id</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t532" href="#t532">532</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t533" href="#t533">533</a></span><span class="t"> <span class="key">if</span> <span class="nam">processor_key</span> <span class="key">in</span> <span class="nam">package_processors</span><span class="op">:</span> </span><span class="r"><span class="annotate short">533 ↛ 534</span><span class="annotate long">line 533 didn't jump to line 534, because the condition on line 533 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t534" href="#t534">534</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginConflictError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t535" href="#t535">535</a></span><span class="t"> <span class="str">f"The plugin {self._plugin_name} already registered a processor with id {processor_id}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t536" href="#t536">536</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t537" href="#t537">537</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t538" href="#t538">538</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t539" href="#t539">539</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t540" href="#t540">540</a></span><span class="t"> <span class="key">for</span> <span class="nam">depends_ref</span> <span class="key">in</span> <span class="nam">depends_on_processor</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t541" href="#t541">541</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">depends_ref</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">541 ↛ 555</span><span class="annotate long">line 541 didn't jump to line 555, because the condition on line 541 was never false</span></span></p> - <p class="par run show_par"><span class="n"><a id="t542" href="#t542">542</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_name</span><span class="op">,</span> <span class="nam">depends_ref</span><span class="op">)</span> <span class="key">in</span> <span class="nam">package_processors</span><span class="op">:</span> </span><span class="r"><span class="annotate short">542 ↛ 544</span><span class="annotate long">line 542 didn't jump to line 544, because the condition on line 542 was never false</span></span></p> - <p class="run"><span class="n"><a id="t543" href="#t543">543</a></span><span class="t"> <span class="nam">depends_key</span> <span class="op">=</span> <span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_name</span><span class="op">,</span> <span class="nam">depends_ref</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t544" href="#t544">544</a></span><span class="t"> <span class="key">elif</span> <span class="op">(</span><span class="str">"debputy"</span><span class="op">,</span> <span class="nam">depends_ref</span><span class="op">)</span> <span class="key">in</span> <span class="nam">package_processors</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t545" href="#t545">545</a></span><span class="t"> <span class="nam">depends_key</span> <span class="op">=</span> <span class="op">(</span><span class="str">"debputy"</span><span class="op">,</span> <span class="nam">depends_ref</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t546" href="#t546">546</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t547" href="#t547">547</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t548" href="#t548">548</a></span><span class="t"> <span class="str">f'Could not resolve dependency "{depends_ref}" for'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t549" href="#t549">549</a></span><span class="t"> <span class="str">f' "{processor_id}". It was not provided by the plugin itself'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t550" href="#t550">550</a></span><span class="t"> <span class="str">f" ({self._plugin_name}) nor debputy."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t551" href="#t551">551</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t552" href="#t552">552</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t553" href="#t553">553</a></span><span class="t"> <span class="com"># TODO: Add proper dependencies first, at which point we should probably resolve "name"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t554" href="#t554">554</a></span><span class="t"> <span class="com"># via the direct dependencies.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t555" href="#t555">555</a></span><span class="t"> <span class="key">assert</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t556" href="#t556">556</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t557" href="#t557">557</a></span><span class="t"> <span class="nam">existing_processor</span> <span class="op">=</span> <span class="nam">package_processors</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">depends_key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t558" href="#t558">558</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing_processor</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">558 ↛ 561</span><span class="annotate long">line 558 didn't jump to line 561, because the condition on line 558 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t559" href="#t559">559</a></span><span class="t"> <span class="com"># We currently require the processor to be declared already. If this ever changes,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t560" href="#t560">560</a></span><span class="t"> <span class="com"># PluginProvidedFeatureSet.package_processors_in_order will need an update</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t561" href="#t561">561</a></span><span class="t"> <span class="nam">dplugin_name</span><span class="op">,</span> <span class="nam">dprocessor_name</span> <span class="op">=</span> <span class="nam">depends_key</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t562" href="#t562">562</a></span><span class="t"> <span class="nam">available_processors</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t563" href="#t563">563</a></span><span class="t"> <span class="nam">n</span> <span class="key">for</span> <span class="nam">p</span><span class="op">,</span> <span class="nam">n</span> <span class="key">in</span> <span class="nam">package_processors</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span> <span class="key">if</span> <span class="nam">p</span> <span class="op">==</span> <span class="nam">dplugin_name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t564" href="#t564">564</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t565" href="#t565">565</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t566" href="#t566">566</a></span><span class="t"> <span class="str">f"The plugin {dplugin_name} does not provide a processor called"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t567" href="#t567">567</a></span><span class="t"> <span class="str">f" {dprocessor_name}. Available processors for that plugin are:"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t568" href="#t568">568</a></span><span class="t"> <span class="str">f" {available_processors}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t569" href="#t569">569</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t570" href="#t570">570</a></span><span class="t"> <span class="nam">dependencies</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">depends_key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t571" href="#t571">571</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t572" href="#t572">572</a></span><span class="t"> <span class="nam">package_processors</span><span class="op">[</span><span class="nam">processor_key</span><span class="op">]</span> <span class="op">=</span> <span class="nam">PluginProvidedPackageProcessor</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t573" href="#t573">573</a></span><span class="t"> <span class="nam">processor_id</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t574" href="#t574">574</a></span><span class="t"> <span class="nam">resolve_package_type_selectors</span><span class="op">(</span><span class="nam">package_type</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t575" href="#t575">575</a></span><span class="t"> <span class="nam">processor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t576" href="#t576">576</a></span><span class="t"> <span class="nam">frozenset</span><span class="op">(</span><span class="nam">dependencies</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t577" href="#t577">577</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t578" href="#t578">578</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t579" href="#t579">579</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t580" href="#t580">580</a></span><span class="t"> <span class="key">def</span> <span class="nam">_unload</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t581" href="#t581">581</a></span><span class="t"> <span class="key">del</span> <span class="nam">package_processors</span><span class="op">[</span><span class="nam">processor_key</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t582" href="#t582">582</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t583" href="#t583">583</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_unloaders</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">_unload</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t584" href="#t584">584</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t585" href="#t585">585</a></span><span class="t"> <span class="key">def</span> <span class="nam">automatic_discard_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t586" href="#t586">586</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t587" href="#t587">587</a></span><span class="t"> <span class="nam">name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t588" href="#t588">588</a></span><span class="t"> <span class="nam">should_discard</span><span class="op">:</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span><span class="op">,</span> <span class="nam">bool</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t589" href="#t589">589</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t590" href="#t590">590</a></span><span class="t"> <span class="nam">rule_reference_documentation</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t591" href="#t591">591</a></span><span class="t"> <span class="nam">examples</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t592" href="#t592">592</a></span><span class="t"> <span class="nam">AutomaticDiscardRuleExample</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">AutomaticDiscardRuleExample</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t593" href="#t593">593</a></span><span class="t"> <span class="op">]</span> <span class="op">=</span> <span class="nam">tuple</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t594" href="#t594">594</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t595" href="#t595">595</a></span><span class="t"> <span class="str">"""Register an automatic discard rule</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t596" href="#t596">596</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t597" href="#t597">597</a></span><span class="t"><span class="str"> An automatic discard rule is basically applied to *every* path about to be installed in to any package.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t598" href="#t598">598</a></span><span class="t"><span class="str"> If any discard rule concludes that a path should not be installed, then the path is not installed.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t599" href="#t599">599</a></span><span class="t"><span class="str"> In the case where the discard path is a:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t600" href="#t600">600</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t601" href="#t601">601</a></span><span class="t"><span class="str"> * directory: Then the entire directory is excluded along with anything beneath it.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t602" href="#t602">602</a></span><span class="t"><span class="str"> * symlink: Then the symlink itself (but not its target) is excluded.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t603" href="#t603">603</a></span><span class="t"><span class="str"> * hardlink: Then the current hardlink will not be installed, but other instances of it will be.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t604" href="#t604">604</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t605" href="#t605">605</a></span><span class="t"><span class="str"> Note: Discarded files are *never* deleted by `debputy`. They just make `debputy` skip the file.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t606" href="#t606">606</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t607" href="#t607">607</a></span><span class="t"><span class="str"> Automatic discard rules should be written with the assumption that directories will be tested</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t608" href="#t608">608</a></span><span class="t"><span class="str"> before their content *when it is relevant* for the discard rule to examine whether the directory</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t609" href="#t609">609</a></span><span class="t"><span class="str"> can be excluded.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t610" href="#t610">610</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t611" href="#t611">611</a></span><span class="t"><span class="str"> The packager can via the manifest overrule automatic discard rules by explicitly listing the path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t612" href="#t612">612</a></span><span class="t"><span class="str"> without any globs. As example:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t613" href="#t613">613</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t614" href="#t614">614</a></span><span class="t"><span class="str"> installations:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t615" href="#t615">615</a></span><span class="t"><span class="str"> - install:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t616" href="#t616">616</a></span><span class="t"><span class="str"> sources:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t617" href="#t617">617</a></span><span class="t"><span class="str"> - usr/lib/libfoo.la # <-- This path is always installed</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t618" href="#t618">618</a></span><span class="t"><span class="str"> # (Discard rules are never asked in this case)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t619" href="#t619">619</a></span><span class="t"><span class="str"> #</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t620" href="#t620">620</a></span><span class="t"><span class="str"> - usr/lib/*.so* # <-- Discard rules applies to any path beneath usr/lib and can exclude matches</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t621" href="#t621">621</a></span><span class="t"><span class="str"> # Though, they will not examine `libfoo.la` as it has already been installed</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t622" href="#t622">622</a></span><span class="t"><span class="str"> #</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t623" href="#t623">623</a></span><span class="t"><span class="str"> # Note: usr/lib itself is never tested in this case (it is assumed to be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t624" href="#t624">624</a></span><span class="t"><span class="str"> # explicitly requested). But any subdir of usr/lib will be examined.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t625" href="#t625">625</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t626" href="#t626">626</a></span><span class="t"><span class="str"> When an automatic discard rule is evaluated, it can see the source path currently being considered</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t627" href="#t627">627</a></span><span class="t"><span class="str"> for installation. While it can look at "surrounding" context (like parent directory), it will not</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t628" href="#t628">628</a></span><span class="t"><span class="str"> know whether those paths are to be installed or will be installed.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t629" href="#t629">629</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t630" href="#t630">630</a></span><span class="t"><span class="str"> :param name: A user visible name discard rule. It can be used on the command line, so avoid shell</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t631" href="#t631">631</a></span><span class="t"><span class="str"> metacharacters and spaces.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t632" href="#t632">632</a></span><span class="t"><span class="str"> :param should_discard: A callable that is the implementation of the automatic discard rule. It will receive</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t633" href="#t633">633</a></span><span class="t"><span class="str"> a VirtualPath representing the *source* path about to be installed. If callable returns `True`, then the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t634" href="#t634">634</a></span><span class="t"><span class="str"> path is discarded. If it returns `False`, the path is not discarded (by this rule at least).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t635" href="#t635">635</a></span><span class="t"><span class="str"> A source path will either be from the root of the source tree or the root of a search directory such as</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t636" href="#t636">636</a></span><span class="t"><span class="str"> `debian/tmp`. Where the path will be installed is not available at the time the discard rule is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t637" href="#t637">637</a></span><span class="t"><span class="str"> evaluated.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t638" href="#t638">638</a></span><span class="t"><span class="str"> :param rule_reference_documentation: Optionally, the reference documentation to be shown when a user</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t639" href="#t639">639</a></span><span class="t"><span class="str"> looks up this automatic discard rule.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t640" href="#t640">640</a></span><span class="t"><span class="str"> :param examples: Provide examples for the rule. Use the automatic_discard_rule_example function to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t641" href="#t641">641</a></span><span class="t"><span class="str"> generate the examples.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t642" href="#t642">642</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t643" href="#t643">643</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t644" href="#t644">644</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_restricted_api</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t645" href="#t645">645</a></span><span class="t"> <span class="nam">auto_discard_rules</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_feature_set</span><span class="op">.</span><span class="nam">auto_discard_rules</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t646" href="#t646">646</a></span><span class="t"> <span class="nam">existing</span> <span class="op">=</span> <span class="nam">auto_discard_rules</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t647" href="#t647">647</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">647 ↛ 648</span><span class="annotate long">line 647 didn't jump to line 648, because the condition on line 647 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t648" href="#t648">648</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing</span><span class="op">.</span><span class="nam">plugin_metadata</span><span class="op">.</span><span class="nam">plugin_name</span> <span class="op">==</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_name</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t649" href="#t649">649</a></span><span class="t"> <span class="nam">message</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t650" href="#t650">650</a></span><span class="t"> <span class="str">f"Bug in the plugin {self._plugin_name}: It tried to register the"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t651" href="#t651">651</a></span><span class="t"> <span class="str">f' automatic discard rule "{name}" twice.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t652" href="#t652">652</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t653" href="#t653">653</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t654" href="#t654">654</a></span><span class="t"> <span class="nam">message</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t655" href="#t655">655</a></span><span class="t"> <span class="str">f"The plugins {existing.plugin_metadata.plugin_name} and {self._plugin_name}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t656" href="#t656">656</a></span><span class="t"> <span class="str">f" both tried to provide the automatic discard rule {name}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t657" href="#t657">657</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t658" href="#t658">658</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginConflictError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t659" href="#t659">659</a></span><span class="t"> <span class="nam">message</span><span class="op">,</span> <span class="nam">existing</span><span class="op">.</span><span class="nam">plugin_metadata</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_metadata</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t660" href="#t660">660</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t661" href="#t661">661</a></span><span class="t"> <span class="nam">examples</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t662" href="#t662">662</a></span><span class="t"> <span class="op">(</span><span class="nam">examples</span><span class="op">,</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t663" href="#t663">663</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">examples</span><span class="op">,</span> <span class="nam">AutomaticDiscardRuleExample</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t664" href="#t664">664</a></span><span class="t"> <span class="key">else</span> <span class="nam">tuple</span><span class="op">(</span><span class="nam">examples</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t665" href="#t665">665</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t666" href="#t666">666</a></span><span class="t"> <span class="nam">auto_discard_rules</span><span class="op">[</span><span class="nam">name</span><span class="op">]</span> <span class="op">=</span> <span class="nam">PluginProvidedDiscardRule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t667" href="#t667">667</a></span><span class="t"> <span class="nam">name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t668" href="#t668">668</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t669" href="#t669">669</a></span><span class="t"> <span class="nam">should_discard</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t670" href="#t670">670</a></span><span class="t"> <span class="nam">rule_reference_documentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t671" href="#t671">671</a></span><span class="t"> <span class="nam">examples</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t672" href="#t672">672</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t673" href="#t673">673</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t674" href="#t674">674</a></span><span class="t"> <span class="key">def</span> <span class="nam">_unload</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t675" href="#t675">675</a></span><span class="t"> <span class="key">del</span> <span class="nam">auto_discard_rules</span><span class="op">[</span><span class="nam">name</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t676" href="#t676">676</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t677" href="#t677">677</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_unloaders</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">_unload</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t678" href="#t678">678</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t679" href="#t679">679</a></span><span class="t"> <span class="key">def</span> <span class="nam">service_provider</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t680" href="#t680">680</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t681" href="#t681">681</a></span><span class="t"> <span class="nam">service_manager</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t682" href="#t682">682</a></span><span class="t"> <span class="nam">detector</span><span class="op">:</span> <span class="nam">ServiceDetector</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t683" href="#t683">683</a></span><span class="t"> <span class="nam">integrator</span><span class="op">:</span> <span class="nam">ServiceIntegrator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t684" href="#t684">684</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t685" href="#t685">685</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_restricted_api</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t686" href="#t686">686</a></span><span class="t"> <span class="nam">service_managers</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_feature_set</span><span class="op">.</span><span class="nam">service_managers</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t687" href="#t687">687</a></span><span class="t"> <span class="nam">existing</span> <span class="op">=</span> <span class="nam">service_managers</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">service_manager</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t688" href="#t688">688</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">688 ↛ 689</span><span class="annotate long">line 688 didn't jump to line 689, because the condition on line 688 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t689" href="#t689">689</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing</span><span class="op">.</span><span class="nam">plugin_metadata</span><span class="op">.</span><span class="nam">plugin_name</span> <span class="op">==</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_name</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t690" href="#t690">690</a></span><span class="t"> <span class="nam">message</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t691" href="#t691">691</a></span><span class="t"> <span class="str">f"Bug in the plugin {self._plugin_name}: It tried to register the"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t692" href="#t692">692</a></span><span class="t"> <span class="str">f' service manager "{service_manager}" twice.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t693" href="#t693">693</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t694" href="#t694">694</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t695" href="#t695">695</a></span><span class="t"> <span class="nam">message</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t696" href="#t696">696</a></span><span class="t"> <span class="str">f"The plugins {existing.plugin_metadata.plugin_name} and {self._plugin_name}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t697" href="#t697">697</a></span><span class="t"> <span class="str">f' both tried to provide the service manager "{service_manager}"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t698" href="#t698">698</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t699" href="#t699">699</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginConflictError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t700" href="#t700">700</a></span><span class="t"> <span class="nam">message</span><span class="op">,</span> <span class="nam">existing</span><span class="op">.</span><span class="nam">plugin_metadata</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_metadata</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t701" href="#t701">701</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t702" href="#t702">702</a></span><span class="t"> <span class="nam">service_managers</span><span class="op">[</span><span class="nam">service_manager</span><span class="op">]</span> <span class="op">=</span> <span class="nam">ServiceManagerDetails</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t703" href="#t703">703</a></span><span class="t"> <span class="nam">service_manager</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t704" href="#t704">704</a></span><span class="t"> <span class="nam">detector</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t705" href="#t705">705</a></span><span class="t"> <span class="nam">integrator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t706" href="#t706">706</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t707" href="#t707">707</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t708" href="#t708">708</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t709" href="#t709">709</a></span><span class="t"> <span class="key">def</span> <span class="nam">_unload</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t710" href="#t710">710</a></span><span class="t"> <span class="key">del</span> <span class="nam">service_managers</span><span class="op">[</span><span class="nam">service_manager</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t711" href="#t711">711</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t712" href="#t712">712</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_unloaders</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">_unload</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t713" href="#t713">713</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t714" href="#t714">714</a></span><span class="t"> <span class="key">def</span> <span class="nam">manifest_variable</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t715" href="#t715">715</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t716" href="#t716">716</a></span><span class="t"> <span class="nam">variable_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t717" href="#t717">717</a></span><span class="t"> <span class="nam">value</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t718" href="#t718">718</a></span><span class="t"> <span class="nam">variable_reference_documentation</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t719" href="#t719">719</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t720" href="#t720">720</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_check_variable_name</span><span class="op">(</span><span class="nam">variable_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t721" href="#t721">721</a></span><span class="t"> <span class="nam">manifest_variables</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_feature_set</span><span class="op">.</span><span class="nam">manifest_variables</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t722" href="#t722">722</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t723" href="#t723">723</a></span><span class="t"> <span class="nam">resolved_value</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_substitution</span><span class="op">.</span><span class="nam">substitute</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t724" href="#t724">724</a></span><span class="t"> <span class="nam">value</span><span class="op">,</span> <span class="str">"Plugin initialization"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t725" href="#t725">725</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t726" href="#t726">726</a></span><span class="t"> <span class="nam">depends_on_variable</span> <span class="op">=</span> <span class="nam">resolved_value</span> <span class="op">!=</span> <span class="nam">value</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t727" href="#t727">727</a></span><span class="t"> <span class="key">except</span> <span class="nam">DebputySubstitutionError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t728" href="#t728">728</a></span><span class="t"> <span class="nam">depends_on_variable</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t729" href="#t729">729</a></span><span class="t"> <span class="key">if</span> <span class="nam">depends_on_variable</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t730" href="#t730">730</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t731" href="#t731">731</a></span><span class="t"> <span class="str">f"The plugin {self._plugin_name} attempted to declare {variable_name} with value {value!r}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t732" href="#t732">732</a></span><span class="t"> <span class="str">f" This value depends on another variable, which is not supported. This restriction may be"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t733" href="#t733">733</a></span><span class="t"> <span class="str">f" lifted in the future."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t734" href="#t734">734</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t735" href="#t735">735</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t736" href="#t736">736</a></span><span class="t"> <span class="nam">manifest_variables</span><span class="op">[</span><span class="nam">variable_name</span><span class="op">]</span> <span class="op">=</span> <span class="nam">PluginProvidedManifestVariable</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t737" href="#t737">737</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t738" href="#t738">738</a></span><span class="t"> <span class="nam">variable_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t739" href="#t739">739</a></span><span class="t"> <span class="nam">value</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t740" href="#t740">740</a></span><span class="t"> <span class="nam">is_context_specific_variable</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t741" href="#t741">741</a></span><span class="t"> <span class="nam">variable_reference_documentation</span><span class="op">=</span><span class="nam">variable_reference_documentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t742" href="#t742">742</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t743" href="#t743">743</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t744" href="#t744">744</a></span><span class="t"> <span class="key">def</span> <span class="nam">_unload</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t745" href="#t745">745</a></span><span class="t"> <span class="com"># We need to check it was never resolved</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t746" href="#t746">746</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginInitializationError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t747" href="#t747">747</a></span><span class="t"> <span class="str">"Cannot unload manifest_variable (not implemented)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t748" href="#t748">748</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t749" href="#t749">749</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t750" href="#t750">750</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_unloaders</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">_unload</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t751" href="#t751">751</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t752" href="#t752">752</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t753" href="#t753">753</a></span><span class="t"> <span class="key">def</span> <span class="nam">_plugin_name</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t754" href="#t754">754</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_metadata</span><span class="op">.</span><span class="nam">plugin_name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t755" href="#t755">755</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t756" href="#t756">756</a></span><span class="t"> <span class="key">def</span> <span class="nam">provide_manifest_keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t757" href="#t757">757</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t758" href="#t758">758</a></span><span class="t"> <span class="nam">rule_type</span><span class="op">:</span> <span class="nam">TTP</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t759" href="#t759">759</a></span><span class="t"> <span class="nam">rule_name</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t760" href="#t760">760</a></span><span class="t"> <span class="nam">handler</span><span class="op">:</span> <span class="nam">DIPKWHandler</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t761" href="#t761">761</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t762" href="#t762">762</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ParserDocumentation</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t763" href="#t763">763</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t764" href="#t764">764</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_restricted_api</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t765" href="#t765">765</a></span><span class="t"> <span class="nam">parser_generator</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_feature_set</span><span class="op">.</span><span class="nam">manifest_parser_generator</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t766" href="#t766">766</a></span><span class="t"> <span class="key">if</span> <span class="nam">rule_type</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">parser_generator</span><span class="op">.</span><span class="nam">dispatchable_table_parsers</span><span class="op">:</span> </span><span class="r"><span class="annotate short">766 ↛ 767</span><span class="annotate long">line 766 didn't jump to line 767, because the condition on line 766 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t767" href="#t767">767</a></span><span class="t"> <span class="nam">types</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t768" href="#t768">768</a></span><span class="t"> <span class="nam">sorted</span><span class="op">(</span><span class="nam">x</span><span class="op">.</span><span class="nam">__name__</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">parser_generator</span><span class="op">.</span><span class="nam">dispatchable_table_parsers</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t769" href="#t769">769</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t770" href="#t770">770</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t771" href="#t771">771</a></span><span class="t"> <span class="str">f"The rule_type was not a supported type. It must be one of {types}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t772" href="#t772">772</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t773" href="#t773">773</a></span><span class="t"> <span class="nam">dispatching_parser</span> <span class="op">=</span> <span class="nam">parser_generator</span><span class="op">.</span><span class="nam">dispatchable_table_parsers</span><span class="op">[</span><span class="nam">rule_type</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t774" href="#t774">774</a></span><span class="t"> <span class="nam">dispatching_parser</span><span class="op">.</span><span class="nam">register_keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t775" href="#t775">775</a></span><span class="t"> <span class="nam">rule_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t776" href="#t776">776</a></span><span class="t"> <span class="nam">handler</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t777" href="#t777">777</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t778" href="#t778">778</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">inline_reference_documentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t779" href="#t779">779</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t780" href="#t780">780</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t781" href="#t781">781</a></span><span class="t"> <span class="key">def</span> <span class="nam">_unload</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t782" href="#t782">782</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginInitializationError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t783" href="#t783">783</a></span><span class="t"> <span class="str">"Cannot unload provide_manifest_keyword (not implemented)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t784" href="#t784">784</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t785" href="#t785">785</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t786" href="#t786">786</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_unloaders</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">_unload</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t787" href="#t787">787</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t788" href="#t788">788</a></span><span class="t"> <span class="key">def</span> <span class="nam">pluggable_object_parser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t789" href="#t789">789</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t790" href="#t790">790</a></span><span class="t"> <span class="nam">rule_type</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t791" href="#t791">791</a></span><span class="t"> <span class="nam">rule_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t792" href="#t792">792</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t793" href="#t793">793</a></span><span class="t"> <span class="nam">object_parser_key</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t794" href="#t794">794</a></span><span class="t"> <span class="nam">on_end_parse_step</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t795" href="#t795">795</a></span><span class="t"> <span class="nam">Callable</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t796" href="#t796">796</a></span><span class="t"> <span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> <span class="nam">AttributePath</span><span class="op">,</span> <span class="nam">ParserContextData</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t797" href="#t797">797</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t798" href="#t798">798</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t799" href="#t799">799</a></span><span class="t"> <span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t800" href="#t800">800</a></span><span class="t"> <span class="nam">nested_in_package_context</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t801" href="#t801">801</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t802" href="#t802">802</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_restricted_api</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t803" href="#t803">803</a></span><span class="t"> <span class="key">if</span> <span class="nam">object_parser_key</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">803 ↛ 804</span><span class="annotate long">line 803 didn't jump to line 804, because the condition on line 803 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t804" href="#t804">804</a></span><span class="t"> <span class="nam">object_parser_key</span> <span class="op">=</span> <span class="nam">rule_name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t805" href="#t805">805</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t806" href="#t806">806</a></span><span class="t"> <span class="nam">parser_generator</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_feature_set</span><span class="op">.</span><span class="nam">manifest_parser_generator</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t807" href="#t807">807</a></span><span class="t"> <span class="nam">dispatchable_object_parsers</span> <span class="op">=</span> <span class="nam">parser_generator</span><span class="op">.</span><span class="nam">dispatchable_object_parsers</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t808" href="#t808">808</a></span><span class="t"> <span class="key">if</span> <span class="nam">rule_type</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">dispatchable_object_parsers</span><span class="op">:</span> </span><span class="r"><span class="annotate short">808 ↛ 809</span><span class="annotate long">line 808 didn't jump to line 809, because the condition on line 808 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t809" href="#t809">809</a></span><span class="t"> <span class="nam">types</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">sorted</span><span class="op">(</span><span class="nam">dispatchable_object_parsers</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t810" href="#t810">810</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t811" href="#t811">811</a></span><span class="t"> <span class="str">f"The rule_type was not a supported type. It must be one of {types}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t812" href="#t812">812</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t813" href="#t813">813</a></span><span class="t"> <span class="key">if</span> <span class="nam">object_parser_key</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">dispatchable_object_parsers</span><span class="op">:</span> </span><span class="r"><span class="annotate short">813 ↛ 814</span><span class="annotate long">line 813 didn't jump to line 814, because the condition on line 813 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t814" href="#t814">814</a></span><span class="t"> <span class="nam">types</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">sorted</span><span class="op">(</span><span class="nam">dispatchable_object_parsers</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t815" href="#t815">815</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t816" href="#t816">816</a></span><span class="t"> <span class="str">f"The object_parser_key was not a supported type. It must be one of {types}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t817" href="#t817">817</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t818" href="#t818">818</a></span><span class="t"> <span class="nam">parent_dispatcher</span> <span class="op">=</span> <span class="nam">dispatchable_object_parsers</span><span class="op">[</span><span class="nam">rule_type</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t819" href="#t819">819</a></span><span class="t"> <span class="nam">child_dispatcher</span> <span class="op">=</span> <span class="nam">dispatchable_object_parsers</span><span class="op">[</span><span class="nam">object_parser_key</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t820" href="#t820">820</a></span><span class="t"> <span class="nam">parent_dispatcher</span><span class="op">.</span><span class="nam">register_child_parser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t821" href="#t821">821</a></span><span class="t"> <span class="nam">rule_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t822" href="#t822">822</a></span><span class="t"> <span class="nam">child_dispatcher</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t823" href="#t823">823</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t824" href="#t824">824</a></span><span class="t"> <span class="nam">on_end_parse_step</span><span class="op">=</span><span class="nam">on_end_parse_step</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t825" href="#t825">825</a></span><span class="t"> <span class="nam">nested_in_package_context</span><span class="op">=</span><span class="nam">nested_in_package_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t826" href="#t826">826</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t827" href="#t827">827</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t828" href="#t828">828</a></span><span class="t"> <span class="key">def</span> <span class="nam">_unload</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t829" href="#t829">829</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginInitializationError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t830" href="#t830">830</a></span><span class="t"> <span class="str">"Cannot unload pluggable_object_parser (not implemented)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t831" href="#t831">831</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t832" href="#t832">832</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t833" href="#t833">833</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_unloaders</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">_unload</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t834" href="#t834">834</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t835" href="#t835">835</a></span><span class="t"> <span class="key">def</span> <span class="nam">pluggable_manifest_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t836" href="#t836">836</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t837" href="#t837">837</a></span><span class="t"> <span class="nam">rule_type</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">TTP</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t838" href="#t838">838</a></span><span class="t"> <span class="nam">rule_name</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t839" href="#t839">839</a></span><span class="t"> <span class="nam">parsed_format</span><span class="op">:</span> <span class="nam">Type</span><span class="op">[</span><span class="nam">PF</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t840" href="#t840">840</a></span><span class="t"> <span class="nam">handler</span><span class="op">:</span> <span class="nam">DIPHandler</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t841" href="#t841">841</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t842" href="#t842">842</a></span><span class="t"> <span class="nam">source_format</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">SF</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t843" href="#t843">843</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ParserDocumentation</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t844" href="#t844">844</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t845" href="#t845">845</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_restricted_api</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t846" href="#t846">846</a></span><span class="t"> <span class="nam">feature_set</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_feature_set</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t847" href="#t847">847</a></span><span class="t"> <span class="nam">parser_generator</span> <span class="op">=</span> <span class="nam">feature_set</span><span class="op">.</span><span class="nam">manifest_parser_generator</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t848" href="#t848">848</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">rule_type</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t849" href="#t849">849</a></span><span class="t"> <span class="key">if</span> <span class="nam">rule_type</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">parser_generator</span><span class="op">.</span><span class="nam">dispatchable_object_parsers</span><span class="op">:</span> </span><span class="r"><span class="annotate short">849 ↛ 850</span><span class="annotate long">line 849 didn't jump to line 850, because the condition on line 849 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t850" href="#t850">850</a></span><span class="t"> <span class="nam">types</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">sorted</span><span class="op">(</span><span class="nam">parser_generator</span><span class="op">.</span><span class="nam">dispatchable_object_parsers</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t851" href="#t851">851</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t852" href="#t852">852</a></span><span class="t"> <span class="str">f"The rule_type was not a supported type. It must be one of {types}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t853" href="#t853">853</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t854" href="#t854">854</a></span><span class="t"> <span class="nam">dispatching_parser</span> <span class="op">=</span> <span class="nam">parser_generator</span><span class="op">.</span><span class="nam">dispatchable_object_parsers</span><span class="op">[</span><span class="nam">rule_type</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t855" href="#t855">855</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t856" href="#t856">856</a></span><span class="t"> <span class="key">if</span> <span class="nam">rule_type</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">parser_generator</span><span class="op">.</span><span class="nam">dispatchable_table_parsers</span><span class="op">:</span> </span><span class="r"><span class="annotate short">856 ↛ 857</span><span class="annotate long">line 856 didn't jump to line 857, because the condition on line 856 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t857" href="#t857">857</a></span><span class="t"> <span class="nam">types</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t858" href="#t858">858</a></span><span class="t"> <span class="nam">sorted</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t859" href="#t859">859</a></span><span class="t"> <span class="nam">x</span><span class="op">.</span><span class="nam">__name__</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">parser_generator</span><span class="op">.</span><span class="nam">dispatchable_table_parsers</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t860" href="#t860">860</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t861" href="#t861">861</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t862" href="#t862">862</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t863" href="#t863">863</a></span><span class="t"> <span class="str">f"The rule_type was not a supported type. It must be one of {types}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t864" href="#t864">864</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t865" href="#t865">865</a></span><span class="t"> <span class="nam">dispatching_parser</span> <span class="op">=</span> <span class="nam">parser_generator</span><span class="op">.</span><span class="nam">dispatchable_table_parsers</span><span class="op">[</span><span class="nam">rule_type</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t866" href="#t866">866</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t867" href="#t867">867</a></span><span class="t"> <span class="nam">parser</span> <span class="op">=</span> <span class="nam">feature_set</span><span class="op">.</span><span class="nam">manifest_parser_generator</span><span class="op">.</span><span class="nam">generate_parser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t868" href="#t868">868</a></span><span class="t"> <span class="nam">parsed_format</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t869" href="#t869">869</a></span><span class="t"> <span class="nam">source_content</span><span class="op">=</span><span class="nam">source_format</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t870" href="#t870">870</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">inline_reference_documentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t871" href="#t871">871</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t872" href="#t872">872</a></span><span class="t"> <span class="nam">dispatching_parser</span><span class="op">.</span><span class="nam">register_parser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t873" href="#t873">873</a></span><span class="t"> <span class="nam">rule_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t874" href="#t874">874</a></span><span class="t"> <span class="nam">parser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t875" href="#t875">875</a></span><span class="t"> <span class="nam">handler</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t876" href="#t876">876</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t877" href="#t877">877</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t878" href="#t878">878</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t879" href="#t879">879</a></span><span class="t"> <span class="key">def</span> <span class="nam">_unload</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t880" href="#t880">880</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginInitializationError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t881" href="#t881">881</a></span><span class="t"> <span class="str">"Cannot unload pluggable_manifest_rule (not implemented)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t882" href="#t882">882</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t883" href="#t883">883</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t884" href="#t884">884</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_unloaders</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">_unload</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t885" href="#t885">885</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t886" href="#t886">886</a></span><span class="t"> <span class="key">def</span> <span class="nam">known_packaging_files</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t887" href="#t887">887</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t888" href="#t888">888</a></span><span class="t"> <span class="nam">packaging_file_details</span><span class="op">:</span> <span class="nam">KnownPackagingFileInfo</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t889" href="#t889">889</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t890" href="#t890">890</a></span><span class="t"> <span class="nam">known_packaging_files</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_feature_set</span><span class="op">.</span><span class="nam">known_packaging_files</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t891" href="#t891">891</a></span><span class="t"> <span class="nam">detection_method</span> <span class="op">=</span> <span class="nam">packaging_file_details</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t892" href="#t892">892</a></span><span class="t"> <span class="str">"detection_method"</span><span class="op">,</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"Literal['path']"</span><span class="op">,</span> <span class="str">"path"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t893" href="#t893">893</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t894" href="#t894">894</a></span><span class="t"> <span class="nam">path</span> <span class="op">=</span> <span class="nam">packaging_file_details</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"path"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t895" href="#t895">895</a></span><span class="t"> <span class="nam">dhpkgfile</span> <span class="op">=</span> <span class="nam">packaging_file_details</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"pkgfile"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t896" href="#t896">896</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t897" href="#t897">897</a></span><span class="t"> <span class="nam">packaging_file_details</span><span class="op">:</span> <span class="nam">KnownPackagingFileInfo</span> <span class="op">=</span> <span class="nam">packaging_file_details</span><span class="op">.</span><span class="nam">copy</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t898" href="#t898">898</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t899" href="#t899">899</a></span><span class="t"> <span class="key">if</span> <span class="nam">detection_method</span> <span class="op">==</span> <span class="str">"path"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t900" href="#t900">900</a></span><span class="t"> <span class="key">if</span> <span class="nam">dhpkgfile</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t901" href="#t901">901</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t902" href="#t902">902</a></span><span class="t"> <span class="str">'The "pkgfile" attribute cannot be used when detection-method is "path" (or omitted)'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t903" href="#t903">903</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t904" href="#t904">904</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span> <span class="op">!=</span> <span class="nam">_normalize_path</span><span class="op">(</span><span class="nam">path</span><span class="op">,</span> <span class="nam">with_prefix</span><span class="op">=</span><span class="key">False</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t905" href="#t905">905</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t906" href="#t906">906</a></span><span class="t"> <span class="str">f"The path for known packaging files must be normalized. Please replace"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t907" href="#t907">907</a></span><span class="t"> <span class="str">f' "{path}" with "{_normalize_path(path, with_prefix=False)}"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t908" href="#t908">908</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t909" href="#t909">909</a></span><span class="t"> <span class="nam">detection_value</span> <span class="op">=</span> <span class="nam">path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t910" href="#t910">910</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t911" href="#t911">911</a></span><span class="t"> <span class="key">assert</span> <span class="nam">detection_method</span> <span class="op">==</span> <span class="str">"dh.pkgfile"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t912" href="#t912">912</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t913" href="#t913">913</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t914" href="#t914">914</a></span><span class="t"> <span class="str">'The "path" attribute cannot be used when detection-method is "dh.pkgfile"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t915" href="#t915">915</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t916" href="#t916">916</a></span><span class="t"> <span class="key">if</span> <span class="str">"/"</span> <span class="key">in</span> <span class="nam">dhpkgfile</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t917" href="#t917">917</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t918" href="#t918">918</a></span><span class="t"> <span class="str">'The "pkgfile" attribute ḿust be a name stem such as "install" (no "/" are allowed)'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t919" href="#t919">919</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t920" href="#t920">920</a></span><span class="t"> <span class="nam">detection_value</span> <span class="op">=</span> <span class="nam">dhpkgfile</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t921" href="#t921">921</a></span><span class="t"> <span class="nam">key</span> <span class="op">=</span> <span class="str">f"{detection_method}::{detection_value}"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t922" href="#t922">922</a></span><span class="t"> <span class="nam">existing</span> <span class="op">=</span> <span class="nam">known_packaging_files</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t923" href="#t923">923</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t924" href="#t924">924</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing</span><span class="op">.</span><span class="nam">plugin_metadata</span><span class="op">.</span><span class="nam">plugin_name</span> <span class="op">!=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_name</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t925" href="#t925">925</a></span><span class="t"> <span class="nam">message</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t926" href="#t926">926</a></span><span class="t"> <span class="str">f'The key "{key}" is registered twice for known packaging files.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t927" href="#t927">927</a></span><span class="t"> <span class="str">f" Once by {existing.plugin_metadata.plugin_name} and once by {self._plugin_name}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t928" href="#t928">928</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t929" href="#t929">929</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t930" href="#t930">930</a></span><span class="t"> <span class="nam">message</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t931" href="#t931">931</a></span><span class="t"> <span class="str">f"Bug in the plugin {self._plugin_name}: It tried to register the"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t932" href="#t932">932</a></span><span class="t"> <span class="str">f' key "{key}" twice for known packaging files.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t933" href="#t933">933</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t934" href="#t934">934</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginConflictError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t935" href="#t935">935</a></span><span class="t"> <span class="nam">message</span><span class="op">,</span> <span class="nam">existing</span><span class="op">.</span><span class="nam">plugin_metadata</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_metadata</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t936" href="#t936">936</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t937" href="#t937">937</a></span><span class="t"> <span class="nam">_validate_known_packaging_file_dh_compat_rules</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t938" href="#t938">938</a></span><span class="t"> <span class="nam">packaging_file_details</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"dh_compat_rules"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t939" href="#t939">939</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t940" href="#t940">940</a></span><span class="t"> <span class="nam">known_packaging_files</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> <span class="op">=</span> <span class="nam">PluginProvidedKnownPackagingFile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t941" href="#t941">941</a></span><span class="t"> <span class="nam">packaging_file_details</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t942" href="#t942">942</a></span><span class="t"> <span class="nam">detection_method</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t943" href="#t943">943</a></span><span class="t"> <span class="nam">detection_value</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t944" href="#t944">944</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t945" href="#t945">945</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t946" href="#t946">946</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t947" href="#t947">947</a></span><span class="t"> <span class="key">def</span> <span class="nam">_unload</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t948" href="#t948">948</a></span><span class="t"> <span class="key">del</span> <span class="nam">known_packaging_files</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t949" href="#t949">949</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t950" href="#t950">950</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_unloaders</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">_unload</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t951" href="#t951">951</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t952" href="#t952">952</a></span><span class="t"> <span class="key">def</span> <span class="nam">register_mapped_type</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t953" href="#t953">953</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t954" href="#t954">954</a></span><span class="t"> <span class="nam">type_mapping</span><span class="op">:</span> <span class="nam">TypeMapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t955" href="#t955">955</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t956" href="#t956">956</a></span><span class="t"> <span class="nam">reference_documentation</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">TypeMappingDocumentation</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t957" href="#t957">957</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t958" href="#t958">958</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_restricted_api</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t959" href="#t959">959</a></span><span class="t"> <span class="nam">target_type</span> <span class="op">=</span> <span class="nam">type_mapping</span><span class="op">.</span><span class="nam">target_type</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t960" href="#t960">960</a></span><span class="t"> <span class="nam">mapped_types</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_feature_set</span><span class="op">.</span><span class="nam">mapped_types</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t961" href="#t961">961</a></span><span class="t"> <span class="nam">existing</span> <span class="op">=</span> <span class="nam">mapped_types</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">target_type</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t962" href="#t962">962</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">962 ↛ 963</span><span class="annotate long">line 962 didn't jump to line 963, because the condition on line 962 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t963" href="#t963">963</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing</span><span class="op">.</span><span class="nam">plugin_metadata</span><span class="op">.</span><span class="nam">plugin_name</span> <span class="op">!=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_name</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t964" href="#t964">964</a></span><span class="t"> <span class="nam">message</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t965" href="#t965">965</a></span><span class="t"> <span class="str">f'The key "{target_type.__name__}" is registered twice for known packaging files.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t966" href="#t966">966</a></span><span class="t"> <span class="str">f" Once by {existing.plugin_metadata.plugin_name} and once by {self._plugin_name}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t967" href="#t967">967</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t968" href="#t968">968</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t969" href="#t969">969</a></span><span class="t"> <span class="nam">message</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t970" href="#t970">970</a></span><span class="t"> <span class="str">f"Bug in the plugin {self._plugin_name}: It tried to register the"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t971" href="#t971">971</a></span><span class="t"> <span class="str">f' key "{target_type.__name__}" twice for known packaging files.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t972" href="#t972">972</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t973" href="#t973">973</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginConflictError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t974" href="#t974">974</a></span><span class="t"> <span class="nam">message</span><span class="op">,</span> <span class="nam">existing</span><span class="op">.</span><span class="nam">plugin_metadata</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_metadata</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t975" href="#t975">975</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t976" href="#t976">976</a></span><span class="t"> <span class="nam">parser_generator</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_feature_set</span><span class="op">.</span><span class="nam">manifest_parser_generator</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t977" href="#t977">977</a></span><span class="t"> <span class="nam">mapped_types</span><span class="op">[</span><span class="nam">target_type</span><span class="op">]</span> <span class="op">=</span> <span class="nam">PluginProvidedTypeMapping</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t978" href="#t978">978</a></span><span class="t"> <span class="nam">type_mapping</span><span class="op">,</span> <span class="nam">reference_documentation</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_metadata</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t979" href="#t979">979</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t980" href="#t980">980</a></span><span class="t"> <span class="nam">parser_generator</span><span class="op">.</span><span class="nam">register_mapped_type</span><span class="op">(</span><span class="nam">type_mapping</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t981" href="#t981">981</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t982" href="#t982">982</a></span><span class="t"> <span class="key">def</span> <span class="nam">_restricted_api</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t983" href="#t983">983</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t984" href="#t984">984</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t985" href="#t985">985</a></span><span class="t"> <span class="nam">allowed_plugins</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t986" href="#t986">986</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t987" href="#t987">987</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_name</span> <span class="op">!=</span> <span class="str">"debputy"</span> <span class="key">and</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_name</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">allowed_plugins</span><span class="op">:</span> </span><span class="r"><span class="annotate short">987 ↛ 988</span><span class="annotate long">line 987 didn't jump to line 988, because the condition on line 987 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t988" href="#t988">988</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginAPIViolationError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t989" href="#t989">989</a></span><span class="t"> <span class="str">f"Plugin {self._plugin_name} attempted to access a debputy-only API."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t990" href="#t990">990</a></span><span class="t"> <span class="str">" If you are the maintainer of this plugin and want access to this"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t991" href="#t991">991</a></span><span class="t"> <span class="str">" API, please file a feature request to make this public."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t992" href="#t992">992</a></span><span class="t"> <span class="str">" (The API is currently private as it is unstable.)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t993" href="#t993">993</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t994" href="#t994">994</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t995" href="#t995">995</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t996" href="#t996">996</a></span><span class="t"><span class="key">class</span> <span class="nam">MaintscriptAccessorProviderBase</span><span class="op">(</span><span class="nam">MaintscriptAccessor</span><span class="op">,</span> <span class="nam">ABC</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t997" href="#t997">997</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t998" href="#t998">998</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t999" href="#t999">999</a></span><span class="t"> <span class="key">def</span> <span class="nam">_append_script</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1000" href="#t1000">1000</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1001" href="#t1001">1001</a></span><span class="t"> <span class="nam">caller_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1002" href="#t1002">1002</a></span><span class="t"> <span class="nam">maintscript</span><span class="op">:</span> <span class="nam">Maintscript</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1003" href="#t1003">1003</a></span><span class="t"> <span class="nam">full_script</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1004" href="#t1004">1004</a></span><span class="t"> <span class="op">/</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1005" href="#t1005">1005</a></span><span class="t"> <span class="nam">perform_substitution</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1006" href="#t1006">1006</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1007" href="#t1007">1007</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1008" href="#t1008">1008</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1009" href="#t1009">1009</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1010" href="#t1010">1010</a></span><span class="t"> <span class="key">def</span> <span class="nam">_apply_condition_to_script</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1011" href="#t1011">1011</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1012" href="#t1012">1012</a></span><span class="t"> <span class="nam">condition</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1013" href="#t1013">1013</a></span><span class="t"> <span class="nam">run_snippet</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1014" href="#t1014">1014</a></span><span class="t"> <span class="op">/</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1015" href="#t1015">1015</a></span><span class="t"> <span class="nam">indent</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1016" href="#t1016">1016</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1017" href="#t1017">1017</a></span><span class="t"> <span class="key">if</span> <span class="nam">indent</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1018" href="#t1018">1018</a></span><span class="t"> <span class="com"># We auto-determine this based on heredocs currently</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1019" href="#t1019">1019</a></span><span class="t"> <span class="nam">indent</span> <span class="op">=</span> <span class="str">"<<"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">run_snippet</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1020" href="#t1020">1020</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1021" href="#t1021">1021</a></span><span class="t"> <span class="key">if</span> <span class="nam">indent</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1022" href="#t1022">1022</a></span><span class="t"> <span class="nam">run_snippet</span> <span class="op">=</span> <span class="str">""</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="str">" "</span> <span class="op">+</span> <span class="nam">x</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">run_snippet</span><span class="op">.</span><span class="nam">splitlines</span><span class="op">(</span><span class="key">True</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1023" href="#t1023">1023</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">run_snippet</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1024" href="#t1024">1024</a></span><span class="t"> <span class="nam">run_snippet</span> <span class="op">+=</span> <span class="str">"\n"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1025" href="#t1025">1025</a></span><span class="t"> <span class="nam">condition_line</span> <span class="op">=</span> <span class="str">f"if {condition}; then\n"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1026" href="#t1026">1026</a></span><span class="t"> <span class="nam">end_line</span> <span class="op">=</span> <span class="str">"fi\n"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1027" href="#t1027">1027</a></span><span class="t"> <span class="key">return</span> <span class="str">""</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="op">(</span><span class="nam">condition_line</span><span class="op">,</span> <span class="nam">run_snippet</span><span class="op">,</span> <span class="nam">end_line</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1028" href="#t1028">1028</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1029" href="#t1029">1029</a></span><span class="t"> <span class="key">def</span> <span class="nam">on_configure</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1030" href="#t1030">1030</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1031" href="#t1031">1031</a></span><span class="t"> <span class="nam">run_snippet</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1032" href="#t1032">1032</a></span><span class="t"> <span class="op">/</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1033" href="#t1033">1033</a></span><span class="t"> <span class="nam">indent</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1034" href="#t1034">1034</a></span><span class="t"> <span class="nam">perform_substitution</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1035" href="#t1035">1035</a></span><span class="t"> <span class="nam">skip_on_rollback</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1036" href="#t1036">1036</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1037" href="#t1037">1037</a></span><span class="t"> <span class="nam">condition</span> <span class="op">=</span> <span class="nam">POSTINST_DEFAULT_CONDITION</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1038" href="#t1038">1038</a></span><span class="t"> <span class="key">if</span> <span class="nam">skip_on_rollback</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1038 ↛ 1039</span><span class="annotate long">line 1038 didn't jump to line 1039, because the condition on line 1038 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1039" href="#t1039">1039</a></span><span class="t"> <span class="nam">condition</span> <span class="op">=</span> <span class="str">'[ "$1" = "configure" ]'</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1040" href="#t1040">1040</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_append_script</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1041" href="#t1041">1041</a></span><span class="t"> <span class="str">"on_configure"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1042" href="#t1042">1042</a></span><span class="t"> <span class="str">"postinst"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1043" href="#t1043">1043</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_apply_condition_to_script</span><span class="op">(</span><span class="nam">condition</span><span class="op">,</span> <span class="nam">run_snippet</span><span class="op">,</span> <span class="nam">indent</span><span class="op">=</span><span class="nam">indent</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1044" href="#t1044">1044</a></span><span class="t"> <span class="nam">perform_substitution</span><span class="op">=</span><span class="nam">perform_substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1045" href="#t1045">1045</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1046" href="#t1046">1046</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1047" href="#t1047">1047</a></span><span class="t"> <span class="key">def</span> <span class="nam">on_initial_install</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1048" href="#t1048">1048</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1049" href="#t1049">1049</a></span><span class="t"> <span class="nam">run_snippet</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1050" href="#t1050">1050</a></span><span class="t"> <span class="op">/</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1051" href="#t1051">1051</a></span><span class="t"> <span class="nam">indent</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1052" href="#t1052">1052</a></span><span class="t"> <span class="nam">perform_substitution</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1053" href="#t1053">1053</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1054" href="#t1054">1054</a></span><span class="t"> <span class="nam">condition</span> <span class="op">=</span> <span class="str">'[ "$1" = "configure" -a -z "$2" ]'</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1055" href="#t1055">1055</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_append_script</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1056" href="#t1056">1056</a></span><span class="t"> <span class="str">"on_initial_install"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1057" href="#t1057">1057</a></span><span class="t"> <span class="str">"postinst"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1058" href="#t1058">1058</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_apply_condition_to_script</span><span class="op">(</span><span class="nam">condition</span><span class="op">,</span> <span class="nam">run_snippet</span><span class="op">,</span> <span class="nam">indent</span><span class="op">=</span><span class="nam">indent</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1059" href="#t1059">1059</a></span><span class="t"> <span class="nam">perform_substitution</span><span class="op">=</span><span class="nam">perform_substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1060" href="#t1060">1060</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1061" href="#t1061">1061</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1062" href="#t1062">1062</a></span><span class="t"> <span class="key">def</span> <span class="nam">on_upgrade</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1063" href="#t1063">1063</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1064" href="#t1064">1064</a></span><span class="t"> <span class="nam">run_snippet</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1065" href="#t1065">1065</a></span><span class="t"> <span class="op">/</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1066" href="#t1066">1066</a></span><span class="t"> <span class="nam">indent</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1067" href="#t1067">1067</a></span><span class="t"> <span class="nam">perform_substitution</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1068" href="#t1068">1068</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1069" href="#t1069">1069</a></span><span class="t"> <span class="nam">condition</span> <span class="op">=</span> <span class="str">'[ "$1" = "configure" -a -n "$2" ]'</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1070" href="#t1070">1070</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_append_script</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1071" href="#t1071">1071</a></span><span class="t"> <span class="str">"on_upgrade"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1072" href="#t1072">1072</a></span><span class="t"> <span class="str">"postinst"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1073" href="#t1073">1073</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_apply_condition_to_script</span><span class="op">(</span><span class="nam">condition</span><span class="op">,</span> <span class="nam">run_snippet</span><span class="op">,</span> <span class="nam">indent</span><span class="op">=</span><span class="nam">indent</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1074" href="#t1074">1074</a></span><span class="t"> <span class="nam">perform_substitution</span><span class="op">=</span><span class="nam">perform_substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1075" href="#t1075">1075</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1076" href="#t1076">1076</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1077" href="#t1077">1077</a></span><span class="t"> <span class="key">def</span> <span class="nam">on_upgrade_from</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1078" href="#t1078">1078</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1079" href="#t1079">1079</a></span><span class="t"> <span class="nam">version</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1080" href="#t1080">1080</a></span><span class="t"> <span class="nam">run_snippet</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1081" href="#t1081">1081</a></span><span class="t"> <span class="op">/</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1082" href="#t1082">1082</a></span><span class="t"> <span class="nam">indent</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1083" href="#t1083">1083</a></span><span class="t"> <span class="nam">perform_substitution</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1084" href="#t1084">1084</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1085" href="#t1085">1085</a></span><span class="t"> <span class="nam">condition</span> <span class="op">=</span> <span class="str">'[ "$1" = "configure" ] && dpkg --compare-versions le-nl "$2"'</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1086" href="#t1086">1086</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_append_script</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1087" href="#t1087">1087</a></span><span class="t"> <span class="str">"on_upgrade_from"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1088" href="#t1088">1088</a></span><span class="t"> <span class="str">"postinst"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1089" href="#t1089">1089</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_apply_condition_to_script</span><span class="op">(</span><span class="nam">condition</span><span class="op">,</span> <span class="nam">run_snippet</span><span class="op">,</span> <span class="nam">indent</span><span class="op">=</span><span class="nam">indent</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1090" href="#t1090">1090</a></span><span class="t"> <span class="nam">perform_substitution</span><span class="op">=</span><span class="nam">perform_substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1091" href="#t1091">1091</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1092" href="#t1092">1092</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1093" href="#t1093">1093</a></span><span class="t"> <span class="key">def</span> <span class="nam">on_before_removal</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1094" href="#t1094">1094</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1095" href="#t1095">1095</a></span><span class="t"> <span class="nam">run_snippet</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1096" href="#t1096">1096</a></span><span class="t"> <span class="op">/</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1097" href="#t1097">1097</a></span><span class="t"> <span class="nam">indent</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1098" href="#t1098">1098</a></span><span class="t"> <span class="nam">perform_substitution</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1099" href="#t1099">1099</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1100" href="#t1100">1100</a></span><span class="t"> <span class="nam">condition</span> <span class="op">=</span> <span class="str">'[ "$1" = "remove" ]'</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1101" href="#t1101">1101</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_append_script</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1102" href="#t1102">1102</a></span><span class="t"> <span class="str">"on_before_removal"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1103" href="#t1103">1103</a></span><span class="t"> <span class="str">"prerm"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1104" href="#t1104">1104</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_apply_condition_to_script</span><span class="op">(</span><span class="nam">condition</span><span class="op">,</span> <span class="nam">run_snippet</span><span class="op">,</span> <span class="nam">indent</span><span class="op">=</span><span class="nam">indent</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1105" href="#t1105">1105</a></span><span class="t"> <span class="nam">perform_substitution</span><span class="op">=</span><span class="nam">perform_substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1106" href="#t1106">1106</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1107" href="#t1107">1107</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1108" href="#t1108">1108</a></span><span class="t"> <span class="key">def</span> <span class="nam">on_removed</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1109" href="#t1109">1109</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1110" href="#t1110">1110</a></span><span class="t"> <span class="nam">run_snippet</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1111" href="#t1111">1111</a></span><span class="t"> <span class="op">/</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1112" href="#t1112">1112</a></span><span class="t"> <span class="nam">indent</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1113" href="#t1113">1113</a></span><span class="t"> <span class="nam">perform_substitution</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1114" href="#t1114">1114</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1115" href="#t1115">1115</a></span><span class="t"> <span class="nam">condition</span> <span class="op">=</span> <span class="str">'[ "$1" = "remove" ]'</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1116" href="#t1116">1116</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_append_script</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1117" href="#t1117">1117</a></span><span class="t"> <span class="str">"on_removed"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1118" href="#t1118">1118</a></span><span class="t"> <span class="str">"postrm"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1119" href="#t1119">1119</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_apply_condition_to_script</span><span class="op">(</span><span class="nam">condition</span><span class="op">,</span> <span class="nam">run_snippet</span><span class="op">,</span> <span class="nam">indent</span><span class="op">=</span><span class="nam">indent</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1120" href="#t1120">1120</a></span><span class="t"> <span class="nam">perform_substitution</span><span class="op">=</span><span class="nam">perform_substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1121" href="#t1121">1121</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1122" href="#t1122">1122</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1123" href="#t1123">1123</a></span><span class="t"> <span class="key">def</span> <span class="nam">on_purge</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1124" href="#t1124">1124</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1125" href="#t1125">1125</a></span><span class="t"> <span class="nam">run_snippet</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1126" href="#t1126">1126</a></span><span class="t"> <span class="op">/</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1127" href="#t1127">1127</a></span><span class="t"> <span class="nam">indent</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1128" href="#t1128">1128</a></span><span class="t"> <span class="nam">perform_substitution</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1129" href="#t1129">1129</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1130" href="#t1130">1130</a></span><span class="t"> <span class="nam">condition</span> <span class="op">=</span> <span class="str">'[ "$1" = "purge" ]'</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1131" href="#t1131">1131</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_append_script</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1132" href="#t1132">1132</a></span><span class="t"> <span class="str">"on_purge"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1133" href="#t1133">1133</a></span><span class="t"> <span class="str">"postrm"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1134" href="#t1134">1134</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_apply_condition_to_script</span><span class="op">(</span><span class="nam">condition</span><span class="op">,</span> <span class="nam">run_snippet</span><span class="op">,</span> <span class="nam">indent</span><span class="op">=</span><span class="nam">indent</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1135" href="#t1135">1135</a></span><span class="t"> <span class="nam">perform_substitution</span><span class="op">=</span><span class="nam">perform_substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1136" href="#t1136">1136</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1137" href="#t1137">1137</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1138" href="#t1138">1138</a></span><span class="t"> <span class="key">def</span> <span class="nam">unconditionally_in_script</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1139" href="#t1139">1139</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1140" href="#t1140">1140</a></span><span class="t"> <span class="nam">maintscript</span><span class="op">:</span> <span class="nam">Maintscript</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1141" href="#t1141">1141</a></span><span class="t"> <span class="nam">run_snippet</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1142" href="#t1142">1142</a></span><span class="t"> <span class="op">/</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1143" href="#t1143">1143</a></span><span class="t"> <span class="nam">perform_substitution</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1144" href="#t1144">1144</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1145" href="#t1145">1145</a></span><span class="t"> <span class="key">if</span> <span class="nam">maintscript</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">STD_CONTROL_SCRIPTS</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1145 ↛ 1146</span><span class="annotate long">line 1145 didn't jump to line 1146, because the condition on line 1145 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1146" href="#t1146">1146</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1147" href="#t1147">1147</a></span><span class="t"> <span class="str">f'Unknown script "{maintscript}". Should have been one of:'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1148" href="#t1148">1148</a></span><span class="t"> <span class="str">f' {", ".join(sorted(STD_CONTROL_SCRIPTS))}'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1149" href="#t1149">1149</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1150" href="#t1150">1150</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_append_script</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1151" href="#t1151">1151</a></span><span class="t"> <span class="str">"unconditionally_in_script"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1152" href="#t1152">1152</a></span><span class="t"> <span class="nam">maintscript</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1153" href="#t1153">1153</a></span><span class="t"> <span class="nam">run_snippet</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1154" href="#t1154">1154</a></span><span class="t"> <span class="nam">perform_substitution</span><span class="op">=</span><span class="nam">perform_substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1155" href="#t1155">1155</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1156" href="#t1156">1156</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1157" href="#t1157">1157</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1158" href="#t1158">1158</a></span><span class="t"><span class="key">class</span> <span class="nam">MaintscriptAccessorProvider</span><span class="op">(</span><span class="nam">MaintscriptAccessorProviderBase</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1159" href="#t1159">1159</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1160" href="#t1160">1160</a></span><span class="t"> <span class="str">"_plugin_metadata"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1161" href="#t1161">1161</a></span><span class="t"> <span class="str">"_maintscript_snippets"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1162" href="#t1162">1162</a></span><span class="t"> <span class="str">"_plugin_source_id"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1163" href="#t1163">1163</a></span><span class="t"> <span class="str">"_package_substitution"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1164" href="#t1164">1164</a></span><span class="t"> <span class="str">"_default_snippet_order"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1165" href="#t1165">1165</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1166" href="#t1166">1166</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1167" href="#t1167">1167</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1168" href="#t1168">1168</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1169" href="#t1169">1169</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">:</span> <span class="nam">DebputyPluginMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1170" href="#t1170">1170</a></span><span class="t"> <span class="nam">plugin_source_id</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1171" href="#t1171">1171</a></span><span class="t"> <span class="nam">maintscript_snippets</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">MaintscriptSnippetContainer</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1172" href="#t1172">1172</a></span><span class="t"> <span class="nam">package_substitution</span><span class="op">:</span> <span class="nam">Substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1173" href="#t1173">1173</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1174" href="#t1174">1174</a></span><span class="t"> <span class="nam">default_snippet_order</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Literal</span><span class="op">[</span><span class="str">"service"</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1175" href="#t1175">1175</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1176" href="#t1176">1176</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_metadata</span> <span class="op">=</span> <span class="nam">plugin_metadata</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1177" href="#t1177">1177</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_source_id</span> <span class="op">=</span> <span class="nam">plugin_source_id</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1178" href="#t1178">1178</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_maintscript_snippets</span> <span class="op">=</span> <span class="nam">maintscript_snippets</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1179" href="#t1179">1179</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_substitution</span> <span class="op">=</span> <span class="nam">package_substitution</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1180" href="#t1180">1180</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_default_snippet_order</span> <span class="op">=</span> <span class="nam">default_snippet_order</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1181" href="#t1181">1181</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1182" href="#t1182">1182</a></span><span class="t"> <span class="key">def</span> <span class="nam">_append_script</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1183" href="#t1183">1183</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1184" href="#t1184">1184</a></span><span class="t"> <span class="nam">caller_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1185" href="#t1185">1185</a></span><span class="t"> <span class="nam">maintscript</span><span class="op">:</span> <span class="nam">Maintscript</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1186" href="#t1186">1186</a></span><span class="t"> <span class="nam">full_script</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1187" href="#t1187">1187</a></span><span class="t"> <span class="op">/</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1188" href="#t1188">1188</a></span><span class="t"> <span class="nam">perform_substitution</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1189" href="#t1189">1189</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1190" href="#t1190">1190</a></span><span class="t"> <span class="nam">def_source</span> <span class="op">=</span> <span class="str">f"{self._plugin_metadata.plugin_name} ({self._plugin_source_id})"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1191" href="#t1191">1191</a></span><span class="t"> <span class="key">if</span> <span class="nam">perform_substitution</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1192" href="#t1192">1192</a></span><span class="t"> <span class="nam">full_script</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_substitution</span><span class="op">.</span><span class="nam">substitute</span><span class="op">(</span><span class="nam">full_script</span><span class="op">,</span> <span class="nam">def_source</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1193" href="#t1193">1193</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1194" href="#t1194">1194</a></span><span class="t"> <span class="nam">snippet</span> <span class="op">=</span> <span class="nam">MaintscriptSnippet</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1195" href="#t1195">1195</a></span><span class="t"> <span class="nam">snippet</span><span class="op">=</span><span class="nam">full_script</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1196" href="#t1196">1196</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">=</span><span class="nam">def_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1197" href="#t1197">1197</a></span><span class="t"> <span class="nam">snippet_order</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">_default_snippet_order</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1198" href="#t1198">1198</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1199" href="#t1199">1199</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_maintscript_snippets</span><span class="op">[</span><span class="nam">maintscript</span><span class="op">]</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">snippet</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1200" href="#t1200">1200</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1201" href="#t1201">1201</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1202" href="#t1202">1202</a></span><span class="t"><span class="key">class</span> <span class="nam">BinaryCtrlAccessorProviderBase</span><span class="op">(</span><span class="nam">BinaryCtrlAccessor</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1203" href="#t1203">1203</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1204" href="#t1204">1204</a></span><span class="t"> <span class="str">"_plugin_metadata"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1205" href="#t1205">1205</a></span><span class="t"> <span class="str">"_plugin_source_id"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1206" href="#t1206">1206</a></span><span class="t"> <span class="str">"_package_metadata_context"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1207" href="#t1207">1207</a></span><span class="t"> <span class="str">"_triggers"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1208" href="#t1208">1208</a></span><span class="t"> <span class="str">"_substvars"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1209" href="#t1209">1209</a></span><span class="t"> <span class="str">"_maintscript"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1210" href="#t1210">1210</a></span><span class="t"> <span class="str">"_shlibs_details"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1211" href="#t1211">1211</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1212" href="#t1212">1212</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1213" href="#t1213">1213</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1214" href="#t1214">1214</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1215" href="#t1215">1215</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">:</span> <span class="nam">DebputyPluginMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1216" href="#t1216">1216</a></span><span class="t"> <span class="nam">plugin_source_id</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1217" href="#t1217">1217</a></span><span class="t"> <span class="nam">package_metadata_context</span><span class="op">:</span> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1218" href="#t1218">1218</a></span><span class="t"> <span class="nam">triggers</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">DpkgTriggerType</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">PluginProvidedTrigger</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1219" href="#t1219">1219</a></span><span class="t"> <span class="nam">substvars</span><span class="op">:</span> <span class="nam">FlushableSubstvars</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1220" href="#t1220">1220</a></span><span class="t"> <span class="nam">shlibs_details</span><span class="op">:</span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1221" href="#t1221">1221</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1222" href="#t1222">1222</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_metadata</span> <span class="op">=</span> <span class="nam">plugin_metadata</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1223" href="#t1223">1223</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_source_id</span> <span class="op">=</span> <span class="nam">plugin_source_id</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1224" href="#t1224">1224</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_metadata_context</span> <span class="op">=</span> <span class="nam">package_metadata_context</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1225" href="#t1225">1225</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_triggers</span> <span class="op">=</span> <span class="nam">triggers</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1226" href="#t1226">1226</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_substvars</span> <span class="op">=</span> <span class="nam">substvars</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1227" href="#t1227">1227</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_maintscript</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">MaintscriptAccessor</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1228" href="#t1228">1228</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_shlibs_details</span> <span class="op">=</span> <span class="nam">shlibs_details</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1229" href="#t1229">1229</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1230" href="#t1230">1230</a></span><span class="t"> <span class="key">def</span> <span class="nam">_create_maintscript_accessor</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">MaintscriptAccessor</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1231" href="#t1231">1231</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1232" href="#t1232">1232</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1233" href="#t1233">1233</a></span><span class="t"> <span class="key">def</span> <span class="nam">dpkg_trigger</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">trigger_type</span><span class="op">:</span> <span class="nam">DpkgTriggerType</span><span class="op">,</span> <span class="nam">trigger_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1234" href="#t1234">1234</a></span><span class="t"> <span class="str">"""Register a declarative dpkg level trigger</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1235" href="#t1235">1235</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1236" href="#t1236">1236</a></span><span class="t"><span class="str"> The provided trigger will be added to the package's metadata (the triggers file of the control.tar).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1237" href="#t1237">1237</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1238" href="#t1238">1238</a></span><span class="t"><span class="str"> If the trigger has already been added previously, a second call with the same trigger data will be ignored.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1239" href="#t1239">1239</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1240" href="#t1240">1240</a></span><span class="t"> <span class="nam">key</span> <span class="op">=</span> <span class="op">(</span><span class="nam">trigger_type</span><span class="op">,</span> <span class="nam">trigger_target</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1241" href="#t1241">1241</a></span><span class="t"> <span class="key">if</span> <span class="nam">key</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_triggers</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1241 ↛ 1242</span><span class="annotate long">line 1241 didn't jump to line 1242, because the condition on line 1241 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1242" href="#t1242">1242</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1243" href="#t1243">1243</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_triggers</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> <span class="op">=</span> <span class="nam">PluginProvidedTrigger</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1244" href="#t1244">1244</a></span><span class="t"> <span class="nam">dpkg_trigger_type</span><span class="op">=</span><span class="nam">trigger_type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1245" href="#t1245">1245</a></span><span class="t"> <span class="nam">dpkg_trigger_target</span><span class="op">=</span><span class="nam">trigger_target</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1246" href="#t1246">1246</a></span><span class="t"> <span class="nam">provider</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1247" href="#t1247">1247</a></span><span class="t"> <span class="nam">provider_source_id</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_source_id</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1248" href="#t1248">1248</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1249" href="#t1249">1249</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1250" href="#t1250">1250</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1251" href="#t1251">1251</a></span><span class="t"> <span class="key">def</span> <span class="nam">maintscript</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">MaintscriptAccessor</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1252" href="#t1252">1252</a></span><span class="t"> <span class="nam">maintscript</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_maintscript</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1253" href="#t1253">1253</a></span><span class="t"> <span class="key">if</span> <span class="nam">maintscript</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1254" href="#t1254">1254</a></span><span class="t"> <span class="nam">maintscript</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_create_maintscript_accessor</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1255" href="#t1255">1255</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_maintscript</span> <span class="op">=</span> <span class="nam">maintscript</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1256" href="#t1256">1256</a></span><span class="t"> <span class="key">return</span> <span class="nam">maintscript</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1257" href="#t1257">1257</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1258" href="#t1258">1258</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1259" href="#t1259">1259</a></span><span class="t"> <span class="key">def</span> <span class="nam">substvars</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">FlushableSubstvars</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1260" href="#t1260">1260</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_substvars</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1261" href="#t1261">1261</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1262" href="#t1262">1262</a></span><span class="t"> <span class="key">def</span> <span class="nam">dpkg_shlibdeps</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">paths</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1263" href="#t1263">1263</a></span><span class="t"> <span class="nam">binary_package</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_metadata_context</span><span class="op">.</span><span class="nam">binary_package</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1264" href="#t1264">1264</a></span><span class="t"> <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">substvars</span><span class="op">.</span><span class="nam">flush</span><span class="op">(</span><span class="op">)</span> <span class="key">as</span> <span class="nam">substvars_file</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1265" href="#t1265">1265</a></span><span class="t"> <span class="nam">dpkg_cmd</span> <span class="op">=</span> <span class="op">[</span><span class="str">"dpkg-shlibdeps"</span><span class="op">,</span> <span class="str">f"-T{substvars_file}"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1266" href="#t1266">1266</a></span><span class="t"> <span class="key">if</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">is_udeb</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1267" href="#t1267">1267</a></span><span class="t"> <span class="nam">dpkg_cmd</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">"-tudeb"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1268" href="#t1268">1268</a></span><span class="t"> <span class="key">if</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">is_essential</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1268 ↛ 1269</span><span class="annotate long">line 1268 didn't jump to line 1269, because the condition on line 1268 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1269" href="#t1269">1269</a></span><span class="t"> <span class="nam">dpkg_cmd</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">"-dPre-Depends"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1270" href="#t1270">1270</a></span><span class="t"> <span class="nam">shlibs_local</span><span class="op">,</span> <span class="nam">shlib_dirs</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_shlibs_details</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1271" href="#t1271">1271</a></span><span class="t"> <span class="key">if</span> <span class="nam">shlibs_local</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1271 ↛ 1272</span><span class="annotate long">line 1271 didn't jump to line 1272, because the condition on line 1271 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1272" href="#t1272">1272</a></span><span class="t"> <span class="nam">dpkg_cmd</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">f"-L{shlibs_local}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1273" href="#t1273">1273</a></span><span class="t"> <span class="key">if</span> <span class="nam">shlib_dirs</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1273 ↛ 1274</span><span class="annotate long">line 1273 didn't jump to line 1274, because the condition on line 1273 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1274" href="#t1274">1274</a></span><span class="t"> <span class="nam">dpkg_cmd</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="str">f"-l{sd}"</span> <span class="key">for</span> <span class="nam">sd</span> <span class="key">in</span> <span class="nam">shlib_dirs</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1275" href="#t1275">1275</a></span><span class="t"> <span class="nam">dpkg_cmd</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">p</span><span class="op">.</span><span class="nam">fs_path</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">paths</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1276" href="#t1276">1276</a></span><span class="t"> <span class="nam">print_command</span><span class="op">(</span><span class="op">*</span><span class="nam">dpkg_cmd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1277" href="#t1277">1277</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1278" href="#t1278">1278</a></span><span class="t"> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_call</span><span class="op">(</span><span class="nam">dpkg_cmd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1279" href="#t1279">1279</a></span><span class="t"> <span class="key">except</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">CalledProcessError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1280" href="#t1280">1280</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1281" href="#t1281">1281</a></span><span class="t"> <span class="str">f"Attempting to auto-detect dependencies via dpkg-shlibdeps for {binary_package.name} failed. Please"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1282" href="#t1282">1282</a></span><span class="t"> <span class="str">" review the output from dpkg-shlibdeps above to understand what went wrong."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1283" href="#t1283">1283</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1284" href="#t1284">1284</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1285" href="#t1285">1285</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1286" href="#t1286">1286</a></span><span class="t"><span class="key">class</span> <span class="nam">BinaryCtrlAccessorProvider</span><span class="op">(</span><span class="nam">BinaryCtrlAccessorProviderBase</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1287" href="#t1287">1287</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1288" href="#t1288">1288</a></span><span class="t"> <span class="str">"_maintscript"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1289" href="#t1289">1289</a></span><span class="t"> <span class="str">"_maintscript_snippets"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1290" href="#t1290">1290</a></span><span class="t"> <span class="str">"_package_substitution"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1291" href="#t1291">1291</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1292" href="#t1292">1292</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1293" href="#t1293">1293</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1294" href="#t1294">1294</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1295" href="#t1295">1295</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">:</span> <span class="nam">DebputyPluginMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1296" href="#t1296">1296</a></span><span class="t"> <span class="nam">plugin_source_id</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1297" href="#t1297">1297</a></span><span class="t"> <span class="nam">package_metadata_context</span><span class="op">:</span> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1298" href="#t1298">1298</a></span><span class="t"> <span class="nam">triggers</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">DpkgTriggerType</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">PluginProvidedTrigger</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1299" href="#t1299">1299</a></span><span class="t"> <span class="nam">substvars</span><span class="op">:</span> <span class="nam">FlushableSubstvars</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1300" href="#t1300">1300</a></span><span class="t"> <span class="nam">maintscript_snippets</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">MaintscriptSnippetContainer</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1301" href="#t1301">1301</a></span><span class="t"> <span class="nam">package_substitution</span><span class="op">:</span> <span class="nam">Substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1302" href="#t1302">1302</a></span><span class="t"> <span class="nam">shlibs_details</span><span class="op">:</span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1303" href="#t1303">1303</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1304" href="#t1304">1304</a></span><span class="t"> <span class="nam">default_snippet_order</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Literal</span><span class="op">[</span><span class="str">"service"</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1305" href="#t1305">1305</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1306" href="#t1306">1306</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1307" href="#t1307">1307</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1308" href="#t1308">1308</a></span><span class="t"> <span class="nam">plugin_source_id</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1309" href="#t1309">1309</a></span><span class="t"> <span class="nam">package_metadata_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1310" href="#t1310">1310</a></span><span class="t"> <span class="nam">triggers</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1311" href="#t1311">1311</a></span><span class="t"> <span class="nam">substvars</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1312" href="#t1312">1312</a></span><span class="t"> <span class="nam">shlibs_details</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1313" href="#t1313">1313</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1314" href="#t1314">1314</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_maintscript_snippets</span> <span class="op">=</span> <span class="nam">maintscript_snippets</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1315" href="#t1315">1315</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_substitution</span> <span class="op">=</span> <span class="nam">package_substitution</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1316" href="#t1316">1316</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_maintscript</span> <span class="op">=</span> <span class="nam">MaintscriptAccessorProvider</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1317" href="#t1317">1317</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1318" href="#t1318">1318</a></span><span class="t"> <span class="nam">plugin_source_id</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1319" href="#t1319">1319</a></span><span class="t"> <span class="nam">maintscript_snippets</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1320" href="#t1320">1320</a></span><span class="t"> <span class="nam">package_substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1321" href="#t1321">1321</a></span><span class="t"> <span class="nam">default_snippet_order</span><span class="op">=</span><span class="nam">default_snippet_order</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1322" href="#t1322">1322</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1323" href="#t1323">1323</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1324" href="#t1324">1324</a></span><span class="t"> <span class="key">def</span> <span class="nam">_create_maintscript_accessor</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">MaintscriptAccessor</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1325" href="#t1325">1325</a></span><span class="t"> <span class="key">return</span> <span class="nam">MaintscriptAccessorProvider</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1326" href="#t1326">1326</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1327" href="#t1327">1327</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_source_id</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1328" href="#t1328">1328</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_maintscript_snippets</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1329" href="#t1329">1329</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1330" href="#t1330">1330</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1331" href="#t1331">1331</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1332" href="#t1332">1332</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1333" href="#t1333">1333</a></span><span class="t"><span class="key">class</span> <span class="nam">BinaryCtrlAccessorProviderCreator</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1334" href="#t1334">1334</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1335" href="#t1335">1335</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1336" href="#t1336">1336</a></span><span class="t"> <span class="nam">package_metadata_context</span><span class="op">:</span> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1337" href="#t1337">1337</a></span><span class="t"> <span class="nam">substvars</span><span class="op">:</span> <span class="nam">FlushableSubstvars</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1338" href="#t1338">1338</a></span><span class="t"> <span class="nam">maintscript_snippets</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">MaintscriptSnippetContainer</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1339" href="#t1339">1339</a></span><span class="t"> <span class="nam">substitution</span><span class="op">:</span> <span class="nam">Substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1340" href="#t1340">1340</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1341" href="#t1341">1341</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_metadata_context</span> <span class="op">=</span> <span class="nam">package_metadata_context</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1342" href="#t1342">1342</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_substvars</span> <span class="op">=</span> <span class="nam">substvars</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1343" href="#t1343">1343</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_maintscript_snippets</span> <span class="op">=</span> <span class="nam">maintscript_snippets</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1344" href="#t1344">1344</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_substitution</span> <span class="op">=</span> <span class="nam">substitution</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1345" href="#t1345">1345</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_triggers</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">DpkgTriggerType</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">PluginProvidedTrigger</span><span class="op">]</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1346" href="#t1346">1346</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">shlibs_details</span><span class="op">:</span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1347" href="#t1347">1347</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1348" href="#t1348">1348</a></span><span class="t"> <span class="key">def</span> <span class="nam">for_plugin</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1349" href="#t1349">1349</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1350" href="#t1350">1350</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">:</span> <span class="nam">DebputyPluginMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1351" href="#t1351">1351</a></span><span class="t"> <span class="nam">plugin_source_id</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1352" href="#t1352">1352</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1353" href="#t1353">1353</a></span><span class="t"> <span class="nam">default_snippet_order</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Literal</span><span class="op">[</span><span class="str">"service"</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1354" href="#t1354">1354</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">BinaryCtrlAccessor</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1355" href="#t1355">1355</a></span><span class="t"> <span class="key">return</span> <span class="nam">BinaryCtrlAccessorProvider</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1356" href="#t1356">1356</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1357" href="#t1357">1357</a></span><span class="t"> <span class="nam">plugin_source_id</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1358" href="#t1358">1358</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_metadata_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1359" href="#t1359">1359</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_triggers</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1360" href="#t1360">1360</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_substvars</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1361" href="#t1361">1361</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_maintscript_snippets</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1362" href="#t1362">1362</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1363" href="#t1363">1363</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">shlibs_details</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1364" href="#t1364">1364</a></span><span class="t"> <span class="nam">default_snippet_order</span><span class="op">=</span><span class="nam">default_snippet_order</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1365" href="#t1365">1365</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1366" href="#t1366">1366</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1367" href="#t1367">1367</a></span><span class="t"> <span class="key">def</span> <span class="nam">generated_triggers</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">PluginProvidedTrigger</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1368" href="#t1368">1368</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_triggers</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1369" href="#t1369">1369</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1370" href="#t1370">1370</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1371" href="#t1371">1371</a></span><span class="t"><span class="key">def</span> <span class="nam">plugin_metadata_for_debputys_own_plugin</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1372" href="#t1372">1372</a></span><span class="t"> <span class="nam">loader</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">PluginInitializationEntryPoint</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1373" href="#t1373">1373</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">DebputyPluginMetadata</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1374" href="#t1374">1374</a></span><span class="t"> <span class="key">if</span> <span class="nam">loader</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1375" href="#t1375">1375</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">debputy</span><span class="op">.</span><span class="nam">debputy_plugin</span> <span class="key">import</span> <span class="nam">initialize_debputy_features</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1376" href="#t1376">1376</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1377" href="#t1377">1377</a></span><span class="t"> <span class="nam">loader</span> <span class="op">=</span> <span class="nam">initialize_debputy_features</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1378" href="#t1378">1378</a></span><span class="t"> <span class="key">return</span> <span class="nam">DebputyPluginMetadata</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1379" href="#t1379">1379</a></span><span class="t"> <span class="nam">plugin_name</span><span class="op">=</span><span class="str">"debputy"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1380" href="#t1380">1380</a></span><span class="t"> <span class="nam">api_compat_version</span><span class="op">=</span><span class="num">1</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1381" href="#t1381">1381</a></span><span class="t"> <span class="nam">plugin_initializer</span><span class="op">=</span><span class="nam">loader</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1382" href="#t1382">1382</a></span><span class="t"> <span class="nam">plugin_loader</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1383" href="#t1383">1383</a></span><span class="t"> <span class="nam">plugin_path</span><span class="op">=</span><span class="str">"<bundled>"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1384" href="#t1384">1384</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1385" href="#t1385">1385</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1386" href="#t1386">1386</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1387" href="#t1387">1387</a></span><span class="t"><span class="key">def</span> <span class="nam">load_plugin_features</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1388" href="#t1388">1388</a></span><span class="t"> <span class="nam">plugin_search_dirs</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1389" href="#t1389">1389</a></span><span class="t"> <span class="nam">substitution</span><span class="op">:</span> <span class="nam">Substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1390" href="#t1390">1390</a></span><span class="t"> <span class="nam">requested_plugins_only</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1391" href="#t1391">1391</a></span><span class="t"> <span class="nam">required_plugins</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1392" href="#t1392">1392</a></span><span class="t"> <span class="nam">plugin_feature_set</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">PluginProvidedFeatureSet</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1393" href="#t1393">1393</a></span><span class="t"> <span class="nam">debug_mode</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1394" href="#t1394">1394</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">PluginProvidedFeatureSet</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1395" href="#t1395">1395</a></span><span class="t"> <span class="key">if</span> <span class="nam">plugin_feature_set</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1396" href="#t1396">1396</a></span><span class="t"> <span class="nam">plugin_feature_set</span> <span class="op">=</span> <span class="nam">PluginProvidedFeatureSet</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1397" href="#t1397">1397</a></span><span class="t"> <span class="nam">plugins</span> <span class="op">=</span> <span class="op">[</span><span class="nam">plugin_metadata_for_debputys_own_plugin</span><span class="op">(</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1398" href="#t1398">1398</a></span><span class="t"> <span class="nam">unloadable_plugins</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1399" href="#t1399">1399</a></span><span class="t"> <span class="key">if</span> <span class="nam">required_plugins</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1400" href="#t1400">1400</a></span><span class="t"> <span class="nam">plugins</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1401" href="#t1401">1401</a></span><span class="t"> <span class="nam">find_json_plugins</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1402" href="#t1402">1402</a></span><span class="t"> <span class="nam">plugin_search_dirs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1403" href="#t1403">1403</a></span><span class="t"> <span class="nam">required_plugins</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1404" href="#t1404">1404</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1405" href="#t1405">1405</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1406" href="#t1406">1406</a></span><span class="t"> <span class="key">if</span> <span class="nam">requested_plugins_only</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1407" href="#t1407">1407</a></span><span class="t"> <span class="nam">plugins</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1408" href="#t1408">1408</a></span><span class="t"> <span class="nam">find_json_plugins</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1409" href="#t1409">1409</a></span><span class="t"> <span class="nam">plugin_search_dirs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1410" href="#t1410">1410</a></span><span class="t"> <span class="nam">requested_plugins_only</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1411" href="#t1411">1411</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1412" href="#t1412">1412</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1413" href="#t1413">1413</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1414" href="#t1414">1414</a></span><span class="t"> <span class="nam">auto_loaded</span> <span class="op">=</span> <span class="nam">_find_all_json_plugins</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1415" href="#t1415">1415</a></span><span class="t"> <span class="nam">plugin_search_dirs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1416" href="#t1416">1416</a></span><span class="t"> <span class="nam">required_plugins</span> <span class="key">if</span> <span class="nam">required_plugins</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">else</span> <span class="nam">frozenset</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1417" href="#t1417">1417</a></span><span class="t"> <span class="nam">debug_mode</span><span class="op">=</span><span class="nam">debug_mode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1418" href="#t1418">1418</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1419" href="#t1419">1419</a></span><span class="t"> <span class="key">for</span> <span class="nam">plugin_metadata</span> <span class="key">in</span> <span class="nam">auto_loaded</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1420" href="#t1420">1420</a></span><span class="t"> <span class="nam">plugins</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">plugin_metadata</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1421" href="#t1421">1421</a></span><span class="t"> <span class="nam">unloadable_plugins</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">plugin_metadata</span><span class="op">.</span><span class="nam">plugin_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1422" href="#t1422">1422</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1423" href="#t1423">1423</a></span><span class="t"> <span class="key">for</span> <span class="nam">plugin_metadata</span> <span class="key">in</span> <span class="nam">plugins</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1424" href="#t1424">1424</a></span><span class="t"> <span class="nam">api</span> <span class="op">=</span> <span class="nam">DebputyPluginInitializerProvider</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1425" href="#t1425">1425</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">,</span> <span class="nam">plugin_feature_set</span><span class="op">,</span> <span class="nam">substitution</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1426" href="#t1426">1426</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1427" href="#t1427">1427</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1428" href="#t1428">1428</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">load_plugin</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1429" href="#t1429">1429</a></span><span class="t"> <span class="key">except</span> <span class="nam">PluginBaseError</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1430" href="#t1430">1430</a></span><span class="t"> <span class="key">if</span> <span class="nam">plugin_metadata</span><span class="op">.</span><span class="nam">plugin_name</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">unloadable_plugins</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1431" href="#t1431">1431</a></span><span class="t"> <span class="key">raise</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1432" href="#t1432">1432</a></span><span class="t"> <span class="key">if</span> <span class="nam">debug_mode</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1433" href="#t1433">1433</a></span><span class="t"> <span class="key">raise</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1434" href="#t1434">1434</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1435" href="#t1435">1435</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">unload_plugin</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1436" href="#t1436">1436</a></span><span class="t"> <span class="key">except</span> <span class="nam">Exception</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1437" href="#t1437">1437</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1438" href="#t1438">1438</a></span><span class="t"> <span class="str">f"Failed to load optional {plugin_metadata.plugin_name} and an error was raised when trying to"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1439" href="#t1439">1439</a></span><span class="t"> <span class="str">" clean up after the half-initialized plugin. Re-raising load error as the partially loaded"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1440" href="#t1440">1440</a></span><span class="t"> <span class="str">" module might have tainted the feature set."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1441" href="#t1441">1441</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1442" href="#t1442">1442</a></span><span class="t"> <span class="key">raise</span> <span class="nam">e</span> <span class="key">from</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1443" href="#t1443">1443</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1444" href="#t1444">1444</a></span><span class="t"> <span class="key">if</span> <span class="nam">debug_mode</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1445" href="#t1445">1445</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1446" href="#t1446">1446</a></span><span class="t"> <span class="str">f"The optional plugin {plugin_metadata.plugin_name} failed during load. Re-raising due"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1447" href="#t1447">1447</a></span><span class="t"> <span class="str">f" to --debug/-d."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1448" href="#t1448">1448</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1449" href="#t1449">1449</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1450" href="#t1450">1450</a></span><span class="t"> <span class="str">f"The optional plugin {plugin_metadata.plugin_name} failed during load. The plugin was"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1451" href="#t1451">1451</a></span><span class="t"> <span class="str">f" deactivated. Use debug mode (--debug) to show the stacktrace (the warning will become an error)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1452" href="#t1452">1452</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1453" href="#t1453">1453</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1454" href="#t1454">1454</a></span><span class="t"> <span class="key">return</span> <span class="nam">plugin_feature_set</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1455" href="#t1455">1455</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1456" href="#t1456">1456</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1457" href="#t1457">1457</a></span><span class="t"><span class="key">def</span> <span class="nam">find_json_plugin</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1458" href="#t1458">1458</a></span><span class="t"> <span class="nam">search_dirs</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1459" href="#t1459">1459</a></span><span class="t"> <span class="nam">requested_plugin</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1460" href="#t1460">1460</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">DebputyPluginMetadata</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1461" href="#t1461">1461</a></span><span class="t"> <span class="nam">r</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">find_json_plugins</span><span class="op">(</span><span class="nam">search_dirs</span><span class="op">,</span> <span class="op">[</span><span class="nam">requested_plugin</span><span class="op">]</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1462" href="#t1462">1462</a></span><span class="t"> <span class="key">assert</span> <span class="nam">len</span><span class="op">(</span><span class="nam">r</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1463" href="#t1463">1463</a></span><span class="t"> <span class="key">return</span> <span class="nam">r</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1464" href="#t1464">1464</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1465" href="#t1465">1465</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1466" href="#t1466">1466</a></span><span class="t"><span class="key">def</span> <span class="nam">find_related_implementation_files_for_plugin</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1467" href="#t1467">1467</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">:</span> <span class="nam">DebputyPluginMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1468" href="#t1468">1468</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1469" href="#t1469">1469</a></span><span class="t"> <span class="nam">plugin_path</span> <span class="op">=</span> <span class="nam">plugin_metadata</span><span class="op">.</span><span class="nam">plugin_path</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1470" href="#t1470">1470</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">isfile</span><span class="op">(</span><span class="nam">plugin_path</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1471" href="#t1471">1471</a></span><span class="t"> <span class="nam">plugin_name</span> <span class="op">=</span> <span class="nam">plugin_metadata</span><span class="op">.</span><span class="nam">plugin_name</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1472" href="#t1472">1472</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1473" href="#t1473">1473</a></span><span class="t"> <span class="str">f"Cannot run find related files for {plugin_name}: The plugin seems to be bundled"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1474" href="#t1474">1474</a></span><span class="t"> <span class="str">" or loaded via a mechanism that does not support detecting its tests."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1475" href="#t1475">1475</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1476" href="#t1476">1476</a></span><span class="t"> <span class="nam">files</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1477" href="#t1477">1477</a></span><span class="t"> <span class="nam">module_name</span><span class="op">,</span> <span class="nam">module_file</span> <span class="op">=</span> <span class="nam">_find_plugin_implementation_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1478" href="#t1478">1478</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">.</span><span class="nam">plugin_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1479" href="#t1479">1479</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">.</span><span class="nam">plugin_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1480" href="#t1480">1480</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1481" href="#t1481">1481</a></span><span class="t"> <span class="key">if</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">isfile</span><span class="op">(</span><span class="nam">module_file</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1482" href="#t1482">1482</a></span><span class="t"> <span class="nam">files</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">module_file</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1483" href="#t1483">1483</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1484" href="#t1484">1484</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">plugin_metadata</span><span class="op">.</span><span class="nam">is_loaded</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1485" href="#t1485">1485</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">.</span><span class="nam">load_plugin</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1486" href="#t1486">1486</a></span><span class="t"> <span class="key">if</span> <span class="nam">module_name</span> <span class="key">in</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">modules</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1487" href="#t1487">1487</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1488" href="#t1488">1488</a></span><span class="t"> <span class="str">f'The plugin {plugin_metadata.plugin_name} uses the "module"" key in its'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1489" href="#t1489">1489</a></span><span class="t"> <span class="str">f" JSON metadata file ({plugin_metadata.plugin_path}) and cannot be "</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1490" href="#t1490">1490</a></span><span class="t"> <span class="str">f" installed via this method. The related Python would not be installed"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1491" href="#t1491">1491</a></span><span class="t"> <span class="str">f" (which would result in a plugin that would fail to load)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1492" href="#t1492">1492</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1493" href="#t1493">1493</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1494" href="#t1494">1494</a></span><span class="t"> <span class="key">return</span> <span class="nam">files</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1495" href="#t1495">1495</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1496" href="#t1496">1496</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1497" href="#t1497">1497</a></span><span class="t"><span class="key">def</span> <span class="nam">find_tests_for_plugin</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1498" href="#t1498">1498</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">:</span> <span class="nam">DebputyPluginMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1499" href="#t1499">1499</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1500" href="#t1500">1500</a></span><span class="t"> <span class="nam">plugin_name</span> <span class="op">=</span> <span class="nam">plugin_metadata</span><span class="op">.</span><span class="nam">plugin_name</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1501" href="#t1501">1501</a></span><span class="t"> <span class="nam">plugin_path</span> <span class="op">=</span> <span class="nam">plugin_metadata</span><span class="op">.</span><span class="nam">plugin_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1502" href="#t1502">1502</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1503" href="#t1503">1503</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">isfile</span><span class="op">(</span><span class="nam">plugin_path</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1504" href="#t1504">1504</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1505" href="#t1505">1505</a></span><span class="t"> <span class="str">f"Cannot run tests for {plugin_name}: The plugin seems to be bundled or loaded via a"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1506" href="#t1506">1506</a></span><span class="t"> <span class="str">" mechanism that does not support detecting its tests."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1507" href="#t1507">1507</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1508" href="#t1508">1508</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1509" href="#t1509">1509</a></span><span class="t"> <span class="nam">plugin_dir</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">dirname</span><span class="op">(</span><span class="nam">plugin_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1510" href="#t1510">1510</a></span><span class="t"> <span class="nam">test_basename_prefix</span> <span class="op">=</span> <span class="nam">plugin_metadata</span><span class="op">.</span><span class="nam">plugin_name</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">"-"</span><span class="op">,</span> <span class="str">"_"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1511" href="#t1511">1511</a></span><span class="t"> <span class="nam">tests</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1512" href="#t1512">1512</a></span><span class="t"> <span class="key">with</span> <span class="nam">os</span><span class="op">.</span><span class="nam">scandir</span><span class="op">(</span><span class="nam">plugin_dir</span><span class="op">)</span> <span class="key">as</span> <span class="nam">dir_iter</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1513" href="#t1513">1513</a></span><span class="t"> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">dir_iter</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1514" href="#t1514">1514</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1515" href="#t1515">1515</a></span><span class="t"> <span class="nam">p</span><span class="op">.</span><span class="nam">is_file</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1516" href="#t1516">1516</a></span><span class="t"> <span class="key">and</span> <span class="nam">p</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="nam">test_basename_prefix</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1517" href="#t1517">1517</a></span><span class="t"> <span class="key">and</span> <span class="nam">PLUGIN_TEST_SUFFIX</span><span class="op">.</span><span class="nam">search</span><span class="op">(</span><span class="nam">p</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1518" href="#t1518">1518</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1519" href="#t1519">1519</a></span><span class="t"> <span class="nam">tests</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">p</span><span class="op">.</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1520" href="#t1520">1520</a></span><span class="t"> <span class="key">return</span> <span class="nam">tests</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1521" href="#t1521">1521</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1522" href="#t1522">1522</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1523" href="#t1523">1523</a></span><span class="t"><span class="key">def</span> <span class="nam">find_json_plugins</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1524" href="#t1524">1524</a></span><span class="t"> <span class="nam">search_dirs</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1525" href="#t1525">1525</a></span><span class="t"> <span class="nam">requested_plugins</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1526" href="#t1526">1526</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">DebputyPluginMetadata</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1527" href="#t1527">1527</a></span><span class="t"> <span class="key">for</span> <span class="nam">plugin_name_or_path</span> <span class="key">in</span> <span class="nam">requested_plugins</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1528" href="#t1528">1528</a></span><span class="t"> <span class="nam">found</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1529" href="#t1529">1529</a></span><span class="t"> <span class="key">if</span> <span class="str">"/"</span> <span class="key">in</span> <span class="nam">plugin_name_or_path</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1529 ↛ 1530</span><span class="annotate long">line 1529 didn't jump to line 1530, because the condition on line 1529 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1530" href="#t1530">1530</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">isfile</span><span class="op">(</span><span class="nam">plugin_name_or_path</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1531" href="#t1531">1531</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginNotFoundError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1532" href="#t1532">1532</a></span><span class="t"> <span class="str">f"Unable to load the plugin {plugin_name_or_path}: The path is not a file."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1533" href="#t1533">1533</a></span><span class="t"> <span class="str">' (Because the plugin name contains "/", it is assumed to be a path and search path'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1534" href="#t1534">1534</a></span><span class="t"> <span class="str">" is not used."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1535" href="#t1535">1535</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1536" href="#t1536">1536</a></span><span class="t"> <span class="key">yield</span> <span class="nam">parse_json_plugin_desc</span><span class="op">(</span><span class="nam">plugin_name_or_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1537" href="#t1537">1537</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1538" href="#t1538">1538</a></span><span class="t"> <span class="key">for</span> <span class="nam">search_dir</span> <span class="key">in</span> <span class="nam">search_dirs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1539" href="#t1539">1539</a></span><span class="t"> <span class="nam">path</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1540" href="#t1540">1540</a></span><span class="t"> <span class="nam">search_dir</span><span class="op">,</span> <span class="str">"debputy"</span><span class="op">,</span> <span class="str">"plugins"</span><span class="op">,</span> <span class="str">f"{plugin_name_or_path}.json"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1541" href="#t1541">1541</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1542" href="#t1542">1542</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">isfile</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1542 ↛ 1543</span><span class="annotate long">line 1542 didn't jump to line 1543, because the condition on line 1542 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1543" href="#t1543">1543</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1544" href="#t1544">1544</a></span><span class="t"> <span class="nam">found</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1545" href="#t1545">1545</a></span><span class="t"> <span class="key">yield</span> <span class="nam">parse_json_plugin_desc</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1546" href="#t1546">1546</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">found</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1546 ↛ 1547</span><span class="annotate long">line 1546 didn't jump to line 1547, because the condition on line 1546 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1547" href="#t1547">1547</a></span><span class="t"> <span class="nam">search_dir_str</span> <span class="op">=</span> <span class="str">":"</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">search_dirs</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1548" href="#t1548">1548</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginNotFoundError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1549" href="#t1549">1549</a></span><span class="t"> <span class="str">f"Unable to load the plugin {plugin_name_or_path}: Could not find {plugin_name_or_path}.json in the"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1550" href="#t1550">1550</a></span><span class="t"> <span class="str">f" debputy/plugins subdir of any of the search dirs ({search_dir_str})"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1551" href="#t1551">1551</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1552" href="#t1552">1552</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1553" href="#t1553">1553</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1554" href="#t1554">1554</a></span><span class="t"><span class="key">def</span> <span class="nam">_find_all_json_plugins</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1555" href="#t1555">1555</a></span><span class="t"> <span class="nam">search_dirs</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1556" href="#t1556">1556</a></span><span class="t"> <span class="nam">required_plugins</span><span class="op">:</span> <span class="nam">AbstractSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1557" href="#t1557">1557</a></span><span class="t"> <span class="nam">debug_mode</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1558" href="#t1558">1558</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">DebputyPluginMetadata</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1559" href="#t1559">1559</a></span><span class="t"> <span class="nam">seen</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="nam">required_plugins</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1560" href="#t1560">1560</a></span><span class="t"> <span class="nam">error_seen</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1561" href="#t1561">1561</a></span><span class="t"> <span class="key">for</span> <span class="nam">search_dir</span> <span class="key">in</span> <span class="nam">search_dirs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1562" href="#t1562">1562</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1563" href="#t1563">1563</a></span><span class="t"> <span class="nam">dir_fd</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">scandir</span><span class="op">(</span><span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">search_dir</span><span class="op">,</span> <span class="str">"debputy"</span><span class="op">,</span> <span class="str">"plugins"</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1564" href="#t1564">1564</a></span><span class="t"> <span class="key">except</span> <span class="nam">FileNotFoundError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1565" href="#t1565">1565</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1566" href="#t1566">1566</a></span><span class="t"> <span class="key">with</span> <span class="nam">dir_fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1567" href="#t1567">1567</a></span><span class="t"> <span class="key">for</span> <span class="nam">entry</span> <span class="key">in</span> <span class="nam">dir_fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1568" href="#t1568">1568</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1569" href="#t1569">1569</a></span><span class="t"> <span class="key">not</span> <span class="nam">entry</span><span class="op">.</span><span class="nam">is_file</span><span class="op">(</span><span class="nam">follow_symlinks</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1570" href="#t1570">1570</a></span><span class="t"> <span class="key">or</span> <span class="key">not</span> <span class="nam">entry</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">".json"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1571" href="#t1571">1571</a></span><span class="t"> <span class="key">or</span> <span class="nam">entry</span><span class="op">.</span><span class="nam">name</span> <span class="key">in</span> <span class="nam">seen</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1572" href="#t1572">1572</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1573" href="#t1573">1573</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1574" href="#t1574">1574</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1575" href="#t1575">1575</a></span><span class="t"> <span class="nam">plugin_metadata</span> <span class="op">=</span> <span class="nam">parse_json_plugin_desc</span><span class="op">(</span><span class="nam">entry</span><span class="op">.</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1576" href="#t1576">1576</a></span><span class="t"> <span class="key">except</span> <span class="nam">PluginBaseError</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1577" href="#t1577">1577</a></span><span class="t"> <span class="key">if</span> <span class="nam">debug_mode</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1578" href="#t1578">1578</a></span><span class="t"> <span class="key">raise</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1579" href="#t1579">1579</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">error_seen</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1580" href="#t1580">1580</a></span><span class="t"> <span class="nam">error_seen</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1581" href="#t1581">1581</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1582" href="#t1582">1582</a></span><span class="t"> <span class="str">f"Failed to load the plugin in {entry.path} due to the following error: {e.message}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1583" href="#t1583">1583</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1584" href="#t1584">1584</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1585" href="#t1585">1585</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1586" href="#t1586">1586</a></span><span class="t"> <span class="str">f"Failed to load plugin in {entry.path} due to errors (not shown)."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1587" href="#t1587">1587</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1588" href="#t1588">1588</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1589" href="#t1589">1589</a></span><span class="t"> <span class="key">yield</span> <span class="nam">plugin_metadata</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1590" href="#t1590">1590</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1591" href="#t1591">1591</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1592" href="#t1592">1592</a></span><span class="t"><span class="key">def</span> <span class="nam">_find_plugin_implementation_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1593" href="#t1593">1593</a></span><span class="t"> <span class="nam">plugin_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1594" href="#t1594">1594</a></span><span class="t"> <span class="nam">json_file_path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1595" href="#t1595">1595</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1596" href="#t1596">1596</a></span><span class="t"> <span class="nam">guessed_module_basename</span> <span class="op">=</span> <span class="nam">plugin_name</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">"-"</span><span class="op">,</span> <span class="str">"_"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1597" href="#t1597">1597</a></span><span class="t"> <span class="nam">module_name</span> <span class="op">=</span> <span class="str">f"debputy.plugin.{guessed_module_basename}"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1598" href="#t1598">1598</a></span><span class="t"> <span class="nam">module_fs_path</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1599" href="#t1599">1599</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">dirname</span><span class="op">(</span><span class="nam">json_file_path</span><span class="op">)</span><span class="op">,</span> <span class="str">f"{guessed_module_basename}.py"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1600" href="#t1600">1600</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1601" href="#t1601">1601</a></span><span class="t"> <span class="key">return</span> <span class="nam">module_name</span><span class="op">,</span> <span class="nam">module_fs_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1602" href="#t1602">1602</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1603" href="#t1603">1603</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1604" href="#t1604">1604</a></span><span class="t"><span class="key">def</span> <span class="nam">_resolve_module_initializer</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1605" href="#t1605">1605</a></span><span class="t"> <span class="nam">plugin_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1606" href="#t1606">1606</a></span><span class="t"> <span class="nam">plugin_initializer_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1607" href="#t1607">1607</a></span><span class="t"> <span class="nam">module_name</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1608" href="#t1608">1608</a></span><span class="t"> <span class="nam">json_file_path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1609" href="#t1609">1609</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">PluginInitializationEntryPoint</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1610" href="#t1610">1610</a></span><span class="t"> <span class="nam">module</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1611" href="#t1611">1611</a></span><span class="t"> <span class="nam">module_fs_path</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1612" href="#t1612">1612</a></span><span class="t"> <span class="key">if</span> <span class="nam">module_name</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1612 ↛ 1640</span><span class="annotate long">line 1612 didn't jump to line 1640, because the condition on line 1612 was never false</span></span></p> - <p class="run"><span class="n"><a id="t1613" href="#t1613">1613</a></span><span class="t"> <span class="nam">module_name</span><span class="op">,</span> <span class="nam">module_fs_path</span> <span class="op">=</span> <span class="nam">_find_plugin_implementation_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1614" href="#t1614">1614</a></span><span class="t"> <span class="nam">plugin_name</span><span class="op">,</span> <span class="nam">json_file_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1615" href="#t1615">1615</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1616" href="#t1616">1616</a></span><span class="t"> <span class="key">if</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">isfile</span><span class="op">(</span><span class="nam">module_fs_path</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1616 ↛ 1640</span><span class="annotate long">line 1616 didn't jump to line 1640, because the condition on line 1616 was never false</span></span></p> - <p class="run"><span class="n"><a id="t1617" href="#t1617">1617</a></span><span class="t"> <span class="nam">spec</span> <span class="op">=</span> <span class="nam">importlib</span><span class="op">.</span><span class="nam">util</span><span class="op">.</span><span class="nam">spec_from_file_location</span><span class="op">(</span><span class="nam">module_name</span><span class="op">,</span> <span class="nam">module_fs_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1618" href="#t1618">1618</a></span><span class="t"> <span class="key">if</span> <span class="nam">spec</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1618 ↛ 1619</span><span class="annotate long">line 1618 didn't jump to line 1619, because the condition on line 1618 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1619" href="#t1619">1619</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginInitializationError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1620" href="#t1620">1620</a></span><span class="t"> <span class="str">f"Failed to load {plugin_name} (path: {module_fs_path})."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1621" href="#t1621">1621</a></span><span class="t"> <span class="str">" The spec_from_file_location function returned None."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1622" href="#t1622">1622</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1623" href="#t1623">1623</a></span><span class="t"> <span class="nam">mod</span> <span class="op">=</span> <span class="nam">importlib</span><span class="op">.</span><span class="nam">util</span><span class="op">.</span><span class="nam">module_from_spec</span><span class="op">(</span><span class="nam">spec</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1624" href="#t1624">1624</a></span><span class="t"> <span class="nam">loader</span> <span class="op">=</span> <span class="nam">spec</span><span class="op">.</span><span class="nam">loader</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1625" href="#t1625">1625</a></span><span class="t"> <span class="key">if</span> <span class="nam">loader</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1625 ↛ 1626</span><span class="annotate long">line 1625 didn't jump to line 1626, because the condition on line 1625 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1626" href="#t1626">1626</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginInitializationError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1627" href="#t1627">1627</a></span><span class="t"> <span class="str">f"Failed to load {plugin_name} (path: {module_fs_path})."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1628" href="#t1628">1628</a></span><span class="t"> <span class="str">" Python could not find a suitable loader (spec.loader was None)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1629" href="#t1629">1629</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1630" href="#t1630">1630</a></span><span class="t"> <span class="nam">sys</span><span class="op">.</span><span class="nam">modules</span><span class="op">[</span><span class="nam">module_name</span><span class="op">]</span> <span class="op">=</span> <span class="nam">mod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1631" href="#t1631">1631</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1632" href="#t1632">1632</a></span><span class="t"> <span class="nam">loader</span><span class="op">.</span><span class="nam">exec_module</span><span class="op">(</span><span class="nam">mod</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1633" href="#t1633">1633</a></span><span class="t"> <span class="key">except</span> <span class="op">(</span><span class="nam">Exception</span><span class="op">,</span> <span class="nam">GeneratorExit</span><span class="op">)</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1634" href="#t1634">1634</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginInitializationError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1635" href="#t1635">1635</a></span><span class="t"> <span class="str">f"Failed to load {plugin_name} (path: {module_fs_path})."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1636" href="#t1636">1636</a></span><span class="t"> <span class="str">" The module threw an exception while being loaded."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1637" href="#t1637">1637</a></span><span class="t"> <span class="op">)</span> <span class="key">from</span> <span class="nam">e</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1638" href="#t1638">1638</a></span><span class="t"> <span class="nam">module</span> <span class="op">=</span> <span class="nam">mod</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1639" href="#t1639">1639</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1640" href="#t1640">1640</a></span><span class="t"> <span class="key">if</span> <span class="nam">module</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1640 ↛ 1641</span><span class="annotate long">line 1640 didn't jump to line 1641, because the condition on line 1640 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1641" href="#t1641">1641</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1642" href="#t1642">1642</a></span><span class="t"> <span class="nam">module</span> <span class="op">=</span> <span class="nam">importlib</span><span class="op">.</span><span class="nam">import_module</span><span class="op">(</span><span class="nam">module_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1643" href="#t1643">1643</a></span><span class="t"> <span class="key">except</span> <span class="nam">ModuleNotFoundError</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1644" href="#t1644">1644</a></span><span class="t"> <span class="key">if</span> <span class="nam">module_fs_path</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1645" href="#t1645">1645</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginMetadataError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1646" href="#t1646">1646</a></span><span class="t"> <span class="str">f'The plugin defined in "{json_file_path}" wanted to load the module "{module_name}", but'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1647" href="#t1647">1647</a></span><span class="t"> <span class="str">" this module is not available in the python search path"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1648" href="#t1648">1648</a></span><span class="t"> <span class="op">)</span> <span class="key">from</span> <span class="nam">e</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1649" href="#t1649">1649</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginInitializationError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1650" href="#t1650">1650</a></span><span class="t"> <span class="str">f"Failed to load {plugin_name}. Tried loading it from"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1651" href="#t1651">1651</a></span><span class="t"> <span class="str">f' "{module_fs_path}" (which did not exist) and PYTHONPATH as'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1652" href="#t1652">1652</a></span><span class="t"> <span class="str">f" {module_name} (where it was not found either). Please ensure"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1653" href="#t1653">1653</a></span><span class="t"> <span class="str">" the module code is installed in the correct spot or provide an"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1654" href="#t1654">1654</a></span><span class="t"> <span class="str">f' explicit "module" definition in {json_file_path}.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1655" href="#t1655">1655</a></span><span class="t"> <span class="op">)</span> <span class="key">from</span> <span class="nam">e</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1656" href="#t1656">1656</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1657" href="#t1657">1657</a></span><span class="t"> <span class="nam">plugin_initializer</span> <span class="op">=</span> <span class="nam">getattr</span><span class="op">(</span><span class="nam">module</span><span class="op">,</span> <span class="nam">plugin_initializer_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1658" href="#t1658">1658</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1659" href="#t1659">1659</a></span><span class="t"> <span class="key">if</span> <span class="nam">plugin_initializer</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1659 ↛ 1660</span><span class="annotate long">line 1659 didn't jump to line 1660, because the condition on line 1659 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1660" href="#t1660">1660</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginMetadataError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1661" href="#t1661">1661</a></span><span class="t"> <span class="str">f'The plugin defined in {json_file_path} claimed that module "{module_name}" would have an'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1662" href="#t1662">1662</a></span><span class="t"> <span class="str">f" attribute called {plugin_initializer}. However, it does not. Please correct the plugin"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1663" href="#t1663">1663</a></span><span class="t"> <span class="str">f" metadata or initializer name in the Python module."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1664" href="#t1664">1664</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1665" href="#t1665">1665</a></span><span class="t"> <span class="key">return</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"PluginInitializationEntryPoint"</span><span class="op">,</span> <span class="nam">plugin_initializer</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1666" href="#t1666">1666</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1667" href="#t1667">1667</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1668" href="#t1668">1668</a></span><span class="t"><span class="key">def</span> <span class="nam">_json_plugin_loader</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1669" href="#t1669">1669</a></span><span class="t"> <span class="nam">plugin_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1670" href="#t1670">1670</a></span><span class="t"> <span class="nam">plugin_json_metadata</span><span class="op">:</span> <span class="nam">PluginJsonMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1671" href="#t1671">1671</a></span><span class="t"> <span class="nam">json_file_path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1672" href="#t1672">1672</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1673" href="#t1673">1673</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="str">"DebputyPluginInitializer"</span><span class="op">]</span><span class="op">,</span> <span class="key">None</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1674" href="#t1674">1674</a></span><span class="t"> <span class="nam">api_compat</span> <span class="op">=</span> <span class="nam">plugin_json_metadata</span><span class="op">[</span><span class="str">"api_compat_version"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1675" href="#t1675">1675</a></span><span class="t"> <span class="nam">module_name</span> <span class="op">=</span> <span class="nam">plugin_json_metadata</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"module"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1676" href="#t1676">1676</a></span><span class="t"> <span class="nam">plugin_initializer_name</span> <span class="op">=</span> <span class="nam">plugin_json_metadata</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"plugin_initializer"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1677" href="#t1677">1677</a></span><span class="t"> <span class="nam">packager_provided_files_raw</span> <span class="op">=</span> <span class="nam">plugin_json_metadata</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1678" href="#t1678">1678</a></span><span class="t"> <span class="str">"packager_provided_files"</span><span class="op">,</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1679" href="#t1679">1679</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1680" href="#t1680">1680</a></span><span class="t"> <span class="nam">manifest_variables_raw</span> <span class="op">=</span> <span class="nam">plugin_json_metadata</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"manifest_variables"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1681" href="#t1681">1681</a></span><span class="t"> <span class="nam">known_packaging_files_raw</span> <span class="op">=</span> <span class="nam">plugin_json_metadata</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"known_packaging_files"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1682" href="#t1682">1682</a></span><span class="t"> <span class="key">if</span> <span class="nam">api_compat</span> <span class="op">!=</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1682 ↛ 1683</span><span class="annotate long">line 1682 didn't jump to line 1683, because the condition on line 1682 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1683" href="#t1683">1683</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginMetadataError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1684" href="#t1684">1684</a></span><span class="t"> <span class="str">f'The plugin defined in "{json_file_path}" requires API compat level {api_compat}, but this'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1685" href="#t1685">1685</a></span><span class="t"> <span class="str">f" version of debputy only supports API compat version of 1"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1686" href="#t1686">1686</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1687" href="#t1687">1687</a></span><span class="t"> <span class="key">if</span> <span class="nam">plugin_initializer_name</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="str">"."</span> <span class="key">in</span> <span class="nam">plugin_initializer_name</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1687 ↛ 1688</span><span class="annotate long">line 1687 didn't jump to line 1688, because the condition on line 1687 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1688" href="#t1688">1688</a></span><span class="t"> <span class="nam">p</span> <span class="op">=</span> <span class="nam">attribute_path</span><span class="op">[</span><span class="str">"plugin_initializer"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1689" href="#t1689">1689</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginMetadataError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1690" href="#t1690">1690</a></span><span class="t"> <span class="str">f'The "{p}" must not contain ".". Problematic file is "{json_file_path}".'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1691" href="#t1691">1691</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1692" href="#t1692">1692</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1693" href="#t1693">1693</a></span><span class="t"> <span class="nam">plugin_initializers</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1694" href="#t1694">1694</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1695" href="#t1695">1695</a></span><span class="t"> <span class="key">if</span> <span class="nam">plugin_initializer_name</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1696" href="#t1696">1696</a></span><span class="t"> <span class="nam">plugin_initializer</span> <span class="op">=</span> <span class="nam">_resolve_module_initializer</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1697" href="#t1697">1697</a></span><span class="t"> <span class="nam">plugin_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1698" href="#t1698">1698</a></span><span class="t"> <span class="nam">plugin_initializer_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1699" href="#t1699">1699</a></span><span class="t"> <span class="nam">module_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1700" href="#t1700">1700</a></span><span class="t"> <span class="nam">json_file_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1701" href="#t1701">1701</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1702" href="#t1702">1702</a></span><span class="t"> <span class="nam">plugin_initializers</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">plugin_initializer</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1703" href="#t1703">1703</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1704" href="#t1704">1704</a></span><span class="t"> <span class="key">if</span> <span class="nam">known_packaging_files_raw</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1704 ↛ 1705</span><span class="annotate long">line 1704 didn't jump to line 1705, because the condition on line 1704 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1705" href="#t1705">1705</a></span><span class="t"> <span class="nam">kpf_root_path</span> <span class="op">=</span> <span class="nam">attribute_path</span><span class="op">[</span><span class="str">"known_packaging_files"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1706" href="#t1706">1706</a></span><span class="t"> <span class="nam">known_packaging_files</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1707" href="#t1707">1707</a></span><span class="t"> <span class="key">for</span> <span class="nam">k</span><span class="op">,</span> <span class="nam">v</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">known_packaging_files_raw</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1708" href="#t1708">1708</a></span><span class="t"> <span class="nam">kpf_path</span> <span class="op">=</span> <span class="nam">kpf_root_path</span><span class="op">[</span><span class="nam">k</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1709" href="#t1709">1709</a></span><span class="t"> <span class="nam">p</span> <span class="op">=</span> <span class="nam">v</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"path"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1710" href="#t1710">1710</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">p</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1711" href="#t1711">1711</a></span><span class="t"> <span class="nam">kpf_path</span><span class="op">.</span><span class="nam">path_hint</span> <span class="op">=</span> <span class="nam">p</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1712" href="#t1712">1712</a></span><span class="t"> <span class="key">if</span> <span class="nam">plugin_name</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"debputy-"</span><span class="op">)</span> <span class="key">and</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">dict</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1713" href="#t1713">1713</a></span><span class="t"> <span class="nam">docs</span> <span class="op">=</span> <span class="nam">v</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"documentation-uris"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1714" href="#t1714">1714</a></span><span class="t"> <span class="key">if</span> <span class="nam">docs</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">docs</span><span class="op">,</span> <span class="nam">list</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1715" href="#t1715">1715</a></span><span class="t"> <span class="nam">docs</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1716" href="#t1716">1716</a></span><span class="t"> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1717" href="#t1717">1717</a></span><span class="t"> <span class="nam">d</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">"@DEBPUTY_DOC_ROOT_DIR@"</span><span class="op">,</span> <span class="nam">DEBPUTY_DOC_ROOT_DIR</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1718" href="#t1718">1718</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">d</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1719" href="#t1719">1719</a></span><span class="t"> <span class="key">else</span> <span class="nam">d</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1720" href="#t1720">1720</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1721" href="#t1721">1721</a></span><span class="t"> <span class="key">for</span> <span class="nam">d</span> <span class="key">in</span> <span class="nam">docs</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1722" href="#t1722">1722</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1723" href="#t1723">1723</a></span><span class="t"> <span class="nam">v</span><span class="op">[</span><span class="str">"documentation-uris"</span><span class="op">]</span> <span class="op">=</span> <span class="nam">docs</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1724" href="#t1724">1724</a></span><span class="t"> <span class="nam">known_packaging_file</span><span class="op">:</span> <span class="nam">KnownPackagingFileInfo</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1725" href="#t1725">1725</a></span><span class="t"> <span class="nam">PLUGIN_KNOWN_PACKAGING_FILES_PARSER</span><span class="op">.</span><span class="nam">parse_input</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1726" href="#t1726">1726</a></span><span class="t"> <span class="nam">v</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1727" href="#t1727">1727</a></span><span class="t"> <span class="nam">kpf_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1728" href="#t1728">1728</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1729" href="#t1729">1729</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1730" href="#t1730">1730</a></span><span class="t"> <span class="nam">known_packaging_files</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="op">(</span><span class="nam">kpf_path</span><span class="op">,</span> <span class="nam">known_packaging_file</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1731" href="#t1731">1731</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1732" href="#t1732">1732</a></span><span class="t"> <span class="key">def</span> <span class="nam">_initialize_json_provided_known_packaging_files</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1733" href="#t1733">1733</a></span><span class="t"> <span class="nam">api</span><span class="op">:</span> <span class="nam">DebputyPluginInitializerProvider</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1734" href="#t1734">1734</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1735" href="#t1735">1735</a></span><span class="t"> <span class="key">for</span> <span class="nam">p</span><span class="op">,</span> <span class="nam">details</span> <span class="key">in</span> <span class="nam">known_packaging_files</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1736" href="#t1736">1736</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1737" href="#t1737">1737</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">known_packaging_files</span><span class="op">(</span><span class="nam">details</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1738" href="#t1738">1738</a></span><span class="t"> <span class="key">except</span> <span class="nam">ValueError</span> <span class="key">as</span> <span class="nam">ex</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1739" href="#t1739">1739</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginMetadataError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1740" href="#t1740">1740</a></span><span class="t"> <span class="str">f"Error while processing {p.path} defined in {json_file_path}: {ex.args[0]}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1741" href="#t1741">1741</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1742" href="#t1742">1742</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1743" href="#t1743">1743</a></span><span class="t"> <span class="nam">plugin_initializers</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">_initialize_json_provided_known_packaging_files</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1744" href="#t1744">1744</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1745" href="#t1745">1745</a></span><span class="t"> <span class="key">if</span> <span class="nam">manifest_variables_raw</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1746" href="#t1746">1746</a></span><span class="t"> <span class="nam">manifest_var_path</span> <span class="op">=</span> <span class="nam">attribute_path</span><span class="op">[</span><span class="str">"manifest_variables"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1747" href="#t1747">1747</a></span><span class="t"> <span class="nam">manifest_variables</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1748" href="#t1748">1748</a></span><span class="t"> <span class="nam">PLUGIN_MANIFEST_VARS_PARSER</span><span class="op">.</span><span class="nam">parse_input</span><span class="op">(</span><span class="nam">p</span><span class="op">,</span> <span class="nam">manifest_var_path</span><span class="op">[</span><span class="nam">i</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1749" href="#t1749">1749</a></span><span class="t"> <span class="key">for</span> <span class="nam">i</span><span class="op">,</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">manifest_variables_raw</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1750" href="#t1750">1750</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1751" href="#t1751">1751</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1752" href="#t1752">1752</a></span><span class="t"> <span class="key">def</span> <span class="nam">_initialize_json_provided_manifest_vars</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1753" href="#t1753">1753</a></span><span class="t"> <span class="nam">api</span><span class="op">:</span> <span class="nam">DebputyPluginInitializer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1754" href="#t1754">1754</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1755" href="#t1755">1755</a></span><span class="t"> <span class="key">for</span> <span class="nam">idx</span><span class="op">,</span> <span class="nam">manifest_variable</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">manifest_variables</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1756" href="#t1756">1756</a></span><span class="t"> <span class="nam">name</span> <span class="op">=</span> <span class="nam">manifest_variable</span><span class="op">[</span><span class="str">"name"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1757" href="#t1757">1757</a></span><span class="t"> <span class="nam">value</span> <span class="op">=</span> <span class="nam">manifest_variable</span><span class="op">[</span><span class="str">"value"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1758" href="#t1758">1758</a></span><span class="t"> <span class="nam">doc</span> <span class="op">=</span> <span class="nam">manifest_variable</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"reference_documentation"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1759" href="#t1759">1759</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1760" href="#t1760">1760</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">manifest_variable</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1761" href="#t1761">1761</a></span><span class="t"> <span class="nam">name</span><span class="op">,</span> <span class="nam">value</span><span class="op">,</span> <span class="nam">variable_reference_documentation</span><span class="op">=</span><span class="nam">doc</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1762" href="#t1762">1762</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1763" href="#t1763">1763</a></span><span class="t"> <span class="key">except</span> <span class="nam">ValueError</span> <span class="key">as</span> <span class="nam">ex</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1764" href="#t1764">1764</a></span><span class="t"> <span class="nam">var_path</span> <span class="op">=</span> <span class="nam">manifest_var_path</span><span class="op">[</span><span class="nam">idx</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1765" href="#t1765">1765</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginMetadataError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1766" href="#t1766">1766</a></span><span class="t"> <span class="str">f"Error while processing {var_path.path} defined in {json_file_path}: {ex.args[0]}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1767" href="#t1767">1767</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1768" href="#t1768">1768</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1769" href="#t1769">1769</a></span><span class="t"> <span class="nam">plugin_initializers</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">_initialize_json_provided_manifest_vars</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1770" href="#t1770">1770</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1771" href="#t1771">1771</a></span><span class="t"> <span class="key">if</span> <span class="nam">packager_provided_files_raw</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1772" href="#t1772">1772</a></span><span class="t"> <span class="nam">ppf_path</span> <span class="op">=</span> <span class="nam">attribute_path</span><span class="op">[</span><span class="str">"packager_provided_files"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1773" href="#t1773">1773</a></span><span class="t"> <span class="nam">ppfs</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1774" href="#t1774">1774</a></span><span class="t"> <span class="nam">PLUGIN_PPF_PARSER</span><span class="op">.</span><span class="nam">parse_input</span><span class="op">(</span><span class="nam">p</span><span class="op">,</span> <span class="nam">ppf_path</span><span class="op">[</span><span class="nam">i</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1775" href="#t1775">1775</a></span><span class="t"> <span class="key">for</span> <span class="nam">i</span><span class="op">,</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">packager_provided_files_raw</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1776" href="#t1776">1776</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1777" href="#t1777">1777</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1778" href="#t1778">1778</a></span><span class="t"> <span class="key">def</span> <span class="nam">_initialize_json_provided_ppfs</span><span class="op">(</span><span class="nam">api</span><span class="op">:</span> <span class="nam">DebputyPluginInitializer</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1779" href="#t1779">1779</a></span><span class="t"> <span class="nam">ppf</span><span class="op">:</span> <span class="nam">PackagerProvidedFileJsonDescription</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1780" href="#t1780">1780</a></span><span class="t"> <span class="key">for</span> <span class="nam">idx</span><span class="op">,</span> <span class="nam">ppf</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">ppfs</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1781" href="#t1781">1781</a></span><span class="t"> <span class="nam">c</span> <span class="op">=</span> <span class="nam">dict</span><span class="op">(</span><span class="nam">ppf</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1782" href="#t1782">1782</a></span><span class="t"> <span class="nam">stem</span> <span class="op">=</span> <span class="nam">ppf</span><span class="op">[</span><span class="str">"stem"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1783" href="#t1783">1783</a></span><span class="t"> <span class="nam">installed_path</span> <span class="op">=</span> <span class="nam">ppf</span><span class="op">[</span><span class="str">"installed_path"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1784" href="#t1784">1784</a></span><span class="t"> <span class="nam">default_mode</span> <span class="op">=</span> <span class="nam">ppf</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"default_mode"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1785" href="#t1785">1785</a></span><span class="t"> <span class="nam">ref_doc_dict</span> <span class="op">=</span> <span class="nam">ppf</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"reference_documentation"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1786" href="#t1786">1786</a></span><span class="t"> <span class="key">if</span> <span class="nam">default_mode</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1786 ↛ 1789</span><span class="annotate long">line 1786 didn't jump to line 1789, because the condition on line 1786 was never false</span></span></p> - <p class="run"><span class="n"><a id="t1787" href="#t1787">1787</a></span><span class="t"> <span class="nam">c</span><span class="op">[</span><span class="str">"default_mode"</span><span class="op">]</span> <span class="op">=</span> <span class="nam">default_mode</span><span class="op">.</span><span class="nam">octal_mode</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1788" href="#t1788">1788</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1789" href="#t1789">1789</a></span><span class="t"> <span class="key">if</span> <span class="nam">ref_doc_dict</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1789 ↛ 1794</span><span class="annotate long">line 1789 didn't jump to line 1794, because the condition on line 1789 was never false</span></span></p> - <p class="run"><span class="n"><a id="t1790" href="#t1790">1790</a></span><span class="t"> <span class="nam">ref_doc</span> <span class="op">=</span> <span class="nam">packager_provided_file_reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1791" href="#t1791">1791</a></span><span class="t"> <span class="op">**</span><span class="nam">ref_doc_dict</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1792" href="#t1792">1792</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1793" href="#t1793">1793</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1794" href="#t1794">1794</a></span><span class="t"> <span class="nam">ref_doc</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1795" href="#t1795">1795</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1796" href="#t1796">1796</a></span><span class="t"> <span class="key">for</span> <span class="nam">k</span> <span class="key">in</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1797" href="#t1797">1797</a></span><span class="t"> <span class="str">"stem"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1798" href="#t1798">1798</a></span><span class="t"> <span class="str">"installed_path"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1799" href="#t1799">1799</a></span><span class="t"> <span class="str">"reference_documentation"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1800" href="#t1800">1800</a></span><span class="t"> <span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1801" href="#t1801">1801</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1802" href="#t1802">1802</a></span><span class="t"> <span class="key">del</span> <span class="nam">c</span><span class="op">[</span><span class="nam">k</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1803" href="#t1803">1803</a></span><span class="t"> <span class="key">except</span> <span class="nam">KeyError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1804" href="#t1804">1804</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1805" href="#t1805">1805</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1806" href="#t1806">1806</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1807" href="#t1807">1807</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span><span class="nam">stem</span><span class="op">,</span> <span class="nam">installed_path</span><span class="op">,</span> <span class="nam">reference_documentation</span><span class="op">=</span><span class="nam">ref_doc</span><span class="op">,</span> <span class="op">**</span><span class="nam">c</span><span class="op">)</span> <span class="com"># type: ignore</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1808" href="#t1808">1808</a></span><span class="t"> <span class="key">except</span> <span class="nam">ValueError</span> <span class="key">as</span> <span class="nam">ex</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1809" href="#t1809">1809</a></span><span class="t"> <span class="nam">p_path</span> <span class="op">=</span> <span class="nam">ppf_path</span><span class="op">[</span><span class="nam">idx</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1810" href="#t1810">1810</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginMetadataError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1811" href="#t1811">1811</a></span><span class="t"> <span class="str">f"Error while processing {p_path.path} defined in {json_file_path}: {ex.args[0]}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1812" href="#t1812">1812</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1813" href="#t1813">1813</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1814" href="#t1814">1814</a></span><span class="t"> <span class="nam">plugin_initializers</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">_initialize_json_provided_ppfs</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1815" href="#t1815">1815</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1816" href="#t1816">1816</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">plugin_initializers</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1816 ↛ 1817</span><span class="annotate long">line 1816 didn't jump to line 1817, because the condition on line 1816 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1817" href="#t1817">1817</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginMetadataError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1818" href="#t1818">1818</a></span><span class="t"> <span class="str">f"The plugin defined in {json_file_path} does not seem to provide features, "</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1819" href="#t1819">1819</a></span><span class="t"> <span class="str">f" such as module + plugin-initializer or packager-provided-files."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1820" href="#t1820">1820</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1821" href="#t1821">1821</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1822" href="#t1822">1822</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">plugin_initializers</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1823" href="#t1823">1823</a></span><span class="t"> <span class="key">return</span> <span class="nam">plugin_initializers</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1824" href="#t1824">1824</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1825" href="#t1825">1825</a></span><span class="t"> <span class="key">def</span> <span class="nam">_chain_loader</span><span class="op">(</span><span class="nam">api</span><span class="op">:</span> <span class="nam">DebputyPluginInitializer</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1826" href="#t1826">1826</a></span><span class="t"> <span class="key">for</span> <span class="nam">initializer</span> <span class="key">in</span> <span class="nam">plugin_initializers</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1827" href="#t1827">1827</a></span><span class="t"> <span class="nam">initializer</span><span class="op">(</span><span class="nam">api</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1828" href="#t1828">1828</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1829" href="#t1829">1829</a></span><span class="t"> <span class="key">return</span> <span class="nam">_chain_loader</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1830" href="#t1830">1830</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1831" href="#t1831">1831</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1832" href="#t1832">1832</a></span><span class="t"><span class="op">@</span><span class="nam">contextlib</span><span class="op">.</span><span class="nam">contextmanager</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1833" href="#t1833">1833</a></span><span class="t"><span class="key">def</span> <span class="nam">_open</span><span class="op">(</span><span class="nam">path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">fd</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">IO</span><span class="op">[</span><span class="nam">bytes</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">IO</span><span class="op">[</span><span class="nam">bytes</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1834" href="#t1834">1834</a></span><span class="t"> <span class="key">if</span> <span class="nam">fd</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1835" href="#t1835">1835</a></span><span class="t"> <span class="key">yield</span> <span class="nam">fd</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1836" href="#t1836">1836</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1837" href="#t1837">1837</a></span><span class="t"> <span class="key">with</span> <span class="nam">open</span><span class="op">(</span><span class="nam">path</span><span class="op">,</span> <span class="str">"rb"</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1838" href="#t1838">1838</a></span><span class="t"> <span class="key">yield</span> <span class="nam">fd</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1839" href="#t1839">1839</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1840" href="#t1840">1840</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1841" href="#t1841">1841</a></span><span class="t"><span class="key">def</span> <span class="nam">parse_json_plugin_desc</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1842" href="#t1842">1842</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">fd</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">IO</span><span class="op">[</span><span class="nam">bytes</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1843" href="#t1843">1843</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">DebputyPluginMetadata</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1844" href="#t1844">1844</a></span><span class="t"> <span class="key">with</span> <span class="nam">_open</span><span class="op">(</span><span class="nam">path</span><span class="op">,</span> <span class="nam">fd</span><span class="op">=</span><span class="nam">fd</span><span class="op">)</span> <span class="key">as</span> <span class="nam">rfd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1845" href="#t1845">1845</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1846" href="#t1846">1846</a></span><span class="t"> <span class="nam">raw</span> <span class="op">=</span> <span class="nam">json</span><span class="op">.</span><span class="nam">load</span><span class="op">(</span><span class="nam">rfd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1847" href="#t1847">1847</a></span><span class="t"> <span class="key">except</span> <span class="nam">JSONDecodeError</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1848" href="#t1848">1848</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginMetadataError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1849" href="#t1849">1849</a></span><span class="t"> <span class="str">f'The plugin defined in "{path}" could not be parsed as valid JSON: {e.args[0]}'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1850" href="#t1850">1850</a></span><span class="t"> <span class="op">)</span> <span class="key">from</span> <span class="nam">e</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1851" href="#t1851">1851</a></span><span class="t"> <span class="nam">plugin_name</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">basename</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1852" href="#t1852">1852</a></span><span class="t"> <span class="key">if</span> <span class="nam">plugin_name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">".json"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1853" href="#t1853">1853</a></span><span class="t"> <span class="nam">plugin_name</span> <span class="op">=</span> <span class="nam">plugin_name</span><span class="op">[</span><span class="op">:</span><span class="op">-</span><span class="num">5</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1854" href="#t1854">1854</a></span><span class="t"> <span class="key">elif</span> <span class="nam">plugin_name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">".json.in"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1855" href="#t1855">1855</a></span><span class="t"> <span class="nam">plugin_name</span> <span class="op">=</span> <span class="nam">plugin_name</span><span class="op">[</span><span class="op">:</span><span class="op">-</span><span class="num">8</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1856" href="#t1856">1856</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1857" href="#t1857">1857</a></span><span class="t"> <span class="key">if</span> <span class="nam">plugin_name</span> <span class="op">==</span> <span class="str">"debputy"</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1857 ↛ 1859</span><span class="annotate long">line 1857 didn't jump to line 1859, because the condition on line 1857 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t1858" href="#t1858">1858</a></span><span class="t"> <span class="com"># Provide a better error message than "The plugin has already loaded!?"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1859" href="#t1859">1859</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginMetadataError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1860" href="#t1860">1860</a></span><span class="t"> <span class="str">f'The plugin named {plugin_name} must be bundled with `debputy`. Please rename "{path}" so it does not'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1861" href="#t1861">1861</a></span><span class="t"> <span class="str">f" clash with the bundled plugin of same name."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1862" href="#t1862">1862</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1863" href="#t1863">1863</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1864" href="#t1864">1864</a></span><span class="t"> <span class="nam">attribute_path</span> <span class="op">=</span> <span class="nam">AttributePath</span><span class="op">.</span><span class="nam">root_path</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1865" href="#t1865">1865</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1866" href="#t1866">1866</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1867" href="#t1867">1867</a></span><span class="t"> <span class="nam">plugin_json_metadata</span> <span class="op">=</span> <span class="nam">PLUGIN_METADATA_PARSER</span><span class="op">.</span><span class="nam">parse_input</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1868" href="#t1868">1868</a></span><span class="t"> <span class="nam">raw</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1869" href="#t1869">1869</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1870" href="#t1870">1870</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1871" href="#t1871">1871</a></span><span class="t"> <span class="key">except</span> <span class="nam">ManifestParseException</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1872" href="#t1872">1872</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginMetadataError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1873" href="#t1873">1873</a></span><span class="t"> <span class="str">f'The plugin defined in "{path}" was valid JSON but could not be parsed: {e.message}'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1874" href="#t1874">1874</a></span><span class="t"> <span class="op">)</span> <span class="key">from</span> <span class="nam">e</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1875" href="#t1875">1875</a></span><span class="t"> <span class="nam">api_compat</span> <span class="op">=</span> <span class="nam">plugin_json_metadata</span><span class="op">[</span><span class="str">"api_compat_version"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1876" href="#t1876">1876</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1877" href="#t1877">1877</a></span><span class="t"> <span class="key">return</span> <span class="nam">DebputyPluginMetadata</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1878" href="#t1878">1878</a></span><span class="t"> <span class="nam">plugin_name</span><span class="op">=</span><span class="nam">plugin_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1879" href="#t1879">1879</a></span><span class="t"> <span class="nam">plugin_loader</span><span class="op">=</span><span class="key">lambda</span><span class="op">:</span> <span class="nam">_json_plugin_loader</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1880" href="#t1880">1880</a></span><span class="t"> <span class="nam">plugin_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1881" href="#t1881">1881</a></span><span class="t"> <span class="nam">plugin_json_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1882" href="#t1882">1882</a></span><span class="t"> <span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1883" href="#t1883">1883</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1884" href="#t1884">1884</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1885" href="#t1885">1885</a></span><span class="t"> <span class="nam">api_compat_version</span><span class="op">=</span><span class="nam">api_compat</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1886" href="#t1886">1886</a></span><span class="t"> <span class="nam">plugin_initializer</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1887" href="#t1887">1887</a></span><span class="t"> <span class="nam">plugin_path</span><span class="op">=</span><span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1888" href="#t1888">1888</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1889" href="#t1889">1889</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1890" href="#t1890">1890</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1891" href="#t1891">1891</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1892" href="#t1892">1892</a></span><span class="t"><span class="key">class</span> <span class="nam">ServiceDefinitionImpl</span><span class="op">(</span><span class="nam">ServiceDefinition</span><span class="op">[</span><span class="nam">DSD</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1893" href="#t1893">1893</a></span><span class="t"> <span class="nam">name</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1894" href="#t1894">1894</a></span><span class="t"> <span class="nam">names</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1895" href="#t1895">1895</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1896" href="#t1896">1896</a></span><span class="t"> <span class="nam">type_of_service</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1897" href="#t1897">1897</a></span><span class="t"> <span class="nam">service_scope</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1898" href="#t1898">1898</a></span><span class="t"> <span class="nam">auto_enable_on_install</span><span class="op">:</span> <span class="nam">bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1899" href="#t1899">1899</a></span><span class="t"> <span class="nam">auto_start_on_install</span><span class="op">:</span> <span class="nam">bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1900" href="#t1900">1900</a></span><span class="t"> <span class="nam">on_upgrade</span><span class="op">:</span> <span class="nam">ServiceUpgradeRule</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1901" href="#t1901">1901</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1902" href="#t1902">1902</a></span><span class="t"> <span class="nam">is_plugin_provided_definition</span><span class="op">:</span> <span class="nam">bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1903" href="#t1903">1903</a></span><span class="t"> <span class="nam">service_context</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">DSD</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1904" href="#t1904">1904</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1905" href="#t1905">1905</a></span><span class="t"> <span class="key">def</span> <span class="nam">replace</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">**</span><span class="nam">changes</span><span class="op">:</span> <span class="nam">Any</span><span class="op">)</span> <span class="op">-></span> <span class="str">"ServiceDefinitionImpl[DSD]"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1906" href="#t1906">1906</a></span><span class="t"> <span class="key">return</span> <span class="nam">dataclasses</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">**</span><span class="nam">changes</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1907" href="#t1907">1907</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1908" href="#t1908">1908</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1909" href="#t1909">1909</a></span><span class="t"><span class="key">class</span> <span class="nam">ServiceRegistryImpl</span><span class="op">(</span><span class="nam">ServiceRegistry</span><span class="op">[</span><span class="nam">DSD</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1910" href="#t1910">1910</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"_service_manager_details"</span><span class="op">,</span> <span class="str">"_service_definitions"</span><span class="op">,</span> <span class="str">"_seen_services"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1911" href="#t1911">1911</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1912" href="#t1912">1912</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">service_manager_details</span><span class="op">:</span> <span class="nam">ServiceManagerDetails</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1913" href="#t1913">1913</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_service_manager_details</span> <span class="op">=</span> <span class="nam">service_manager_details</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1914" href="#t1914">1914</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_service_definitions</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">ServiceDefinition</span><span class="op">[</span><span class="nam">DSD</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1915" href="#t1915">1915</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_seen_services</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1916" href="#t1916">1916</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1917" href="#t1917">1917</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1918" href="#t1918">1918</a></span><span class="t"> <span class="key">def</span> <span class="nam">detected_services</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">ServiceDefinition</span><span class="op">[</span><span class="nam">DSD</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1919" href="#t1919">1919</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_service_definitions</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1920" href="#t1920">1920</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1921" href="#t1921">1921</a></span><span class="t"> <span class="key">def</span> <span class="nam">register_service</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1922" href="#t1922">1922</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1923" href="#t1923">1923</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1924" href="#t1924">1924</a></span><span class="t"> <span class="nam">name</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1925" href="#t1925">1925</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1926" href="#t1926">1926</a></span><span class="t"> <span class="nam">type_of_service</span><span class="op">:</span> <span class="nam">str</span> <span class="op">=</span> <span class="str">"service"</span><span class="op">,</span> <span class="com"># "timer", etc.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1927" href="#t1927">1927</a></span><span class="t"> <span class="nam">service_scope</span><span class="op">:</span> <span class="nam">str</span> <span class="op">=</span> <span class="str">"system"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1928" href="#t1928">1928</a></span><span class="t"> <span class="nam">enable_by_default</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1929" href="#t1929">1929</a></span><span class="t"> <span class="nam">start_by_default</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1930" href="#t1930">1930</a></span><span class="t"> <span class="nam">default_upgrade_rule</span><span class="op">:</span> <span class="nam">ServiceUpgradeRule</span> <span class="op">=</span> <span class="str">"restart"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1931" href="#t1931">1931</a></span><span class="t"> <span class="nam">service_context</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">DSD</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1932" href="#t1932">1932</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1933" href="#t1933">1933</a></span><span class="t"> <span class="nam">names</span> <span class="op">=</span> <span class="nam">name</span> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">name</span><span class="op">,</span> <span class="nam">list</span><span class="op">)</span> <span class="key">else</span> <span class="op">[</span><span class="nam">name</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1934" href="#t1934">1934</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">names</span><span class="op">)</span> <span class="op"><</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1935" href="#t1935">1935</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1936" href="#t1936">1936</a></span><span class="t"> <span class="str">f"The service must have at least one name - {path.absolute} did not have any"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1937" href="#t1937">1937</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1938" href="#t1938">1938</a></span><span class="t"> <span class="key">for</span> <span class="nam">n</span> <span class="key">in</span> <span class="nam">names</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1939" href="#t1939">1939</a></span><span class="t"> <span class="nam">key</span> <span class="op">=</span> <span class="op">(</span><span class="nam">n</span><span class="op">,</span> <span class="nam">type_of_service</span><span class="op">,</span> <span class="nam">service_scope</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1940" href="#t1940">1940</a></span><span class="t"> <span class="key">if</span> <span class="nam">key</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_seen_services</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1941" href="#t1941">1941</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginAPIViolationError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1942" href="#t1942">1942</a></span><span class="t"> <span class="str">f"The service manager (from {self._service_manager_details.plugin_metadata.plugin_name}) used"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1943" href="#t1943">1943</a></span><span class="t"> <span class="str">f" the service name {n} (type: {type_of_service}, scope: {service_scope}) twice. This is not"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1944" href="#t1944">1944</a></span><span class="t"> <span class="str">" allowed by the debputy plugin API."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1945" href="#t1945">1945</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1946" href="#t1946">1946</a></span><span class="t"> <span class="com"># TODO: We cannot create a service definition immediate once the manifest is involved</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1947" href="#t1947">1947</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_service_definitions</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1948" href="#t1948">1948</a></span><span class="t"> <span class="nam">ServiceDefinitionImpl</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1949" href="#t1949">1949</a></span><span class="t"> <span class="nam">names</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1950" href="#t1950">1950</a></span><span class="t"> <span class="nam">names</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1951" href="#t1951">1951</a></span><span class="t"> <span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1952" href="#t1952">1952</a></span><span class="t"> <span class="nam">type_of_service</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1953" href="#t1953">1953</a></span><span class="t"> <span class="nam">service_scope</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1954" href="#t1954">1954</a></span><span class="t"> <span class="nam">enable_by_default</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1955" href="#t1955">1955</a></span><span class="t"> <span class="nam">start_by_default</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1956" href="#t1956">1956</a></span><span class="t"> <span class="nam">default_upgrade_rule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1957" href="#t1957">1957</a></span><span class="t"> <span class="str">f"Auto-detected by plugin {self._service_manager_details.plugin_metadata.plugin_name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1958" href="#t1958">1958</a></span><span class="t"> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1959" href="#t1959">1959</a></span><span class="t"> <span class="nam">service_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1960" href="#t1960">1960</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1961" href="#t1961">1961</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_64287305fe0c6642_feature_set_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_64287305fe0c6642_impl_types_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_64287305fe0c6642_impl_types_py.html b/coverage-report/d_64287305fe0c6642_impl_types_py.html deleted file mode 100644 index ed43f9a..0000000 --- a/coverage-report/d_64287305fe0c6642_impl_types_py.html +++ /dev/null @@ -1,1383 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/plugin/api/impl_types.py: 78%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/plugin/api/impl_types.py</b>: - <span class="pc_cov">78%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">526 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">428<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">98<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">6<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">23<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_64287305fe0c6642_impl_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_64287305fe0c6642_plugin_parser_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">dataclasses</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">textwrap</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="nam">Callable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">FrozenSet</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">Dict</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">List</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">Generic</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">TYPE_CHECKING</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">TypeVar</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">cast</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">Sequence</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">Type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">TypedDict</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">Iterable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">Mapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">NotRequired</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="nam">Literal</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">Set</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="nam">Iterator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"><span class="key">from</span> <span class="nam">weakref</span> <span class="key">import</span> <span class="nam">ref</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span> <span class="key">import</span> <span class="nam">DEBPUTY_DOC_ROOT_DIR</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">exceptions</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="nam">DebputyFSIsROError</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="nam">PluginAPIViolationError</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="nam">PluginConflictError</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="nam">UnhandledOrUnexpectedErrorFromPluginError</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">filesystem_scan</span> <span class="key">import</span> <span class="nam">as_path_def</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">installations</span> <span class="key">import</span> <span class="nam">InstallRule</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">maintscript_snippet</span> <span class="key">import</span> <span class="nam">DpkgMaintscriptHelperCommand</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_conditions</span> <span class="key">import</span> <span class="nam">ManifestCondition</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">base_types</span> <span class="key">import</span> <span class="nam">DebputyParsedContent</span><span class="op">,</span> <span class="nam">TypeMapping</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">exceptions</span> <span class="key">import</span> <span class="nam">ManifestParseException</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">AttributePath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">packages</span> <span class="key">import</span> <span class="nam">BinaryPackage</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="nam">BinaryCtrlAccessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">spec</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="nam">DebputyPluginInitializer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="nam">MetadataAutoDetector</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="nam">DpkgTriggerType</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="nam">ParserDocumentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="nam">PackageProcessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="nam">PathDef</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">ParserAttributeDocumentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="nam">undocumented_attr</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="nam">reference_documentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="nam">PackagerProvidedFileReferenceDocumentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="nam">TypeMappingDocumentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">substitution</span> <span class="key">import</span> <span class="nam">VariableContext</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">transformation_rules</span> <span class="key">import</span> <span class="nam">TransformationRule</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">_normalize_path</span><span class="op">,</span> <span class="nam">package_cross_check_precheck</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"><span class="key">if</span> <span class="nam">TYPE_CHECKING</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">spec</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="nam">ServiceDetector</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="nam">ServiceIntegrator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="nam">PackageTypeSelector</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">parser_data</span> <span class="key">import</span> <span class="nam">ParserContextData</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">highlevel_manifest</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="nam">HighLevelManifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="nam">PackageTransformationDefinition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="nam">BinaryPackageData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"><span class="nam">_PACKAGE_TYPE_DEB_ONLY</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span><span class="op">[</span><span class="str">"deb"</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"><span class="nam">_ALL_PACKAGE_TYPES</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span><span class="op">[</span><span class="str">"deb"</span><span class="op">,</span> <span class="str">"udeb"</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"><span class="nam">TD</span> <span class="op">=</span> <span class="nam">TypeVar</span><span class="op">(</span><span class="str">"TD"</span><span class="op">,</span> <span class="nam">bound</span><span class="op">=</span><span class="str">"Union[DebputyParsedContent, List[DebputyParsedContent]]"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"><span class="nam">PF</span> <span class="op">=</span> <span class="nam">TypeVar</span><span class="op">(</span><span class="str">"PF"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"><span class="nam">SF</span> <span class="op">=</span> <span class="nam">TypeVar</span><span class="op">(</span><span class="str">"SF"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"><span class="nam">TP</span> <span class="op">=</span> <span class="nam">TypeVar</span><span class="op">(</span><span class="str">"TP"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"><span class="nam">TTP</span> <span class="op">=</span> <span class="nam">Type</span><span class="op">[</span><span class="nam">TP</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"><span class="nam">DIPKWHandler</span> <span class="op">=</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">AttributePath</span><span class="op">,</span> <span class="str">"ParserContextData"</span><span class="op">]</span><span class="op">,</span> <span class="nam">TP</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"><span class="nam">DIPHandler</span> <span class="op">=</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">PF</span><span class="op">,</span> <span class="nam">AttributePath</span><span class="op">,</span> <span class="str">"ParserContextData"</span><span class="op">]</span><span class="op">,</span> <span class="nam">TP</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"><span class="key">def</span> <span class="nam">resolve_package_type_selectors</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="nam">package_type</span><span class="op">:</span> <span class="str">"PackageTypeSelector"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="key">if</span> <span class="nam">package_type</span> <span class="key">is</span> <span class="nam">_ALL_PACKAGE_TYPES</span> <span class="key">or</span> <span class="nam">package_type</span> <span class="key">is</span> <span class="nam">_PACKAGE_TYPE_DEB_ONLY</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="key">return</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"FrozenSet[str]"</span><span class="op">,</span> <span class="nam">package_type</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">package_type</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="key">return</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="nam">_PACKAGE_TYPE_DEB_ONLY</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="key">if</span> <span class="nam">package_type</span> <span class="op">==</span> <span class="str">"deb"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="key">else</span> <span class="nam">frozenset</span><span class="op">(</span><span class="op">[</span><span class="nam">package_type</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="key">return</span> <span class="nam">frozenset</span><span class="op">(</span><span class="nam">package_type</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"><span class="key">class</span> <span class="nam">DebputyPluginMetadata</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="nam">plugin_name</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="nam">api_compat_version</span><span class="op">:</span> <span class="nam">int</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="nam">plugin_loader</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="op">]</span><span class="op">,</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="str">"DebputyPluginInitializer"</span><span class="op">]</span><span class="op">,</span> <span class="key">None</span><span class="op">]</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="nam">plugin_initializer</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="str">"DebputyPluginInitializer"</span><span class="op">]</span><span class="op">,</span> <span class="key">None</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="nam">plugin_path</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="nam">_is_initialized</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_loaded</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">plugin_initializer</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_initialized</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_is_initialized</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="key">def</span> <span class="nam">initialize_plugin</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">api</span><span class="op">:</span> <span class="str">"DebputyPluginInitializer"</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_initialized</span><span class="op">:</span> </span><span class="r"><span class="annotate short">128 ↛ 129</span><span class="annotate long">line 128 didn't jump to line 129, because the condition on line 128 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="key">raise</span> <span class="nam">RuntimeError</span><span class="op">(</span><span class="str">"Cannot load plugins twice"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_loaded</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">load_plugin</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="nam">plugin_initializer</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">plugin_initializer</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="key">assert</span> <span class="nam">plugin_initializer</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="nam">plugin_initializer</span><span class="op">(</span><span class="nam">api</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_is_initialized</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="key">def</span> <span class="nam">load_plugin</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="nam">plugin_loader</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">plugin_loader</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="key">assert</span> <span class="nam">plugin_loader</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">plugin_initializer</span> <span class="op">=</span> <span class="nam">plugin_loader</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="key">assert</span> <span class="nam">self</span><span class="op">.</span><span class="nam">plugin_initializer</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"><span class="key">class</span> <span class="nam">PluginProvidedParser</span><span class="op">(</span><span class="nam">Generic</span><span class="op">[</span><span class="nam">PF</span><span class="op">,</span> <span class="nam">TP</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="nam">parser</span><span class="op">:</span> <span class="str">"DeclarativeInputParser[PF]"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="nam">handler</span><span class="op">:</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">PF</span><span class="op">,</span> <span class="str">"AttributePath"</span><span class="op">,</span> <span class="str">"ParserContextData"</span><span class="op">]</span><span class="op">,</span> <span class="nam">TP</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">:</span> <span class="nam">DebputyPluginMetadata</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="key">def</span> <span class="nam">parse</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="nam">name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="nam">value</span><span class="op">:</span> <span class="nam">object</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="str">"AttributePath"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="nam">parser_context</span><span class="op">:</span> <span class="str">"ParserContextData"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">TP</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="nam">parsed_value</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">parser</span><span class="op">.</span><span class="nam">parse_input</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="nam">value</span><span class="op">,</span> <span class="nam">attribute_path</span><span class="op">,</span> <span class="nam">parser_context</span><span class="op">=</span><span class="nam">parser_context</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">handler</span><span class="op">(</span><span class="nam">name</span><span class="op">,</span> <span class="nam">parsed_value</span><span class="op">,</span> <span class="nam">attribute_path</span><span class="op">,</span> <span class="nam">parser_context</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"><span class="key">class</span> <span class="nam">PPFFormatParam</span><span class="op">(</span><span class="nam">TypedDict</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="nam">priority</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="nam">name</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="nam">owning_package</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"><span class="key">class</span> <span class="nam">PackagerProvidedFileClassSpec</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="nam">debputy_plugin_metadata</span><span class="op">:</span> <span class="nam">DebputyPluginMetadata</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">stem</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="nam">installed_as_format</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="nam">default_mode</span><span class="op">:</span> <span class="nam">int</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="nam">default_priority</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="nam">allow_name_segment</span><span class="op">:</span> <span class="nam">bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="nam">allow_architecture_segment</span><span class="op">:</span> <span class="nam">bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="nam">post_formatting_rewrite</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="nam">packageless_is_fallback_for_all_packages</span><span class="op">:</span> <span class="nam">bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="nam">reservation_only</span><span class="op">:</span> <span class="nam">bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="nam">formatting_callback</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">PPFFormatParam</span><span class="op">,</span> <span class="nam">VirtualPath</span><span class="op">]</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="nam">reference_documentation</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">PackagerProvidedFileReferenceDocumentation</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="nam">bug_950723</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="key">def</span> <span class="nam">supports_priority</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">default_priority</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="key">def</span> <span class="nam">compute_dest</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="nam">assigned_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="com"># Note this method is currently used 1:1 inside plugin tests.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="nam">owning_package</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="nam">assigned_priority</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="key">if</span> <span class="nam">assigned_priority</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">supports_priority</span><span class="op">:</span> </span><span class="r"><span class="annotate short">201 ↛ 202</span><span class="annotate long">line 201 didn't jump to line 202, because the condition on line 201 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="str">f"Cannot assign priority to packager provided files with stem"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="str">f' "{self.stem}" (e.g., "debian/foo.{self.stem}"). They'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="str">" do not use priority at all."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="nam">path_format</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">installed_as_format</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">supports_priority</span> <span class="key">and</span> <span class="nam">assigned_priority</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="nam">assigned_priority</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">default_priority</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="key">if</span> <span class="nam">owning_package</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="nam">owning_package</span> <span class="op">=</span> <span class="nam">assigned_name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="nam">params</span><span class="op">:</span> <span class="nam">PPFFormatParam</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="str">"priority"</span><span class="op">:</span> <span class="nam">assigned_priority</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="str">"name"</span><span class="op">:</span> <span class="nam">assigned_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="str">"owning_package"</span><span class="op">:</span> <span class="nam">owning_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">formatting_callback</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">222 ↛ 223</span><span class="annotate long">line 222 didn't jump to line 223, because the condition on line 222 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="str">"The path parameter is required for PPFs with formatting_callback"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="nam">dest_path</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">formatting_callback</span><span class="op">(</span><span class="nam">path_format</span><span class="op">,</span> <span class="nam">params</span><span class="op">,</span> <span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="nam">dest_path</span> <span class="op">=</span> <span class="nam">path_format</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span><span class="op">**</span><span class="nam">params</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="nam">dirname</span><span class="op">,</span> <span class="nam">basename</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="nam">dest_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="nam">dirname</span> <span class="op">=</span> <span class="nam">_normalize_path</span><span class="op">(</span><span class="nam">dirname</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">post_formatting_rewrite</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="nam">basename</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">post_formatting_rewrite</span><span class="op">(</span><span class="nam">basename</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="key">return</span> <span class="nam">dirname</span><span class="op">,</span> <span class="nam">basename</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"><span class="key">class</span> <span class="nam">MetadataOrMaintscriptDetector</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">:</span> <span class="nam">DebputyPluginMetadata</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="nam">detector_id</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="nam">detector</span><span class="op">:</span> <span class="nam">MetadataAutoDetector</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="nam">applies_to_package_types</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="nam">enabled</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="key">def</span> <span class="nam">applies_to</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">binary_package</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="key">return</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">package_type</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">applies_to_package_types</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="key">def</span> <span class="nam">run_detector</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="str">"VirtualPath"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">:</span> <span class="str">"BinaryCtrlAccessor"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="nam">context</span><span class="op">:</span> <span class="str">"PackageProcessingContext"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">detector</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">,</span> <span class="nam">ctrl</span><span class="op">,</span> <span class="nam">context</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="key">except</span> <span class="nam">DebputyFSIsROError</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"><span class="annotate short">257 ↛ 266</span><span class="annotate long">line 257 didn't jump to line 266</span></span></p> - <p class="run"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="nam">nv</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">plugin_metadata</span><span class="op">.</span><span class="nam">plugin_name</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginAPIViolationError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="str">f'The plugin {nv} violated the API contract for "metadata detectors"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="str">" by attempting to mutate the provided file system in its metadata detector"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="str">f" with id {self.detector_id}. File system mutation is *not* supported at"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="str">" this stage (file system layout is committed and the attempted changes"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="str">" would be lost)."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="op">)</span> <span class="key">from</span> <span class="nam">e</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="key">except</span> <span class="op">(</span><span class="nam">ChildProcessError</span><span class="op">,</span> <span class="nam">RuntimeError</span><span class="op">,</span> <span class="nam">AttributeError</span><span class="op">)</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="nam">nv</span> <span class="op">=</span> <span class="str">f"{self.plugin_metadata.plugin_name}"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="key">raise</span> <span class="nam">UnhandledOrUnexpectedErrorFromPluginError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="str">f"The plugin {nv} threw an unhandled or unexpected exception from its metadata"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="str">f" detector with id {self.detector_id}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="op">)</span> <span class="key">from</span> <span class="nam">e</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"><span class="key">class</span> <span class="nam">DeclarativeInputParser</span><span class="op">(</span><span class="nam">Generic</span><span class="op">[</span><span class="nam">TD</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="key">def</span> <span class="nam">inline_reference_documentation</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ParserDocumentation</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="key">def</span> <span class="nam">reference_documentation_url</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="nam">doc</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">inline_reference_documentation</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="key">return</span> <span class="nam">doc</span><span class="op">.</span><span class="nam">documentation_reference_url</span> <span class="key">if</span> <span class="nam">doc</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">else</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="key">def</span> <span class="nam">parse_input</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="nam">value</span><span class="op">:</span> <span class="nam">object</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="str">"AttributePath"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="nam">parser_context</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"ParserContextData"</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">TD</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"><span class="key">class</span> <span class="nam">DelegatingDeclarativeInputParser</span><span class="op">(</span><span class="nam">DeclarativeInputParser</span><span class="op">[</span><span class="nam">TD</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"delegate"</span><span class="op">,</span> <span class="str">"_reference_documentation"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="nam">delegate</span><span class="op">:</span> <span class="nam">DeclarativeInputParser</span><span class="op">[</span><span class="nam">TD</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ParserDocumentation</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">delegate</span> <span class="op">=</span> <span class="nam">delegate</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_reference_documentation</span> <span class="op">=</span> <span class="nam">inline_reference_documentation</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="key">def</span> <span class="nam">inline_reference_documentation</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ParserDocumentation</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="nam">doc</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_reference_documentation</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="key">if</span> <span class="nam">doc</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">delegate</span><span class="op">.</span><span class="nam">inline_reference_documentation</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="key">return</span> <span class="nam">doc</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"><span class="key">class</span> <span class="nam">ListWrappedDeclarativeInputParser</span><span class="op">(</span><span class="nam">DelegatingDeclarativeInputParser</span><span class="op">[</span><span class="nam">TD</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="key">def</span> <span class="nam">_doc_url_error_suffix</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">see_url_version</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="nam">doc_url</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">reference_documentation_url</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="key">if</span> <span class="nam">doc_url</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">319 ↛ 323</span><span class="annotate long">line 319 didn't jump to line 323, because the condition on line 319 was never false</span></span></p> - <p class="par run show_par"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="key">if</span> <span class="nam">see_url_version</span><span class="op">:</span> </span><span class="r"><span class="annotate short">320 ↛ 322</span><span class="annotate long">line 320 didn't jump to line 322, because the condition on line 320 was never false</span></span></p> - <p class="run"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="key">return</span> <span class="str">f" Please see {doc_url} for the documentation."</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="key">return</span> <span class="str">f" (Documentation: {doc_url})"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> <span class="key">return</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> <span class="key">def</span> <span class="nam">parse_input</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> <span class="nam">value</span><span class="op">:</span> <span class="nam">object</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="str">"AttributePath"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> <span class="nam">parser_context</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"ParserContextData"</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">TD</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">value</span><span class="op">,</span> <span class="nam">list</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> <span class="nam">doc_ref</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_doc_url_error_suffix</span><span class="op">(</span><span class="nam">see_url_version</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> <span class="str">f"The attribute {path.path} must be a list.{doc_ref}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> <span class="nam">result</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> <span class="nam">delegate</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">delegate</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"> <span class="key">for</span> <span class="nam">idx</span><span class="op">,</span> <span class="nam">element</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">value</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> <span class="nam">element_path</span> <span class="op">=</span> <span class="nam">path</span><span class="op">[</span><span class="nam">idx</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"> <span class="nam">result</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"> <span class="nam">delegate</span><span class="op">.</span><span class="nam">parse_input</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"> <span class="nam">element</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> <span class="nam">element_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"> <span class="nam">parser_context</span><span class="op">=</span><span class="nam">parser_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"> <span class="key">return</span> <span class="nam">result</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"><span class="key">class</span> <span class="nam">DispatchingParserBase</span><span class="op">(</span><span class="nam">Generic</span><span class="op">[</span><span class="nam">TP</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">manifest_attribute_path_template</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">manifest_attribute_path_template</span> <span class="op">=</span> <span class="nam">manifest_attribute_path_template</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_parsers</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">PluginProvidedParser</span><span class="op">[</span><span class="nam">Any</span><span class="op">,</span> <span class="nam">TP</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_known_keyword</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">keyword</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"> <span class="key">return</span> <span class="nam">keyword</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parsers</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"> <span class="key">def</span> <span class="nam">registered_keywords</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parsers</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"> <span class="key">def</span> <span class="nam">parser_for</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">keyword</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">PluginProvidedParser</span><span class="op">[</span><span class="nam">Any</span><span class="op">,</span> <span class="nam">TP</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parsers</span><span class="op">[</span><span class="nam">keyword</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"> <span class="key">def</span> <span class="nam">register_keyword</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"> <span class="nam">keyword</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"> <span class="nam">handler</span><span class="op">:</span> <span class="nam">DIPKWHandler</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">:</span> <span class="nam">DebputyPluginMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ParserDocumentation</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"> <span class="nam">reference_documentation_url</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"> <span class="key">if</span> <span class="nam">inline_reference_documentation</span><span class="op">:</span> </span><span class="r"><span class="annotate short">374 ↛ 386</span><span class="annotate long">line 374 didn't jump to line 386, because the condition on line 374 was never false</span></span></p> - <p class="par run show_par"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"> <span class="key">if</span> <span class="nam">inline_reference_documentation</span><span class="op">.</span><span class="nam">attribute_doc</span><span class="op">:</span> </span><span class="r"><span class="annotate short">375 ↛ 376</span><span class="annotate long">line 375 didn't jump to line 376, because the condition on line 375 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"> <span class="str">"Cannot provide per-attribute documentation for a value-less keyword!"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"> <span class="key">if</span> <span class="nam">inline_reference_documentation</span><span class="op">.</span><span class="nam">alt_parser_description</span><span class="op">:</span> </span><span class="r"><span class="annotate short">379 ↛ 380</span><span class="annotate long">line 379 didn't jump to line 380, because the condition on line 379 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"> <span class="str">"Cannot provide non-mapping-format documentation for a value-less keyword!"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"> <span class="nam">reference_documentation_url</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">.</span><span class="nam">documentation_reference_url</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t385" href="#t385">385</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t386" href="#t386">386</a></span><span class="t"> <span class="nam">parser</span> <span class="op">=</span> <span class="nam">DeclarativeValuelessKeywordInputParser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t387" href="#t387">387</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t388" href="#t388">388</a></span><span class="t"> <span class="nam">documentation_reference</span><span class="op">=</span><span class="nam">reference_documentation_url</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t389" href="#t389">389</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t390" href="#t390">390</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t391" href="#t391">391</a></span><span class="t"> <span class="key">def</span> <span class="nam">_combined_handler</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t392" href="#t392">392</a></span><span class="t"> <span class="nam">name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t393" href="#t393">393</a></span><span class="t"> <span class="nam">_ignored</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t394" href="#t394">394</a></span><span class="t"> <span class="nam">attr_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t395" href="#t395">395</a></span><span class="t"> <span class="nam">context</span><span class="op">:</span> <span class="str">"ParserContextData"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t396" href="#t396">396</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">TP</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t397" href="#t397">397</a></span><span class="t"> <span class="key">return</span> <span class="nam">handler</span><span class="op">(</span><span class="nam">name</span><span class="op">,</span> <span class="nam">attr_path</span><span class="op">,</span> <span class="nam">context</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t398" href="#t398">398</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t399" href="#t399">399</a></span><span class="t"> <span class="nam">p</span> <span class="op">=</span> <span class="nam">PluginProvidedParser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t400" href="#t400">400</a></span><span class="t"> <span class="nam">parser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t401" href="#t401">401</a></span><span class="t"> <span class="nam">_combined_handler</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t402" href="#t402">402</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t403" href="#t403">403</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t404" href="#t404">404</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t405" href="#t405">405</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_add_parser</span><span class="op">(</span><span class="nam">keyword</span><span class="op">,</span> <span class="nam">p</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t406" href="#t406">406</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t407" href="#t407">407</a></span><span class="t"> <span class="key">def</span> <span class="nam">register_parser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t408" href="#t408">408</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t409" href="#t409">409</a></span><span class="t"> <span class="nam">keyword</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t410" href="#t410">410</a></span><span class="t"> <span class="nam">parser</span><span class="op">:</span> <span class="str">"DeclarativeInputParser[PF]"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t411" href="#t411">411</a></span><span class="t"> <span class="nam">handler</span><span class="op">:</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">PF</span><span class="op">,</span> <span class="str">"AttributePath"</span><span class="op">,</span> <span class="str">"ParserContextData"</span><span class="op">]</span><span class="op">,</span> <span class="nam">TP</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t412" href="#t412">412</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">:</span> <span class="nam">DebputyPluginMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t413" href="#t413">413</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t414" href="#t414">414</a></span><span class="t"> <span class="nam">p</span> <span class="op">=</span> <span class="nam">PluginProvidedParser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t415" href="#t415">415</a></span><span class="t"> <span class="nam">parser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t416" href="#t416">416</a></span><span class="t"> <span class="nam">handler</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t417" href="#t417">417</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t418" href="#t418">418</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t419" href="#t419">419</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_add_parser</span><span class="op">(</span><span class="nam">keyword</span><span class="op">,</span> <span class="nam">p</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t420" href="#t420">420</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t421" href="#t421">421</a></span><span class="t"> <span class="key">def</span> <span class="nam">_add_parser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t422" href="#t422">422</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t423" href="#t423">423</a></span><span class="t"> <span class="nam">keyword</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t424" href="#t424">424</a></span><span class="t"> <span class="nam">ppp</span><span class="op">:</span> <span class="str">"PluginProvidedParser[PF, TP]"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t425" href="#t425">425</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t426" href="#t426">426</a></span><span class="t"> <span class="nam">ks</span> <span class="op">=</span> <span class="op">[</span><span class="nam">keyword</span><span class="op">]</span> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">keyword</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span> <span class="key">else</span> <span class="nam">keyword</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t427" href="#t427">427</a></span><span class="t"> <span class="key">for</span> <span class="nam">k</span> <span class="key">in</span> <span class="nam">ks</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t428" href="#t428">428</a></span><span class="t"> <span class="nam">existing_parser</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parsers</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">k</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t429" href="#t429">429</a></span><span class="t"> <span class="key">if</span> <span class="nam">existing_parser</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">429 ↛ 430</span><span class="annotate long">line 429 didn't jump to line 430</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t430" href="#t430">430</a></span><span class="t"> <span class="nam">message</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t431" href="#t431">431</a></span><span class="t"> <span class="str">f'The rule name "{k}" is already taken by the plugin'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t432" href="#t432">432</a></span><span class="t"> <span class="str">f" {existing_parser.plugin_metadata.plugin_name}. This conflict was triggered"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t433" href="#t433">433</a></span><span class="t"> <span class="str">f" when plugin {ppp.plugin_metadata.plugin_name} attempted to register its parser."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t434" href="#t434">434</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t435" href="#t435">435</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginConflictError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t436" href="#t436">436</a></span><span class="t"> <span class="nam">message</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t437" href="#t437">437</a></span><span class="t"> <span class="nam">existing_parser</span><span class="op">.</span><span class="nam">plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t438" href="#t438">438</a></span><span class="t"> <span class="nam">ppp</span><span class="op">.</span><span class="nam">plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t439" href="#t439">439</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t440" href="#t440">440</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_new_parser</span><span class="op">(</span><span class="nam">k</span><span class="op">,</span> <span class="nam">ppp</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t441" href="#t441">441</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t442" href="#t442">442</a></span><span class="t"> <span class="key">def</span> <span class="nam">_new_parser</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">keyword</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">ppp</span><span class="op">:</span> <span class="str">"PluginProvidedParser[PF, TP]"</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t443" href="#t443">443</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_parsers</span><span class="op">[</span><span class="nam">keyword</span><span class="op">]</span> <span class="op">=</span> <span class="nam">ppp</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t444" href="#t444">444</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t445" href="#t445">445</a></span><span class="t"> <span class="key">def</span> <span class="nam">parse_input</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t446" href="#t446">446</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t447" href="#t447">447</a></span><span class="t"> <span class="nam">orig_value</span><span class="op">:</span> <span class="nam">object</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t448" href="#t448">448</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="str">"AttributePath"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t449" href="#t449">449</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t450" href="#t450">450</a></span><span class="t"> <span class="nam">parser_context</span><span class="op">:</span> <span class="str">"ParserContextData"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t451" href="#t451">451</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">TP</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t452" href="#t452">452</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t453" href="#t453">453</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t454" href="#t454">454</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t455" href="#t455">455</a></span><span class="t"><span class="key">class</span> <span class="nam">DispatchingObjectParser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t456" href="#t456">456</a></span><span class="t"> <span class="nam">DispatchingParserBase</span><span class="op">[</span><span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t457" href="#t457">457</a></span><span class="t"> <span class="nam">DeclarativeInputParser</span><span class="op">[</span><span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t458" href="#t458">458</a></span><span class="t"><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t459" href="#t459">459</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t460" href="#t460">460</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t461" href="#t461">461</a></span><span class="t"> <span class="nam">manifest_attribute_path_template</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t462" href="#t462">462</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t463" href="#t463">463</a></span><span class="t"> <span class="nam">parser_documentation</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ParserDocumentation</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t464" href="#t464">464</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t465" href="#t465">465</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="nam">manifest_attribute_path_template</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t466" href="#t466">466</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_attribute_documentation</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">ParserAttributeDocumentation</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t467" href="#t467">467</a></span><span class="t"> <span class="key">if</span> <span class="nam">parser_documentation</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">467 ↛ 468</span><span class="annotate long">line 467 didn't jump to line 468, because the condition on line 467 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t468" href="#t468">468</a></span><span class="t"> <span class="nam">parser_documentation</span> <span class="op">=</span> <span class="nam">reference_documentation</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t469" href="#t469">469</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_parser_documentation</span> <span class="op">=</span> <span class="nam">parser_documentation</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t470" href="#t470">470</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t471" href="#t471">471</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t472" href="#t472">472</a></span><span class="t"> <span class="key">def</span> <span class="nam">reference_documentation_url</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t473" href="#t473">473</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parser_documentation</span><span class="op">.</span><span class="nam">documentation_reference_url</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t474" href="#t474">474</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t475" href="#t475">475</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t476" href="#t476">476</a></span><span class="t"> <span class="key">def</span> <span class="nam">inline_reference_documentation</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ParserDocumentation</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t477" href="#t477">477</a></span><span class="t"> <span class="nam">ref_doc</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parser_documentation</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t478" href="#t478">478</a></span><span class="t"> <span class="key">return</span> <span class="nam">reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t479" href="#t479">479</a></span><span class="t"> <span class="nam">title</span><span class="op">=</span><span class="nam">ref_doc</span><span class="op">.</span><span class="nam">title</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t480" href="#t480">480</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">ref_doc</span><span class="op">.</span><span class="nam">description</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t481" href="#t481">481</a></span><span class="t"> <span class="nam">attributes</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">_attribute_documentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t482" href="#t482">482</a></span><span class="t"> <span class="nam">reference_documentation_url</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">reference_documentation_url</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t483" href="#t483">483</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t484" href="#t484">484</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t485" href="#t485">485</a></span><span class="t"> <span class="key">def</span> <span class="nam">_new_parser</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">keyword</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">ppp</span><span class="op">:</span> <span class="str">"PluginProvidedParser[PF, TP]"</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t486" href="#t486">486</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">_new_parser</span><span class="op">(</span><span class="nam">keyword</span><span class="op">,</span> <span class="nam">ppp</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t487" href="#t487">487</a></span><span class="t"> <span class="nam">doc</span> <span class="op">=</span> <span class="nam">ppp</span><span class="op">.</span><span class="nam">parser</span><span class="op">.</span><span class="nam">inline_reference_documentation</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t488" href="#t488">488</a></span><span class="t"> <span class="key">if</span> <span class="nam">doc</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">doc</span><span class="op">.</span><span class="nam">description</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t489" href="#t489">489</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_attribute_documentation</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">undocumented_attr</span><span class="op">(</span><span class="nam">keyword</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t490" href="#t490">490</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t491" href="#t491">491</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_attribute_documentation</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t492" href="#t492">492</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span><span class="nam">keyword</span><span class="op">,</span> <span class="nam">doc</span><span class="op">.</span><span class="nam">description</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t493" href="#t493">493</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t494" href="#t494">494</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t495" href="#t495">495</a></span><span class="t"> <span class="key">def</span> <span class="nam">register_child_parser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t496" href="#t496">496</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t497" href="#t497">497</a></span><span class="t"> <span class="nam">keyword</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t498" href="#t498">498</a></span><span class="t"> <span class="nam">parser</span><span class="op">:</span> <span class="str">"DispatchingObjectParser"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t499" href="#t499">499</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">:</span> <span class="nam">DebputyPluginMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t500" href="#t500">500</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t501" href="#t501">501</a></span><span class="t"> <span class="nam">on_end_parse_step</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t502" href="#t502">502</a></span><span class="t"> <span class="nam">Callable</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t503" href="#t503">503</a></span><span class="t"> <span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> <span class="nam">AttributePath</span><span class="op">,</span> <span class="str">"ParserContextData"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t504" href="#t504">504</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t505" href="#t505">505</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t506" href="#t506">506</a></span><span class="t"> <span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t507" href="#t507">507</a></span><span class="t"> <span class="nam">nested_in_package_context</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t508" href="#t508">508</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t509" href="#t509">509</a></span><span class="t"> <span class="key">def</span> <span class="nam">_handler</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t510" href="#t510">510</a></span><span class="t"> <span class="nam">name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t511" href="#t511">511</a></span><span class="t"> <span class="nam">value</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t512" href="#t512">512</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t513" href="#t513">513</a></span><span class="t"> <span class="nam">parser_context</span><span class="op">:</span> <span class="str">"ParserContextData"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t514" href="#t514">514</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t515" href="#t515">515</a></span><span class="t"> <span class="nam">on_end_parse_step</span><span class="op">(</span><span class="nam">name</span><span class="op">,</span> <span class="nam">value</span><span class="op">,</span> <span class="nam">path</span><span class="op">,</span> <span class="nam">parser_context</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t516" href="#t516">516</a></span><span class="t"> <span class="key">return</span> <span class="nam">value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t517" href="#t517">517</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t518" href="#t518">518</a></span><span class="t"> <span class="key">if</span> <span class="nam">nested_in_package_context</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t519" href="#t519">519</a></span><span class="t"> <span class="nam">parser</span> <span class="op">=</span> <span class="nam">InPackageContextParser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t520" href="#t520">520</a></span><span class="t"> <span class="nam">keyword</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t521" href="#t521">521</a></span><span class="t"> <span class="nam">parser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t522" href="#t522">522</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t523" href="#t523">523</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t524" href="#t524">524</a></span><span class="t"> <span class="nam">p</span> <span class="op">=</span> <span class="nam">PluginProvidedParser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t525" href="#t525">525</a></span><span class="t"> <span class="nam">parser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t526" href="#t526">526</a></span><span class="t"> <span class="nam">_handler</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t527" href="#t527">527</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t528" href="#t528">528</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t529" href="#t529">529</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_add_parser</span><span class="op">(</span><span class="nam">keyword</span><span class="op">,</span> <span class="nam">p</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t530" href="#t530">530</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t531" href="#t531">531</a></span><span class="t"> <span class="key">def</span> <span class="nam">parse_input</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t532" href="#t532">532</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t533" href="#t533">533</a></span><span class="t"> <span class="nam">orig_value</span><span class="op">:</span> <span class="nam">object</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t534" href="#t534">534</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="str">"AttributePath"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t535" href="#t535">535</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t536" href="#t536">536</a></span><span class="t"> <span class="nam">parser_context</span><span class="op">:</span> <span class="str">"ParserContextData"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t537" href="#t537">537</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">TP</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t538" href="#t538">538</a></span><span class="t"> <span class="nam">doc_ref</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t539" href="#t539">539</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">reference_documentation_url</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">539 ↛ 543</span><span class="annotate long">line 539 didn't jump to line 543, because the condition on line 539 was never false</span></span></p> - <p class="run"><span class="n"><a id="t540" href="#t540">540</a></span><span class="t"> <span class="nam">doc_ref</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t541" href="#t541">541</a></span><span class="t"> <span class="str">f" Please see {self.reference_documentation_url} for the documentation."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t542" href="#t542">542</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t543" href="#t543">543</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">orig_value</span><span class="op">,</span> <span class="nam">dict</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t544" href="#t544">544</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t545" href="#t545">545</a></span><span class="t"> <span class="str">f"The attribute {attribute_path.path} must be a non-empty mapping.{doc_ref}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t546" href="#t546">546</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t547" href="#t547">547</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">orig_value</span><span class="op">:</span> </span><span class="r"><span class="annotate short">547 ↛ 548</span><span class="annotate long">line 547 didn't jump to line 548, because the condition on line 547 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t548" href="#t548">548</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t549" href="#t549">549</a></span><span class="t"> <span class="str">f"The attribute {attribute_path.path} must be a non-empty mapping.{doc_ref}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t550" href="#t550">550</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t551" href="#t551">551</a></span><span class="t"> <span class="nam">result</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t552" href="#t552">552</a></span><span class="t"> <span class="nam">unknown_keys</span> <span class="op">=</span> <span class="nam">orig_value</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span> <span class="op">-</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parsers</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t553" href="#t553">553</a></span><span class="t"> <span class="key">if</span> <span class="nam">unknown_keys</span><span class="op">:</span> </span><span class="r"><span class="annotate short">553 ↛ 554</span><span class="annotate long">line 553 didn't jump to line 554, because the condition on line 553 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t554" href="#t554">554</a></span><span class="t"> <span class="nam">first_key</span> <span class="op">=</span> <span class="nam">next</span><span class="op">(</span><span class="nam">iter</span><span class="op">(</span><span class="nam">unknown_keys</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t555" href="#t555">555</a></span><span class="t"> <span class="nam">remaining_valid_attributes</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parsers</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span> <span class="op">-</span> <span class="nam">orig_value</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t556" href="#t556">556</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">remaining_valid_attributes</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t557" href="#t557">557</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t558" href="#t558">558</a></span><span class="t"> <span class="str">f'The attribute "{first_key}" is not applicable at {attribute_path.path} (with the'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t559" href="#t559">559</a></span><span class="t"> <span class="str">f" current set of plugins).{doc_ref}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t560" href="#t560">560</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t561" href="#t561">561</a></span><span class="t"> <span class="nam">remaining_valid_attribute_names</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">remaining_valid_attributes</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t562" href="#t562">562</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t563" href="#t563">563</a></span><span class="t"> <span class="str">f'The attribute "{first_key}" is not applicable at {attribute_path.path}(with the current set'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t564" href="#t564">564</a></span><span class="t"> <span class="str">" of plugins). Possible attributes available (and not already used) are:"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t565" href="#t565">565</a></span><span class="t"> <span class="str">f" {remaining_valid_attribute_names}.{doc_ref}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t566" href="#t566">566</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t567" href="#t567">567</a></span><span class="t"> <span class="com"># Parse order is important for the root level (currently we use rule registration order)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t568" href="#t568">568</a></span><span class="t"> <span class="key">for</span> <span class="nam">key</span><span class="op">,</span> <span class="nam">provided_parser</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parsers</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t569" href="#t569">569</a></span><span class="t"> <span class="nam">value</span> <span class="op">=</span> <span class="nam">orig_value</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t570" href="#t570">570</a></span><span class="t"> <span class="key">if</span> <span class="nam">value</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t571" href="#t571">571</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">provided_parser</span><span class="op">.</span><span class="nam">parser</span><span class="op">,</span> <span class="nam">DispatchingObjectParser</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t572" href="#t572">572</a></span><span class="t"> <span class="nam">provided_parser</span><span class="op">.</span><span class="nam">handler</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t573" href="#t573">573</a></span><span class="t"> <span class="nam">key</span><span class="op">,</span> <span class="op">{</span><span class="op">}</span><span class="op">,</span> <span class="nam">attribute_path</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span><span class="op">,</span> <span class="nam">parser_context</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t574" href="#t574">574</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t575" href="#t575">575</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t576" href="#t576">576</a></span><span class="t"> <span class="nam">value_path</span> <span class="op">=</span> <span class="nam">attribute_path</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t577" href="#t577">577</a></span><span class="t"> <span class="key">if</span> <span class="nam">provided_parser</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">577 ↛ 578</span><span class="annotate long">line 577 didn't jump to line 578, because the condition on line 577 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t578" href="#t578">578</a></span><span class="t"> <span class="nam">valid_keys</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">sorted</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_parsers</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t579" href="#t579">579</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t580" href="#t580">580</a></span><span class="t"> <span class="str">f'Unknown or unsupported option "{key}" at {value_path.path}.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t581" href="#t581">581</a></span><span class="t"> <span class="str">" Valid options at this location are:"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t582" href="#t582">582</a></span><span class="t"> <span class="str">f" {valid_keys}\n{doc_ref}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t583" href="#t583">583</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t584" href="#t584">584</a></span><span class="t"> <span class="nam">parsed_value</span> <span class="op">=</span> <span class="nam">provided_parser</span><span class="op">.</span><span class="nam">parse</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t585" href="#t585">585</a></span><span class="t"> <span class="nam">key</span><span class="op">,</span> <span class="nam">value</span><span class="op">,</span> <span class="nam">value_path</span><span class="op">,</span> <span class="nam">parser_context</span><span class="op">=</span><span class="nam">parser_context</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t586" href="#t586">586</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t587" href="#t587">587</a></span><span class="t"> <span class="nam">result</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> <span class="op">=</span> <span class="nam">parsed_value</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t588" href="#t588">588</a></span><span class="t"> <span class="key">return</span> <span class="nam">result</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t589" href="#t589">589</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t590" href="#t590">590</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t591" href="#t591">591</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t592" href="#t592">592</a></span><span class="t"><span class="key">class</span> <span class="nam">PackageContextData</span><span class="op">(</span><span class="nam">Generic</span><span class="op">[</span><span class="nam">TP</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t593" href="#t593">593</a></span><span class="t"> <span class="nam">resolved_package_name</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t594" href="#t594">594</a></span><span class="t"> <span class="nam">value</span><span class="op">:</span> <span class="nam">TP</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t595" href="#t595">595</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t596" href="#t596">596</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t597" href="#t597">597</a></span><span class="t"><span class="key">class</span> <span class="nam">InPackageContextParser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t598" href="#t598">598</a></span><span class="t"> <span class="nam">DelegatingDeclarativeInputParser</span><span class="op">[</span><span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">PackageContextData</span><span class="op">[</span><span class="nam">TP</span><span class="op">]</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t599" href="#t599">599</a></span><span class="t"><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t600" href="#t600">600</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t601" href="#t601">601</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t602" href="#t602">602</a></span><span class="t"> <span class="nam">manifest_attribute_path_template</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t603" href="#t603">603</a></span><span class="t"> <span class="nam">delegate</span><span class="op">:</span> <span class="nam">DeclarativeInputParser</span><span class="op">[</span><span class="nam">TP</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t604" href="#t604">604</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t605" href="#t605">605</a></span><span class="t"> <span class="nam">parser_documentation</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ParserDocumentation</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t606" href="#t606">606</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t607" href="#t607">607</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">manifest_attribute_path_template</span> <span class="op">=</span> <span class="nam">manifest_attribute_path_template</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t608" href="#t608">608</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_attribute_documentation</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">ParserAttributeDocumentation</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t609" href="#t609">609</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="nam">delegate</span><span class="op">,</span> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">parser_documentation</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t610" href="#t610">610</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t611" href="#t611">611</a></span><span class="t"> <span class="key">def</span> <span class="nam">parse_input</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t612" href="#t612">612</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t613" href="#t613">613</a></span><span class="t"> <span class="nam">orig_value</span><span class="op">:</span> <span class="nam">object</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t614" href="#t614">614</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="str">"AttributePath"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t615" href="#t615">615</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t616" href="#t616">616</a></span><span class="t"> <span class="nam">parser_context</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"ParserContextData"</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t617" href="#t617">617</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">TP</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t618" href="#t618">618</a></span><span class="t"> <span class="key">assert</span> <span class="nam">parser_context</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t619" href="#t619">619</a></span><span class="t"> <span class="nam">doc_ref</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t620" href="#t620">620</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">reference_documentation_url</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">620 ↛ 624</span><span class="annotate long">line 620 didn't jump to line 624, because the condition on line 620 was never false</span></span></p> - <p class="run"><span class="n"><a id="t621" href="#t621">621</a></span><span class="t"> <span class="nam">doc_ref</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t622" href="#t622">622</a></span><span class="t"> <span class="str">f" Please see {self.reference_documentation_url} for the documentation."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t623" href="#t623">623</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t624" href="#t624">624</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">orig_value</span><span class="op">,</span> <span class="nam">dict</span><span class="op">)</span> <span class="key">or</span> <span class="key">not</span> <span class="nam">orig_value</span><span class="op">:</span> </span><span class="r"><span class="annotate short">624 ↛ 625</span><span class="annotate long">line 624 didn't jump to line 625, because the condition on line 624 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t625" href="#t625">625</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t626" href="#t626">626</a></span><span class="t"> <span class="str">f"The attribute {attribute_path.path} must be a non-empty mapping.{doc_ref}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t627" href="#t627">627</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t628" href="#t628">628</a></span><span class="t"> <span class="nam">delegate</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">delegate</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t629" href="#t629">629</a></span><span class="t"> <span class="nam">result</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t630" href="#t630">630</a></span><span class="t"> <span class="key">for</span> <span class="nam">package_name_raw</span><span class="op">,</span> <span class="nam">value</span> <span class="key">in</span> <span class="nam">orig_value</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t631" href="#t631">631</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t632" href="#t632">632</a></span><span class="t"> <span class="nam">definition_source</span> <span class="op">=</span> <span class="nam">attribute_path</span><span class="op">[</span><span class="nam">package_name_raw</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t633" href="#t633">633</a></span><span class="t"> <span class="nam">package_name</span> <span class="op">=</span> <span class="nam">package_name_raw</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t634" href="#t634">634</a></span><span class="t"> <span class="key">if</span> <span class="str">"{{"</span> <span class="key">in</span> <span class="nam">package_name</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t635" href="#t635">635</a></span><span class="t"> <span class="nam">package_name</span> <span class="op">=</span> <span class="nam">parser_context</span><span class="op">.</span><span class="nam">substitution</span><span class="op">.</span><span class="nam">substitute</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t636" href="#t636">636</a></span><span class="t"> <span class="nam">package_name_raw</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t637" href="#t637">637</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t638" href="#t638">638</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t639" href="#t639">639</a></span><span class="t"> <span class="nam">package_state</span><span class="op">:</span> <span class="nam">PackageTransformationDefinition</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t640" href="#t640">640</a></span><span class="t"> <span class="key">with</span> <span class="nam">parser_context</span><span class="op">.</span><span class="nam">binary_package_context</span><span class="op">(</span><span class="nam">package_name</span><span class="op">)</span> <span class="key">as</span> <span class="nam">package_state</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t641" href="#t641">641</a></span><span class="t"> <span class="key">if</span> <span class="nam">package_state</span><span class="op">.</span><span class="nam">is_auto_generated_package</span><span class="op">:</span> </span><span class="r"><span class="annotate short">641 ↛ 643</span><span class="annotate long">line 641 didn't jump to line 643, because the condition on line 641 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t642" href="#t642">642</a></span><span class="t"> <span class="com"># Maybe lift (part) of this restriction.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t643" href="#t643">643</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t644" href="#t644">644</a></span><span class="t"> <span class="str">f'Cannot define rules for package "{package_name}" (at {definition_source.path}). It is an'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t645" href="#t645">645</a></span><span class="t"> <span class="str">" auto-generated package."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t646" href="#t646">646</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t647" href="#t647">647</a></span><span class="t"> <span class="nam">parsed_value</span> <span class="op">=</span> <span class="nam">delegate</span><span class="op">.</span><span class="nam">parse_input</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t648" href="#t648">648</a></span><span class="t"> <span class="nam">value</span><span class="op">,</span> <span class="nam">definition_source</span><span class="op">,</span> <span class="nam">parser_context</span><span class="op">=</span><span class="nam">parser_context</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t649" href="#t649">649</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t650" href="#t650">650</a></span><span class="t"> <span class="nam">result</span><span class="op">[</span><span class="nam">package_name_raw</span><span class="op">]</span> <span class="op">=</span> <span class="nam">PackageContextData</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t651" href="#t651">651</a></span><span class="t"> <span class="nam">package_name</span><span class="op">,</span> <span class="nam">parsed_value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t652" href="#t652">652</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t653" href="#t653">653</a></span><span class="t"> <span class="key">return</span> <span class="nam">result</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t654" href="#t654">654</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t655" href="#t655">655</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t656" href="#t656">656</a></span><span class="t"><span class="key">class</span> <span class="nam">DispatchingTableParser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t657" href="#t657">657</a></span><span class="t"> <span class="nam">DispatchingParserBase</span><span class="op">[</span><span class="nam">TP</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t658" href="#t658">658</a></span><span class="t"> <span class="nam">DeclarativeInputParser</span><span class="op">[</span><span class="nam">TP</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t659" href="#t659">659</a></span><span class="t"><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t660" href="#t660">660</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">base_type</span><span class="op">:</span> <span class="nam">TTP</span><span class="op">,</span> <span class="nam">manifest_attribute_path_template</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t661" href="#t661">661</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="nam">manifest_attribute_path_template</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t662" href="#t662">662</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">base_type</span> <span class="op">=</span> <span class="nam">base_type</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t663" href="#t663">663</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t664" href="#t664">664</a></span><span class="t"> <span class="key">def</span> <span class="nam">parse_input</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t665" href="#t665">665</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t666" href="#t666">666</a></span><span class="t"> <span class="nam">orig_value</span><span class="op">:</span> <span class="nam">object</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t667" href="#t667">667</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="str">"AttributePath"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t668" href="#t668">668</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t669" href="#t669">669</a></span><span class="t"> <span class="nam">parser_context</span><span class="op">:</span> <span class="str">"ParserContextData"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t670" href="#t670">670</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">TP</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t671" href="#t671">671</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">orig_value</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">671 ↛ 672</span><span class="annotate long">line 671 didn't jump to line 672, because the condition on line 671 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t672" href="#t672">672</a></span><span class="t"> <span class="nam">key</span> <span class="op">=</span> <span class="nam">orig_value</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t673" href="#t673">673</a></span><span class="t"> <span class="nam">value</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t674" href="#t674">674</a></span><span class="t"> <span class="nam">value_path</span> <span class="op">=</span> <span class="nam">attribute_path</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t675" href="#t675">675</a></span><span class="t"> <span class="key">elif</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">orig_value</span><span class="op">,</span> <span class="nam">dict</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">675 ↛ 686</span><span class="annotate long">line 675 didn't jump to line 686, because the condition on line 675 was never false</span></span></p> - <p class="par run show_par"><span class="n"><a id="t676" href="#t676">676</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">orig_value</span><span class="op">)</span> <span class="op">!=</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"><span class="annotate short">676 ↛ 677</span><span class="annotate long">line 676 didn't jump to line 677, because the condition on line 676 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t677" href="#t677">677</a></span><span class="t"> <span class="nam">valid_keys</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">sorted</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_parsers</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t678" href="#t678">678</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t679" href="#t679">679</a></span><span class="t"> <span class="str">f'The mapping "{attribute_path.path}" had two keys, but it should only have one top level key.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t680" href="#t680">680</a></span><span class="t"> <span class="str">" Maybe you are missing a list marker behind the second key or some indentation. The"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t681" href="#t681">681</a></span><span class="t"> <span class="str">f" possible keys are: {valid_keys}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t682" href="#t682">682</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t683" href="#t683">683</a></span><span class="t"> <span class="nam">key</span><span class="op">,</span> <span class="nam">value</span> <span class="op">=</span> <span class="nam">next</span><span class="op">(</span><span class="nam">iter</span><span class="op">(</span><span class="nam">orig_value</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t684" href="#t684">684</a></span><span class="t"> <span class="nam">value_path</span> <span class="op">=</span> <span class="nam">attribute_path</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t685" href="#t685">685</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t686" href="#t686">686</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t687" href="#t687">687</a></span><span class="t"> <span class="str">f"The attribute {attribute_path.path} must be a string or a mapping."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t688" href="#t688">688</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t689" href="#t689">689</a></span><span class="t"> <span class="nam">provided_parser</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parsers</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t690" href="#t690">690</a></span><span class="t"> <span class="key">if</span> <span class="nam">provided_parser</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">690 ↛ 691</span><span class="annotate long">line 690 didn't jump to line 691, because the condition on line 690 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t691" href="#t691">691</a></span><span class="t"> <span class="nam">valid_keys</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">sorted</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_parsers</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t692" href="#t692">692</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t693" href="#t693">693</a></span><span class="t"> <span class="str">f'Unknown or unsupported action "{key}" at {value_path.path}.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t694" href="#t694">694</a></span><span class="t"> <span class="str">" Valid actions at this location are:"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t695" href="#t695">695</a></span><span class="t"> <span class="str">f" {valid_keys}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t696" href="#t696">696</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t697" href="#t697">697</a></span><span class="t"> <span class="key">return</span> <span class="nam">provided_parser</span><span class="op">.</span><span class="nam">parse</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t698" href="#t698">698</a></span><span class="t"> <span class="nam">key</span><span class="op">,</span> <span class="nam">value</span><span class="op">,</span> <span class="nam">value_path</span><span class="op">,</span> <span class="nam">parser_context</span><span class="op">=</span><span class="nam">parser_context</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t699" href="#t699">699</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t700" href="#t700">700</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t701" href="#t701">701</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t702" href="#t702">702</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t703" href="#t703">703</a></span><span class="t"><span class="key">class</span> <span class="nam">DeclarativeValuelessKeywordInputParser</span><span class="op">(</span><span class="nam">DeclarativeInputParser</span><span class="op">[</span><span class="key">None</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t704" href="#t704">704</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ParserDocumentation</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t705" href="#t705">705</a></span><span class="t"> <span class="nam">documentation_reference</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t706" href="#t706">706</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t707" href="#t707">707</a></span><span class="t"> <span class="key">def</span> <span class="nam">parse_input</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t708" href="#t708">708</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t709" href="#t709">709</a></span><span class="t"> <span class="nam">value</span><span class="op">:</span> <span class="nam">object</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t710" href="#t710">710</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="str">"AttributePath"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t711" href="#t711">711</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t712" href="#t712">712</a></span><span class="t"> <span class="nam">parser_context</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"ParserContextData"</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t713" href="#t713">713</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">TD</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t714" href="#t714">714</a></span><span class="t"> <span class="key">if</span> <span class="nam">value</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t715" href="#t715">715</a></span><span class="t"> <span class="key">return</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"TD"</span><span class="op">,</span> <span class="nam">value</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t716" href="#t716">716</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">documentation_reference</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t717" href="#t717">717</a></span><span class="t"> <span class="nam">doc_ref</span> <span class="op">=</span> <span class="str">f" (Documentation: {self.documentation_reference})"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t718" href="#t718">718</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t719" href="#t719">719</a></span><span class="t"> <span class="nam">doc_ref</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t720" href="#t720">720</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t721" href="#t721">721</a></span><span class="t"> <span class="str">f"Expected attribute {path.path} to be a string.{doc_ref}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t722" href="#t722">722</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t723" href="#t723">723</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t724" href="#t724">724</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t725" href="#t725">725</a></span><span class="t"><span class="nam">SUPPORTED_DISPATCHABLE_TABLE_PARSERS</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t726" href="#t726">726</a></span><span class="t"> <span class="nam">InstallRule</span><span class="op">:</span> <span class="str">"installations"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t727" href="#t727">727</a></span><span class="t"> <span class="nam">TransformationRule</span><span class="op">:</span> <span class="str">"packages.{{PACKAGE}}.transformations"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t728" href="#t728">728</a></span><span class="t"> <span class="nam">DpkgMaintscriptHelperCommand</span><span class="op">:</span> <span class="str">"packages.{{PACKAGE}}.conffile-management"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t729" href="#t729">729</a></span><span class="t"> <span class="nam">ManifestCondition</span><span class="op">:</span> <span class="str">"*.when"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t730" href="#t730">730</a></span><span class="t"><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t731" href="#t731">731</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t732" href="#t732">732</a></span><span class="t"><span class="nam">OPARSER_MANIFEST_ROOT</span> <span class="op">=</span> <span class="str">"<ROOT>"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t733" href="#t733">733</a></span><span class="t"><span class="nam">OPARSER_PACKAGES_ROOT</span> <span class="op">=</span> <span class="str">"packages"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t734" href="#t734">734</a></span><span class="t"><span class="nam">OPARSER_PACKAGES</span> <span class="op">=</span> <span class="str">"packages.{{PACKAGE}}"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t735" href="#t735">735</a></span><span class="t"><span class="nam">OPARSER_MANIFEST_DEFINITIONS</span> <span class="op">=</span> <span class="str">"definitions"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t736" href="#t736">736</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t737" href="#t737">737</a></span><span class="t"><span class="nam">SUPPORTED_DISPATCHABLE_OBJECT_PARSERS</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t738" href="#t738">738</a></span><span class="t"> <span class="nam">OPARSER_MANIFEST_ROOT</span><span class="op">:</span> <span class="nam">reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t739" href="#t739">739</a></span><span class="t"> <span class="nam">reference_documentation_url</span><span class="op">=</span><span class="str">f"{DEBPUTY_DOC_ROOT_DIR}/MANIFEST-FORMAT.md"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t740" href="#t740">740</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t741" href="#t741">741</a></span><span class="t"> <span class="nam">OPARSER_MANIFEST_DEFINITIONS</span><span class="op">:</span> <span class="nam">reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t742" href="#t742">742</a></span><span class="t"> <span class="nam">title</span><span class="op">=</span><span class="str">"Packager provided definitions"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t743" href="#t743">743</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="str">"Reusable packager provided definitions such as manifest variables."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t744" href="#t744">744</a></span><span class="t"> <span class="nam">reference_documentation_url</span><span class="op">=</span><span class="str">f"{DEBPUTY_DOC_ROOT_DIR}/MANIFEST-FORMAT.md#packager-provided-definitions"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t745" href="#t745">745</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t746" href="#t746">746</a></span><span class="t"> <span class="nam">OPARSER_PACKAGES</span><span class="op">:</span> <span class="nam">reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t747" href="#t747">747</a></span><span class="t"> <span class="nam">title</span><span class="op">=</span><span class="str">"Binary package rules"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t748" href="#t748">748</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t749" href="#t749">749</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t750" href="#t750">750</a></span><span class="t"><span class="str"> Inside the manifest, the `packages` mapping can be used to define requests for the binary packages</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t751" href="#t751">751</a></span><span class="t"><span class="str"> you want `debputy` to produce. Each key inside `packages` must be the name of a binary package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t752" href="#t752">752</a></span><span class="t"><span class="str"> defined in `debian/control`. The value is a dictionary defining which features that `debputy`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t753" href="#t753">753</a></span><span class="t"><span class="str"> should apply to that binary package. An example could be:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t754" href="#t754">754</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t755" href="#t755">755</a></span><span class="t"><span class="str"> packages:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t756" href="#t756">756</a></span><span class="t"><span class="str"> foo:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t757" href="#t757">757</a></span><span class="t"><span class="str"> transformations:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t758" href="#t758">758</a></span><span class="t"><span class="str"> - create-symlink:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t759" href="#t759">759</a></span><span class="t"><span class="str"> path: usr/share/foo/my-first-symlink</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t760" href="#t760">760</a></span><span class="t"><span class="str"> target: /usr/share/bar/symlink-target</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t761" href="#t761">761</a></span><span class="t"><span class="str"> - create-symlink:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t762" href="#t762">762</a></span><span class="t"><span class="str"> path: usr/lib/{{DEB_HOST_MULTIARCH}}/my-second-symlink</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t763" href="#t763">763</a></span><span class="t"><span class="str"> target: /usr/lib/{{DEB_HOST_MULTIARCH}}/baz/symlink-target</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t764" href="#t764">764</a></span><span class="t"><span class="str"> bar:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t765" href="#t765">765</a></span><span class="t"><span class="str"> transformations:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t766" href="#t766">766</a></span><span class="t"><span class="str"> - create-directories:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t767" href="#t767">767</a></span><span class="t"><span class="str"> - some/empty/directory.d</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t768" href="#t768">768</a></span><span class="t"><span class="str"> - another/empty/integration-point.d</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t769" href="#t769">769</a></span><span class="t"><span class="str"> - create-directories:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t770" href="#t770">770</a></span><span class="t"><span class="str"> path: a/third-empty/directory.d</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t771" href="#t771">771</a></span><span class="t"><span class="str"> owner: www-data</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t772" href="#t772">772</a></span><span class="t"><span class="str"> group: www-data</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t773" href="#t773">773</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t774" href="#t774">774</a></span><span class="t"><span class="str"> In this case, `debputy` will create some symlinks inside the `foo` package and some directories for</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t775" href="#t775">775</a></span><span class="t"><span class="str"> the `bar` package. The following subsections define the keys you can use under each binary package.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t776" href="#t776">776</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t777" href="#t777">777</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t778" href="#t778">778</a></span><span class="t"> <span class="nam">reference_documentation_url</span><span class="op">=</span><span class="str">f"{DEBPUTY_DOC_ROOT_DIR}/MANIFEST-FORMAT.md#binary-package-rules"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t779" href="#t779">779</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t780" href="#t780">780</a></span><span class="t"><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t781" href="#t781">781</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t782" href="#t782">782</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t783" href="#t783">783</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t784" href="#t784">784</a></span><span class="t"><span class="key">class</span> <span class="nam">PluginProvidedManifestVariable</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t785" href="#t785">785</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">:</span> <span class="nam">DebputyPluginMetadata</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t786" href="#t786">786</a></span><span class="t"> <span class="nam">variable_name</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t787" href="#t787">787</a></span><span class="t"> <span class="nam">variable_value</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">VariableContext</span><span class="op">]</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t788" href="#t788">788</a></span><span class="t"> <span class="nam">is_context_specific_variable</span><span class="op">:</span> <span class="nam">bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t789" href="#t789">789</a></span><span class="t"> <span class="nam">variable_reference_documentation</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t790" href="#t790">790</a></span><span class="t"> <span class="nam">is_documentation_placeholder</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t791" href="#t791">791</a></span><span class="t"> <span class="nam">is_for_special_case</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t792" href="#t792">792</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t793" href="#t793">793</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t794" href="#t794">794</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_internal</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t795" href="#t795">795</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">variable_name</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"_"</span><span class="op">)</span> <span class="key">or</span> <span class="str">":_"</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">variable_name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t796" href="#t796">796</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t797" href="#t797">797</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t798" href="#t798">798</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_token</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t799" href="#t799">799</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">variable_name</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"token:"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t800" href="#t800">800</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t801" href="#t801">801</a></span><span class="t"> <span class="key">def</span> <span class="nam">resolve</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">variable_context</span><span class="op">:</span> <span class="nam">VariableContext</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t802" href="#t802">802</a></span><span class="t"> <span class="nam">value_resolver</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">variable_value</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t803" href="#t803">803</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">value_resolver</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t804" href="#t804">804</a></span><span class="t"> <span class="nam">res</span> <span class="op">=</span> <span class="nam">value_resolver</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t805" href="#t805">805</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t806" href="#t806">806</a></span><span class="t"> <span class="nam">res</span> <span class="op">=</span> <span class="nam">value_resolver</span><span class="op">(</span><span class="nam">variable_context</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t807" href="#t807">807</a></span><span class="t"> <span class="key">return</span> <span class="nam">res</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t808" href="#t808">808</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t809" href="#t809">809</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t810" href="#t810">810</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t811" href="#t811">811</a></span><span class="t"><span class="key">class</span> <span class="nam">AutomaticDiscardRuleExample</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t812" href="#t812">812</a></span><span class="t"> <span class="nam">content</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">PathDef</span><span class="op">,</span> <span class="nam">bool</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t813" href="#t813">813</a></span><span class="t"> <span class="nam">description</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t814" href="#t814">814</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t815" href="#t815">815</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t816" href="#t816">816</a></span><span class="t"><span class="key">def</span> <span class="nam">automatic_discard_rule_example</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t817" href="#t817">817</a></span><span class="t"> <span class="op">*</span><span class="nam">content</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">PathDef</span><span class="op">,</span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">PathDef</span><span class="op">]</span><span class="op">,</span> <span class="nam">bool</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t818" href="#t818">818</a></span><span class="t"> <span class="nam">example_description</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t819" href="#t819">819</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">AutomaticDiscardRuleExample</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t820" href="#t820">820</a></span><span class="t"> <span class="str">"""Provide an example for an automatic discard rule</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t821" href="#t821">821</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t822" href="#t822">822</a></span><span class="t"><span class="str"> The return value of this method should be passed to the `examples` parameter of</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t823" href="#t823">823</a></span><span class="t"><span class="str"> `automatic_discard_rule` method - either directly for a single example or as a</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t824" href="#t824">824</a></span><span class="t"><span class="str"> part of a sequence of examples.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t825" href="#t825">825</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t826" href="#t826">826</a></span><span class="t"><span class="str"> >>> # Possible example for an exclude rule for ".la" files</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t827" href="#t827">827</a></span><span class="t"><span class="str"> >>> # Example shows two files; The ".la" file that will be removed and another file that</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t828" href="#t828">828</a></span><span class="t"><span class="str"> >>> # will be kept.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t829" href="#t829">829</a></span><span class="t"><span class="str"> >>> automatic_discard_rule_example( # doctest: +ELLIPSIS</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t830" href="#t830">830</a></span><span class="t"><span class="str"> ... "usr/lib/libfoo.la",</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t831" href="#t831">831</a></span><span class="t"><span class="str"> ... ("usr/lib/libfoo.so.1.0.0", False),</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t832" href="#t832">832</a></span><span class="t"><span class="str"> ... )</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t833" href="#t833">833</a></span><span class="t"><span class="str"> AutomaticDiscardRuleExample(...)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t834" href="#t834">834</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t835" href="#t835">835</a></span><span class="t"><span class="str"> Keep in mind that you have to explicitly include directories that are relevant for the test</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t836" href="#t836">836</a></span><span class="t"><span class="str"> if you want them shown. Also, if a directory is excluded, all path beneath it will be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t837" href="#t837">837</a></span><span class="t"><span class="str"> automatically excluded in the example as well. Your example data must account for that.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t838" href="#t838">838</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t839" href="#t839">839</a></span><span class="t"><span class="str"> >>> # Possible example for python cache file discard rule</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t840" href="#t840">840</a></span><span class="t"><span class="str"> >>> # In this example, we explicitly list the __pycache__ directory itself because we</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t841" href="#t841">841</a></span><span class="t"><span class="str"> >>> # want it shown in the output (otherwise, we could have omitted it)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t842" href="#t842">842</a></span><span class="t"><span class="str"> >>> automatic_discard_rule_example( # doctest: +ELLIPSIS</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t843" href="#t843">843</a></span><span class="t"><span class="str"> ... (".../foo.py", False),</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t844" href="#t844">844</a></span><span class="t"><span class="str"> ... ".../__pycache__/",</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t845" href="#t845">845</a></span><span class="t"><span class="str"> ... ".../__pycache__/...",</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t846" href="#t846">846</a></span><span class="t"><span class="str"> ... ".../foo.pyc",</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t847" href="#t847">847</a></span><span class="t"><span class="str"> ... ".../foo.pyo",</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t848" href="#t848">848</a></span><span class="t"><span class="str"> ... )</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t849" href="#t849">849</a></span><span class="t"><span class="str"> AutomaticDiscardRuleExample(...)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t850" href="#t850">850</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t851" href="#t851">851</a></span><span class="t"><span class="str"> Note: Even if `__pycache__` had been implicit, the result would have been the same. However,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t852" href="#t852">852</a></span><span class="t"><span class="str"> the rendered example would not have shown the directory on its own. The use of `...` as</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t853" href="#t853">853</a></span><span class="t"><span class="str"> path names is useful for denoting "anywhere" or "anything". Though, there is nothing "magic"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t854" href="#t854">854</a></span><span class="t"><span class="str"> about this name - it happens to be allowed as a path name (unlike `.` or `..`).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t855" href="#t855">855</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t856" href="#t856">856</a></span><span class="t"><span class="str"> These examples can be seen via `debputy plugin show automatic-discard-rules <name-here>`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t857" href="#t857">857</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t858" href="#t858">858</a></span><span class="t"><span class="str"> :param content: The content of the example. Each element can be either a path definition or</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t859" href="#t859">859</a></span><span class="t"><span class="str"> a tuple of a path definition followed by a verdict (boolean). Each provided path definition</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t860" href="#t860">860</a></span><span class="t"><span class="str"> describes the paths to be presented in the example. Implicit paths such as parent</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t861" href="#t861">861</a></span><span class="t"><span class="str"> directories will be created but not shown in the example. Therefore, if a directory is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t862" href="#t862">862</a></span><span class="t"><span class="str"> relevant to the example, be sure to explicitly list it.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t863" href="#t863">863</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t864" href="#t864">864</a></span><span class="t"><span class="str"> The verdict associated with a path determines whether the path should be discarded (when</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t865" href="#t865">865</a></span><span class="t"><span class="str"> True) or kept (when False). When a path is not explicitly associated with a verdict, the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t866" href="#t866">866</a></span><span class="t"><span class="str"> verdict is assumed to be discarded (True).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t867" href="#t867">867</a></span><span class="t"><span class="str"> :param example_description: An optional description displayed together with the example.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t868" href="#t868">868</a></span><span class="t"><span class="str"> :return: An opaque data structure containing the example.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t869" href="#t869">869</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t870" href="#t870">870</a></span><span class="t"> <span class="nam">example</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t871" href="#t871">871</a></span><span class="t"> <span class="key">for</span> <span class="nam">d</span> <span class="key">in</span> <span class="nam">content</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t872" href="#t872">872</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">d</span><span class="op">,</span> <span class="nam">tuple</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t873" href="#t873">873</a></span><span class="t"> <span class="nam">pd</span> <span class="op">=</span> <span class="nam">d</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t874" href="#t874">874</a></span><span class="t"> <span class="nam">verdict</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t875" href="#t875">875</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t876" href="#t876">876</a></span><span class="t"> <span class="nam">pd</span><span class="op">,</span> <span class="nam">verdict</span> <span class="op">=</span> <span class="nam">d</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t877" href="#t877">877</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t878" href="#t878">878</a></span><span class="t"> <span class="nam">path_def</span> <span class="op">=</span> <span class="nam">as_path_def</span><span class="op">(</span><span class="nam">pd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t879" href="#t879">879</a></span><span class="t"> <span class="nam">example</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="op">(</span><span class="nam">path_def</span><span class="op">,</span> <span class="nam">verdict</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t880" href="#t880">880</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t881" href="#t881">881</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">example</span><span class="op">:</span> </span><span class="r"><span class="annotate short">881 ↛ 882</span><span class="annotate long">line 881 didn't jump to line 882, because the condition on line 881 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t882" href="#t882">882</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"At least one path must be given for an example"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t883" href="#t883">883</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t884" href="#t884">884</a></span><span class="t"> <span class="key">return</span> <span class="nam">AutomaticDiscardRuleExample</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t885" href="#t885">885</a></span><span class="t"> <span class="nam">tuple</span><span class="op">(</span><span class="nam">example</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t886" href="#t886">886</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">example_description</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t887" href="#t887">887</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t888" href="#t888">888</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t889" href="#t889">889</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t890" href="#t890">890</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t891" href="#t891">891</a></span><span class="t"><span class="key">class</span> <span class="nam">PluginProvidedPackageProcessor</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t892" href="#t892">892</a></span><span class="t"> <span class="nam">processor_id</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t893" href="#t893">893</a></span><span class="t"> <span class="nam">applies_to_package_types</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t894" href="#t894">894</a></span><span class="t"> <span class="nam">package_processor</span><span class="op">:</span> <span class="nam">PackageProcessor</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t895" href="#t895">895</a></span><span class="t"> <span class="nam">dependencies</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t896" href="#t896">896</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">:</span> <span class="nam">DebputyPluginMetadata</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t897" href="#t897">897</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t898" href="#t898">898</a></span><span class="t"> <span class="key">def</span> <span class="nam">applies_to</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">binary_package</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t899" href="#t899">899</a></span><span class="t"> <span class="key">return</span> <span class="nam">binary_package</span><span class="op">.</span><span class="nam">package_type</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">applies_to_package_types</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t900" href="#t900">900</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t901" href="#t901">901</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t902" href="#t902">902</a></span><span class="t"> <span class="key">def</span> <span class="nam">dependency_id</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t903" href="#t903">903</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">plugin_metadata</span><span class="op">.</span><span class="nam">plugin_name</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">processor_id</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t904" href="#t904">904</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t905" href="#t905">905</a></span><span class="t"> <span class="key">def</span> <span class="nam">run_package_processor</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t906" href="#t906">906</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t907" href="#t907">907</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="str">"VirtualPath"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t908" href="#t908">908</a></span><span class="t"> <span class="nam">unused</span><span class="op">:</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t909" href="#t909">909</a></span><span class="t"> <span class="nam">context</span><span class="op">:</span> <span class="str">"PackageProcessingContext"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t910" href="#t910">910</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t911" href="#t911">911</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">package_processor</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">,</span> <span class="nam">unused</span><span class="op">,</span> <span class="nam">context</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t912" href="#t912">912</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t913" href="#t913">913</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t914" href="#t914">914</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t915" href="#t915">915</a></span><span class="t"><span class="key">class</span> <span class="nam">PluginProvidedDiscardRule</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t916" href="#t916">916</a></span><span class="t"> <span class="nam">name</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t917" href="#t917">917</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">:</span> <span class="nam">DebputyPluginMetadata</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t918" href="#t918">918</a></span><span class="t"> <span class="nam">discard_check</span><span class="op">:</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span><span class="op">,</span> <span class="nam">bool</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t919" href="#t919">919</a></span><span class="t"> <span class="nam">reference_documentation</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t920" href="#t920">920</a></span><span class="t"> <span class="nam">examples</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">AutomaticDiscardRuleExample</span><span class="op">]</span> <span class="op">=</span> <span class="nam">tuple</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t921" href="#t921">921</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t922" href="#t922">922</a></span><span class="t"> <span class="key">def</span> <span class="nam">should_discard</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t923" href="#t923">923</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">discard_check</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t924" href="#t924">924</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t925" href="#t925">925</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t926" href="#t926">926</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t927" href="#t927">927</a></span><span class="t"><span class="key">class</span> <span class="nam">ServiceManagerDetails</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t928" href="#t928">928</a></span><span class="t"> <span class="nam">service_manager</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t929" href="#t929">929</a></span><span class="t"> <span class="nam">service_detector</span><span class="op">:</span> <span class="str">"ServiceDetector"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t930" href="#t930">930</a></span><span class="t"> <span class="nam">service_integrator</span><span class="op">:</span> <span class="str">"ServiceIntegrator"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t931" href="#t931">931</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">:</span> <span class="nam">DebputyPluginMetadata</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t932" href="#t932">932</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t933" href="#t933">933</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t934" href="#t934">934</a></span><span class="t"><span class="nam">ReferenceValue</span> <span class="op">=</span> <span class="nam">TypedDict</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t935" href="#t935">935</a></span><span class="t"> <span class="str">"ReferenceValue"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t936" href="#t936">936</a></span><span class="t"> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t937" href="#t937">937</a></span><span class="t"> <span class="str">"description"</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t938" href="#t938">938</a></span><span class="t"> <span class="op">}</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t939" href="#t939">939</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t940" href="#t940">940</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t941" href="#t941">941</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t942" href="#t942">942</a></span><span class="t"><span class="key">def</span> <span class="nam">_reference_data_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t943" href="#t943">943</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t944" href="#t944">944</a></span><span class="t"> <span class="nam">description</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t945" href="#t945">945</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">ReferenceValue</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t946" href="#t946">946</a></span><span class="t"> <span class="key">return</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t947" href="#t947">947</a></span><span class="t"> <span class="str">"description"</span><span class="op">:</span> <span class="nam">description</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t948" href="#t948">948</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t949" href="#t949">949</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t950" href="#t950">950</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t951" href="#t951">951</a></span><span class="t"><span class="nam">KnownPackagingFileCategories</span> <span class="op">=</span> <span class="nam">Literal</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t952" href="#t952">952</a></span><span class="t"> <span class="str">"generated"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t953" href="#t953">953</a></span><span class="t"> <span class="str">"generic-template"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t954" href="#t954">954</a></span><span class="t"> <span class="str">"ppf-file"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t955" href="#t955">955</a></span><span class="t"> <span class="str">"ppf-control-file"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t956" href="#t956">956</a></span><span class="t"> <span class="str">"maint-config"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t957" href="#t957">957</a></span><span class="t"> <span class="str">"pkg-metadata"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t958" href="#t958">958</a></span><span class="t"> <span class="str">"pkg-helper-config"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t959" href="#t959">959</a></span><span class="t"> <span class="str">"testing"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t960" href="#t960">960</a></span><span class="t"> <span class="str">"lint-config"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t961" href="#t961">961</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t962" href="#t962">962</a></span><span class="t"><span class="nam">KNOWN_PACKAGING_FILE_CATEGORY_DESCRIPTIONS</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t963" href="#t963">963</a></span><span class="t"> <span class="nam">KnownPackagingFileCategories</span><span class="op">,</span> <span class="nam">ReferenceValue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t964" href="#t964">964</a></span><span class="t"><span class="op">]</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t965" href="#t965">965</a></span><span class="t"> <span class="str">"generated"</span><span class="op">:</span> <span class="nam">_reference_data_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t966" href="#t966">966</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="str">"The file is (likely) generated from another file"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t967" href="#t967">967</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t968" href="#t968">968</a></span><span class="t"> <span class="str">"generic-template"</span><span class="op">:</span> <span class="nam">_reference_data_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t969" href="#t969">969</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="str">"The file is (likely) a generic template that generates a known packaging file. While the"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t970" href="#t970">970</a></span><span class="t"> <span class="str">" file is annotated as if it was the target file, the file might uses a custom template"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t971" href="#t971">971</a></span><span class="t"> <span class="str">" language inside it."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t972" href="#t972">972</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t973" href="#t973">973</a></span><span class="t"> <span class="str">"ppf-file"</span><span class="op">:</span> <span class="nam">_reference_data_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t974" href="#t974">974</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="str">"Packager provided file to be installed on the file system - usually as-is."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t975" href="#t975">975</a></span><span class="t"> <span class="str">" When `install-pattern` or `install-path` are provided, this is where the file is installed."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t976" href="#t976">976</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t977" href="#t977">977</a></span><span class="t"> <span class="str">"ppf-control-file"</span><span class="op">:</span> <span class="nam">_reference_data_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t978" href="#t978">978</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="str">"Packager provided file that becomes a control file - possible after processing. "</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t979" href="#t979">979</a></span><span class="t"> <span class="str">" If `install-pattern` or `install-path` are provided, they denote where the is placed"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t980" href="#t980">980</a></span><span class="t"> <span class="str">" (generally, this will be of the form `DEBIAN/<name>`)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t981" href="#t981">981</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t982" href="#t982">982</a></span><span class="t"> <span class="str">"maint-config"</span><span class="op">:</span> <span class="nam">_reference_data_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t983" href="#t983">983</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="str">"Maintenance configuration for a specific tool that the maintainer uses (tool / style preferences)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t984" href="#t984">984</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t985" href="#t985">985</a></span><span class="t"> <span class="str">"pkg-metadata"</span><span class="op">:</span> <span class="nam">_reference_data_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t986" href="#t986">986</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="str">"The file is related to standard package metadata (usually documented in Debian Policy)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t987" href="#t987">987</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t988" href="#t988">988</a></span><span class="t"> <span class="str">"pkg-helper-config"</span><span class="op">:</span> <span class="nam">_reference_data_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t989" href="#t989">989</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="str">"The file is packaging helper configuration or instruction file"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t990" href="#t990">990</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t991" href="#t991">991</a></span><span class="t"> <span class="str">"testing"</span><span class="op">:</span> <span class="nam">_reference_data_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t992" href="#t992">992</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="str">"The file is related to automated testing (autopkgtests, salsa/gitlab CI)."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t993" href="#t993">993</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t994" href="#t994">994</a></span><span class="t"> <span class="str">"lint-config"</span><span class="op">:</span> <span class="nam">_reference_data_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t995" href="#t995">995</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="str">"The file is related to a linter (such as overrides for false-positives or style preferences)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t996" href="#t996">996</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t997" href="#t997">997</a></span><span class="t"><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t998" href="#t998">998</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t999" href="#t999">999</a></span><span class="t"><span class="nam">KnownPackagingConfigFeature</span> <span class="op">=</span> <span class="nam">Literal</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1000" href="#t1000">1000</a></span><span class="t"> <span class="str">"dh-filearray"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1001" href="#t1001">1001</a></span><span class="t"> <span class="str">"dh-filedoublearray"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1002" href="#t1002">1002</a></span><span class="t"> <span class="str">"dh-hash-subst"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1003" href="#t1003">1003</a></span><span class="t"> <span class="str">"dh-dollar-subst"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1004" href="#t1004">1004</a></span><span class="t"> <span class="str">"dh-glob"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1005" href="#t1005">1005</a></span><span class="t"> <span class="str">"dh-partial-glob"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1006" href="#t1006">1006</a></span><span class="t"> <span class="str">"dh-late-glob"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1007" href="#t1007">1007</a></span><span class="t"> <span class="str">"dh-glob-after-execute"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1008" href="#t1008">1008</a></span><span class="t"> <span class="str">"dh-executable-config"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1009" href="#t1009">1009</a></span><span class="t"> <span class="str">"dh-custom-format"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1010" href="#t1010">1010</a></span><span class="t"> <span class="str">"dh-file-list"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1011" href="#t1011">1011</a></span><span class="t"> <span class="str">"dh-install-list"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1012" href="#t1012">1012</a></span><span class="t"> <span class="str">"dh-install-list-dest-dir-like-dh_install"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1013" href="#t1013">1013</a></span><span class="t"> <span class="str">"dh-install-list-fixed-dest-dir"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1014" href="#t1014">1014</a></span><span class="t"> <span class="str">"dh-fixed-dest-dir"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1015" href="#t1015">1015</a></span><span class="t"> <span class="str">"dh-exec-rename"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1016" href="#t1016">1016</a></span><span class="t"> <span class="str">"dh-docs-only"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1017" href="#t1017">1017</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1018" href="#t1018">1018</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1019" href="#t1019">1019</a></span><span class="t"><span class="nam">KNOWN_PACKAGING_FILE_CONFIG_FEATURE_DESCRIPTION</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1020" href="#t1020">1020</a></span><span class="t"> <span class="nam">KnownPackagingConfigFeature</span><span class="op">,</span> <span class="nam">ReferenceValue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1021" href="#t1021">1021</a></span><span class="t"><span class="op">]</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1022" href="#t1022">1022</a></span><span class="t"> <span class="str">"dh-filearray"</span><span class="op">:</span> <span class="nam">_reference_data_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1023" href="#t1023">1023</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="str">"The file will be read as a list of space/newline separated tokens"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1024" href="#t1024">1024</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1025" href="#t1025">1025</a></span><span class="t"> <span class="str">"dh-filedoublearray"</span><span class="op">:</span> <span class="nam">_reference_data_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1026" href="#t1026">1026</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="str">"Each line in the file will be read as a list of space-separated tokens"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1027" href="#t1027">1027</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1028" href="#t1028">1028</a></span><span class="t"> <span class="str">"dh-hash-subst"</span><span class="op">:</span> <span class="nam">_reference_data_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1029" href="#t1029">1029</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="str">"Supports debhelper #PACKAGE# style substitutions (udebs often excluded)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1030" href="#t1030">1030</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1031" href="#t1031">1031</a></span><span class="t"> <span class="str">"dh-dollar-subst"</span><span class="op">:</span> <span class="nam">_reference_data_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1032" href="#t1032">1032</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="str">"Supports debhelper ${PACKAGE} style substitutions (usually requires compat 13+)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1033" href="#t1033">1033</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1034" href="#t1034">1034</a></span><span class="t"> <span class="str">"dh-glob"</span><span class="op">:</span> <span class="nam">_reference_data_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1035" href="#t1035">1035</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="str">"Supports standard debhelper globing"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1036" href="#t1036">1036</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1037" href="#t1037">1037</a></span><span class="t"> <span class="str">"dh-partial-glob"</span><span class="op">:</span> <span class="nam">_reference_data_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1038" href="#t1038">1038</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="str">"Supports standard debhelper globing but only to a subset of the values (implies dh-late-glob)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1039" href="#t1039">1039</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1040" href="#t1040">1040</a></span><span class="t"> <span class="str">"dh-late-glob"</span><span class="op">:</span> <span class="nam">_reference_data_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1041" href="#t1041">1041</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="str">"Globbing is done separately instead of using the built-in function"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1042" href="#t1042">1042</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1043" href="#t1043">1043</a></span><span class="t"> <span class="str">"dh-glob-after-execute"</span><span class="op">:</span> <span class="nam">_reference_data_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1044" href="#t1044">1044</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="str">"When the dh config file is executable, the generated output will be subject to globbing"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1045" href="#t1045">1045</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1046" href="#t1046">1046</a></span><span class="t"> <span class="str">"dh-executable-config"</span><span class="op">:</span> <span class="nam">_reference_data_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1047" href="#t1047">1047</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="str">"If marked executable, debhelper will execute the file and read its output"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1048" href="#t1048">1048</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1049" href="#t1049">1049</a></span><span class="t"> <span class="str">"dh-custom-format"</span><span class="op">:</span> <span class="nam">_reference_data_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1050" href="#t1050">1050</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="str">"The dh tool will or may have a custom parser for this file"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1051" href="#t1051">1051</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1052" href="#t1052">1052</a></span><span class="t"> <span class="str">"dh-file-list"</span><span class="op">:</span> <span class="nam">_reference_data_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1053" href="#t1053">1053</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="str">"The dh file contains a list of paths to be processed"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1054" href="#t1054">1054</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1055" href="#t1055">1055</a></span><span class="t"> <span class="str">"dh-install-list"</span><span class="op">:</span> <span class="nam">_reference_data_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1056" href="#t1056">1056</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="str">"The dh file contains a list of paths/globs to be installed but the tool specific knowledge"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1057" href="#t1057">1057</a></span><span class="t"> <span class="str">" required to understand the file cannot be conveyed via this interface."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1058" href="#t1058">1058</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1059" href="#t1059">1059</a></span><span class="t"> <span class="str">"dh-install-list-dest-dir-like-dh_install"</span><span class="op">:</span> <span class="nam">_reference_data_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1060" href="#t1060">1060</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="str">"The dh file is processed similar to dh_install (notably dest-dir handling derived"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1061" href="#t1061">1061</a></span><span class="t"> <span class="str">" from the path or the last token on the line)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1062" href="#t1062">1062</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1063" href="#t1063">1063</a></span><span class="t"> <span class="str">"dh-install-list-fixed-dest-dir"</span><span class="op">:</span> <span class="nam">_reference_data_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1064" href="#t1064">1064</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="str">"The dh file is an install list and the dest-dir is always the same for all patterns"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1065" href="#t1065">1065</a></span><span class="t"> <span class="str">" (when `install-pattern` or `install-path` are provided, they identify the directory - not the file location)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1066" href="#t1066">1066</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1067" href="#t1067">1067</a></span><span class="t"> <span class="str">"dh-exec-rename"</span><span class="op">:</span> <span class="nam">_reference_data_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1068" href="#t1068">1068</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="str">"When `dh-exec` is the interpreter of this dh config file, its renaming (=>) feature can be"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1069" href="#t1069">1069</a></span><span class="t"> <span class="str">" requested/used"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1070" href="#t1070">1070</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1071" href="#t1071">1071</a></span><span class="t"> <span class="str">"dh-docs-only"</span><span class="op">:</span> <span class="nam">_reference_data_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1072" href="#t1072">1072</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="str">"The dh config file is used for documentation only. Implicit <!nodocs> Build-Profiles support"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1073" href="#t1073">1073</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1074" href="#t1074">1074</a></span><span class="t"><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1075" href="#t1075">1075</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1076" href="#t1076">1076</a></span><span class="t"><span class="nam">CONFIG_FEATURE_ALIASES</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1077" href="#t1077">1077</a></span><span class="t"> <span class="nam">KnownPackagingConfigFeature</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">KnownPackagingConfigFeature</span><span class="op">,</span> <span class="nam">int</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1078" href="#t1078">1078</a></span><span class="t"><span class="op">]</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1079" href="#t1079">1079</a></span><span class="t"> <span class="str">"dh-filearray"</span><span class="op">:</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1080" href="#t1080">1080</a></span><span class="t"> <span class="op">(</span><span class="str">"dh-filearray"</span><span class="op">,</span> <span class="num">0</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1081" href="#t1081">1081</a></span><span class="t"> <span class="op">(</span><span class="str">"dh-executable-config"</span><span class="op">,</span> <span class="num">9</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1082" href="#t1082">1082</a></span><span class="t"> <span class="op">(</span><span class="str">"dh-dollar-subst"</span><span class="op">,</span> <span class="num">13</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1083" href="#t1083">1083</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1084" href="#t1084">1084</a></span><span class="t"> <span class="str">"dh-filedoublearray"</span><span class="op">:</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1085" href="#t1085">1085</a></span><span class="t"> <span class="op">(</span><span class="str">"dh-filedoublearray"</span><span class="op">,</span> <span class="num">0</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1086" href="#t1086">1086</a></span><span class="t"> <span class="op">(</span><span class="str">"dh-executable-config"</span><span class="op">,</span> <span class="num">9</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1087" href="#t1087">1087</a></span><span class="t"> <span class="op">(</span><span class="str">"dh-dollar-subst"</span><span class="op">,</span> <span class="num">13</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1088" href="#t1088">1088</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1089" href="#t1089">1089</a></span><span class="t"><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1090" href="#t1090">1090</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1091" href="#t1091">1091</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1092" href="#t1092">1092</a></span><span class="t"><span class="key">def</span> <span class="nam">_implies</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1093" href="#t1093">1093</a></span><span class="t"> <span class="nam">features</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">KnownPackagingConfigFeature</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1094" href="#t1094">1094</a></span><span class="t"> <span class="nam">seen</span><span class="op">:</span> <span class="nam">Set</span><span class="op">[</span><span class="nam">KnownPackagingConfigFeature</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1095" href="#t1095">1095</a></span><span class="t"> <span class="nam">implying</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">KnownPackagingConfigFeature</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1096" href="#t1096">1096</a></span><span class="t"> <span class="nam">implied</span><span class="op">:</span> <span class="nam">KnownPackagingConfigFeature</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1097" href="#t1097">1097</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1098" href="#t1098">1098</a></span><span class="t"> <span class="key">if</span> <span class="nam">implied</span> <span class="key">in</span> <span class="nam">seen</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1099" href="#t1099">1099</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1100" href="#t1100">1100</a></span><span class="t"> <span class="key">if</span> <span class="nam">all</span><span class="op">(</span><span class="nam">f</span> <span class="key">in</span> <span class="nam">seen</span> <span class="key">for</span> <span class="nam">f</span> <span class="key">in</span> <span class="nam">implying</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1101" href="#t1101">1101</a></span><span class="t"> <span class="nam">seen</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">implied</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1102" href="#t1102">1102</a></span><span class="t"> <span class="nam">features</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">implied</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1103" href="#t1103">1103</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1104" href="#t1104">1104</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1105" href="#t1105">1105</a></span><span class="t"><span class="key">def</span> <span class="nam">expand_known_packaging_config_features</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1106" href="#t1106">1106</a></span><span class="t"> <span class="nam">compat_level</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1107" href="#t1107">1107</a></span><span class="t"> <span class="nam">features</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">KnownPackagingConfigFeature</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1108" href="#t1108">1108</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">List</span><span class="op">[</span><span class="nam">KnownPackagingConfigFeature</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1109" href="#t1109">1109</a></span><span class="t"> <span class="nam">final_features</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">KnownPackagingConfigFeature</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1110" href="#t1110">1110</a></span><span class="t"> <span class="nam">seen</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1111" href="#t1111">1111</a></span><span class="t"> <span class="key">for</span> <span class="nam">feature</span> <span class="key">in</span> <span class="nam">features</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1112" href="#t1112">1112</a></span><span class="t"> <span class="nam">expanded</span> <span class="op">=</span> <span class="nam">CONFIG_FEATURE_ALIASES</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">feature</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1113" href="#t1113">1113</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">expanded</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1114" href="#t1114">1114</a></span><span class="t"> <span class="nam">expanded</span> <span class="op">=</span> <span class="op">[</span><span class="op">(</span><span class="nam">feature</span><span class="op">,</span> <span class="num">0</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1115" href="#t1115">1115</a></span><span class="t"> <span class="key">for</span> <span class="nam">v</span><span class="op">,</span> <span class="nam">c</span> <span class="key">in</span> <span class="nam">expanded</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1116" href="#t1116">1116</a></span><span class="t"> <span class="key">if</span> <span class="nam">compat_level</span> <span class="op"><</span> <span class="nam">c</span> <span class="key">or</span> <span class="nam">v</span> <span class="key">in</span> <span class="nam">seen</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1117" href="#t1117">1117</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1118" href="#t1118">1118</a></span><span class="t"> <span class="nam">seen</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">v</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1119" href="#t1119">1119</a></span><span class="t"> <span class="nam">final_features</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">v</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1120" href="#t1120">1120</a></span><span class="t"> <span class="key">if</span> <span class="str">"dh-glob"</span> <span class="key">in</span> <span class="nam">seen</span> <span class="key">and</span> <span class="str">"dh-late-glob"</span> <span class="key">in</span> <span class="nam">seen</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1121" href="#t1121">1121</a></span><span class="t"> <span class="nam">final_features</span><span class="op">.</span><span class="nam">remove</span><span class="op">(</span><span class="str">"dh-glob"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1122" href="#t1122">1122</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1123" href="#t1123">1123</a></span><span class="t"> <span class="nam">_implies</span><span class="op">(</span><span class="nam">final_features</span><span class="op">,</span> <span class="nam">seen</span><span class="op">,</span> <span class="op">[</span><span class="str">"dh-partial-glob"</span><span class="op">]</span><span class="op">,</span> <span class="str">"dh-late-glob"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1124" href="#t1124">1124</a></span><span class="t"> <span class="nam">_implies</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1125" href="#t1125">1125</a></span><span class="t"> <span class="nam">final_features</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1126" href="#t1126">1126</a></span><span class="t"> <span class="nam">seen</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1127" href="#t1127">1127</a></span><span class="t"> <span class="op">[</span><span class="str">"dh-late-glob"</span><span class="op">,</span> <span class="str">"dh-executable-config"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1128" href="#t1128">1128</a></span><span class="t"> <span class="str">"dh-glob-after-execute"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1129" href="#t1129">1129</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1130" href="#t1130">1130</a></span><span class="t"> <span class="key">return</span> <span class="nam">sorted</span><span class="op">(</span><span class="nam">final_features</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1131" href="#t1131">1131</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1132" href="#t1132">1132</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1133" href="#t1133">1133</a></span><span class="t"><span class="key">class</span> <span class="nam">InstallPatternDHCompatRule</span><span class="op">(</span><span class="nam">DebputyParsedContent</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1134" href="#t1134">1134</a></span><span class="t"> <span class="nam">install_pattern</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1135" href="#t1135">1135</a></span><span class="t"> <span class="nam">add_config_features</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">KnownPackagingConfigFeature</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1136" href="#t1136">1136</a></span><span class="t"> <span class="nam">starting_with_compat_level</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1137" href="#t1137">1137</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1138" href="#t1138">1138</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1139" href="#t1139">1139</a></span><span class="t"><span class="key">class</span> <span class="nam">KnownPackagingFileInfo</span><span class="op">(</span><span class="nam">DebputyParsedContent</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1140" href="#t1140">1140</a></span><span class="t"> <span class="com"># Exposed directly in the JSON plugin parsing; be careful with changes</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1141" href="#t1141">1141</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1142" href="#t1142">1142</a></span><span class="t"> <span class="nam">pkgfile</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1143" href="#t1143">1143</a></span><span class="t"> <span class="nam">detection_method</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">Literal</span><span class="op">[</span><span class="str">"path"</span><span class="op">,</span> <span class="str">"dh.pkgfile"</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1144" href="#t1144">1144</a></span><span class="t"> <span class="nam">file_categories</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">KnownPackagingFileCategories</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1145" href="#t1145">1145</a></span><span class="t"> <span class="nam">documentation_uris</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1146" href="#t1146">1146</a></span><span class="t"> <span class="nam">debputy_cmd_templates</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1147" href="#t1147">1147</a></span><span class="t"> <span class="nam">debhelper_commands</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1148" href="#t1148">1148</a></span><span class="t"> <span class="nam">config_features</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">KnownPackagingConfigFeature</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1149" href="#t1149">1149</a></span><span class="t"> <span class="nam">install_pattern</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1150" href="#t1150">1150</a></span><span class="t"> <span class="nam">dh_compat_rules</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">InstallPatternDHCompatRule</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1151" href="#t1151">1151</a></span><span class="t"> <span class="nam">default_priority</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1152" href="#t1152">1152</a></span><span class="t"> <span class="nam">post_formatting_rewrite</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">Literal</span><span class="op">[</span><span class="str">"period-to-underscore"</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1153" href="#t1153">1153</a></span><span class="t"> <span class="nam">packageless_is_fallback_for_all_packages</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1154" href="#t1154">1154</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1155" href="#t1155">1155</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1156" href="#t1156">1156</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1157" href="#t1157">1157</a></span><span class="t"><span class="key">class</span> <span class="nam">PluginProvidedKnownPackagingFile</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1158" href="#t1158">1158</a></span><span class="t"> <span class="nam">info</span><span class="op">:</span> <span class="nam">KnownPackagingFileInfo</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1159" href="#t1159">1159</a></span><span class="t"> <span class="nam">detection_method</span><span class="op">:</span> <span class="nam">Literal</span><span class="op">[</span><span class="str">"path"</span><span class="op">,</span> <span class="str">"dh.pkgfile"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1160" href="#t1160">1160</a></span><span class="t"> <span class="nam">detection_value</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1161" href="#t1161">1161</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">:</span> <span class="nam">DebputyPluginMetadata</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1162" href="#t1162">1162</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1163" href="#t1163">1163</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1164" href="#t1164">1164</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1165" href="#t1165">1165</a></span><span class="t"><span class="key">class</span> <span class="nam">PluginProvidedTypeMapping</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1166" href="#t1166">1166</a></span><span class="t"> <span class="nam">mapped_type</span><span class="op">:</span> <span class="nam">TypeMapping</span><span class="op">[</span><span class="nam">Any</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1167" href="#t1167">1167</a></span><span class="t"> <span class="nam">reference_documentation</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">TypeMappingDocumentation</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1168" href="#t1168">1168</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">:</span> <span class="nam">DebputyPluginMetadata</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1169" href="#t1169">1169</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1170" href="#t1170">1170</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1171" href="#t1171">1171</a></span><span class="t"><span class="key">class</span> <span class="nam">PackageDataTable</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1172" href="#t1172">1172</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">package_data_table</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="str">"BinaryPackageData"</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1173" href="#t1173">1173</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_data_table</span> <span class="op">=</span> <span class="nam">package_data_table</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1174" href="#t1174">1174</a></span><span class="t"> <span class="com"># This is enabled for metadata-detectors. But it is deliberate not enabled for package processors,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1175" href="#t1175">1175</a></span><span class="t"> <span class="com"># because it is not clear how it should interact with dependencies. For metadata-detectors, things</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1176" href="#t1176">1176</a></span><span class="t"> <span class="com"># read-only and there are no dependencies, so we cannot "get them wrong".</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1177" href="#t1177">1177</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">enable_cross_package_checks</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1178" href="#t1178">1178</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1179" href="#t1179">1179</a></span><span class="t"> <span class="key">def</span> <span class="nam">__iter__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="str">"BinaryPackageData"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1180" href="#t1180">1180</a></span><span class="t"> <span class="key">return</span> <span class="nam">iter</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_package_data_table</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1181" href="#t1181">1181</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1182" href="#t1182">1182</a></span><span class="t"> <span class="key">def</span> <span class="nam">__getitem__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">item</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="str">"BinaryPackageData"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1183" href="#t1183">1183</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_data_table</span><span class="op">[</span><span class="nam">item</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1184" href="#t1184">1184</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1185" href="#t1185">1185</a></span><span class="t"> <span class="key">def</span> <span class="nam">__contains__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">item</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1186" href="#t1186">1186</a></span><span class="t"> <span class="key">return</span> <span class="nam">item</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_data_table</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1187" href="#t1187">1187</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1188" href="#t1188">1188</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1189" href="#t1189">1189</a></span><span class="t"><span class="key">class</span> <span class="nam">PackageProcessingContextProvider</span><span class="op">(</span><span class="nam">PackageProcessingContext</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1190" href="#t1190">1190</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1191" href="#t1191">1191</a></span><span class="t"> <span class="str">"_manifest"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1192" href="#t1192">1192</a></span><span class="t"> <span class="str">"_binary_package"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1193" href="#t1193">1193</a></span><span class="t"> <span class="str">"_related_udeb_package"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1194" href="#t1194">1194</a></span><span class="t"> <span class="str">"_package_data_table"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1195" href="#t1195">1195</a></span><span class="t"> <span class="str">"_cross_check_cache"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1196" href="#t1196">1196</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1197" href="#t1197">1197</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1198" href="#t1198">1198</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1199" href="#t1199">1199</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1200" href="#t1200">1200</a></span><span class="t"> <span class="nam">manifest</span><span class="op">:</span> <span class="str">"HighLevelManifest"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1201" href="#t1201">1201</a></span><span class="t"> <span class="nam">binary_package</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1202" href="#t1202">1202</a></span><span class="t"> <span class="nam">related_udeb_package</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1203" href="#t1203">1203</a></span><span class="t"> <span class="nam">package_data_table</span><span class="op">:</span> <span class="nam">PackageDataTable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1204" href="#t1204">1204</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1205" href="#t1205">1205</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_manifest</span> <span class="op">=</span> <span class="nam">manifest</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1206" href="#t1206">1206</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_binary_package</span> <span class="op">=</span> <span class="nam">binary_package</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1207" href="#t1207">1207</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_related_udeb_package</span> <span class="op">=</span> <span class="nam">related_udeb_package</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1208" href="#t1208">1208</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_data_table</span> <span class="op">=</span> <span class="nam">ref</span><span class="op">(</span><span class="nam">package_data_table</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1209" href="#t1209">1209</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_cross_check_cache</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1210" href="#t1210">1210</a></span><span class="t"> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">,</span> <span class="str">"VirtualPath"</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1211" href="#t1211">1211</a></span><span class="t"> <span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1212" href="#t1212">1212</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1213" href="#t1213">1213</a></span><span class="t"> <span class="key">def</span> <span class="nam">_package_state_for</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1214" href="#t1214">1214</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1215" href="#t1215">1215</a></span><span class="t"> <span class="nam">package</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1216" href="#t1216">1216</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"PackageTransformationDefinition"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1217" href="#t1217">1217</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_manifest</span><span class="op">.</span><span class="nam">package_state_for</span><span class="op">(</span><span class="nam">package</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1218" href="#t1218">1218</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1219" href="#t1219">1219</a></span><span class="t"> <span class="key">def</span> <span class="nam">_package_version_for</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1220" href="#t1220">1220</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1221" href="#t1221">1221</a></span><span class="t"> <span class="nam">package</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1222" href="#t1222">1222</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1223" href="#t1223">1223</a></span><span class="t"> <span class="nam">package_state</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_state_for</span><span class="op">(</span><span class="nam">package</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1224" href="#t1224">1224</a></span><span class="t"> <span class="nam">version</span> <span class="op">=</span> <span class="nam">package_state</span><span class="op">.</span><span class="nam">binary_version</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1225" href="#t1225">1225</a></span><span class="t"> <span class="key">if</span> <span class="nam">version</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1226" href="#t1226">1226</a></span><span class="t"> <span class="key">return</span> <span class="nam">version</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1227" href="#t1227">1227</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_manifest</span><span class="op">.</span><span class="nam">source_version</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1228" href="#t1228">1228</a></span><span class="t"> <span class="nam">include_binnmu_version</span><span class="op">=</span><span class="key">not</span> <span class="nam">package</span><span class="op">.</span><span class="nam">is_arch_all</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1229" href="#t1229">1229</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1230" href="#t1230">1230</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1231" href="#t1231">1231</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1232" href="#t1232">1232</a></span><span class="t"> <span class="key">def</span> <span class="nam">binary_package</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">BinaryPackage</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1233" href="#t1233">1233</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_binary_package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1234" href="#t1234">1234</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1235" href="#t1235">1235</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1236" href="#t1236">1236</a></span><span class="t"> <span class="key">def</span> <span class="nam">related_udeb_package</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1237" href="#t1237">1237</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_related_udeb_package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1238" href="#t1238">1238</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1239" href="#t1239">1239</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1240" href="#t1240">1240</a></span><span class="t"> <span class="key">def</span> <span class="nam">binary_package_version</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1241" href="#t1241">1241</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_version_for</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_binary_package</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1242" href="#t1242">1242</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1243" href="#t1243">1243</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1244" href="#t1244">1244</a></span><span class="t"> <span class="key">def</span> <span class="nam">related_udeb_package_version</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1245" href="#t1245">1245</a></span><span class="t"> <span class="nam">udeb</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_related_udeb_package</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1246" href="#t1246">1246</a></span><span class="t"> <span class="key">if</span> <span class="nam">udeb</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1247" href="#t1247">1247</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1248" href="#t1248">1248</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_version_for</span><span class="op">(</span><span class="nam">udeb</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1249" href="#t1249">1249</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1250" href="#t1250">1250</a></span><span class="t"> <span class="key">def</span> <span class="nam">accessible_package_roots</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">,</span> <span class="str">"VirtualPath"</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1251" href="#t1251">1251</a></span><span class="t"> <span class="nam">package_table</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_package_data_table</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1252" href="#t1252">1252</a></span><span class="t"> <span class="key">if</span> <span class="nam">package_table</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1253" href="#t1253">1253</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ReferenceError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1254" href="#t1254">1254</a></span><span class="t"> <span class="str">"Internal error: package_table was garbage collected too early"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1255" href="#t1255">1255</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1256" href="#t1256">1256</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">package_table</span><span class="op">.</span><span class="nam">enable_cross_package_checks</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1257" href="#t1257">1257</a></span><span class="t"> <span class="key">raise</span> <span class="nam">PluginAPIViolationError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1258" href="#t1258">1258</a></span><span class="t"> <span class="str">"Cross package content checks are not available at this time."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1259" href="#t1259">1259</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1260" href="#t1260">1260</a></span><span class="t"> <span class="nam">cache</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_cross_check_cache</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1261" href="#t1261">1261</a></span><span class="t"> <span class="key">if</span> <span class="nam">cache</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1262" href="#t1262">1262</a></span><span class="t"> <span class="nam">matches</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1263" href="#t1263">1263</a></span><span class="t"> <span class="nam">pkg</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">binary_package</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1264" href="#t1264">1264</a></span><span class="t"> <span class="key">for</span> <span class="nam">pkg_data</span> <span class="key">in</span> <span class="nam">package_table</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1265" href="#t1265">1265</a></span><span class="t"> <span class="key">if</span> <span class="nam">pkg_data</span><span class="op">.</span><span class="nam">binary_package</span><span class="op">.</span><span class="nam">name</span> <span class="op">==</span> <span class="nam">pkg</span><span class="op">.</span><span class="nam">name</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1266" href="#t1266">1266</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1267" href="#t1267">1267</a></span><span class="t"> <span class="nam">res</span> <span class="op">=</span> <span class="nam">package_cross_check_precheck</span><span class="op">(</span><span class="nam">pkg</span><span class="op">,</span> <span class="nam">pkg_data</span><span class="op">.</span><span class="nam">binary_package</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1268" href="#t1268">1268</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">res</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1269" href="#t1269">1269</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1270" href="#t1270">1270</a></span><span class="t"> <span class="nam">matches</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="op">(</span><span class="nam">pkg_data</span><span class="op">.</span><span class="nam">binary_package</span><span class="op">,</span> <span class="nam">pkg_data</span><span class="op">.</span><span class="nam">fs_root</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1271" href="#t1271">1271</a></span><span class="t"> <span class="nam">cache</span> <span class="op">=</span> <span class="nam">tuple</span><span class="op">(</span><span class="nam">matches</span><span class="op">)</span> <span class="key">if</span> <span class="nam">matches</span> <span class="key">else</span> <span class="nam">tuple</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1272" href="#t1272">1272</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_cross_check_cache</span> <span class="op">=</span> <span class="nam">cache</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1273" href="#t1273">1273</a></span><span class="t"> <span class="key">return</span> <span class="nam">cache</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1274" href="#t1274">1274</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1275" href="#t1275">1275</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1276" href="#t1276">1276</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1277" href="#t1277">1277</a></span><span class="t"><span class="key">class</span> <span class="nam">PluginProvidedTrigger</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1278" href="#t1278">1278</a></span><span class="t"> <span class="nam">dpkg_trigger_type</span><span class="op">:</span> <span class="nam">DpkgTriggerType</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1279" href="#t1279">1279</a></span><span class="t"> <span class="nam">dpkg_trigger_target</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1280" href="#t1280">1280</a></span><span class="t"> <span class="nam">provider</span><span class="op">:</span> <span class="nam">DebputyPluginMetadata</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1281" href="#t1281">1281</a></span><span class="t"> <span class="nam">provider_source_id</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1282" href="#t1282">1282</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1283" href="#t1283">1283</a></span><span class="t"> <span class="key">def</span> <span class="nam">serialized_format</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1284" href="#t1284">1284</a></span><span class="t"> <span class="key">return</span> <span class="str">f"{self.dpkg_trigger_type} {self.dpkg_trigger_target}"</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_64287305fe0c6642_impl_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_64287305fe0c6642_plugin_parser_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_64287305fe0c6642_plugin_parser_py.html b/coverage-report/d_64287305fe0c6642_plugin_parser_py.html deleted file mode 100644 index e9a7713..0000000 --- a/coverage-report/d_64287305fe0c6642_plugin_parser_py.html +++ /dev/null @@ -1,165 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/plugin/api/plugin_parser.py: 100%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/plugin/api/plugin_parser.py</b>: - <span class="pc_cov">100%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">35 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">35<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">0<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_64287305fe0c6642_impl_types_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_64287305fe0c6642_spec_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">NotRequired</span><span class="op">,</span> <span class="nam">List</span><span class="op">,</span> <span class="nam">Any</span><span class="op">,</span> <span class="nam">TypedDict</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">base_types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> <span class="nam">DebputyParsedContent</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> <span class="nam">OctalMode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="nam">TypeMapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">declarative_parser</span> <span class="key">import</span> <span class="nam">ParserGenerator</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">impl_types</span> <span class="key">import</span> <span class="nam">KnownPackagingFileInfo</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="key">class</span> <span class="nam">PPFReferenceDocumentation</span><span class="op">(</span><span class="nam">TypedDict</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">description</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">format_documentation_uris</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"><span class="key">class</span> <span class="nam">PackagerProvidedFileJsonDescription</span><span class="op">(</span><span class="nam">DebputyParsedContent</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">stem</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">installed_path</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">default_mode</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">OctalMode</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">default_priority</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">allow_name_segment</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="nam">allow_architecture_segment</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">reference_documentation</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">PPFReferenceDocumentation</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"><span class="key">class</span> <span class="nam">ManifestVariableJsonDescription</span><span class="op">(</span><span class="nam">DebputyParsedContent</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="nam">name</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="nam">value</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="nam">reference_documentation</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"><span class="key">class</span> <span class="nam">PluginJsonMetadata</span><span class="op">(</span><span class="nam">DebputyParsedContent</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="nam">api_compat_version</span><span class="op">:</span> <span class="nam">int</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="nam">module</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="nam">plugin_initializer</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="nam">packager_provided_files</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="nam">manifest_variables</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">known_packaging_files</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"><span class="key">def</span> <span class="nam">_initialize_plugin_metadata_parser_generator</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="nam">ParserGenerator</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">pc</span> <span class="op">=</span> <span class="nam">ParserGenerator</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="nam">pc</span><span class="op">.</span><span class="nam">register_mapped_type</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="nam">TypeMapping</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="nam">OctalMode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="key">lambda</span> <span class="nam">v</span><span class="op">,</span> <span class="nam">ap</span><span class="op">,</span> <span class="nam">_</span><span class="op">:</span> <span class="nam">OctalMode</span><span class="op">.</span><span class="nam">parse_filesystem_mode</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">ap</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="key">return</span> <span class="nam">pc</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"><span class="nam">PLUGIN_METADATA_PARSER_GENERATOR</span> <span class="op">=</span> <span class="nam">_initialize_plugin_metadata_parser_generator</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"><span class="nam">PLUGIN_METADATA_PARSER</span> <span class="op">=</span> <span class="nam">PLUGIN_METADATA_PARSER_GENERATOR</span><span class="op">.</span><span class="nam">generate_parser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">PluginJsonMetadata</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"><span class="nam">PLUGIN_PPF_PARSER</span> <span class="op">=</span> <span class="nam">PLUGIN_METADATA_PARSER_GENERATOR</span><span class="op">.</span><span class="nam">generate_parser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="nam">PackagerProvidedFileJsonDescription</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"><span class="nam">PLUGIN_MANIFEST_VARS_PARSER</span> <span class="op">=</span> <span class="nam">PLUGIN_METADATA_PARSER_GENERATOR</span><span class="op">.</span><span class="nam">generate_parser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="nam">ManifestVariableJsonDescription</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"><span class="nam">PLUGIN_KNOWN_PACKAGING_FILES_PARSER</span> <span class="op">=</span> <span class="nam">PLUGIN_METADATA_PARSER_GENERATOR</span><span class="op">.</span><span class="nam">generate_parser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="nam">KnownPackagingFileInfo</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_64287305fe0c6642_impl_types_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_64287305fe0c6642_spec_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_64287305fe0c6642_spec_py.html b/coverage-report/d_64287305fe0c6642_spec_py.html deleted file mode 100644 index 700a493..0000000 --- a/coverage-report/d_64287305fe0c6642_spec_py.html +++ /dev/null @@ -1,1842 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/plugin/api/spec.py: 87%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/plugin/api/spec.py</b>: - <span class="pc_cov">87%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">282 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">246<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">36<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">66<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">7<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_64287305fe0c6642_plugin_parser_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_4b9be07fb6071cd2___init___py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">contextlib</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">dataclasses</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">import</span> <span class="nam">tempfile</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">import</span> <span class="nam">textwrap</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">Iterable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">Callable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">Literal</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">Iterator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">overload</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">FrozenSet</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">Sequence</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">TypeVar</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">TYPE_CHECKING</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">TextIO</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">BinaryIO</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">Generic</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">ContextManager</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="nam">List</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">Type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"><span class="key">from</span> <span class="nam">debian</span><span class="op">.</span><span class="nam">substvars</span> <span class="key">import</span> <span class="nam">Substvars</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span> <span class="key">import</span> <span class="nam">util</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">exceptions</span> <span class="key">import</span> <span class="nam">TestPathWithNonExistentFSPathError</span><span class="op">,</span> <span class="nam">PureVirtualPathError</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">interpreter</span> <span class="key">import</span> <span class="nam">Interpreter</span><span class="op">,</span> <span class="nam">extract_shebang_interpreter_from_file</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">parse_symbolic_mode</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">packages</span> <span class="key">import</span> <span class="nam">BinaryPackage</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">types</span> <span class="key">import</span> <span class="nam">S</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="key">if</span> <span class="nam">TYPE_CHECKING</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">base_types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">StaticFileSystemOwner</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="nam">StaticFileSystemGroup</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"><span class="nam">PluginInitializationEntryPoint</span> <span class="op">=</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="str">"DebputyPluginInitializer"</span><span class="op">]</span><span class="op">,</span> <span class="key">None</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"><span class="nam">MetadataAutoDetector</span> <span class="op">=</span> <span class="nam">Callable</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="op">[</span><span class="str">"VirtualPath"</span><span class="op">,</span> <span class="str">"BinaryCtrlAccessor"</span><span class="op">,</span> <span class="str">"PackageProcessingContext"</span><span class="op">]</span><span class="op">,</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"><span class="nam">PackageProcessor</span> <span class="op">=</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="str">"VirtualPath"</span><span class="op">,</span> <span class="key">None</span><span class="op">,</span> <span class="str">"PackageProcessingContext"</span><span class="op">]</span><span class="op">,</span> <span class="key">None</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"><span class="nam">DpkgTriggerType</span> <span class="op">=</span> <span class="nam">Literal</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="str">"activate"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="str">"activate-await"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="str">"activate-noawait"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="str">"interest"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="str">"interest-await"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="str">"interest-noawait"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"><span class="nam">Maintscript</span> <span class="op">=</span> <span class="nam">Literal</span><span class="op">[</span><span class="str">"postinst"</span><span class="op">,</span> <span class="str">"preinst"</span><span class="op">,</span> <span class="str">"prerm"</span><span class="op">,</span> <span class="str">"postrm"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"><span class="nam">PackageTypeSelector</span> <span class="op">=</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">Literal</span><span class="op">[</span><span class="str">"deb"</span><span class="op">,</span> <span class="str">"udeb"</span><span class="op">]</span><span class="op">,</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Literal</span><span class="op">[</span><span class="str">"deb"</span><span class="op">,</span> <span class="str">"udeb"</span><span class="op">]</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"><span class="nam">ServiceUpgradeRule</span> <span class="op">=</span> <span class="nam">Literal</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="str">"do-nothing"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="str">"reload"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="str">"restart"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="str">"stop-then-start"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"><span class="nam">DSD</span> <span class="op">=</span> <span class="nam">TypeVar</span><span class="op">(</span><span class="str">"DSD"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"><span class="nam">ServiceDetector</span> <span class="op">=</span> <span class="nam">Callable</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="op">[</span><span class="str">"VirtualPath"</span><span class="op">,</span> <span class="str">"ServiceRegistry[DSD]"</span><span class="op">,</span> <span class="str">"PackageProcessingContext"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"><span class="nam">ServiceIntegrator</span> <span class="op">=</span> <span class="nam">Callable</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="nam">Sequence</span><span class="op">[</span><span class="str">"ServiceDefinition[DSD]"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="str">"BinaryCtrlAccessor"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="str">"PackageProcessingContext"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"><span class="nam">PMT</span> <span class="op">=</span> <span class="nam">TypeVar</span><span class="op">(</span><span class="str">"PMT"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"><span class="key">class</span> <span class="nam">PackagerProvidedFileReferenceDocumentation</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="nam">description</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="nam">format_documentation_uris</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="nam">tuple</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="key">def</span> <span class="nam">replace</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">**</span><span class="nam">changes</span><span class="op">:</span> <span class="nam">Any</span><span class="op">)</span> <span class="op">-></span> <span class="str">"PackagerProvidedFileReferenceDocumentation"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="key">return</span> <span class="nam">dataclasses</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">**</span><span class="nam">changes</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"><span class="key">def</span> <span class="nam">packager_provided_file_reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="nam">description</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="nam">format_documentation_uris</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="nam">tuple</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">PackagerProvidedFileReferenceDocumentation</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="str">"""Provide documentation for a given packager provided file.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"><span class="str"> :param description: Textual description presented to the user.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"><span class="str"> :param format_documentation_uris: A sequence of URIs to documentation that describes</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"><span class="str"> the format of the file. Most relevant first.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"><span class="str"> :return:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="nam">uris</span> <span class="op">=</span> <span class="nam">tuple</span><span class="op">(</span><span class="nam">format_documentation_uris</span><span class="op">)</span> <span class="key">if</span> <span class="nam">format_documentation_uris</span> <span class="key">else</span> <span class="nam">tuple</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="key">return</span> <span class="nam">PackagerProvidedFileReferenceDocumentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">description</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="nam">format_documentation_uris</span><span class="op">=</span><span class="nam">uris</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"><span class="key">class</span> <span class="nam">PathMetadataReference</span><span class="op">(</span><span class="nam">Generic</span><span class="op">[</span><span class="nam">PMT</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="str">"""An accessor to plugin provided metadata</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"><span class="str"> This is a *short-lived* reference to a piece of metadata. It should *not* be stored beyond</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"><span class="str"> the boundaries of the current plugin execution context as it can be become invalid (as an</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"><span class="str"> example, if the path associated with this path is removed, then this reference become invalid)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_present</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="str">"""Determine whether the value has been set</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"><span class="str"> If the current plugin cannot access the value, then this method unconditionally returns</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"><span class="str"> `False` regardless of whether the value is there.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"><span class="str"> :return: `True` if the value has been set to a not None value (and not been deleted).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"><span class="str"> Otherwise, this property is `False`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="key">def</span> <span class="nam">can_read</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="str">"""Test whether it is possible to read the metadata</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"><span class="str"> Note: That the metadata being readable does *not* imply that the metadata is present.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"><span class="str"> :return: True if it is possible to read the metadata. This is always True for the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"><span class="str"> owning plugin.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="key">def</span> <span class="nam">can_write</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="str">"""Test whether it is possible to update the metadata</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"><span class="str"> :return: True if it is possible to update the metadata.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="key">def</span> <span class="nam">value</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">PMT</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="str">"""Fetch the currently stored value if present.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"><span class="str"> :return: The value previously stored if any. Returns `None` if the value was never</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"><span class="str"> stored, explicitly set to `None` or was deleted.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="op">@</span><span class="nam">value</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="key">def</span> <span class="nam">value</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">value</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">PMT</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="str">"""Replace any current value with the provided value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"><span class="str"> This operation is only possible if the path is writable *and* the caller is from</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"><span class="str"> the owning plugin OR the owning plugin made the reference read-write.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="op">@</span><span class="nam">value</span><span class="op">.</span><span class="nam">deleter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="key">def</span> <span class="nam">value</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="str">"""Delete any current value.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"><span class="str"> This has the same effect as setting the value to `None`. It has the same restrictions</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"><span class="str"> as the value setter.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">value</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"><span class="key">class</span> <span class="nam">PathDef</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="nam">path_name</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="nam">mode</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="nam">mtime</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="nam">has_fs_path</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="nam">fs_path</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="nam">link_target</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="nam">content</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="nam">materialized_content</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"><span class="key">def</span> <span class="nam">virtual_path_def</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="nam">path_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="op">/</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="nam">mode</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="nam">mtime</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="nam">fs_path</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="nam">link_target</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="nam">content</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="nam">materialized_content</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">PathDef</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="str">"""Define a virtual path for use with examples or, in tests, `build_virtual_file_system`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"><span class="str"> :param path_name: The full path. Must start with "./". If it ends with "/", the path will be interpreted</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"><span class="str"> as a directory (the `is_dir` attribute will be True). Otherwise, it will be a symlink or file depending</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"><span class="str"> on whether a `link_target` is provided.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"><span class="str"> :param mode: The mode to use for this path. Defaults to 0644 for files and 0755 for directories. The mode</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"><span class="str"> should be None for symlinks.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"><span class="str"> :param mtime: Define the last modified time for this path. If not provided, debputy will provide a default</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"><span class="str"> if the mtime attribute is accessed.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"><span class="str"> :param fs_path: Define a file system path for this path. This causes `has_fs_path` to return True and the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"><span class="str"> `fs_path` attribute will return this value. The test is required to make this path available to the extent</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"><span class="str"> required. Note that the virtual file system will *not* examine the provided path in any way nor attempt</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"><span class="str"> to resolve defaults from the path.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"><span class="str"> :param link_target: A target for the symlink. Providing a not None value for this parameter will make the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"><span class="str"> path a symlink.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"><span class="str"> :param content: The content of the path (if opened). The path must be a file.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"><span class="str"> :param materialized_content: Same as `content` except `debputy` will put the contents into a physical file</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"><span class="str"> as needed. Cannot be used with `content` or `fs_path`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"><span class="str"> :return: An *opaque* object to be passed to `build_virtual_file_system`. While the exact type is provided</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"><span class="str"> to aid with typing, the type name and its behaviour is not part of the API.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="nam">is_dir</span> <span class="op">=</span> <span class="nam">path_name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="nam">is_symlink</span> <span class="op">=</span> <span class="nam">link_target</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_symlink</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="key">if</span> <span class="nam">mode</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="str">f'Please do not provide mode for symlinks. Triggered by "{path_name}"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="str">"Path name looks like a directory, but a symlink target was also provided."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="str">f' Please remove the trailing slash OR the symlink_target. Triggered by "{path_name}"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="key">if</span> <span class="nam">content</span> <span class="key">and</span> <span class="op">(</span><span class="nam">is_dir</span> <span class="key">or</span> <span class="nam">is_symlink</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">236 ↛ 237</span><span class="annotate long">line 236 didn't jump to line 237, because the condition on line 236 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="str">"Content was defined however, the path appears to be a directory a or a symlink"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="str">f' Please remove the content, the trailing slash OR the symlink_target. Triggered by "{path_name}"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="key">if</span> <span class="nam">materialized_content</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="key">if</span> <span class="nam">content</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">243 ↛ 244</span><span class="annotate long">line 243 didn't jump to line 244, because the condition on line 243 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="str">"The materialized_content keyword is mutually exclusive with the content keyword."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="str">f' Triggered by "{path_name}"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="key">if</span> <span class="nam">fs_path</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">248 ↛ 249</span><span class="annotate long">line 248 didn't jump to line 249, because the condition on line 248 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="str">"The materialized_content keyword is mutually exclusive with the fs_path keyword."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="str">f' Triggered by "{path_name}"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="key">return</span> <span class="nam">PathDef</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="nam">path_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="nam">mode</span><span class="op">=</span><span class="nam">mode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="nam">mtime</span><span class="op">=</span><span class="nam">mtime</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="nam">has_fs_path</span><span class="op">=</span><span class="nam">bool</span><span class="op">(</span><span class="nam">fs_path</span><span class="op">)</span> <span class="key">or</span> <span class="nam">materialized_content</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="nam">fs_path</span><span class="op">=</span><span class="nam">fs_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="nam">link_target</span><span class="op">=</span><span class="nam">link_target</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="nam">content</span><span class="op">=</span><span class="nam">content</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="nam">materialized_content</span><span class="op">=</span><span class="nam">materialized_content</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"><span class="key">class</span> <span class="nam">PackageProcessingContext</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="str">"""Context for auto-detectors of metadata and package processors (no instantiation)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"><span class="str"> This object holds some context related data for the metadata detector or/and package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"><span class="str"> processors. It may receive new attributes in the future.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="key">def</span> <span class="nam">binary_package</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">BinaryPackage</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="str">"""The binary package stanza from `debian/control`"""</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="key">def</span> <span class="nam">binary_package_version</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="str">"""The version of the binary package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"><span class="str"> Note this never includes the binNMU version for arch:all packages, but it may for arch:any.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="key">def</span> <span class="nam">related_udeb_package</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="str">"""An udeb related to this binary package (if any)"""</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="key">def</span> <span class="nam">related_udeb_package_version</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> <span class="str">"""The version of the related udeb package (if present)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"><span class="str"> Note this never includes the binNMU version for arch:all packages, but it may for arch:any.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="key">def</span> <span class="nam">accessible_package_roots</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">,</span> <span class="str">"VirtualPath"</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="com"># """The source package stanza from `debian/control`"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> <span class="com"># source_package: SourcePackage</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"><span class="key">class</span> <span class="nam">DebputyPluginInitializer</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="key">def</span> <span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="nam">stem</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="nam">installed_path</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="nam">default_mode</span><span class="op">:</span> <span class="nam">int</span> <span class="op">=</span> <span class="num">0o0644</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="nam">default_priority</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="nam">allow_name_segment</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="nam">allow_architecture_segment</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="nam">post_formatting_rewrite</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="nam">packageless_is_fallback_for_all_packages</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="nam">reservation_only</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="nam">reference_documentation</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> <span class="nam">PackagerProvidedFileReferenceDocumentation</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> <span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> <span class="str">"""Register a packager provided file (debian/<pkg>.foo)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"><span class="str"> Register a packager provided file that debputy should automatically detect and install for the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"><span class="str"> packager (example `debian/foo.tmpfiles` -> `debian/foo/usr/lib/tmpfiles.d/foo.conf`). A packager</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"><span class="str"> provided file typically identified by a package prefix and a "stem" and by convention placed</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"><span class="str"> in the `debian/` directory.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"><span class="str"> Like debhelper, debputy also supports the `foo.bar.tmpfiles` variant where the file is to be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"><span class="str"> installed into the `foo` package but be named after the `bar` segment rather than the package name.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"><span class="str"> This feature can be controlled via the `allow_name_segment` parameter.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"><span class="str"> :param stem: The "stem" of the file. This would be the `tmpfiles` part of `debian/foo.tmpfiles`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"><span class="str"> Note that this value must be unique across all registered packager provided files.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"><span class="str"> :param installed_path: A format string describing where the file should be installed. Would be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"><span class="str"> `/usr/lib/tmpfiles.d/{name}.conf` from the example above.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"><span class="str"> The caller should provide a string with one or more of the placeholders listed below (usually `{name}`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"><span class="str"> should be one of them). The format affect the entire path.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"><span class="str"> The following placeholders are supported:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"><span class="str"> * `{name}` - The name in the name segment (defaulting the package name if no name segment is given)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"><span class="str"> * `{priority}` / `{priority:02}` - The priority of the file. Only provided priorities are used (that</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"><span class="str"> is, default_priority is not None). The latter variant ensuring that the priority takes at least</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"><span class="str"> two characters and the `0` character is left-padded for priorities that takes less than two</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"><span class="str"> characters.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"><span class="str"> * `{owning_package}` - The name of the package. Should only be used when `{name}` alone is insufficient.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"><span class="str"> If you do not want the "name" segment in the first place, use `allow_name_segment=False` instead.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"><span class="str"> The path is always interpreted as relative to the binary package root.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"><span class="str"> :param default_mode: The mode the installed file should have by default. Common options are 0o0644 (the default)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"><span class="str"> or 0o0755 (for files that must be executable).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"><span class="str"> :param allow_architecture_segment: If True, the file may have an optional "architecture" segment at the end</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"><span class="str"> (`foo.tmpfiles.amd64`), which marks it architecture specific. When False, debputy will detect the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"><span class="str"> "architecture" segment and report the use as an error. Note the architecture segment is only allowed for</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"><span class="str"> arch:any packages. If a file targeting an arch:all package uses an architecture specific file it will</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"><span class="str"> always result in an error.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"><span class="str"> :param allow_name_segment: If True, the file may have an optional "name" segment after the package name prefix.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"><span class="str"> (`foo.<name-here>.tmpfiles`). When False, debputy will detect the "name" segment and report the use as an</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"><span class="str"> error.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"><span class="str"> :param default_priority: Special-case option for packager files that are installed into directories that have</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"><span class="str"> "parse ordering" or "priority". These files will generally be installed as something like `20-foo.conf`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"><span class="str"> where the `20-` denotes their "priority". If the plugin is registering such a file type, then it should</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"><span class="str"> provide a default priority.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"><span class="str"> The following placeholders are supported:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"><span class="str"> * `{name}` - The name in the name segment (defaulting the package name if no name segment is given)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"><span class="str"> * `{priority}` - The priority of the file. Only provided priorities are used (that is, default_priority</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"><span class="str"> is not None)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"><span class="str"> * `{owning_package}` - The name of the package. Should only be used when `{name}` alone is insufficient.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"><span class="str"> If you do not want the "name" segment in the first place, use `allow_name_segment=False` instead.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"><span class="str"> :param post_formatting_rewrite: An optional "name correcting" callback. It receives the formatted name and can</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"><span class="str"> do any transformation required. The primary use-case for this is to replace "forbidden" characters. The most</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"><span class="str"> common case for debputy itself is to replace "." with "_" for tools that refuse to work with files containing</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"><span class="str"> "." (`lambda x: x.replace(".", "_")`). The callback operates on basename of formatted version of the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"><span class="str"> `installed_path` and the callback should return the basename.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"><span class="str"> :param packageless_is_fallback_for_all_packages: If True, the packageless variant (such as, `debian/changelog`)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"><span class="str"> is a fallback for every package.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"><span class="str"> :param reference_documentation: Reference documentation for the packager provided file. Use the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t385" href="#t385">385</a></span><span class="t"><span class="str"> packager_provided_file_reference_documentation function to provide the value for this parameter.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t386" href="#t386">386</a></span><span class="t"><span class="str"> :param reservation_only: When True, tell debputy that the plugin reserves this packager provided file, but that</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t387" href="#t387">387</a></span><span class="t"><span class="str"> debputy should not actually install it automatically. This is useful in the cases, where the plugin</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t388" href="#t388">388</a></span><span class="t"><span class="str"> needs to process the file before installing it. The file will be marked as provided by this plugin. This</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t389" href="#t389">389</a></span><span class="t"><span class="str"> enables introspection and detects conflicts if other plugins attempts to claim the file.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t390" href="#t390">390</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t391" href="#t391">391</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t392" href="#t392">392</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t393" href="#t393">393</a></span><span class="t"> <span class="key">def</span> <span class="nam">metadata_or_maintscript_detector</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t394" href="#t394">394</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t395" href="#t395">395</a></span><span class="t"> <span class="nam">auto_detector_id</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t396" href="#t396">396</a></span><span class="t"> <span class="nam">auto_detector</span><span class="op">:</span> <span class="nam">MetadataAutoDetector</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t397" href="#t397">397</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t398" href="#t398">398</a></span><span class="t"> <span class="nam">package_type</span><span class="op">:</span> <span class="nam">PackageTypeSelector</span> <span class="op">=</span> <span class="str">"deb"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t399" href="#t399">399</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t400" href="#t400">400</a></span><span class="t"> <span class="str">"""Provide a pre-assembly hook that can affect the metadata/maintscript of binary ("deb") packages</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t401" href="#t401">401</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t402" href="#t402">402</a></span><span class="t"><span class="str"> The provided hook will be run once per binary package to be assembled, and it can see all the content</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t403" href="#t403">403</a></span><span class="t"><span class="str"> ("data.tar") planned to be included in the deb. The hook may do any *read-only* analysis of this content</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t404" href="#t404">404</a></span><span class="t"><span class="str"> and provide metadata, alter substvars or inject maintscript snippets. However, the hook must *not*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t405" href="#t405">405</a></span><span class="t"><span class="str"> change the content ("data.tar") part of the deb.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t406" href="#t406">406</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t407" href="#t407">407</a></span><span class="t"><span class="str"> The hook will be run unconditionally for all binary packages built. When the hook does not apply to all</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t408" href="#t408">408</a></span><span class="t"><span class="str"> packages, it must provide its own (internal) logic for detecting whether it is relevant and reduced itself</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t409" href="#t409">409</a></span><span class="t"><span class="str"> to a no-op if it should not apply to the current package.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t410" href="#t410">410</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t411" href="#t411">411</a></span><span class="t"><span class="str"> Hooks are run in "some implementation defined order" and should not rely on being run before or after</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t412" href="#t412">412</a></span><span class="t"><span class="str"> any other hook.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t413" href="#t413">413</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t414" href="#t414">414</a></span><span class="t"><span class="str"> The hooks are only applied to packages defined in `debian/control`. Notably, the metadata detector will</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t415" href="#t415">415</a></span><span class="t"><span class="str"> not apply to auto-generated `-dbgsym` packages (as those are not listed explicitly in `debian/control`).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t416" href="#t416">416</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t417" href="#t417">417</a></span><span class="t"><span class="str"> :param auto_detector_id: A plugin-wide unique ID for this detector. Packagers may use this ID for disabling</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t418" href="#t418">418</a></span><span class="t"><span class="str"> the detector and accordingly the ID is part of the plugin's API toward the packager.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t419" href="#t419">419</a></span><span class="t"><span class="str"> :param auto_detector: The code to be called that will be run at the metadata generation state (once for each</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t420" href="#t420">420</a></span><span class="t"><span class="str"> binary package).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t421" href="#t421">421</a></span><span class="t"><span class="str"> :param package_type: Which kind of packages this metadata detector applies to. The package type is generally</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t422" href="#t422">422</a></span><span class="t"><span class="str"> defined by `Package-Type` field in the binary package. The default is to only run for regular `deb` packages</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t423" href="#t423">423</a></span><span class="t"><span class="str"> and ignore `udeb` packages.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t424" href="#t424">424</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t425" href="#t425">425</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t426" href="#t426">426</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t427" href="#t427">427</a></span><span class="t"> <span class="key">def</span> <span class="nam">manifest_variable</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t428" href="#t428">428</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t429" href="#t429">429</a></span><span class="t"> <span class="nam">variable_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t430" href="#t430">430</a></span><span class="t"> <span class="nam">value</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t431" href="#t431">431</a></span><span class="t"> <span class="nam">variable_reference_documentation</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t432" href="#t432">432</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t433" href="#t433">433</a></span><span class="t"> <span class="str">"""Provide a variable that can be used in the package manifest</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t434" href="#t434">434</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t435" href="#t435">435</a></span><span class="t"><span class="str"> >>> # Enable users to use "{{path:BASH_COMPLETION_DIR}}/foo" in their manifest.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t436" href="#t436">436</a></span><span class="t"><span class="str"> >>> api.manifest_variable( # doctest: +SKIP</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t437" href="#t437">437</a></span><span class="t"><span class="str"> ... "path:BASH_COMPLETION_DIR",</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t438" href="#t438">438</a></span><span class="t"><span class="str"> ... "/usr/share/bash-completion/completions",</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t439" href="#t439">439</a></span><span class="t"><span class="str"> ... variable_reference_documentation="Directory to install bash completions into",</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t440" href="#t440">440</a></span><span class="t"><span class="str"> ... )</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t441" href="#t441">441</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t442" href="#t442">442</a></span><span class="t"><span class="str"> :param variable_name: The variable name.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t443" href="#t443">443</a></span><span class="t"><span class="str"> :param value: The value the variable should resolve to.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t444" href="#t444">444</a></span><span class="t"><span class="str"> :param variable_reference_documentation: A short snippet of reference documentation that explains</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t445" href="#t445">445</a></span><span class="t"><span class="str"> the purpose of the variable.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t446" href="#t446">446</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t447" href="#t447">447</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t448" href="#t448">448</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t449" href="#t449">449</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t450" href="#t450">450</a></span><span class="t"><span class="key">class</span> <span class="nam">MaintscriptAccessor</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t451" href="#t451">451</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t452" href="#t452">452</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t453" href="#t453">453</a></span><span class="t"> <span class="key">def</span> <span class="nam">on_configure</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t454" href="#t454">454</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t455" href="#t455">455</a></span><span class="t"> <span class="nam">run_snippet</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t456" href="#t456">456</a></span><span class="t"> <span class="op">/</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t457" href="#t457">457</a></span><span class="t"> <span class="nam">indent</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t458" href="#t458">458</a></span><span class="t"> <span class="nam">perform_substitution</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t459" href="#t459">459</a></span><span class="t"> <span class="nam">skip_on_rollback</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t460" href="#t460">460</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t461" href="#t461">461</a></span><span class="t"> <span class="str">"""Provide a snippet to be run when the package is about to be "configured"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t462" href="#t462">462</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t463" href="#t463">463</a></span><span class="t"><span class="str"> This condition is the most common "post install" condition and covers the two</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t464" href="#t464">464</a></span><span class="t"><span class="str"> common cases:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t465" href="#t465">465</a></span><span class="t"><span class="str"> * On initial install, OR</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t466" href="#t466">466</a></span><span class="t"><span class="str"> * On upgrade</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t467" href="#t467">467</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t468" href="#t468">468</a></span><span class="t"><span class="str"> In dpkg maintscript terms, this method roughly corresponds to postinst containing</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t469" href="#t469">469</a></span><span class="t"><span class="str"> `if [ "$1" = configure ]; then <snippet>; fi`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t470" href="#t470">470</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t471" href="#t471">471</a></span><span class="t"><span class="str"> Additionally, the condition will by default also include rollback/abort scenarios such as "above-remove",</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t472" href="#t472">472</a></span><span class="t"><span class="str"> which is normally what you want but most people forget about.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t473" href="#t473">473</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t474" href="#t474">474</a></span><span class="t"><span class="str"> :param run_snippet: The actual shell snippet to be run in the given condition. The snippet must be idempotent.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t475" href="#t475">475</a></span><span class="t"><span class="str"> The snippet may contain newlines as necessary, which will make the result more readable. Additionally, the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t476" href="#t476">476</a></span><span class="t"><span class="str"> snippet may contain '{{FOO}}' substitutions by default.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t477" href="#t477">477</a></span><span class="t"><span class="str"> :param skip_on_rollback: By default, this condition will also cover common rollback scenarios. This</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t478" href="#t478">478</a></span><span class="t"><span class="str"> is normally what you want (or benign in most cases due to the idempotence requirement for maintscripts).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t479" href="#t479">479</a></span><span class="t"><span class="str"> However, you can disable the rollback cases, leaving only "On initial install OR On upgrade".</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t480" href="#t480">480</a></span><span class="t"><span class="str"> :param indent: If True, the provided snippet will be indented to fit the condition provided by debputy.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t481" href="#t481">481</a></span><span class="t"><span class="str"> In most cases, this is safe to do and provides more readable scripts. However, it may cause issues</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t482" href="#t482">482</a></span><span class="t"><span class="str"> with some special shell syntax (such as "Heredocs"). When False, the snippet will *not* be re-indented.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t483" href="#t483">483</a></span><span class="t"><span class="str"> You are recommended to do 4 spaces of indentation when indent is False for readability.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t484" href="#t484">484</a></span><span class="t"><span class="str"> :param perform_substitution: When True, `{{FOO}}` will be substituted in the snippet. When False, no</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t485" href="#t485">485</a></span><span class="t"><span class="str"> substitution is provided.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t486" href="#t486">486</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t487" href="#t487">487</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t488" href="#t488">488</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t489" href="#t489">489</a></span><span class="t"> <span class="key">def</span> <span class="nam">on_initial_install</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t490" href="#t490">490</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t491" href="#t491">491</a></span><span class="t"> <span class="nam">run_snippet</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t492" href="#t492">492</a></span><span class="t"> <span class="op">/</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t493" href="#t493">493</a></span><span class="t"> <span class="nam">indent</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t494" href="#t494">494</a></span><span class="t"> <span class="nam">perform_substitution</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t495" href="#t495">495</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t496" href="#t496">496</a></span><span class="t"> <span class="str">"""Provide a snippet to be run when the package is about to be "configured" for the first time</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t497" href="#t497">497</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t498" href="#t498">498</a></span><span class="t"><span class="str"> The snippet will only be run on the first time the package is installed (ever or since last purge).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t499" href="#t499">499</a></span><span class="t"><span class="str"> Note that "first" does not mean "exactly once" as dpkg does *not* provide such semantics. There are two</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t500" href="#t500">500</a></span><span class="t"><span class="str"> common cases where this can snippet can be run multiple times for the same system (and why the snippet</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t501" href="#t501">501</a></span><span class="t"><span class="str"> must still be idempotent):</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t502" href="#t502">502</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t503" href="#t503">503</a></span><span class="t"><span class="str"> 1) The package is installed (1), then purged and then installed again (2). This can partly be mitigated</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t504" href="#t504">504</a></span><span class="t"><span class="str"> by having an `on_purge` script to do clean up.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t505" href="#t505">505</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t506" href="#t506">506</a></span><span class="t"><span class="str"> 2) As the package is installed, the `postinst` script terminates prematurely (Disk full, power loss, etc.).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t507" href="#t507">507</a></span><span class="t"><span class="str"> The user resolves the problem and runs `dpkg --configure <pkg>`, which in turn restarts the script</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t508" href="#t508">508</a></span><span class="t"><span class="str"> from the beginning. This is why scripts must be idempotent in general.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t509" href="#t509">509</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t510" href="#t510">510</a></span><span class="t"><span class="str"> In dpkg maintscript terms, this method roughly corresponds to postinst containing</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t511" href="#t511">511</a></span><span class="t"><span class="str"> `if [ "$1" = configure ] && [ -z "$2" ]; then <snippet>; fi`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t512" href="#t512">512</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t513" href="#t513">513</a></span><span class="t"><span class="str"> :param run_snippet: The actual shell snippet to be run in the given condition. The snippet must be idempotent.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t514" href="#t514">514</a></span><span class="t"><span class="str"> The snippet may contain newlines as necessary, which will make the result more readable. Additionally, the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t515" href="#t515">515</a></span><span class="t"><span class="str"> snippet may contain '{{FOO}}' substitutions by default.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t516" href="#t516">516</a></span><span class="t"><span class="str"> :param indent: If True, the provided snippet will be indented to fit the condition provided by debputy.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t517" href="#t517">517</a></span><span class="t"><span class="str"> In most cases, this is safe to do and provides more readable scripts. However, it may cause issues</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t518" href="#t518">518</a></span><span class="t"><span class="str"> with some special shell syntax (such as "Heredocs"). When False, the snippet will *not* be re-indented.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t519" href="#t519">519</a></span><span class="t"><span class="str"> You are recommended to do 4 spaces of indentation when indent is False for readability.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t520" href="#t520">520</a></span><span class="t"><span class="str"> :param perform_substitution: When True, `{{FOO}}` will be substituted in the snippet. When False, no</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t521" href="#t521">521</a></span><span class="t"><span class="str"> substitution is provided.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t522" href="#t522">522</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t523" href="#t523">523</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t524" href="#t524">524</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t525" href="#t525">525</a></span><span class="t"> <span class="key">def</span> <span class="nam">on_upgrade</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t526" href="#t526">526</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t527" href="#t527">527</a></span><span class="t"> <span class="nam">run_snippet</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t528" href="#t528">528</a></span><span class="t"> <span class="op">/</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t529" href="#t529">529</a></span><span class="t"> <span class="nam">indent</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t530" href="#t530">530</a></span><span class="t"> <span class="nam">perform_substitution</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t531" href="#t531">531</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t532" href="#t532">532</a></span><span class="t"> <span class="str">"""Provide a snippet to be run when the package is about to be "configured" after an upgrade</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t533" href="#t533">533</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t534" href="#t534">534</a></span><span class="t"><span class="str"> The snippet will only be run on any upgrade (that is, it will be skipped on the initial install).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t535" href="#t535">535</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t536" href="#t536">536</a></span><span class="t"><span class="str"> In dpkg maintscript terms, this method roughly corresponds to postinst containing</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t537" href="#t537">537</a></span><span class="t"><span class="str"> `if [ "$1" = configure ] && [ -n "$2" ]; then <snippet>; fi`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t538" href="#t538">538</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t539" href="#t539">539</a></span><span class="t"><span class="str"> :param run_snippet: The actual shell snippet to be run in the given condition. The snippet must be idempotent.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t540" href="#t540">540</a></span><span class="t"><span class="str"> The snippet may contain newlines as necessary, which will make the result more readable. Additionally, the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t541" href="#t541">541</a></span><span class="t"><span class="str"> snippet may contain '{{FOO}}' substitutions by default.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t542" href="#t542">542</a></span><span class="t"><span class="str"> :param indent: If True, the provided snippet will be indented to fit the condition provided by debputy.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t543" href="#t543">543</a></span><span class="t"><span class="str"> In most cases, this is safe to do and provides more readable scripts. However, it may cause issues</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t544" href="#t544">544</a></span><span class="t"><span class="str"> with some special shell syntax (such as "Heredocs"). When False, the snippet will *not* be re-indented.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t545" href="#t545">545</a></span><span class="t"><span class="str"> You are recommended to do 4 spaces of indentation when indent is False for readability.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t546" href="#t546">546</a></span><span class="t"><span class="str"> :param perform_substitution: When True, `{{FOO}}` will be substituted in the snippet. When False, no</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t547" href="#t547">547</a></span><span class="t"><span class="str"> substitution is provided.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t548" href="#t548">548</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t549" href="#t549">549</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t550" href="#t550">550</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t551" href="#t551">551</a></span><span class="t"> <span class="key">def</span> <span class="nam">on_upgrade_from</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t552" href="#t552">552</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t553" href="#t553">553</a></span><span class="t"> <span class="nam">version</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t554" href="#t554">554</a></span><span class="t"> <span class="nam">run_snippet</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t555" href="#t555">555</a></span><span class="t"> <span class="op">/</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t556" href="#t556">556</a></span><span class="t"> <span class="nam">indent</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t557" href="#t557">557</a></span><span class="t"> <span class="nam">perform_substitution</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t558" href="#t558">558</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t559" href="#t559">559</a></span><span class="t"> <span class="str">"""Provide a snippet to be run when the package is about to be "configured" after an upgrade from a given version</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t560" href="#t560">560</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t561" href="#t561">561</a></span><span class="t"><span class="str"> The snippet will only be run on any upgrade (that is, it will be skipped on the initial install).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t562" href="#t562">562</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t563" href="#t563">563</a></span><span class="t"><span class="str"> In dpkg maintscript terms, this method roughly corresponds to postinst containing</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t564" href="#t564">564</a></span><span class="t"><span class="str"> `if [ "$1" = configure ] && dpkg --compare-versions le-nl "$2" ; then <snippet>; fi`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t565" href="#t565">565</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t566" href="#t566">566</a></span><span class="t"><span class="str"> :param version: The version to upgrade from</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t567" href="#t567">567</a></span><span class="t"><span class="str"> :param run_snippet: The actual shell snippet to be run in the given condition. The snippet must be idempotent.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t568" href="#t568">568</a></span><span class="t"><span class="str"> The snippet may contain newlines as necessary, which will make the result more readable. Additionally, the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t569" href="#t569">569</a></span><span class="t"><span class="str"> snippet may contain '{{FOO}}' substitutions by default.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t570" href="#t570">570</a></span><span class="t"><span class="str"> :param indent: If True, the provided snippet will be indented to fit the condition provided by debputy.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t571" href="#t571">571</a></span><span class="t"><span class="str"> In most cases, this is safe to do and provides more readable scripts. However, it may cause issues</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t572" href="#t572">572</a></span><span class="t"><span class="str"> with some special shell syntax (such as "Heredocs"). When False, the snippet will *not* be re-indented.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t573" href="#t573">573</a></span><span class="t"><span class="str"> You are recommended to do 4 spaces of indentation when indent is False for readability.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t574" href="#t574">574</a></span><span class="t"><span class="str"> :param perform_substitution: When True, `{{FOO}}` will be substituted in the snippet. When False, no</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t575" href="#t575">575</a></span><span class="t"><span class="str"> substitution is provided.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t576" href="#t576">576</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t577" href="#t577">577</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t578" href="#t578">578</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t579" href="#t579">579</a></span><span class="t"> <span class="key">def</span> <span class="nam">on_before_removal</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t580" href="#t580">580</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t581" href="#t581">581</a></span><span class="t"> <span class="nam">run_snippet</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t582" href="#t582">582</a></span><span class="t"> <span class="op">/</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t583" href="#t583">583</a></span><span class="t"> <span class="nam">indent</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t584" href="#t584">584</a></span><span class="t"> <span class="nam">perform_substitution</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t585" href="#t585">585</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t586" href="#t586">586</a></span><span class="t"> <span class="str">"""Provide a snippet to be run when the package is about to be removed</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t587" href="#t587">587</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t588" href="#t588">588</a></span><span class="t"><span class="str"> The snippet will be run before dpkg removes any files.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t589" href="#t589">589</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t590" href="#t590">590</a></span><span class="t"><span class="str"> In dpkg maintscript terms, this method roughly corresponds to prerm containing</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t591" href="#t591">591</a></span><span class="t"><span class="str"> `if [ "$1" = remove ] ; then <snippet>; fi`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t592" href="#t592">592</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t593" href="#t593">593</a></span><span class="t"><span class="str"> :param run_snippet: The actual shell snippet to be run in the given condition. The snippet must be idempotent.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t594" href="#t594">594</a></span><span class="t"><span class="str"> The snippet may contain newlines as necessary, which will make the result more readable. Additionally, the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t595" href="#t595">595</a></span><span class="t"><span class="str"> snippet may contain '{{FOO}}' substitutions by default.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t596" href="#t596">596</a></span><span class="t"><span class="str"> :param indent: If True, the provided snippet will be indented to fit the condition provided by debputy.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t597" href="#t597">597</a></span><span class="t"><span class="str"> In most cases, this is safe to do and provides more readable scripts. However, it may cause issues</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t598" href="#t598">598</a></span><span class="t"><span class="str"> with some special shell syntax (such as "Heredocs"). When False, the snippet will *not* be re-indented.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t599" href="#t599">599</a></span><span class="t"><span class="str"> You are recommended to do 4 spaces of indentation when indent is False for readability.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t600" href="#t600">600</a></span><span class="t"><span class="str"> :param perform_substitution: When True, `{{FOO}}` will be substituted in the snippet. When False, no</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t601" href="#t601">601</a></span><span class="t"><span class="str"> substitution is provided.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t602" href="#t602">602</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t603" href="#t603">603</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t604" href="#t604">604</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t605" href="#t605">605</a></span><span class="t"> <span class="key">def</span> <span class="nam">on_removed</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t606" href="#t606">606</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t607" href="#t607">607</a></span><span class="t"> <span class="nam">run_snippet</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t608" href="#t608">608</a></span><span class="t"> <span class="op">/</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t609" href="#t609">609</a></span><span class="t"> <span class="nam">indent</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t610" href="#t610">610</a></span><span class="t"> <span class="nam">perform_substitution</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t611" href="#t611">611</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t612" href="#t612">612</a></span><span class="t"> <span class="str">"""Provide a snippet to be run when the package has been removed</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t613" href="#t613">613</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t614" href="#t614">614</a></span><span class="t"><span class="str"> The snippet will be run after dpkg removes the package content from the file system.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t615" href="#t615">615</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t616" href="#t616">616</a></span><span class="t"><span class="str"> **WARNING**: The snippet *cannot* rely on dependencies and must rely on `Essential: yes` packages.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t617" href="#t617">617</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t618" href="#t618">618</a></span><span class="t"><span class="str"> In dpkg maintscript terms, this method roughly corresponds to postrm containing</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t619" href="#t619">619</a></span><span class="t"><span class="str"> `if [ "$1" = remove ] ; then <snippet>; fi`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t620" href="#t620">620</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t621" href="#t621">621</a></span><span class="t"><span class="str"> :param run_snippet: The actual shell snippet to be run in the given condition. The snippet must be idempotent.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t622" href="#t622">622</a></span><span class="t"><span class="str"> The snippet may contain newlines as necessary, which will make the result more readable. Additionally, the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t623" href="#t623">623</a></span><span class="t"><span class="str"> snippet may contain '{{FOO}}' substitutions by default.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t624" href="#t624">624</a></span><span class="t"><span class="str"> :param indent: If True, the provided snippet will be indented to fit the condition provided by debputy.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t625" href="#t625">625</a></span><span class="t"><span class="str"> In most cases, this is safe to do and provides more readable scripts. However, it may cause issues</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t626" href="#t626">626</a></span><span class="t"><span class="str"> with some special shell syntax (such as "Heredocs"). When False, the snippet will *not* be re-indented.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t627" href="#t627">627</a></span><span class="t"><span class="str"> You are recommended to do 4 spaces of indentation when indent is False for readability.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t628" href="#t628">628</a></span><span class="t"><span class="str"> :param perform_substitution: When True, `{{FOO}}` will be substituted in the snippet. When False, no</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t629" href="#t629">629</a></span><span class="t"><span class="str"> substitution is provided.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t630" href="#t630">630</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t631" href="#t631">631</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t632" href="#t632">632</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t633" href="#t633">633</a></span><span class="t"> <span class="key">def</span> <span class="nam">on_purge</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t634" href="#t634">634</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t635" href="#t635">635</a></span><span class="t"> <span class="nam">run_snippet</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t636" href="#t636">636</a></span><span class="t"> <span class="op">/</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t637" href="#t637">637</a></span><span class="t"> <span class="nam">indent</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t638" href="#t638">638</a></span><span class="t"> <span class="nam">perform_substitution</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t639" href="#t639">639</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t640" href="#t640">640</a></span><span class="t"> <span class="str">"""Provide a snippet to be run when the package is being purged.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t641" href="#t641">641</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t642" href="#t642">642</a></span><span class="t"><span class="str"> The snippet will when the package is purged from the system.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t643" href="#t643">643</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t644" href="#t644">644</a></span><span class="t"><span class="str"> **WARNING**: The snippet *cannot* rely on dependencies and must rely on `Essential: yes` packages.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t645" href="#t645">645</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t646" href="#t646">646</a></span><span class="t"><span class="str"> In dpkg maintscript terms, this method roughly corresponds to postrm containing</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t647" href="#t647">647</a></span><span class="t"><span class="str"> `if [ "$1" = purge ] ; then <snippet>; fi`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t648" href="#t648">648</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t649" href="#t649">649</a></span><span class="t"><span class="str"> :param run_snippet: The actual shell snippet to be run in the given condition. The snippet must be idempotent.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t650" href="#t650">650</a></span><span class="t"><span class="str"> The snippet may contain newlines as necessary, which will make the result more readable. Additionally, the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t651" href="#t651">651</a></span><span class="t"><span class="str"> snippet may contain '{{FOO}}' substitutions by default.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t652" href="#t652">652</a></span><span class="t"><span class="str"> :param indent: If True, the provided snippet will be indented to fit the condition provided by debputy.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t653" href="#t653">653</a></span><span class="t"><span class="str"> In most cases, this is safe to do and provides more readable scripts. However, it may cause issues</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t654" href="#t654">654</a></span><span class="t"><span class="str"> with some special shell syntax (such as "Heredocs"). When False, the snippet will *not* be re-indented.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t655" href="#t655">655</a></span><span class="t"><span class="str"> You are recommended to do 4 spaces of indentation when indent is False for readability.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t656" href="#t656">656</a></span><span class="t"><span class="str"> :param perform_substitution: When True, `{{FOO}}` will be substituted in the snippet. When False, no</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t657" href="#t657">657</a></span><span class="t"><span class="str"> substitution is provided.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t658" href="#t658">658</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t659" href="#t659">659</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t660" href="#t660">660</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t661" href="#t661">661</a></span><span class="t"> <span class="key">def</span> <span class="nam">unconditionally_in_script</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t662" href="#t662">662</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t663" href="#t663">663</a></span><span class="t"> <span class="nam">maintscript</span><span class="op">:</span> <span class="nam">Maintscript</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t664" href="#t664">664</a></span><span class="t"> <span class="nam">run_snippet</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t665" href="#t665">665</a></span><span class="t"> <span class="op">/</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t666" href="#t666">666</a></span><span class="t"> <span class="nam">perform_substitution</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t667" href="#t667">667</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t668" href="#t668">668</a></span><span class="t"> <span class="str">"""Provide a snippet to be run in a given script</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t669" href="#t669">669</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t670" href="#t670">670</a></span><span class="t"><span class="str"> Run a given snippet unconditionally from a given script. The snippet must contain its own conditional</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t671" href="#t671">671</a></span><span class="t"><span class="str"> for when it should be run.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t672" href="#t672">672</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t673" href="#t673">673</a></span><span class="t"><span class="str"> :param maintscript: The maintscript to insert the snippet into.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t674" href="#t674">674</a></span><span class="t"><span class="str"> :param run_snippet: The actual shell snippet to be run. The snippet will be run unconditionally and should</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t675" href="#t675">675</a></span><span class="t"><span class="str"> contain its own conditions as necessary. The snippet must be idempotent. The snippet may contain newlines</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t676" href="#t676">676</a></span><span class="t"><span class="str"> as necessary, which will make the result more readable. Additionally, the snippet may contain '{{FOO}}'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t677" href="#t677">677</a></span><span class="t"><span class="str"> substitutions by default.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t678" href="#t678">678</a></span><span class="t"><span class="str"> :param perform_substitution: When True, `{{FOO}}` will be substituted in the snippet. When False, no</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t679" href="#t679">679</a></span><span class="t"><span class="str"> substitution is provided.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t680" href="#t680">680</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t681" href="#t681">681</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t682" href="#t682">682</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t683" href="#t683">683</a></span><span class="t"> <span class="key">def</span> <span class="nam">escape_shell_words</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">*</span><span class="nam">args</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t684" href="#t684">684</a></span><span class="t"> <span class="str">"""Provide sh-shell escape of strings</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t685" href="#t685">685</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t686" href="#t686">686</a></span><span class="t"><span class="str"> `assert escape_shell("foo", "fu bar", "baz") == 'foo "fu bar" baz'`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t687" href="#t687">687</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t688" href="#t688">688</a></span><span class="t"><span class="str"> This is useful for ensuring file names and other "input" are considered one parameter even when they</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t689" href="#t689">689</a></span><span class="t"><span class="str"> contain spaces or shell meta-characters.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t690" href="#t690">690</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t691" href="#t691">691</a></span><span class="t"><span class="str"> :param args: The string(s) to be escaped.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t692" href="#t692">692</a></span><span class="t"><span class="str"> :return: Each argument escaped such that each argument becomes a single "word" and then all these words are</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t693" href="#t693">693</a></span><span class="t"><span class="str"> joined by a single space.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t694" href="#t694">694</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t695" href="#t695">695</a></span><span class="t"> <span class="key">return</span> <span class="nam">util</span><span class="op">.</span><span class="nam">escape_shell</span><span class="op">(</span><span class="op">*</span><span class="nam">args</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t696" href="#t696">696</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t697" href="#t697">697</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t698" href="#t698">698</a></span><span class="t"><span class="key">class</span> <span class="nam">BinaryCtrlAccessor</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t699" href="#t699">699</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t700" href="#t700">700</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t701" href="#t701">701</a></span><span class="t"> <span class="key">def</span> <span class="nam">dpkg_trigger</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">trigger_type</span><span class="op">:</span> <span class="nam">DpkgTriggerType</span><span class="op">,</span> <span class="nam">trigger_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t702" href="#t702">702</a></span><span class="t"> <span class="str">"""Register a declarative dpkg level trigger</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t703" href="#t703">703</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t704" href="#t704">704</a></span><span class="t"><span class="str"> The provided trigger will be added to the package's metadata (the triggers file of the control.tar).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t705" href="#t705">705</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t706" href="#t706">706</a></span><span class="t"><span class="str"> If the trigger has already been added previously, a second call with the same trigger data will be ignored.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t707" href="#t707">707</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t708" href="#t708">708</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t709" href="#t709">709</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t710" href="#t710">710</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t711" href="#t711">711</a></span><span class="t"> <span class="key">def</span> <span class="nam">maintscript</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">MaintscriptAccessor</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t712" href="#t712">712</a></span><span class="t"> <span class="str">"""Attribute for manipulating maintscripts"""</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t713" href="#t713">713</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t714" href="#t714">714</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t715" href="#t715">715</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t716" href="#t716">716</a></span><span class="t"> <span class="key">def</span> <span class="nam">substvars</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="str">"FlushableSubstvars"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t717" href="#t717">717</a></span><span class="t"> <span class="str">"""Attribute for manipulating dpkg substvars (deb-substvars)"""</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t718" href="#t718">718</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t719" href="#t719">719</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t720" href="#t720">720</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t721" href="#t721">721</a></span><span class="t"><span class="key">class</span> <span class="nam">VirtualPath</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t722" href="#t722">722</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t723" href="#t723">723</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t724" href="#t724">724</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t725" href="#t725">725</a></span><span class="t"> <span class="key">def</span> <span class="nam">name</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t726" href="#t726">726</a></span><span class="t"> <span class="str">"""Basename of the path a.k.a. last segment of the path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t727" href="#t727">727</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t728" href="#t728">728</a></span><span class="t"><span class="str"> In a path "usr/share/doc/pkg/changelog.gz" the basename is "changelog.gz".</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t729" href="#t729">729</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t730" href="#t730">730</a></span><span class="t"><span class="str"> For a directory, the basename *never* ends with a `/`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t731" href="#t731">731</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t732" href="#t732">732</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t733" href="#t733">733</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t734" href="#t734">734</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t735" href="#t735">735</a></span><span class="t"> <span class="key">def</span> <span class="nam">iterdir</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="str">"VirtualPath"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t736" href="#t736">736</a></span><span class="t"> <span class="str">"""Returns an iterable that iterates over all children of this path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t737" href="#t737">737</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t738" href="#t738">738</a></span><span class="t"><span class="str"> For directories, this returns an iterable of all children. For non-directories,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t739" href="#t739">739</a></span><span class="t"><span class="str"> the iterable is always empty.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t740" href="#t740">740</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t741" href="#t741">741</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t742" href="#t742">742</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t743" href="#t743">743</a></span><span class="t"> <span class="key">def</span> <span class="nam">lookup</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">path</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"VirtualPath"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t744" href="#t744">744</a></span><span class="t"> <span class="str">"""Perform a path lookup relative to this path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t745" href="#t745">745</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t746" href="#t746">746</a></span><span class="t"><span class="str"> As an example `doc_dir = fs_root.lookup('./usr/share/doc')`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t747" href="#t747">747</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t748" href="#t748">748</a></span><span class="t"><span class="str"> If the provided path starts with `/`, then the lookup is performed relative to the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t749" href="#t749">749</a></span><span class="t"><span class="str"> file system root. That is, you can assume the following to always be True:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t750" href="#t750">750</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t751" href="#t751">751</a></span><span class="t"><span class="str"> `fs_root.lookup("usr") == any_path_beneath_fs_root.lookup('/usr')`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t752" href="#t752">752</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t753" href="#t753">753</a></span><span class="t"><span class="str"> Note: This method requires the path to be attached (see `is_detached`) regardless of</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t754" href="#t754">754</a></span><span class="t"><span class="str"> whether the lookup is relative or absolute.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t755" href="#t755">755</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t756" href="#t756">756</a></span><span class="t"><span class="str"> If the path traverse a symlink, the symlink will be resolved.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t757" href="#t757">757</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t758" href="#t758">758</a></span><span class="t"><span class="str"> :param path: The path to look. Can contain "." and ".." segments. If starting with `/`,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t759" href="#t759">759</a></span><span class="t"><span class="str"> look up is performed relative to the file system root, otherwise the lookup is relative</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t760" href="#t760">760</a></span><span class="t"><span class="str"> to this path.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t761" href="#t761">761</a></span><span class="t"><span class="str"> :return: The path object for the desired path if it can be found. Otherwise, None.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t762" href="#t762">762</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t763" href="#t763">763</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t764" href="#t764">764</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t765" href="#t765">765</a></span><span class="t"> <span class="key">def</span> <span class="nam">all_paths</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="str">"VirtualPath"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t766" href="#t766">766</a></span><span class="t"> <span class="str">"""Iterate over this path and all of its descendants (if any)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t767" href="#t767">767</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t768" href="#t768">768</a></span><span class="t"><span class="str"> If used on the root path, then every path in the package is returned.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t769" href="#t769">769</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t770" href="#t770">770</a></span><span class="t"><span class="str"> The iterable is ordered, so using the order in output will be produce</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t771" href="#t771">771</a></span><span class="t"><span class="str"> bit-for-bit reproducible output. Additionally, a directory will always</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t772" href="#t772">772</a></span><span class="t"><span class="str"> be seen before its descendants. Otherwise, the order is implementation</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t773" href="#t773">773</a></span><span class="t"><span class="str"> defined.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t774" href="#t774">774</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t775" href="#t775">775</a></span><span class="t"><span class="str"> The iteration is lazy and as a side effect do account for some obvious</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t776" href="#t776">776</a></span><span class="t"><span class="str"> mutation. Like if the current path is removed, then none of its children</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t777" href="#t777">777</a></span><span class="t"><span class="str"> will be returned (provided mutation happens before the lazy iteration</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t778" href="#t778">778</a></span><span class="t"><span class="str"> was required to resolve it). Likewise, mutation of the directory will</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t779" href="#t779">779</a></span><span class="t"><span class="str"> also work (again, provided mutation happens before the lazy iteration order).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t780" href="#t780">780</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t781" href="#t781">781</a></span><span class="t"><span class="str"> :return: An ordered iterable of this path followed by its descendants.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t782" href="#t782">782</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t783" href="#t783">783</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t784" href="#t784">784</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t785" href="#t785">785</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t786" href="#t786">786</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_detached</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t787" href="#t787">787</a></span><span class="t"> <span class="str">"""Returns True if this path is detached</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t788" href="#t788">788</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t789" href="#t789">789</a></span><span class="t"><span class="str"> Paths that are detached from the file system will not be present in the package and</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t790" href="#t790">790</a></span><span class="t"><span class="str"> most operations are unsafe on them. This usually only happens if the path or one of</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t791" href="#t791">791</a></span><span class="t"><span class="str"> its parent directories are unlinked (rm'ed) from the file system tree.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t792" href="#t792">792</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t793" href="#t793">793</a></span><span class="t"><span class="str"> All paths are attached by default and will only become detached as a result of</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t794" href="#t794">794</a></span><span class="t"><span class="str"> an action to mutate the virtual file system. Note that the file system may not</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t795" href="#t795">795</a></span><span class="t"><span class="str"> always be manipulated.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t796" href="#t796">796</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t797" href="#t797">797</a></span><span class="t"><span class="str"> :return: True if the entry is detached. Detached entries should be discarded, so they</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t798" href="#t798">798</a></span><span class="t"><span class="str"> can be garbage collected.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t799" href="#t799">799</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t800" href="#t800">800</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t801" href="#t801">801</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t802" href="#t802">802</a></span><span class="t"> <span class="com"># The __getitem__ behaves like __getitem__ from Dict but __iter__ would ideally work like a Sequence.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t803" href="#t803">803</a></span><span class="t"> <span class="com"># However, that does not feel compatible, so lets force people to use .children instead for the Sequence</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t804" href="#t804">804</a></span><span class="t"> <span class="com"># behaviour to avoid surprises for now.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t805" href="#t805">805</a></span><span class="t"> <span class="com"># (Maybe it is a non-issue, but it is easier to add the API later than to remove it once we have committed</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t806" href="#t806">806</a></span><span class="t"> <span class="com"># to using it)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t807" href="#t807">807</a></span><span class="t"> <span class="nam">__iter__</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t808" href="#t808">808</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t809" href="#t809">809</a></span><span class="t"> <span class="key">def</span> <span class="nam">__getitem__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">key</span><span class="op">:</span> <span class="nam">object</span><span class="op">)</span> <span class="op">-></span> <span class="str">"VirtualPath"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t810" href="#t810">810</a></span><span class="t"> <span class="str">"""Lookup a (direct) child by name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t811" href="#t811">811</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t812" href="#t812">812</a></span><span class="t"><span class="str"> Ignoring the possible `KeyError`, then the following are the same:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t813" href="#t813">813</a></span><span class="t"><span class="str"> `fs_root["usr"] == fs_root.lookup('usr')`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t814" href="#t814">814</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t815" href="#t815">815</a></span><span class="t"><span class="str"> Note that unlike `.lookup` this can only locate direct children.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t816" href="#t816">816</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t817" href="#t817">817</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t818" href="#t818">818</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t819" href="#t819">819</a></span><span class="t"> <span class="key">def</span> <span class="nam">__delitem__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">key</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t820" href="#t820">820</a></span><span class="t"> <span class="str">"""Remove a child from this node if it exists</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t821" href="#t821">821</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t822" href="#t822">822</a></span><span class="t"><span class="str"> If that child is a directory, then the entire tree is removed (like `rm -fr`).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t823" href="#t823">823</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t824" href="#t824">824</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t825" href="#t825">825</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t826" href="#t826">826</a></span><span class="t"> <span class="key">def</span> <span class="nam">get</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">key</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="str">"Optional[VirtualPath]"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t827" href="#t827">827</a></span><span class="t"> <span class="str">"""Lookup a (direct) child by name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t828" href="#t828">828</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t829" href="#t829">829</a></span><span class="t"><span class="str"> The following are the same:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t830" href="#t830">830</a></span><span class="t"><span class="str"> `fs_root.get("usr") == fs_root.lookup('usr')`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t831" href="#t831">831</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t832" href="#t832">832</a></span><span class="t"><span class="str"> Note that unlike `.lookup` this can only locate direct children.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t833" href="#t833">833</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t834" href="#t834">834</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t835" href="#t835">835</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t836" href="#t836">836</a></span><span class="t"> <span class="key">except</span> <span class="nam">KeyError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t837" href="#t837">837</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t838" href="#t838">838</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t839" href="#t839">839</a></span><span class="t"> <span class="key">def</span> <span class="nam">__contains__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">item</span><span class="op">:</span> <span class="nam">object</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t840" href="#t840">840</a></span><span class="t"> <span class="str">"""Determine if this path includes a given child (either by object or string)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t841" href="#t841">841</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t842" href="#t842">842</a></span><span class="t"><span class="str"> Examples:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t843" href="#t843">843</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t844" href="#t844">844</a></span><span class="t"><span class="str"> if 'foo' in dir: ...</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t845" href="#t845">845</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t846" href="#t846">846</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">item</span><span class="op">,</span> <span class="nam">VirtualPath</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t847" href="#t847">847</a></span><span class="t"> <span class="key">return</span> <span class="nam">item</span><span class="op">.</span><span class="nam">parent_dir</span> <span class="key">is</span> <span class="nam">self</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t848" href="#t848">848</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">item</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t849" href="#t849">849</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t850" href="#t850">850</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">item</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t851" href="#t851">851</a></span><span class="t"> <span class="key">return</span> <span class="nam">m</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t852" href="#t852">852</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t853" href="#t853">853</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t854" href="#t854">854</a></span><span class="t"> <span class="key">def</span> <span class="nam">path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t855" href="#t855">855</a></span><span class="t"> <span class="str">"""Returns the "full" path for this file system entry</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t856" href="#t856">856</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t857" href="#t857">857</a></span><span class="t"><span class="str"> This is the path that debputy uses to refer to this file system entry. It is always</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t858" href="#t858">858</a></span><span class="t"><span class="str"> normalized. Use the `absolute` attribute for how the path looks</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t859" href="#t859">859</a></span><span class="t"><span class="str"> when the package is installed. Alternatively, there is also `fs_path`, which is the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t860" href="#t860">860</a></span><span class="t"><span class="str"> path to the underlying file system object (assuming there is one). That is the one</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t861" href="#t861">861</a></span><span class="t"><span class="str"> you need if you want to read the file.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t862" href="#t862">862</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t863" href="#t863">863</a></span><span class="t"><span class="str"> This is attribute is mostly useful for debugging or for looking up the path relative</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t864" href="#t864">864</a></span><span class="t"><span class="str"> to the "root" of the virtual file system that debputy maintains.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t865" href="#t865">865</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t866" href="#t866">866</a></span><span class="t"><span class="str"> If the path is detached (see `is_detached`), then this method returns the path as it</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t867" href="#t867">867</a></span><span class="t"><span class="str"> was known prior to being detached.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t868" href="#t868">868</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t869" href="#t869">869</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t870" href="#t870">870</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t871" href="#t871">871</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t872" href="#t872">872</a></span><span class="t"> <span class="key">def</span> <span class="nam">absolute</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t873" href="#t873">873</a></span><span class="t"> <span class="str">"""Returns the absolute version of this path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t874" href="#t874">874</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t875" href="#t875">875</a></span><span class="t"><span class="str"> This is how to refer to this path when the package is installed.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t876" href="#t876">876</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t877" href="#t877">877</a></span><span class="t"><span class="str"> If the path is detached (see `is_detached`), then this method returns the last known location</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t878" href="#t878">878</a></span><span class="t"><span class="str"> of installation (prior to being detached).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t879" href="#t879">879</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t880" href="#t880">880</a></span><span class="t"><span class="str"> :return: The absolute path of this file as it would be on the installed system.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t881" href="#t881">881</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t882" href="#t882">882</a></span><span class="t"> <span class="nam">p</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">lstrip</span><span class="op">(</span><span class="str">"."</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t883" href="#t883">883</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">p</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t884" href="#t884">884</a></span><span class="t"> <span class="key">return</span> <span class="str">f"/{p}"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t885" href="#t885">885</a></span><span class="t"> <span class="key">return</span> <span class="nam">p</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t886" href="#t886">886</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t887" href="#t887">887</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t888" href="#t888">888</a></span><span class="t"> <span class="key">def</span> <span class="nam">parent_dir</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"VirtualPath"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t889" href="#t889">889</a></span><span class="t"> <span class="str">"""The parent directory of this path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t890" href="#t890">890</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t891" href="#t891">891</a></span><span class="t"><span class="str"> Note this operation requires the path is "attached" (see `is_detached`). All paths are attached</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t892" href="#t892">892</a></span><span class="t"><span class="str"> by default but unlinking paths will cause them to become detached.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t893" href="#t893">893</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t894" href="#t894">894</a></span><span class="t"><span class="str"> :return: The parent path or None for the root.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t895" href="#t895">895</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t896" href="#t896">896</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t897" href="#t897">897</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t898" href="#t898">898</a></span><span class="t"> <span class="key">def</span> <span class="nam">stat</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">os</span><span class="op">.</span><span class="nam">stat_result</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t899" href="#t899">899</a></span><span class="t"> <span class="str">"""Attempt to do stat of the underlying path (if it exists)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t900" href="#t900">900</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t901" href="#t901">901</a></span><span class="t"><span class="str"> *Avoid* using `stat()` whenever possible where a more specialized attribute exist. The</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t902" href="#t902">902</a></span><span class="t"><span class="str"> `stat()` call returns the data from the file system and often, `debputy` does *not* track</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t903" href="#t903">903</a></span><span class="t"><span class="str"> its state in the file system. As an example, if you want to know the file system mode of</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t904" href="#t904">904</a></span><span class="t"><span class="str"> a path, please use the `mode` attribute instead.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t905" href="#t905">905</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t906" href="#t906">906</a></span><span class="t"><span class="str"> This never follow symlinks (it behaves like `os.lstat`). It will raise an error</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t907" href="#t907">907</a></span><span class="t"><span class="str"> if the path is not backed by a file system object (that is, `has_fs_path` is False).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t908" href="#t908">908</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t909" href="#t909">909</a></span><span class="t"><span class="str"> :return: The stat result or an error.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t910" href="#t910">910</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t911" href="#t911">911</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t912" href="#t912">912</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t913" href="#t913">913</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t914" href="#t914">914</a></span><span class="t"> <span class="key">def</span> <span class="nam">size</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t915" href="#t915">915</a></span><span class="t"> <span class="str">"""Resolve the file size (`st_size`)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t916" href="#t916">916</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t917" href="#t917">917</a></span><span class="t"><span class="str"> This may be using `stat()` and therefore `fs_path`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t918" href="#t918">918</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t919" href="#t919">919</a></span><span class="t"><span class="str"> :return: The size of the file in bytes</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t920" href="#t920">920</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t921" href="#t921">921</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">stat</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">st_size</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t922" href="#t922">922</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t923" href="#t923">923</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t924" href="#t924">924</a></span><span class="t"> <span class="key">def</span> <span class="nam">mode</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t925" href="#t925">925</a></span><span class="t"> <span class="str">"""Determine the mode bits of this path object</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t926" href="#t926">926</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t927" href="#t927">927</a></span><span class="t"><span class="str"> Note that:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t928" href="#t928">928</a></span><span class="t"><span class="str"> * like with `stat` above, this never follows symlinks.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t929" href="#t929">929</a></span><span class="t"><span class="str"> * the mode returned by this method is not always a 1:1 with the mode in the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t930" href="#t930">930</a></span><span class="t"><span class="str"> physical file system. As an optimization, `debputy` skips unnecessary writes</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t931" href="#t931">931</a></span><span class="t"><span class="str"> to the underlying file system in many cases.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t932" href="#t932">932</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t933" href="#t933">933</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t934" href="#t934">934</a></span><span class="t"><span class="str"> :return: The mode bits for the path.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t935" href="#t935">935</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t936" href="#t936">936</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t937" href="#t937">937</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t938" href="#t938">938</a></span><span class="t"> <span class="op">@</span><span class="nam">mode</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t939" href="#t939">939</a></span><span class="t"> <span class="key">def</span> <span class="nam">mode</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">new_mode</span><span class="op">:</span> <span class="nam">int</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t940" href="#t940">940</a></span><span class="t"> <span class="str">"""Set the octal file mode of this path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t941" href="#t941">941</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t942" href="#t942">942</a></span><span class="t"><span class="str"> Note that:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t943" href="#t943">943</a></span><span class="t"><span class="str"> * this operation will fail if `path.is_read_write` returns False.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t944" href="#t944">944</a></span><span class="t"><span class="str"> * this operation is generally *not* synced to the physical file system (as</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t945" href="#t945">945</a></span><span class="t"><span class="str"> an optimization).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t946" href="#t946">946</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t947" href="#t947">947</a></span><span class="t"><span class="str"> :param new_mode: The new octal mode for this path. Note that `debputy` insists</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t948" href="#t948">948</a></span><span class="t"><span class="str"> that all paths have the `user read bit` and, for directories also, the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t949" href="#t949">949</a></span><span class="t"><span class="str"> `user execute bit`. The absence of these minimal mode bits causes hard to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t950" href="#t950">950</a></span><span class="t"><span class="str"> debug errors.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t951" href="#t951">951</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t952" href="#t952">952</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t953" href="#t953">953</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t954" href="#t954">954</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t955" href="#t955">955</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_executable</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t956" href="#t956">956</a></span><span class="t"> <span class="str">"""Determine whether a path is considered executable</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t957" href="#t957">957</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t958" href="#t958">958</a></span><span class="t"><span class="str"> Generally, this means that at least one executable bit is set. This will</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t959" href="#t959">959</a></span><span class="t"><span class="str"> basically always be true for directories as directories need the execute</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t960" href="#t960">960</a></span><span class="t"><span class="str"> parameter to be traversable.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t961" href="#t961">961</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t962" href="#t962">962</a></span><span class="t"><span class="str"> :return: True if the path is considered executable with its current mode</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t963" href="#t963">963</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t964" href="#t964">964</a></span><span class="t"> <span class="key">return</span> <span class="nam">bool</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">mode</span> <span class="op">&</span> <span class="num">0o0111</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t965" href="#t965">965</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t966" href="#t966">966</a></span><span class="t"> <span class="key">def</span> <span class="nam">chmod</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">new_mode</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">int</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t967" href="#t967">967</a></span><span class="t"> <span class="str">"""Set the file mode of this path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t968" href="#t968">968</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t969" href="#t969">969</a></span><span class="t"><span class="str"> This is similar to setting the `mode` attribute. However, this method accepts</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t970" href="#t970">970</a></span><span class="t"><span class="str"> a string argument, which will be parsed as a symbolic mode (example: `u+rX,go=rX`).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t971" href="#t971">971</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t972" href="#t972">972</a></span><span class="t"><span class="str"> Note that:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t973" href="#t973">973</a></span><span class="t"><span class="str"> * this operation will fail if `path.is_read_write` returns False.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t974" href="#t974">974</a></span><span class="t"><span class="str"> * this operation is generally *not* synced to the physical file system (as</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t975" href="#t975">975</a></span><span class="t"><span class="str"> an optimization).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t976" href="#t976">976</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t977" href="#t977">977</a></span><span class="t"><span class="str"> :param new_mode: The new mode for this path.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t978" href="#t978">978</a></span><span class="t"><span class="str"> Note that `debputy` insists that all paths have the `user read bit` and, for</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t979" href="#t979">979</a></span><span class="t"><span class="str"> directories also, the `user execute bit`. The absence of these minimal mode</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t980" href="#t980">980</a></span><span class="t"><span class="str"> bits causes hard to debug errors.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t981" href="#t981">981</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t982" href="#t982">982</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">new_mode</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t983" href="#t983">983</a></span><span class="t"> <span class="nam">segments</span> <span class="op">=</span> <span class="nam">parse_symbolic_mode</span><span class="op">(</span><span class="nam">new_mode</span><span class="op">,</span> <span class="key">None</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t984" href="#t984">984</a></span><span class="t"> <span class="nam">final_mode</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">mode</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t985" href="#t985">985</a></span><span class="t"> <span class="nam">is_dir</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_dir</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t986" href="#t986">986</a></span><span class="t"> <span class="key">for</span> <span class="nam">segment</span> <span class="key">in</span> <span class="nam">segments</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t987" href="#t987">987</a></span><span class="t"> <span class="nam">final_mode</span> <span class="op">=</span> <span class="nam">segment</span><span class="op">.</span><span class="nam">apply</span><span class="op">(</span><span class="nam">final_mode</span><span class="op">,</span> <span class="nam">is_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t988" href="#t988">988</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">mode</span> <span class="op">=</span> <span class="nam">final_mode</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t989" href="#t989">989</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t990" href="#t990">990</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">mode</span> <span class="op">=</span> <span class="nam">new_mode</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t991" href="#t991">991</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t992" href="#t992">992</a></span><span class="t"> <span class="key">def</span> <span class="nam">chown</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t993" href="#t993">993</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t994" href="#t994">994</a></span><span class="t"> <span class="nam">owner</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"StaticFileSystemOwner"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t995" href="#t995">995</a></span><span class="t"> <span class="nam">group</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="str">"StaticFileSystemGroup"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t996" href="#t996">996</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t997" href="#t997">997</a></span><span class="t"> <span class="str">"""Change the owner/group of this path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t998" href="#t998">998</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t999" href="#t999">999</a></span><span class="t"><span class="str"> :param owner: The desired owner definition for this path. If None, then no change of owner is performed.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1000" href="#t1000">1000</a></span><span class="t"><span class="str"> :param group: The desired group definition for this path. If None, then no change of group is performed.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1001" href="#t1001">1001</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1002" href="#t1002">1002</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1003" href="#t1003">1003</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1004" href="#t1004">1004</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1005" href="#t1005">1005</a></span><span class="t"> <span class="key">def</span> <span class="nam">mtime</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">float</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1006" href="#t1006">1006</a></span><span class="t"> <span class="str">"""Determine the mtime of this path object</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1007" href="#t1007">1007</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1008" href="#t1008">1008</a></span><span class="t"><span class="str"> Note that:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1009" href="#t1009">1009</a></span><span class="t"><span class="str"> * like with `stat` above, this never follows symlinks.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1010" href="#t1010">1010</a></span><span class="t"><span class="str"> * the mtime returned has *not* been clamped against ´SOURCE_DATE_EPOCH`. Timestamp</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1011" href="#t1011">1011</a></span><span class="t"><span class="str"> normalization is handled later by `debputy`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1012" href="#t1012">1012</a></span><span class="t"><span class="str"> * the mtime returned by this method is not always a 1:1 with the mtime in the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1013" href="#t1013">1013</a></span><span class="t"><span class="str"> physical file system. As an optimization, `debputy` skips unnecessary writes</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1014" href="#t1014">1014</a></span><span class="t"><span class="str"> to the underlying file system in many cases.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1015" href="#t1015">1015</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1016" href="#t1016">1016</a></span><span class="t"><span class="str"> :return: The mtime for the path.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1017" href="#t1017">1017</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1018" href="#t1018">1018</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1019" href="#t1019">1019</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1020" href="#t1020">1020</a></span><span class="t"> <span class="op">@</span><span class="nam">mtime</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1021" href="#t1021">1021</a></span><span class="t"> <span class="key">def</span> <span class="nam">mtime</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">new_mtime</span><span class="op">:</span> <span class="nam">float</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1022" href="#t1022">1022</a></span><span class="t"> <span class="str">"""Set the mtime of this path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1023" href="#t1023">1023</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1024" href="#t1024">1024</a></span><span class="t"><span class="str"> Note that:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1025" href="#t1025">1025</a></span><span class="t"><span class="str"> * this operation will fail if `path.is_read_write` returns False.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1026" href="#t1026">1026</a></span><span class="t"><span class="str"> * this operation is generally *not* synced to the physical file system (as</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1027" href="#t1027">1027</a></span><span class="t"><span class="str"> an optimization).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1028" href="#t1028">1028</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1029" href="#t1029">1029</a></span><span class="t"><span class="str"> :param new_mtime: The new mtime of this path. Note that the caller does not need to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1030" href="#t1030">1030</a></span><span class="t"><span class="str"> account for `SOURCE_DATE_EPOCH`. Timestamp normalization is handled later.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1031" href="#t1031">1031</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1032" href="#t1032">1032</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1033" href="#t1033">1033</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1034" href="#t1034">1034</a></span><span class="t"> <span class="key">def</span> <span class="nam">readlink</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1035" href="#t1035">1035</a></span><span class="t"> <span class="str">"""Determine the link target of this path assuming it is a symlink</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1036" href="#t1036">1036</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1037" href="#t1037">1037</a></span><span class="t"><span class="str"> For paths where `is_symlink` is True, this already returns a link target even when</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1038" href="#t1038">1038</a></span><span class="t"><span class="str"> `has_fs_path` is False.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1039" href="#t1039">1039</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1040" href="#t1040">1040</a></span><span class="t"><span class="str"> :return: The link target of the path or an error is this is not a symlink</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1041" href="#t1041">1041</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1042" href="#t1042">1042</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1043" href="#t1043">1043</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1044" href="#t1044">1044</a></span><span class="t"> <span class="op">@</span><span class="nam">overload</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1045" href="#t1045">1045</a></span><span class="t"> <span class="key">def</span> <span class="nam">open</span><span class="op">(</span> </span><span class="r"><span class="annotate short">1045 ↛ exit</span><span class="annotate long">line 1045 didn't jump to the function exit</span></span></p> - <p class="pln"><span class="n"><a id="t1046" href="#t1046">1046</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1047" href="#t1047">1047</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1048" href="#t1048">1048</a></span><span class="t"> <span class="nam">byte_io</span><span class="op">:</span> <span class="nam">Literal</span><span class="op">[</span><span class="key">False</span><span class="op">]</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1049" href="#t1049">1049</a></span><span class="t"> <span class="nam">buffering</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span> <span class="op">=</span> <span class="op">...</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1050" href="#t1050">1050</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">TextIO</span><span class="op">:</span> <span class="op">...</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1051" href="#t1051">1051</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1052" href="#t1052">1052</a></span><span class="t"> <span class="op">@</span><span class="nam">overload</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1053" href="#t1053">1053</a></span><span class="t"> <span class="key">def</span> <span class="nam">open</span><span class="op">(</span> </span><span class="r"><span class="annotate short">1053 ↛ exit</span><span class="annotate long">line 1053 didn't jump to the function exit</span></span></p> - <p class="pln"><span class="n"><a id="t1054" href="#t1054">1054</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1055" href="#t1055">1055</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1056" href="#t1056">1056</a></span><span class="t"> <span class="nam">byte_io</span><span class="op">:</span> <span class="nam">Literal</span><span class="op">[</span><span class="key">True</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1057" href="#t1057">1057</a></span><span class="t"> <span class="nam">buffering</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span> <span class="op">=</span> <span class="op">...</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1058" href="#t1058">1058</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">BinaryIO</span><span class="op">:</span> <span class="op">...</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1059" href="#t1059">1059</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1060" href="#t1060">1060</a></span><span class="t"> <span class="op">@</span><span class="nam">overload</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1061" href="#t1061">1061</a></span><span class="t"> <span class="key">def</span> <span class="nam">open</span><span class="op">(</span> </span><span class="r"><span class="annotate short">1061 ↛ exit</span><span class="annotate long">line 1061 didn't jump to the function exit</span></span></p> - <p class="pln"><span class="n"><a id="t1062" href="#t1062">1062</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1063" href="#t1063">1063</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1064" href="#t1064">1064</a></span><span class="t"> <span class="nam">byte_io</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1065" href="#t1065">1065</a></span><span class="t"> <span class="nam">buffering</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span> <span class="op">=</span> <span class="op">...</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1066" href="#t1066">1066</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Union</span><span class="op">[</span><span class="nam">TextIO</span><span class="op">,</span> <span class="nam">BinaryIO</span><span class="op">]</span><span class="op">:</span> <span class="op">...</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1067" href="#t1067">1067</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1068" href="#t1068">1068</a></span><span class="t"> <span class="key">def</span> <span class="nam">open</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1069" href="#t1069">1069</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1070" href="#t1070">1070</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1071" href="#t1071">1071</a></span><span class="t"> <span class="nam">byte_io</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1072" href="#t1072">1072</a></span><span class="t"> <span class="nam">buffering</span><span class="op">:</span> <span class="nam">int</span> <span class="op">=</span> <span class="op">-</span><span class="num">1</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1073" href="#t1073">1073</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Union</span><span class="op">[</span><span class="nam">TextIO</span><span class="op">,</span> <span class="nam">BinaryIO</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1074" href="#t1074">1074</a></span><span class="t"> <span class="str">"""Open the file for reading. Usually used with a context manager</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1075" href="#t1075">1075</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1076" href="#t1076">1076</a></span><span class="t"><span class="str"> By default, the file is opened in text mode (utf-8). Binary mode can be requested</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1077" href="#t1077">1077</a></span><span class="t"><span class="str"> via the `byte_io` parameter. This operation is only valid for files (`is_file` returns</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1078" href="#t1078">1078</a></span><span class="t"><span class="str"> `True`). Usage on symlinks and directories will raise exceptions.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1079" href="#t1079">1079</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1080" href="#t1080">1080</a></span><span class="t"><span class="str"> This method *often* requires the `fs_path` to be present. However, tests as a notable</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1081" href="#t1081">1081</a></span><span class="t"><span class="str"> case can inject content without having the `fs_path` point to a real file. (To be clear,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1082" href="#t1082">1082</a></span><span class="t"><span class="str"> such tests are generally expected to ensure `has_fs_path` returns `True`).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1083" href="#t1083">1083</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1084" href="#t1084">1084</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1085" href="#t1085">1085</a></span><span class="t"><span class="str"> :param byte_io: If True, open the file in binary mode (like `rb` for `open`)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1086" href="#t1086">1086</a></span><span class="t"><span class="str"> :param buffering: Same as open(..., buffering=...) where supported. Notably during</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1087" href="#t1087">1087</a></span><span class="t"><span class="str"> testing, the content may be purely in memory and use a BytesIO/StringIO</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1088" href="#t1088">1088</a></span><span class="t"><span class="str"> (which does not accept that parameter, but then is buffered in a different way)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1089" href="#t1089">1089</a></span><span class="t"><span class="str"> :return: The file handle.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1090" href="#t1090">1090</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1091" href="#t1091">1091</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1092" href="#t1092">1092</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_file</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1092 ↛ 1093</span><span class="annotate long">line 1092 didn't jump to line 1093, because the condition on line 1092 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1093" href="#t1093">1093</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TypeError</span><span class="op">(</span><span class="str">f"Cannot open {self.path} for reading: It is not a file"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1094" href="#t1094">1094</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1095" href="#t1095">1095</a></span><span class="t"> <span class="key">if</span> <span class="nam">byte_io</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1096" href="#t1096">1096</a></span><span class="t"> <span class="key">return</span> <span class="nam">open</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">,</span> <span class="str">"rb"</span><span class="op">,</span> <span class="nam">buffering</span><span class="op">=</span><span class="nam">buffering</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1097" href="#t1097">1097</a></span><span class="t"> <span class="key">return</span> <span class="nam">open</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">,</span> <span class="str">"rt"</span><span class="op">,</span> <span class="nam">encoding</span><span class="op">=</span><span class="str">"utf-8"</span><span class="op">,</span> <span class="nam">buffering</span><span class="op">=</span><span class="nam">buffering</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1098" href="#t1098">1098</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1099" href="#t1099">1099</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1100" href="#t1100">1100</a></span><span class="t"> <span class="key">def</span> <span class="nam">fs_path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1101" href="#t1101">1101</a></span><span class="t"> <span class="str">"""Request the underling fs_path of this path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1102" href="#t1102">1102</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1103" href="#t1103">1103</a></span><span class="t"><span class="str"> Only available when `has_fs_path` is True. Generally this should only be used for files to read</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1104" href="#t1104">1104</a></span><span class="t"><span class="str"> the contents of the file and do some action based on the parsed result.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1105" href="#t1105">1105</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1106" href="#t1106">1106</a></span><span class="t"><span class="str"> The path should only be used for read-only purposes as debputy may assume that it is safe to have</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1107" href="#t1107">1107</a></span><span class="t"><span class="str"> multiple paths pointing to the same file system path.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1108" href="#t1108">1108</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1109" href="#t1109">1109</a></span><span class="t"><span class="str"> Note that:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1110" href="#t1110">1110</a></span><span class="t"><span class="str"> * This is often *not* available for directories and symlinks.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1111" href="#t1111">1111</a></span><span class="t"><span class="str"> * The debputy in-memory file system overrules the physical file system. Attempting to "fix" things</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1112" href="#t1112">1112</a></span><span class="t"><span class="str"> by using `os.chmod` or `os.unlink`'ing files, etc. will generally not do as you expect. Best case,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1113" href="#t1113">1113</a></span><span class="t"><span class="str"> your actions are ignored and worst case it will cause the build to fail as it violates debputy's</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1114" href="#t1114">1114</a></span><span class="t"><span class="str"> internal invariants.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1115" href="#t1115">1115</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1116" href="#t1116">1116</a></span><span class="t"><span class="str"> :return: The path to the underlying file system object on the build system or an error if no such</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1117" href="#t1117">1117</a></span><span class="t"><span class="str"> file exist (see `has_fs_path`).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1118" href="#t1118">1118</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1119" href="#t1119">1119</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1120" href="#t1120">1120</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1121" href="#t1121">1121</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1122" href="#t1122">1122</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_dir</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1123" href="#t1123">1123</a></span><span class="t"> <span class="str">"""Determine if this path is a directory</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1124" href="#t1124">1124</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1125" href="#t1125">1125</a></span><span class="t"><span class="str"> Never follows symlinks.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1126" href="#t1126">1126</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1127" href="#t1127">1127</a></span><span class="t"><span class="str"> :return: True if this path is a directory. False otherwise.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1128" href="#t1128">1128</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1129" href="#t1129">1129</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1130" href="#t1130">1130</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1131" href="#t1131">1131</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1132" href="#t1132">1132</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_file</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1133" href="#t1133">1133</a></span><span class="t"> <span class="str">"""Determine if this path is a directory</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1134" href="#t1134">1134</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1135" href="#t1135">1135</a></span><span class="t"><span class="str"> Never follows symlinks.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1136" href="#t1136">1136</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1137" href="#t1137">1137</a></span><span class="t"><span class="str"> :return: True if this path is a regular file. False otherwise.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1138" href="#t1138">1138</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1139" href="#t1139">1139</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1140" href="#t1140">1140</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1141" href="#t1141">1141</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1142" href="#t1142">1142</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_symlink</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1143" href="#t1143">1143</a></span><span class="t"> <span class="str">"""Determine if this path is a symlink</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1144" href="#t1144">1144</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1145" href="#t1145">1145</a></span><span class="t"><span class="str"> :return: True if this path is a symlink. False otherwise.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1146" href="#t1146">1146</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1147" href="#t1147">1147</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1148" href="#t1148">1148</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1149" href="#t1149">1149</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1150" href="#t1150">1150</a></span><span class="t"> <span class="key">def</span> <span class="nam">has_fs_path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1151" href="#t1151">1151</a></span><span class="t"> <span class="str">"""Determine whether this path is backed by a file system path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1152" href="#t1152">1152</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1153" href="#t1153">1153</a></span><span class="t"><span class="str"> :return: True if this path is backed by a file system object on the build system.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1154" href="#t1154">1154</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1155" href="#t1155">1155</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1156" href="#t1156">1156</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1157" href="#t1157">1157</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1158" href="#t1158">1158</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_read_write</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1159" href="#t1159">1159</a></span><span class="t"> <span class="str">"""When true, the file system entry may be mutated</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1160" href="#t1160">1160</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1161" href="#t1161">1161</a></span><span class="t"><span class="str"> Read-write rules are:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1162" href="#t1162">1162</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1163" href="#t1163">1163</a></span><span class="t"><span class="str"> +--------------------------+-------------------+------------------------+</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1164" href="#t1164">1164</a></span><span class="t"><span class="str"> | File system | From / Inside | Read-Only / Read-Write |</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1165" href="#t1165">1165</a></span><span class="t"><span class="str"> +--------------------------+-------------------+------------------------+</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1166" href="#t1166">1166</a></span><span class="t"><span class="str"> | Source directory | Any context | Read-Only |</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1167" href="#t1167">1167</a></span><span class="t"><span class="str"> | Binary staging directory | Package Processor | Read-Write |</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1168" href="#t1168">1168</a></span><span class="t"><span class="str"> | Binary staging directory | Metadata Detector | Read-Only |</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1169" href="#t1169">1169</a></span><span class="t"><span class="str"> +--------------------------+-------------------+------------------------+</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1170" href="#t1170">1170</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1171" href="#t1171">1171</a></span><span class="t"><span class="str"> These rules apply to the virtual file system (`debputy` cannot enforce</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1172" href="#t1172">1172</a></span><span class="t"><span class="str"> these rules in the underlying file system). The `debputy` code relies</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1173" href="#t1173">1173</a></span><span class="t"><span class="str"> on these rules for its logic in multiple places to catch bugs and for</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1174" href="#t1174">1174</a></span><span class="t"><span class="str"> optimizations.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1175" href="#t1175">1175</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1176" href="#t1176">1176</a></span><span class="t"><span class="str"> As an example, the reason why the file system is read-only when Metadata</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1177" href="#t1177">1177</a></span><span class="t"><span class="str"> Detectors are run is based the contents of the file system has already</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1178" href="#t1178">1178</a></span><span class="t"><span class="str"> been committed. New files will not be included, removals of existing</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1179" href="#t1179">1179</a></span><span class="t"><span class="str"> files will trigger a hard error when the package is assembled, etc.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1180" href="#t1180">1180</a></span><span class="t"><span class="str"> To avoid people spending hours debugging why their code does not work</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1181" href="#t1181">1181</a></span><span class="t"><span class="str"> as intended, `debputy` instead throws a hard error if you try to mutate</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1182" href="#t1182">1182</a></span><span class="t"><span class="str"> the file system when it is read-only mode to "fail fast".</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1183" href="#t1183">1183</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1184" href="#t1184">1184</a></span><span class="t"><span class="str"> :return: Whether file system mutations are permitted.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1185" href="#t1185">1185</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1186" href="#t1186">1186</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1187" href="#t1187">1187</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1188" href="#t1188">1188</a></span><span class="t"> <span class="key">def</span> <span class="nam">mkdir</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">name</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="str">"VirtualPath"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1189" href="#t1189">1189</a></span><span class="t"> <span class="str">"""Create a new subdirectory of the current path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1190" href="#t1190">1190</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1191" href="#t1191">1191</a></span><span class="t"><span class="str"> :param name: Basename of the new directory. The directory must not contain a path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1192" href="#t1192">1192</a></span><span class="t"><span class="str"> with this basename.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1193" href="#t1193">1193</a></span><span class="t"><span class="str"> :return: The new subdirectory</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1194" href="#t1194">1194</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1195" href="#t1195">1195</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1196" href="#t1196">1196</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1197" href="#t1197">1197</a></span><span class="t"> <span class="key">def</span> <span class="nam">mkdirs</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">path</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="str">"VirtualPath"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1198" href="#t1198">1198</a></span><span class="t"> <span class="str">"""Ensure a given path exists and is a directory.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1199" href="#t1199">1199</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1200" href="#t1200">1200</a></span><span class="t"><span class="str"> :param path: Path to the directory to create. Any parent directories will be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1201" href="#t1201">1201</a></span><span class="t"><span class="str"> created as needed. If the path already exists and is a directory, then it</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1202" href="#t1202">1202</a></span><span class="t"><span class="str"> is returned. If any part of the path exists and that is not a directory,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1203" href="#t1203">1203</a></span><span class="t"><span class="str"> then the `mkdirs` call will raise an error.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1204" href="#t1204">1204</a></span><span class="t"><span class="str"> :return: The directory denoted by the given path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1205" href="#t1205">1205</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1206" href="#t1206">1206</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1207" href="#t1207">1207</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1208" href="#t1208">1208</a></span><span class="t"> <span class="key">def</span> <span class="nam">add_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1209" href="#t1209">1209</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1210" href="#t1210">1210</a></span><span class="t"> <span class="nam">name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1211" href="#t1211">1211</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1212" href="#t1212">1212</a></span><span class="t"> <span class="nam">unlink_if_exists</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1213" href="#t1213">1213</a></span><span class="t"> <span class="nam">use_fs_path_mode</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1214" href="#t1214">1214</a></span><span class="t"> <span class="nam">mode</span><span class="op">:</span> <span class="nam">int</span> <span class="op">=</span> <span class="num">0o0644</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1215" href="#t1215">1215</a></span><span class="t"> <span class="nam">mtime</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">float</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1216" href="#t1216">1216</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">ContextManager</span><span class="op">[</span><span class="str">"VirtualPath"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1217" href="#t1217">1217</a></span><span class="t"> <span class="str">"""Add a new regular file as a child of this path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1218" href="#t1218">1218</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1219" href="#t1219">1219</a></span><span class="t"><span class="str"> This method will insert a new file into the virtual file system as a child</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1220" href="#t1220">1220</a></span><span class="t"><span class="str"> of the current path (which must be a directory). The caller must use the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1221" href="#t1221">1221</a></span><span class="t"><span class="str"> return value as a context manager (see example). During the life-cycle of</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1222" href="#t1222">1222</a></span><span class="t"><span class="str"> the managed context, the caller can fill out the contents of the file</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1223" href="#t1223">1223</a></span><span class="t"><span class="str"> from the new path's `fs_path` attribute. The `fs_path` will exist as an</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1224" href="#t1224">1224</a></span><span class="t"><span class="str"> empty file when the context manager is entered.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1225" href="#t1225">1225</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1226" href="#t1226">1226</a></span><span class="t"><span class="str"> Once the context manager exits, mutation of the `fs_path` is no longer permitted.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1227" href="#t1227">1227</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1228" href="#t1228">1228</a></span><span class="t"><span class="str"> >>> import subprocess</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1229" href="#t1229">1229</a></span><span class="t"><span class="str"> >>> path = ... # doctest: +SKIP</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1230" href="#t1230">1230</a></span><span class="t"><span class="str"> >>> with path.add_file("foo") as new_file, open(new_file.fs_path, "w") as fd: # doctest: +SKIP</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1231" href="#t1231">1231</a></span><span class="t"><span class="str"> ... fd.writelines(["Some", "Content", "Here"])</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1232" href="#t1232">1232</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1233" href="#t1233">1233</a></span><span class="t"><span class="str"> The caller can replace the provided `fs_path` entirely provided at the end result</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1234" href="#t1234">1234</a></span><span class="t"><span class="str"> (when the context manager exits) is a regular file with no hard links.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1235" href="#t1235">1235</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1236" href="#t1236">1236</a></span><span class="t"><span class="str"> Note that this operation will fail if `path.is_read_write` returns False.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1237" href="#t1237">1237</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1238" href="#t1238">1238</a></span><span class="t"><span class="str"> :param name: Basename of the new file</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1239" href="#t1239">1239</a></span><span class="t"><span class="str"> :param unlink_if_exists: If the name was already in use, then either an exception is thrown</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1240" href="#t1240">1240</a></span><span class="t"><span class="str"> (when `unlink_if_exists` is False) or the path will be removed via ´unlink(recursive=False)`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1241" href="#t1241">1241</a></span><span class="t"><span class="str"> (when `unlink_if_exists` is True)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1242" href="#t1242">1242</a></span><span class="t"><span class="str"> :param use_fs_path_mode: When True, the file created will have this mode in the physical file</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1243" href="#t1243">1243</a></span><span class="t"><span class="str"> system. When the context manager exists, `debputy` will refresh its mode to match the mode</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1244" href="#t1244">1244</a></span><span class="t"><span class="str"> in the physical file system. This is primarily useful if the caller uses a subprocess to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1245" href="#t1245">1245</a></span><span class="t"><span class="str"> mutate the path and the file mode is relevant for this tool (either as input or output).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1246" href="#t1246">1246</a></span><span class="t"><span class="str"> When the parameter is false, the new file is guaranteed to be readable and writable for</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1247" href="#t1247">1247</a></span><span class="t"><span class="str"> the current user. However, no other guarantees are given (not even that it matches the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1248" href="#t1248">1248</a></span><span class="t"><span class="str"> `mode` parameter and any changes to the mode in the physical file system will be ignored.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1249" href="#t1249">1249</a></span><span class="t"><span class="str"> :param mode: This is the initial file mode. Note the `use_fs_path_mode` parameter for how</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1250" href="#t1250">1250</a></span><span class="t"><span class="str"> this interacts with the physical file system.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1251" href="#t1251">1251</a></span><span class="t"><span class="str"> :param mtime: If the caller has a more accurate mtime than the mtime of the generated file,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1252" href="#t1252">1252</a></span><span class="t"><span class="str"> then it can be provided here. Note that all mtimes will later be clamped based on</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1253" href="#t1253">1253</a></span><span class="t"><span class="str"> `SOURCE_DATE_EPOCH`. This parameter is only for when the conceptual mtime of this path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1254" href="#t1254">1254</a></span><span class="t"><span class="str"> should be earlier than `SOURCE_DATE_EPOCH`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1255" href="#t1255">1255</a></span><span class="t"><span class="str"> :return: A Context manager that upon entering provides a `VirtualPath` instance for the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1256" href="#t1256">1256</a></span><span class="t"><span class="str"> new file. The instance remains valid after the context manager exits (assuming it exits</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1257" href="#t1257">1257</a></span><span class="t"><span class="str"> successfully), but the file denoted by `fs_path` must not be changed after the context</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1258" href="#t1258">1258</a></span><span class="t"><span class="str"> manager exits</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1259" href="#t1259">1259</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1260" href="#t1260">1260</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1261" href="#t1261">1261</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1262" href="#t1262">1262</a></span><span class="t"> <span class="key">def</span> <span class="nam">replace_fs_path_content</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1263" href="#t1263">1263</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1264" href="#t1264">1264</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1265" href="#t1265">1265</a></span><span class="t"> <span class="nam">use_fs_path_mode</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1266" href="#t1266">1266</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">ContextManager</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1267" href="#t1267">1267</a></span><span class="t"> <span class="str">"""Replace the contents of this file via inline manipulation</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1268" href="#t1268">1268</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1269" href="#t1269">1269</a></span><span class="t"><span class="str"> Used as a context manager to provide the fs path for manipulation.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1270" href="#t1270">1270</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1271" href="#t1271">1271</a></span><span class="t"><span class="str"> Example:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1272" href="#t1272">1272</a></span><span class="t"><span class="str"> >>> import subprocess</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1273" href="#t1273">1273</a></span><span class="t"><span class="str"> >>> path = ... # doctest: +SKIP</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1274" href="#t1274">1274</a></span><span class="t"><span class="str"> >>> with path.replace_fs_path_content() as fs_path: # doctest: +SKIP</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1275" href="#t1275">1275</a></span><span class="t"><span class="str"> ... subprocess.check_call(['strip', fs_path]) # doctest: +SKIP</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1276" href="#t1276">1276</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1277" href="#t1277">1277</a></span><span class="t"><span class="str"> The provided file system path should be manipulated inline. The debputy framework may</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1278" href="#t1278">1278</a></span><span class="t"><span class="str"> copy it first as necessary and therefore the provided fs_path may be different from</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1279" href="#t1279">1279</a></span><span class="t"><span class="str"> `path.fs_path` prior to entering the context manager.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1280" href="#t1280">1280</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1281" href="#t1281">1281</a></span><span class="t"><span class="str"> Note that this operation will fail if `path.is_read_write` returns False.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1282" href="#t1282">1282</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1283" href="#t1283">1283</a></span><span class="t"><span class="str"> If the mutation causes the returned `fs_path` to be a non-file or a hard-linked file</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1284" href="#t1284">1284</a></span><span class="t"><span class="str"> when the context manager exits, `debputy` will raise an error at that point. To preserve</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1285" href="#t1285">1285</a></span><span class="t"><span class="str"> the internal invariants of `debputy`, the path will be unlinked as `debputy` cannot</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1286" href="#t1286">1286</a></span><span class="t"><span class="str"> reliably restore the path.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1287" href="#t1287">1287</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1288" href="#t1288">1288</a></span><span class="t"><span class="str"> :param use_fs_path_mode: If True, any changes to the mode on the physical FS path will be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1289" href="#t1289">1289</a></span><span class="t"><span class="str"> recorded as the desired mode of the file when the contextmanager ends. The provided FS path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1290" href="#t1290">1290</a></span><span class="t"><span class="str"> with start with the current mode when `use_fs_path_mode` is True. Otherwise, `debputy` will</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1291" href="#t1291">1291</a></span><span class="t"><span class="str"> ignore the mode of the file system entry and reuse its own current mode</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1292" href="#t1292">1292</a></span><span class="t"><span class="str"> definition.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1293" href="#t1293">1293</a></span><span class="t"><span class="str"> :return: A Context manager that upon entering provides the path to a muable (copy) of</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1294" href="#t1294">1294</a></span><span class="t"><span class="str"> this path's `fs_path` attribute. The file on the underlying path may be mutated however</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1295" href="#t1295">1295</a></span><span class="t"><span class="str"> the caller wishes until the context manager exits.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1296" href="#t1296">1296</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1297" href="#t1297">1297</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1298" href="#t1298">1298</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1299" href="#t1299">1299</a></span><span class="t"> <span class="key">def</span> <span class="nam">add_symlink</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">link_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">link_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="str">"VirtualPath"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1300" href="#t1300">1300</a></span><span class="t"> <span class="str">"""Add a new regular file as a child of this path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1301" href="#t1301">1301</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1302" href="#t1302">1302</a></span><span class="t"><span class="str"> This will create a new symlink inside the current path. If the path already exists,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1303" href="#t1303">1303</a></span><span class="t"><span class="str"> the existing path will be unlinked via `unlink(recursive=False)`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1304" href="#t1304">1304</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1305" href="#t1305">1305</a></span><span class="t"><span class="str"> Note that this operation will fail if `path.is_read_write` returns False.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1306" href="#t1306">1306</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1307" href="#t1307">1307</a></span><span class="t"><span class="str"> :param link_name: The basename of the link file entry.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1308" href="#t1308">1308</a></span><span class="t"><span class="str"> :param link_target: The target of the link. Link target normalization will</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1309" href="#t1309">1309</a></span><span class="t"><span class="str"> be handled by `debputy`, so the caller can use relative or absolute paths.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1310" href="#t1310">1310</a></span><span class="t"><span class="str"> (At the time of writing, symlink target normalization happens late)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1311" href="#t1311">1311</a></span><span class="t"><span class="str"> :return: The newly created symlink.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1312" href="#t1312">1312</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1313" href="#t1313">1313</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1314" href="#t1314">1314</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1315" href="#t1315">1315</a></span><span class="t"> <span class="key">def</span> <span class="nam">unlink</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">recursive</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1316" href="#t1316">1316</a></span><span class="t"> <span class="str">"""Unlink a file or a directory</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1317" href="#t1317">1317</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1318" href="#t1318">1318</a></span><span class="t"><span class="str"> This operation will remove the path from the file system (causing `is_detached` to return True).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1319" href="#t1319">1319</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1320" href="#t1320">1320</a></span><span class="t"><span class="str"> When the path is a:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1321" href="#t1321">1321</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1322" href="#t1322">1322</a></span><span class="t"><span class="str"> * symlink, then the symlink itself is removed. The target (if present) is not affected.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1323" href="#t1323">1323</a></span><span class="t"><span class="str"> * *non-empty* directory, then the `recursive` parameter decides the outcome. An empty</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1324" href="#t1324">1324</a></span><span class="t"><span class="str"> directory will be removed regardless of the value of `recursive`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1325" href="#t1325">1325</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1326" href="#t1326">1326</a></span><span class="t"><span class="str"> Note that:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1327" href="#t1327">1327</a></span><span class="t"><span class="str"> * the root directory cannot be deleted.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1328" href="#t1328">1328</a></span><span class="t"><span class="str"> * this operation will fail if `path.is_read_write` returns False.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1329" href="#t1329">1329</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1330" href="#t1330">1330</a></span><span class="t"><span class="str"> :param recursive: If True, then non-empty directories will be unlinked as well removing everything inside them</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1331" href="#t1331">1331</a></span><span class="t"><span class="str"> as well. When False, an error is raised if the path is a non-empty directory</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1332" href="#t1332">1332</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1333" href="#t1333">1333</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1334" href="#t1334">1334</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1335" href="#t1335">1335</a></span><span class="t"> <span class="key">def</span> <span class="nam">interpreter</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Interpreter</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1336" href="#t1336">1336</a></span><span class="t"> <span class="str">"""Determine the interpreter of the file (`#!`-line details)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1337" href="#t1337">1337</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1338" href="#t1338">1338</a></span><span class="t"><span class="str"> Note: this method is only applicable for files (`is_file` is True).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1339" href="#t1339">1339</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1340" href="#t1340">1340</a></span><span class="t"><span class="str"> :return: The detected interpreter if present or None if no interpreter can be detected.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1341" href="#t1341">1341</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1342" href="#t1342">1342</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_file</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1343" href="#t1343">1343</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TypeError</span><span class="op">(</span><span class="str">"Only files can have interpreters"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1344" href="#t1344">1344</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1345" href="#t1345">1345</a></span><span class="t"> <span class="key">with</span> <span class="nam">self</span><span class="op">.</span><span class="nam">open</span><span class="op">(</span><span class="nam">byte_io</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">buffering</span><span class="op">=</span><span class="num">4096</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1346" href="#t1346">1346</a></span><span class="t"> <span class="key">return</span> <span class="nam">extract_shebang_interpreter_from_file</span><span class="op">(</span><span class="nam">fd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1347" href="#t1347">1347</a></span><span class="t"> <span class="key">except</span> <span class="op">(</span><span class="nam">PureVirtualPathError</span><span class="op">,</span> <span class="nam">TestPathWithNonExistentFSPathError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1348" href="#t1348">1348</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1349" href="#t1349">1349</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1350" href="#t1350">1350</a></span><span class="t"> <span class="key">def</span> <span class="nam">metadata</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1351" href="#t1351">1351</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1352" href="#t1352">1352</a></span><span class="t"> <span class="nam">metadata_type</span><span class="op">:</span> <span class="nam">Type</span><span class="op">[</span><span class="nam">PMT</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1353" href="#t1353">1353</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">PathMetadataReference</span><span class="op">[</span><span class="nam">PMT</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1354" href="#t1354">1354</a></span><span class="t"> <span class="str">"""Fetch the path metadata reference to access the underlying metadata</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1355" href="#t1355">1355</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1356" href="#t1356">1356</a></span><span class="t"><span class="str"> Calling this method returns a reference to an arbitrary piece of metadata associated</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1357" href="#t1357">1357</a></span><span class="t"><span class="str"> with this path. Plugins can store any arbitrary data associated with a given path.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1358" href="#t1358">1358</a></span><span class="t"><span class="str"> Keep in mind that the metadata is stored in memory, so keep the size in moderation.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1359" href="#t1359">1359</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1360" href="#t1360">1360</a></span><span class="t"><span class="str"> To store / update the metadata, the path must be in read-write mode. However,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1361" href="#t1361">1361</a></span><span class="t"><span class="str"> already stored metadata remains accessible even if the path becomes read-only.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1362" href="#t1362">1362</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1363" href="#t1363">1363</a></span><span class="t"><span class="str"> Note this method is not applicable if the path is detached</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1364" href="#t1364">1364</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1365" href="#t1365">1365</a></span><span class="t"><span class="str"> :param metadata_type: Type of the metadata being stored.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1366" href="#t1366">1366</a></span><span class="t"><span class="str"> :return: A reference to the metadata.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1367" href="#t1367">1367</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1368" href="#t1368">1368</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1369" href="#t1369">1369</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1370" href="#t1370">1370</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1371" href="#t1371">1371</a></span><span class="t"><span class="key">class</span> <span class="nam">FlushableSubstvars</span><span class="op">(</span><span class="nam">Substvars</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1372" href="#t1372">1372</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1373" href="#t1373">1373</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1374" href="#t1374">1374</a></span><span class="t"> <span class="op">@</span><span class="nam">contextlib</span><span class="op">.</span><span class="nam">contextmanager</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1375" href="#t1375">1375</a></span><span class="t"> <span class="key">def</span> <span class="nam">flush</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1376" href="#t1376">1376</a></span><span class="t"> <span class="str">"""Temporarily write the substvars to a file and then re-read it again</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1377" href="#t1377">1377</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1378" href="#t1378">1378</a></span><span class="t"><span class="str"> >>> s = FlushableSubstvars()</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1379" href="#t1379">1379</a></span><span class="t"><span class="str"> >>> 'Test:Var' in s</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1380" href="#t1380">1380</a></span><span class="t"><span class="str"> False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1381" href="#t1381">1381</a></span><span class="t"><span class="str"> >>> with s.flush() as name, open(name, 'wt', encoding='utf-8') as fobj:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1382" href="#t1382">1382</a></span><span class="t"><span class="str"> ... _ = fobj.write('Test:Var=bar\\n') # "_ = " is to ignore the return value of write</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1383" href="#t1383">1383</a></span><span class="t"><span class="str"> >>> 'Test:Var' in s</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1384" href="#t1384">1384</a></span><span class="t"><span class="str"> True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1385" href="#t1385">1385</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1386" href="#t1386">1386</a></span><span class="t"><span class="str"> Used as a context manager to define when the file is flushed and can be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1387" href="#t1387">1387</a></span><span class="t"><span class="str"> accessed via the file system. If the context terminates successfully, the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1388" href="#t1388">1388</a></span><span class="t"><span class="str"> file is read and its content replaces the current substvars.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1389" href="#t1389">1389</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1390" href="#t1390">1390</a></span><span class="t"><span class="str"> This is mostly useful if the plugin needs to interface with a third-party</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1391" href="#t1391">1391</a></span><span class="t"><span class="str"> tool that requires a file as interprocess communication (IPC) for sharing</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1392" href="#t1392">1392</a></span><span class="t"><span class="str"> the substvars.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1393" href="#t1393">1393</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1394" href="#t1394">1394</a></span><span class="t"><span class="str"> The file may be truncated or completed replaced (change inode) as long as</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1395" href="#t1395">1395</a></span><span class="t"><span class="str"> the provided path points to a regular file when the context manager</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1396" href="#t1396">1396</a></span><span class="t"><span class="str"> terminates successfully.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1397" href="#t1397">1397</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1398" href="#t1398">1398</a></span><span class="t"><span class="str"> Note that any manipulation of the substvars via the `Substvars` API while</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1399" href="#t1399">1399</a></span><span class="t"><span class="str"> the file is flushed will silently be discarded if the context manager completes</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1400" href="#t1400">1400</a></span><span class="t"><span class="str"> successfully.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1401" href="#t1401">1401</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1402" href="#t1402">1402</a></span><span class="t"> <span class="key">with</span> <span class="nam">tempfile</span><span class="op">.</span><span class="nam">NamedTemporaryFile</span><span class="op">(</span><span class="nam">mode</span><span class="op">=</span><span class="str">"w+t"</span><span class="op">,</span> <span class="nam">encoding</span><span class="op">=</span><span class="str">"utf-8"</span><span class="op">)</span> <span class="key">as</span> <span class="nam">tmp</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1403" href="#t1403">1403</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">write_substvars</span><span class="op">(</span><span class="nam">tmp</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1404" href="#t1404">1404</a></span><span class="t"> <span class="nam">tmp</span><span class="op">.</span><span class="nam">flush</span><span class="op">(</span><span class="op">)</span> <span class="com"># Temping to use close, but then we have to manually delete the file.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1405" href="#t1405">1405</a></span><span class="t"> <span class="key">yield</span> <span class="nam">tmp</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1406" href="#t1406">1406</a></span><span class="t"> <span class="com"># Re-open; seek did not work when I last tried (if I did it work, feel free to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1407" href="#t1407">1407</a></span><span class="t"> <span class="com"># convert back to seek - as long as it works!)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1408" href="#t1408">1408</a></span><span class="t"> <span class="key">with</span> <span class="nam">open</span><span class="op">(</span><span class="nam">tmp</span><span class="op">.</span><span class="nam">name</span><span class="op">,</span> <span class="str">"rt"</span><span class="op">,</span> <span class="nam">encoding</span><span class="op">=</span><span class="str">"utf-8"</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1409" href="#t1409">1409</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">read_substvars</span><span class="op">(</span><span class="nam">fd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1410" href="#t1410">1410</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1411" href="#t1411">1411</a></span><span class="t"> <span class="key">def</span> <span class="nam">save</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1412" href="#t1412">1412</a></span><span class="t"> <span class="com"># Promote the debputy extension over `save()` for the plugins.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1413" href="#t1413">1413</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_substvars_path</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1414" href="#t1414">1414</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TypeError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1415" href="#t1415">1415</a></span><span class="t"> <span class="str">"Please use `flush()` extension to temporarily write the substvars to the file system"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1416" href="#t1416">1416</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1417" href="#t1417">1417</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">save</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1418" href="#t1418">1418</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1419" href="#t1419">1419</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1420" href="#t1420">1420</a></span><span class="t"><span class="key">class</span> <span class="nam">ServiceRegistry</span><span class="op">(</span><span class="nam">Generic</span><span class="op">[</span><span class="nam">DSD</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1421" href="#t1421">1421</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1422" href="#t1422">1422</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1423" href="#t1423">1423</a></span><span class="t"> <span class="key">def</span> <span class="nam">register_service</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1424" href="#t1424">1424</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1425" href="#t1425">1425</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1426" href="#t1426">1426</a></span><span class="t"> <span class="nam">name</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1427" href="#t1427">1427</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1428" href="#t1428">1428</a></span><span class="t"> <span class="nam">type_of_service</span><span class="op">:</span> <span class="nam">str</span> <span class="op">=</span> <span class="str">"service"</span><span class="op">,</span> <span class="com"># "timer", etc.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1429" href="#t1429">1429</a></span><span class="t"> <span class="nam">service_scope</span><span class="op">:</span> <span class="nam">str</span> <span class="op">=</span> <span class="str">"system"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1430" href="#t1430">1430</a></span><span class="t"> <span class="nam">enable_by_default</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1431" href="#t1431">1431</a></span><span class="t"> <span class="nam">start_by_default</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1432" href="#t1432">1432</a></span><span class="t"> <span class="nam">default_upgrade_rule</span><span class="op">:</span> <span class="nam">ServiceUpgradeRule</span> <span class="op">=</span> <span class="str">"restart"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1433" href="#t1433">1433</a></span><span class="t"> <span class="nam">service_context</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">DSD</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1434" href="#t1434">1434</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1435" href="#t1435">1435</a></span><span class="t"> <span class="str">"""Register a service detected in the package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1436" href="#t1436">1436</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1437" href="#t1437">1437</a></span><span class="t"><span class="str"> All the details will either be provided as-is or used as default when the plugin provided</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1438" href="#t1438">1438</a></span><span class="t"><span class="str"> integration code is called.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1439" href="#t1439">1439</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1440" href="#t1440">1440</a></span><span class="t"><span class="str"> Two services from different service managers are considered related when:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1441" href="#t1441">1441</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1442" href="#t1442">1442</a></span><span class="t"><span class="str"> 1) They are of the same type (`type_of_service`) and has the same scope (`service_scope`), AND</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1443" href="#t1443">1443</a></span><span class="t"><span class="str"> 2) Their plugin provided names has an overlap</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1444" href="#t1444">1444</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1445" href="#t1445">1445</a></span><span class="t"><span class="str"> Related services can be covered by the same service definition in the manifest.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1446" href="#t1446">1446</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1447" href="#t1447">1447</a></span><span class="t"><span class="str"> :param path: The path defining this service.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1448" href="#t1448">1448</a></span><span class="t"><span class="str"> :param name: The name of the service. Multiple ones can be provided if the service has aliases.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1449" href="#t1449">1449</a></span><span class="t"><span class="str"> Note that when providing multiple names, `debputy` will use the first name in the list as the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1450" href="#t1450">1450</a></span><span class="t"><span class="str"> default name if it has to choose. Any alternative name provided can be used by the packager</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1451" href="#t1451">1451</a></span><span class="t"><span class="str"> to identify this service.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1452" href="#t1452">1452</a></span><span class="t"><span class="str"> :param type_of_service: The type of service. By default, this is "service", but plugins can</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1453" href="#t1453">1453</a></span><span class="t"><span class="str"> provide other types (such as "timer" for the systemd timer unit).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1454" href="#t1454">1454</a></span><span class="t"><span class="str"> :param service_scope: The scope for this service. By default, this is "system" meaning the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1455" href="#t1455">1455</a></span><span class="t"><span class="str"> service is a system-wide service. Service managers can define their own scopes such as</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1456" href="#t1456">1456</a></span><span class="t"><span class="str"> "user" (which is used by systemd for "per-user" services).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1457" href="#t1457">1457</a></span><span class="t"><span class="str"> :param enable_by_default: Whether the service should be enabled by default, assuming the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1458" href="#t1458">1458</a></span><span class="t"><span class="str"> packager does not explicitly override this setting.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1459" href="#t1459">1459</a></span><span class="t"><span class="str"> :param start_by_default: Whether the service should be started by default on install, assuming</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1460" href="#t1460">1460</a></span><span class="t"><span class="str"> the packager does not explicitly override this setting.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1461" href="#t1461">1461</a></span><span class="t"><span class="str"> :param default_upgrade_rule: The default value for how the service should be processed during</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1462" href="#t1462">1462</a></span><span class="t"><span class="str"> upgrades. Options are:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1463" href="#t1463">1463</a></span><span class="t"><span class="str"> * `do-nothing`: The plugin should not interact with the running service (if any)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1464" href="#t1464">1464</a></span><span class="t"><span class="str"> (maintenance of the enabled start, start on install, etc. are still applicable)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1465" href="#t1465">1465</a></span><span class="t"><span class="str"> * `reload`: The plugin should attempt to reload the running service (if any).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1466" href="#t1466">1466</a></span><span class="t"><span class="str"> Note: In combination with `auto_start_in_install == False`, be careful to not</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1467" href="#t1467">1467</a></span><span class="t"><span class="str"> start the service if not is not already running.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1468" href="#t1468">1468</a></span><span class="t"><span class="str"> * `restart`: The plugin should attempt to restart the running service (if any).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1469" href="#t1469">1469</a></span><span class="t"><span class="str"> Note: In combination with `auto_start_in_install == False`, be careful to not</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1470" href="#t1470">1470</a></span><span class="t"><span class="str"> start the service if not is not already running.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1471" href="#t1471">1471</a></span><span class="t"><span class="str"> * `stop-then-start`: The plugin should stop the service during `prerm upgrade`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1472" href="#t1472">1472</a></span><span class="t"><span class="str"> and start it against in the `postinst` script.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1473" href="#t1473">1473</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1474" href="#t1474">1474</a></span><span class="t"><span class="str"> :param service_context: Any custom data that the detector want to pass along to the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1475" href="#t1475">1475</a></span><span class="t"><span class="str"> integrator for this service.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1476" href="#t1476">1476</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1477" href="#t1477">1477</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1478" href="#t1478">1478</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1479" href="#t1479">1479</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1480" href="#t1480">1480</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1481" href="#t1481">1481</a></span><span class="t"><span class="key">class</span> <span class="nam">ParserAttributeDocumentation</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1482" href="#t1482">1482</a></span><span class="t"> <span class="nam">attributes</span><span class="op">:</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1483" href="#t1483">1483</a></span><span class="t"> <span class="nam">description</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1484" href="#t1484">1484</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1485" href="#t1485">1485</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1486" href="#t1486">1486</a></span><span class="t"><span class="key">def</span> <span class="nam">undocumented_attr</span><span class="op">(</span><span class="nam">attr</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">ParserAttributeDocumentation</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1487" href="#t1487">1487</a></span><span class="t"> <span class="str">"""Describe an attribute as undocumented</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1488" href="#t1488">1488</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1489" href="#t1489">1489</a></span><span class="t"><span class="str"> If you for some reason do not want to document a particular attribute, you can mark it as</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1490" href="#t1490">1490</a></span><span class="t"><span class="str"> undocumented. This is required if you are only documenting a subset of the attributes,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1491" href="#t1491">1491</a></span><span class="t"><span class="str"> because `debputy` assumes any omission to be a mistake.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1492" href="#t1492">1492</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1493" href="#t1493">1493</a></span><span class="t"> <span class="key">return</span> <span class="nam">ParserAttributeDocumentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1494" href="#t1494">1494</a></span><span class="t"> <span class="nam">frozenset</span><span class="op">(</span><span class="op">{</span><span class="nam">attr</span><span class="op">}</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1495" href="#t1495">1495</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1496" href="#t1496">1496</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1497" href="#t1497">1497</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1498" href="#t1498">1498</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1499" href="#t1499">1499</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1500" href="#t1500">1500</a></span><span class="t"><span class="key">class</span> <span class="nam">ParserDocumentation</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1501" href="#t1501">1501</a></span><span class="t"> <span class="nam">title</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1502" href="#t1502">1502</a></span><span class="t"> <span class="nam">description</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1503" href="#t1503">1503</a></span><span class="t"> <span class="nam">attribute_doc</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Sequence</span><span class="op">[</span><span class="nam">ParserAttributeDocumentation</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1504" href="#t1504">1504</a></span><span class="t"> <span class="nam">alt_parser_description</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1505" href="#t1505">1505</a></span><span class="t"> <span class="nam">documentation_reference_url</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1506" href="#t1506">1506</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1507" href="#t1507">1507</a></span><span class="t"> <span class="key">def</span> <span class="nam">replace</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">**</span><span class="nam">changes</span><span class="op">:</span> <span class="nam">Any</span><span class="op">)</span> <span class="op">-></span> <span class="str">"ParserDocumentation"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1508" href="#t1508">1508</a></span><span class="t"> <span class="key">return</span> <span class="nam">dataclasses</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">**</span><span class="nam">changes</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1509" href="#t1509">1509</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1510" href="#t1510">1510</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1511" href="#t1511">1511</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1512" href="#t1512">1512</a></span><span class="t"><span class="key">class</span> <span class="nam">TypeMappingExample</span><span class="op">(</span><span class="nam">Generic</span><span class="op">[</span><span class="nam">S</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1513" href="#t1513">1513</a></span><span class="t"> <span class="nam">source_input</span><span class="op">:</span> <span class="nam">S</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1514" href="#t1514">1514</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1515" href="#t1515">1515</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1516" href="#t1516">1516</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1517" href="#t1517">1517</a></span><span class="t"><span class="key">class</span> <span class="nam">TypeMappingDocumentation</span><span class="op">(</span><span class="nam">Generic</span><span class="op">[</span><span class="nam">S</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1518" href="#t1518">1518</a></span><span class="t"> <span class="nam">description</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1519" href="#t1519">1519</a></span><span class="t"> <span class="nam">examples</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">TypeMappingExample</span><span class="op">[</span><span class="nam">S</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="nam">tuple</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1520" href="#t1520">1520</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1521" href="#t1521">1521</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1522" href="#t1522">1522</a></span><span class="t"><span class="key">def</span> <span class="nam">type_mapping_example</span><span class="op">(</span><span class="nam">source_input</span><span class="op">:</span> <span class="nam">S</span><span class="op">)</span> <span class="op">-></span> <span class="nam">TypeMappingExample</span><span class="op">[</span><span class="nam">S</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1523" href="#t1523">1523</a></span><span class="t"> <span class="key">return</span> <span class="nam">TypeMappingExample</span><span class="op">(</span><span class="nam">source_input</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1524" href="#t1524">1524</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1525" href="#t1525">1525</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1526" href="#t1526">1526</a></span><span class="t"><span class="key">def</span> <span class="nam">type_mapping_reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1527" href="#t1527">1527</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1528" href="#t1528">1528</a></span><span class="t"> <span class="nam">description</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1529" href="#t1529">1529</a></span><span class="t"> <span class="nam">examples</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">TypeMappingExample</span><span class="op">[</span><span class="nam">S</span><span class="op">]</span><span class="op">,</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">TypeMappingExample</span><span class="op">[</span><span class="nam">S</span><span class="op">]</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="nam">tuple</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1530" href="#t1530">1530</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">TypeMappingDocumentation</span><span class="op">[</span><span class="nam">S</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1531" href="#t1531">1531</a></span><span class="t"> <span class="nam">e</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1532" href="#t1532">1532</a></span><span class="t"> <span class="nam">tuple</span><span class="op">(</span><span class="op">[</span><span class="nam">examples</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1533" href="#t1533">1533</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">examples</span><span class="op">,</span> <span class="nam">TypeMappingExample</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1534" href="#t1534">1534</a></span><span class="t"> <span class="key">else</span> <span class="nam">tuple</span><span class="op">(</span><span class="nam">examples</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1535" href="#t1535">1535</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1536" href="#t1536">1536</a></span><span class="t"> <span class="key">return</span> <span class="nam">TypeMappingDocumentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1537" href="#t1537">1537</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">description</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1538" href="#t1538">1538</a></span><span class="t"> <span class="nam">examples</span><span class="op">=</span><span class="nam">e</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1539" href="#t1539">1539</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1540" href="#t1540">1540</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1541" href="#t1541">1541</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1542" href="#t1542">1542</a></span><span class="t"><span class="key">def</span> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1543" href="#t1543">1543</a></span><span class="t"> <span class="nam">attr</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1544" href="#t1544">1544</a></span><span class="t"> <span class="nam">description</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1545" href="#t1545">1545</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">ParserAttributeDocumentation</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1546" href="#t1546">1546</a></span><span class="t"> <span class="str">"""Describe an attribute or a group of attributes</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1547" href="#t1547">1547</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1548" href="#t1548">1548</a></span><span class="t"><span class="str"> :param attr: A single attribute or a sequence of attributes. The attribute must be the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1549" href="#t1549">1549</a></span><span class="t"><span class="str"> attribute name as used in the source format version of the TypedDict.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1550" href="#t1550">1550</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1551" href="#t1551">1551</a></span><span class="t"><span class="str"> If multiple attributes are provided, they will be documented together. This is often</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1552" href="#t1552">1552</a></span><span class="t"><span class="str"> useful if these attributes are strongly related (such as different names for the same</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1553" href="#t1553">1553</a></span><span class="t"><span class="str"> target attribute).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1554" href="#t1554">1554</a></span><span class="t"><span class="str"> :param description: The description the user should see for this attribute / these</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1555" href="#t1555">1555</a></span><span class="t"><span class="str"> attributes. This parameter can be a Python format string with variables listed in</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1556" href="#t1556">1556</a></span><span class="t"><span class="str"> the description of `reference_documentation`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1557" href="#t1557">1557</a></span><span class="t"><span class="str"> :return: An opaque representation of the documentation,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1558" href="#t1558">1558</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1559" href="#t1559">1559</a></span><span class="t"> <span class="nam">attributes</span> <span class="op">=</span> <span class="op">[</span><span class="nam">attr</span><span class="op">]</span> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">attr</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span> <span class="key">else</span> <span class="nam">attr</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1560" href="#t1560">1560</a></span><span class="t"> <span class="key">return</span> <span class="nam">ParserAttributeDocumentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1561" href="#t1561">1561</a></span><span class="t"> <span class="nam">frozenset</span><span class="op">(</span><span class="nam">attributes</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1562" href="#t1562">1562</a></span><span class="t"> <span class="nam">description</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1563" href="#t1563">1563</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1564" href="#t1564">1564</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1565" href="#t1565">1565</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1566" href="#t1566">1566</a></span><span class="t"><span class="key">def</span> <span class="nam">reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1567" href="#t1567">1567</a></span><span class="t"> <span class="nam">title</span><span class="op">:</span> <span class="nam">str</span> <span class="op">=</span> <span class="str">"Auto-generated reference documentation for {RULE_NAME}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1568" href="#t1568">1568</a></span><span class="t"> <span class="nam">description</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1569" href="#t1569">1569</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1570" href="#t1570">1570</a></span><span class="t"><span class="str"> This is an automatically generated reference documentation for {RULE_NAME}. It is generated</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1571" href="#t1571">1571</a></span><span class="t"><span class="str"> from input provided by {PLUGIN_NAME} via the debputy API.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1572" href="#t1572">1572</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1573" href="#t1573">1573</a></span><span class="t"><span class="str"> (If you are the provider of the {PLUGIN_NAME} plugin, you can replace this text with</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1574" href="#t1574">1574</a></span><span class="t"><span class="str"> your own documentation by providing the `inline_reference_documentation` when registering</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1575" href="#t1575">1575</a></span><span class="t"><span class="str"> the manifest rule.)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1576" href="#t1576">1576</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1577" href="#t1577">1577</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1578" href="#t1578">1578</a></span><span class="t"> <span class="nam">attributes</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Sequence</span><span class="op">[</span><span class="nam">ParserAttributeDocumentation</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1579" href="#t1579">1579</a></span><span class="t"> <span class="nam">non_mapping_description</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1580" href="#t1580">1580</a></span><span class="t"> <span class="nam">reference_documentation_url</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1581" href="#t1581">1581</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">ParserDocumentation</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1582" href="#t1582">1582</a></span><span class="t"> <span class="str">"""Provide inline reference documentation for the manifest snippet</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1583" href="#t1583">1583</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1584" href="#t1584">1584</a></span><span class="t"><span class="str"> For parameters that mention that they are a Python format, the following format variables</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1585" href="#t1585">1585</a></span><span class="t"><span class="str"> are available:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1586" href="#t1586">1586</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1587" href="#t1587">1587</a></span><span class="t"><span class="str"> * RULE_NAME: Name of the rule. If manifest snippet has aliases, this will be the name of</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1588" href="#t1588">1588</a></span><span class="t"><span class="str"> the alias provided by the user.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1589" href="#t1589">1589</a></span><span class="t"><span class="str"> * MANIFEST_FORMAT_DOC: Path OR URL to the "MANIFEST-FORMAT" reference documentation from</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1590" href="#t1590">1590</a></span><span class="t"><span class="str"> `debputy`. By using the MANIFEST_FORMAT_DOC variable, you ensure that you point to the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1591" href="#t1591">1591</a></span><span class="t"><span class="str"> file that matches the version of `debputy` itself.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1592" href="#t1592">1592</a></span><span class="t"><span class="str"> * PLUGIN_NAME: Name of the plugin providing this rule.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1593" href="#t1593">1593</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1594" href="#t1594">1594</a></span><span class="t"><span class="str"> :param title: The text you want the user to see as for your rule. A placeholder is provided by default.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1595" href="#t1595">1595</a></span><span class="t"><span class="str"> This parameter can be a Python format string with the above listed variables.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1596" href="#t1596">1596</a></span><span class="t"><span class="str"> :param description: The text you want the user to see as a description for the rule. An auto-generated</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1597" href="#t1597">1597</a></span><span class="t"><span class="str"> placeholder is provided by default saying that no human written documentation was provided.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1598" href="#t1598">1598</a></span><span class="t"><span class="str"> This parameter can be a Python format string with the above listed variables.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1599" href="#t1599">1599</a></span><span class="t"><span class="str"> :param attributes: A sequence of attribute-related documentation. Each element of the sequence should</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1600" href="#t1600">1600</a></span><span class="t"><span class="str"> be the result of `documented_attr` or `undocumented_attr`. The sequence must cover all source</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1601" href="#t1601">1601</a></span><span class="t"><span class="str"> attributes exactly once.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1602" href="#t1602">1602</a></span><span class="t"><span class="str"> :param non_mapping_description: The text you want the user to see as the description for your rule when</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1603" href="#t1603">1603</a></span><span class="t"><span class="str"> `debputy` describes its non-mapping format. Must not be provided for rules that do not have an</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1604" href="#t1604">1604</a></span><span class="t"><span class="str"> (optional) non-mapping format as source format. This parameter can be a Python format string with</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1605" href="#t1605">1605</a></span><span class="t"><span class="str"> the above listed variables.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1606" href="#t1606">1606</a></span><span class="t"><span class="str"> :param reference_documentation_url: A URL to the reference documentation.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1607" href="#t1607">1607</a></span><span class="t"><span class="str"> :return: An opaque representation of the documentation,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1608" href="#t1608">1608</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1609" href="#t1609">1609</a></span><span class="t"> <span class="key">return</span> <span class="nam">ParserDocumentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1610" href="#t1610">1610</a></span><span class="t"> <span class="nam">title</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1611" href="#t1611">1611</a></span><span class="t"> <span class="nam">description</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1612" href="#t1612">1612</a></span><span class="t"> <span class="nam">attributes</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1613" href="#t1613">1613</a></span><span class="t"> <span class="nam">non_mapping_description</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1614" href="#t1614">1614</a></span><span class="t"> <span class="nam">reference_documentation_url</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1615" href="#t1615">1615</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1616" href="#t1616">1616</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1617" href="#t1617">1617</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1618" href="#t1618">1618</a></span><span class="t"><span class="key">class</span> <span class="nam">ServiceDefinition</span><span class="op">(</span><span class="nam">Generic</span><span class="op">[</span><span class="nam">DSD</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1619" href="#t1619">1619</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1620" href="#t1620">1620</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1621" href="#t1621">1621</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1622" href="#t1622">1622</a></span><span class="t"> <span class="key">def</span> <span class="nam">name</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1623" href="#t1623">1623</a></span><span class="t"> <span class="str">"""Name of the service registered by the plugin</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1624" href="#t1624">1624</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1625" href="#t1625">1625</a></span><span class="t"><span class="str"> This is always a plugin provided name for this service (that is, `x.name in x.names`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1626" href="#t1626">1626</a></span><span class="t"><span class="str"> will always be `True`). Where possible, this will be the same as the one that the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1627" href="#t1627">1627</a></span><span class="t"><span class="str"> packager provided when they provided any configuration related to this service.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1628" href="#t1628">1628</a></span><span class="t"><span class="str"> When not possible, this will be the first name provided by the plugin (`x.names[0]`).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1629" href="#t1629">1629</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1630" href="#t1630">1630</a></span><span class="t"><span class="str"> If all the aliases are equal, then using this attribute will provide traceability</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1631" href="#t1631">1631</a></span><span class="t"><span class="str"> between the manifest and the generated maintscript snippets. When the exact name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1632" href="#t1632">1632</a></span><span class="t"><span class="str"> used is important, the plugin should ignore this attribute and pick the name that</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1633" href="#t1633">1633</a></span><span class="t"><span class="str"> is needed.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1634" href="#t1634">1634</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1635" href="#t1635">1635</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1636" href="#t1636">1636</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1637" href="#t1637">1637</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1638" href="#t1638">1638</a></span><span class="t"> <span class="key">def</span> <span class="nam">names</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1639" href="#t1639">1639</a></span><span class="t"> <span class="str">"""All *plugin provided* names and aliases of the service</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1640" href="#t1640">1640</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1641" href="#t1641">1641</a></span><span class="t"><span class="str"> This is the name/sequence of names that the plugin provided when it registered</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1642" href="#t1642">1642</a></span><span class="t"><span class="str"> the service earlier.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1643" href="#t1643">1643</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1644" href="#t1644">1644</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1645" href="#t1645">1645</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1646" href="#t1646">1646</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1647" href="#t1647">1647</a></span><span class="t"> <span class="key">def</span> <span class="nam">path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">VirtualPath</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1648" href="#t1648">1648</a></span><span class="t"> <span class="str">"""The registered path for this service</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1649" href="#t1649">1649</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1650" href="#t1650">1650</a></span><span class="t"><span class="str"> :return: The path that was associated with this service when it was registered</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1651" href="#t1651">1651</a></span><span class="t"><span class="str"> earlier.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1652" href="#t1652">1652</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1653" href="#t1653">1653</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1654" href="#t1654">1654</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1655" href="#t1655">1655</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1656" href="#t1656">1656</a></span><span class="t"> <span class="key">def</span> <span class="nam">type_of_service</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1657" href="#t1657">1657</a></span><span class="t"> <span class="str">"""Type of the service such as "service" (daemon), "timer", etc.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1658" href="#t1658">1658</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1659" href="#t1659">1659</a></span><span class="t"><span class="str"> :return: The type of service scope. It is the same value as the one as the plugin provided</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1660" href="#t1660">1660</a></span><span class="t"><span class="str"> when registering the service (if not explicitly provided, it defaults to "service").</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1661" href="#t1661">1661</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1662" href="#t1662">1662</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1663" href="#t1663">1663</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1664" href="#t1664">1664</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1665" href="#t1665">1665</a></span><span class="t"> <span class="key">def</span> <span class="nam">service_scope</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1666" href="#t1666">1666</a></span><span class="t"> <span class="str">"""Service scope such as "system" or "user"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1667" href="#t1667">1667</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1668" href="#t1668">1668</a></span><span class="t"><span class="str"> :return: The service scope. It is the same value as the one as the plugin provided</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1669" href="#t1669">1669</a></span><span class="t"><span class="str"> when registering the service (if not explicitly provided, it defaults to "system")</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1670" href="#t1670">1670</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1671" href="#t1671">1671</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1672" href="#t1672">1672</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1673" href="#t1673">1673</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1674" href="#t1674">1674</a></span><span class="t"> <span class="key">def</span> <span class="nam">auto_enable_on_install</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1675" href="#t1675">1675</a></span><span class="t"> <span class="str">"""Whether the service should be auto-enabled on install</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1676" href="#t1676">1676</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1677" href="#t1677">1677</a></span><span class="t"><span class="str"> :return: True if the service should be enabled automatically, false if not.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1678" href="#t1678">1678</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1679" href="#t1679">1679</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1680" href="#t1680">1680</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1681" href="#t1681">1681</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1682" href="#t1682">1682</a></span><span class="t"> <span class="key">def</span> <span class="nam">auto_start_on_install</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1683" href="#t1683">1683</a></span><span class="t"> <span class="str">"""Whether the service should be auto-started on install</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1684" href="#t1684">1684</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1685" href="#t1685">1685</a></span><span class="t"><span class="str"> :return: True if the service should be started automatically, false if not.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1686" href="#t1686">1686</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1687" href="#t1687">1687</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1688" href="#t1688">1688</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1689" href="#t1689">1689</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1690" href="#t1690">1690</a></span><span class="t"> <span class="key">def</span> <span class="nam">on_upgrade</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">ServiceUpgradeRule</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1691" href="#t1691">1691</a></span><span class="t"> <span class="str">"""How to handle the service during an upgrade</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1692" href="#t1692">1692</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1693" href="#t1693">1693</a></span><span class="t"><span class="str"> Options are:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1694" href="#t1694">1694</a></span><span class="t"><span class="str"> * `do-nothing`: The plugin should not interact with the running service (if any)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1695" href="#t1695">1695</a></span><span class="t"><span class="str"> (maintenance of the enabled start, start on install, etc. are still applicable)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1696" href="#t1696">1696</a></span><span class="t"><span class="str"> * `reload`: The plugin should attempt to reload the running service (if any).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1697" href="#t1697">1697</a></span><span class="t"><span class="str"> Note: In combination with `auto_start_in_install == False`, be careful to not</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1698" href="#t1698">1698</a></span><span class="t"><span class="str"> start the service if not is not already running.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1699" href="#t1699">1699</a></span><span class="t"><span class="str"> * `restart`: The plugin should attempt to restart the running service (if any).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1700" href="#t1700">1700</a></span><span class="t"><span class="str"> Note: In combination with `auto_start_in_install == False`, be careful to not</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1701" href="#t1701">1701</a></span><span class="t"><span class="str"> start the service if not is not already running.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1702" href="#t1702">1702</a></span><span class="t"><span class="str"> * `stop-then-start`: The plugin should stop the service during `prerm upgrade`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1703" href="#t1703">1703</a></span><span class="t"><span class="str"> and start it against in the `postinst` script.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1704" href="#t1704">1704</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1705" href="#t1705">1705</a></span><span class="t"><span class="str"> Note: In all cases, the plugin should still consider what to do in</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1706" href="#t1706">1706</a></span><span class="t"><span class="str"> `prerm remove`, which is the last point in time where the plugin can rely on the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1707" href="#t1707">1707</a></span><span class="t"><span class="str"> service definitions in the file systems to stop the services when the package is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1708" href="#t1708">1708</a></span><span class="t"><span class="str"> being uninstalled.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1709" href="#t1709">1709</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1710" href="#t1710">1710</a></span><span class="t"><span class="str"> :return: The service restart rule</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1711" href="#t1711">1711</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1712" href="#t1712">1712</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1713" href="#t1713">1713</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1714" href="#t1714">1714</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1715" href="#t1715">1715</a></span><span class="t"> <span class="key">def</span> <span class="nam">definition_source</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1716" href="#t1716">1716</a></span><span class="t"> <span class="str">"""Describes where this definition came from</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1717" href="#t1717">1717</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1718" href="#t1718">1718</a></span><span class="t"><span class="str"> If the definition is provided by the packager, then this will reference the part</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1719" href="#t1719">1719</a></span><span class="t"><span class="str"> of the manifest that made this definition. Otherwise, this will be a reference</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1720" href="#t1720">1720</a></span><span class="t"><span class="str"> to the plugin providing this definition.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1721" href="#t1721">1721</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1722" href="#t1722">1722</a></span><span class="t"><span class="str"> :return: The source of this definition</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1723" href="#t1723">1723</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1724" href="#t1724">1724</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1725" href="#t1725">1725</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1726" href="#t1726">1726</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1727" href="#t1727">1727</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_plugin_provided_definition</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1728" href="#t1728">1728</a></span><span class="t"> <span class="str">"""Whether the definition source points to the plugin or a package provided definition</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1729" href="#t1729">1729</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1730" href="#t1730">1730</a></span><span class="t"><span class="str"> :return: True if definition is 100% from the plugin. False if the definition is partially</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1731" href="#t1731">1731</a></span><span class="t"><span class="str"> or fully from another source (usually, the packager via the manifest).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1732" href="#t1732">1732</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1733" href="#t1733">1733</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1734" href="#t1734">1734</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1735" href="#t1735">1735</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1736" href="#t1736">1736</a></span><span class="t"> <span class="key">def</span> <span class="nam">service_context</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">DSD</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1737" href="#t1737">1737</a></span><span class="t"> <span class="str">"""Custom service context (if any) provided by the detector code of the plugin</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1738" href="#t1738">1738</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1739" href="#t1739">1739</a></span><span class="t"><span class="str"> :return: If the detection code provided a custom data when registering the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1740" href="#t1740">1740</a></span><span class="t"><span class="str"> service, this attribute will reference that data. If nothing was provided,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1741" href="#t1741">1741</a></span><span class="t"><span class="str"> then this attribute will be None.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1742" href="#t1742">1742</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1743" href="#t1743">1743</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_64287305fe0c6642_plugin_parser_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_4b9be07fb6071cd2___init___py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_6c155ce9dd9f7742___init___py.html b/coverage-report/d_6c155ce9dd9f7742___init___py.html deleted file mode 100644 index 2481545..0000000 --- a/coverage-report/d_6c155ce9dd9f7742___init___py.html +++ /dev/null @@ -1,108 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/yaml/__init__.py: 100%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/yaml/__init__.py</b>: - <span class="pc_cov">100%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">3 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">3<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">0<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_version_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_6c155ce9dd9f7742_compat_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">compat</span> <span class="key">import</span> <span class="nam">YAML</span><span class="op">,</span> <span class="nam">YAMLError</span><span class="op">,</span> <span class="nam">MarkedYAMLError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="nam">MANIFEST_YAML</span> <span class="op">=</span> <span class="nam">YAML</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="nam">__all__</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="str">"MANIFEST_YAML"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="str">"YAMLError"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="str">"MarkedYAMLError"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_version_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_6c155ce9dd9f7742_compat_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_6c155ce9dd9f7742_compat_py.html b/coverage-report/d_6c155ce9dd9f7742_compat_py.html deleted file mode 100644 index 06aa381..0000000 --- a/coverage-report/d_6c155ce9dd9f7742_compat_py.html +++ /dev/null @@ -1,118 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/yaml/compat.py: 56%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/yaml/compat.py</b>: - <span class="pc_cov">56%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">9 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">5<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">4<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_6c155ce9dd9f7742___init___py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="index.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="nam">__all__</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"> <span class="str">"YAML"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"> <span class="str">"YAMLError"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> <span class="str">"MarkedYAMLError"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> <span class="str">"Node"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="str">"LineCol"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="str">"CommentedBase"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="str">"CommentedMap"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="str">"CommentedSeq"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="key">from</span> <span class="nam">ruyaml</span> <span class="key">import</span> <span class="nam">YAMLError</span><span class="op">,</span> <span class="nam">YAML</span><span class="op">,</span> <span class="nam">Node</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="key">from</span> <span class="nam">ruyaml</span><span class="op">.</span><span class="nam">comments</span> <span class="key">import</span> <span class="nam">LineCol</span><span class="op">,</span> <span class="nam">CommentedBase</span><span class="op">,</span> <span class="nam">CommentedMap</span><span class="op">,</span> <span class="nam">CommentedSeq</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="key">from</span> <span class="nam">ruyaml</span><span class="op">.</span><span class="nam">error</span> <span class="key">import</span> <span class="nam">MarkedYAMLError</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"><span class="key">except</span> <span class="op">(</span><span class="nam">ImportError</span><span class="op">,</span> <span class="nam">ModuleNotFoundError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="key">from</span> <span class="nam">ruamel</span><span class="op">.</span><span class="nam">yaml</span> <span class="key">import</span> <span class="nam">YAMLError</span><span class="op">,</span> <span class="nam">YAML</span><span class="op">,</span> <span class="nam">Node</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="key">from</span> <span class="nam">ruamel</span><span class="op">.</span><span class="nam">yaml</span><span class="op">.</span><span class="nam">comments</span> <span class="key">import</span> <span class="nam">LineCol</span><span class="op">,</span> <span class="nam">CommentedBase</span><span class="op">,</span> <span class="nam">CommentedMap</span><span class="op">,</span> <span class="nam">CommentedSeq</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="key">from</span> <span class="nam">ruamel</span><span class="op">.</span><span class="nam">yaml</span><span class="op">.</span><span class="nam">error</span> <span class="key">import</span> <span class="nam">MarkedYAMLError</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_6c155ce9dd9f7742___init___py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="index.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_6e57078c9ef7177d___init___py.html b/coverage-report/d_6e57078c9ef7177d___init___py.html deleted file mode 100644 index 1b88a9d..0000000 --- a/coverage-report/d_6e57078c9ef7177d___init___py.html +++ /dev/null @@ -1,99 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/commands/debputy_cmd/__init__.py: 100%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/commands/debputy_cmd/__init__.py</b>: - <span class="pc_cov">100%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">0 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">0<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">0<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_2882d0a735873825_deb_packer_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_6e57078c9ef7177d_context_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_2882d0a735873825_deb_packer_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_6e57078c9ef7177d_context_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_6e57078c9ef7177d_context_py.html b/coverage-report/d_6e57078c9ef7177d_context_py.html deleted file mode 100644 index bd5b3ce..0000000 --- a/coverage-report/d_6e57078c9ef7177d_context_py.html +++ /dev/null @@ -1,715 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/commands/debputy_cmd/context.py: 42%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/commands/debputy_cmd/context.py</b>: - <span class="pc_cov">42%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">283 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">131<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">152<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">4<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">2<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_6e57078c9ef7177d___init___py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_6e57078c9ef7177d_dc_util_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">argparse</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">dataclasses</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">errno</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">Mapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">FrozenSet</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">Set</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">Sequence</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">Iterable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">Callable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">Dict</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">TYPE_CHECKING</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"><span class="key">from</span> <span class="nam">debian</span><span class="op">.</span><span class="nam">debian_support</span> <span class="key">import</span> <span class="nam">DpkgArchTable</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">_deb_options_profiles</span> <span class="key">import</span> <span class="nam">DebBuildOptionsAndProfiles</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">architecture_support</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="nam">DpkgArchitectureBuildProcessValuesTable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">dpkg_architecture_table</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">exceptions</span> <span class="key">import</span> <span class="nam">DebputyRuntimeError</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">filesystem_scan</span> <span class="key">import</span> <span class="nam">FSROOverlay</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">highlevel_manifest</span> <span class="key">import</span> <span class="nam">HighLevelManifest</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">highlevel_manifest_parser</span> <span class="key">import</span> <span class="nam">YAMLManifestParser</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">packages</span> <span class="key">import</span> <span class="nam">SourcePackage</span><span class="op">,</span> <span class="nam">BinaryPackage</span><span class="op">,</span> <span class="nam">parse_source_debian_control</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="nam">VirtualPath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">impl</span> <span class="key">import</span> <span class="nam">load_plugin_features</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">feature_set</span> <span class="key">import</span> <span class="nam">PluginProvidedFeatureSet</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">substitution</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="nam">Substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="nam">VariableContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="nam">SubstitutionImpl</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="nam">NULL_SUBSTITUTION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">_error</span><span class="op">,</span> <span class="nam">PKGNAME_REGEX</span><span class="op">,</span> <span class="nam">resolve_source_date_epoch</span><span class="op">,</span> <span class="nam">setup_logging</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"><span class="key">if</span> <span class="nam">TYPE_CHECKING</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="key">from</span> <span class="nam">argparse</span> <span class="key">import</span> <span class="nam">_SubParsersAction</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"><span class="nam">CommandHandler</span> <span class="op">=</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="str">"CommandContext"</span><span class="op">]</span><span class="op">,</span> <span class="key">None</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"><span class="nam">ArgparserConfigurator</span> <span class="op">=</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">argparse</span><span class="op">.</span><span class="nam">ArgumentParser</span><span class="op">]</span><span class="op">,</span> <span class="key">None</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"><span class="key">def</span> <span class="nam">add_arg</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="op">*</span><span class="nam">name_or_flags</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="op">**</span><span class="nam">kwargs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">argparse</span><span class="op">.</span><span class="nam">ArgumentParser</span><span class="op">]</span><span class="op">,</span> <span class="key">None</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="key">def</span> <span class="nam">_configurator</span><span class="op">(</span><span class="nam">argparser</span><span class="op">:</span> <span class="nam">argparse</span><span class="op">.</span><span class="nam">ArgumentParser</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="nam">argparser</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="op">*</span><span class="nam">name_or_flags</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="op">**</span><span class="nam">kwargs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="key">return</span> <span class="nam">_configurator</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"><span class="key">class</span> <span class="nam">CommandArg</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="nam">parsed_args</span><span class="op">:</span> <span class="nam">argparse</span><span class="op">.</span><span class="nam">Namespace</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="nam">plugin_search_dirs</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"><span class="key">class</span> <span class="nam">Command</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="nam">handler</span><span class="op">:</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="str">"CommandContext"</span><span class="op">]</span><span class="op">,</span> <span class="key">None</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="nam">require_substitution</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="nam">requested_plugins_only</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"><span class="key">class</span> <span class="nam">CommandContext</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="nam">parsed_args</span><span class="op">:</span> <span class="nam">argparse</span><span class="op">.</span><span class="nam">Namespace</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="nam">plugin_search_dirs</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="nam">require_substitution</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="nam">requested_plugins_only</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">parsed_args</span> <span class="op">=</span> <span class="nam">parsed_args</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">plugin_search_dirs</span> <span class="op">=</span> <span class="nam">plugin_search_dirs</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_require_substitution</span> <span class="op">=</span> <span class="nam">require_substitution</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_requested_plugins_only</span> <span class="op">=</span> <span class="nam">requested_plugins_only</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_debputy_plugin_feature_set</span><span class="op">:</span> <span class="nam">PluginProvidedFeatureSet</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="nam">PluginProvidedFeatureSet</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_debian_dir</span> <span class="op">=</span> <span class="nam">FSROOverlay</span><span class="op">.</span><span class="nam">create_root_dir</span><span class="op">(</span><span class="str">"debian"</span><span class="op">,</span> <span class="str">"debian"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_mtime</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_source_variables</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_substitution</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Substitution</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_requested_plugins</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugins_loaded</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_dctrl_data</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="nam">DpkgArchitectureBuildProcessValuesTable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="nam">DpkgArchTable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="nam">DebBuildOptionsAndProfiles</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="str">"SourcePackage"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="str">"BinaryPackage"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="key">def</span> <span class="nam">debian_dir</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">VirtualPath</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_debian_dir</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="key">def</span> <span class="nam">mtime</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_mtime</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_mtime</span> <span class="op">=</span> <span class="nam">resolve_source_date_epoch</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="nam">substitution</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_mtime</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="key">def</span> <span class="nam">source_package</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">SourcePackage</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="nam">_a</span><span class="op">,</span> <span class="nam">_b</span><span class="op">,</span> <span class="nam">_c</span><span class="op">,</span> <span class="nam">source</span><span class="op">,</span> <span class="nam">_d</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parse_dctrl</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="key">return</span> <span class="nam">source</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="key">def</span> <span class="nam">binary_packages</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="str">"BinaryPackage"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="nam">_a</span><span class="op">,</span> <span class="nam">_b</span><span class="op">,</span> <span class="nam">_c</span><span class="op">,</span> <span class="nam">_source</span><span class="op">,</span> <span class="nam">binary_package_table</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parse_dctrl</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="key">return</span> <span class="nam">binary_package_table</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="key">def</span> <span class="nam">requested_plugins</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_requested_plugins</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_requested_plugins</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_resolve_requested_plugins</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_requested_plugins</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="key">def</span> <span class="nam">required_plugins</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="key">return</span> <span class="nam">set</span><span class="op">(</span><span class="nam">getattr</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">parsed_args</span><span class="op">,</span> <span class="str">"required_plugins"</span><span class="op">)</span> <span class="key">or</span> <span class="op">[</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="key">def</span> <span class="nam">deb_build_options_and_profiles</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="str">"DebBuildOptionsAndProfiles"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="nam">_a</span><span class="op">,</span> <span class="nam">_b</span><span class="op">,</span> <span class="nam">deb_build_options_and_profiles</span><span class="op">,</span> <span class="nam">_c</span><span class="op">,</span> <span class="nam">_d</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parse_dctrl</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="key">return</span> <span class="nam">deb_build_options_and_profiles</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="key">def</span> <span class="nam">deb_build_options</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">deb_build_options_and_profiles</span><span class="op">.</span><span class="nam">deb_build_options</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="key">def</span> <span class="nam">_create_substitution</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="nam">parsed_args</span><span class="op">:</span> <span class="nam">argparse</span><span class="op">.</span><span class="nam">Namespace</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="nam">plugin_feature_set</span><span class="op">:</span> <span class="nam">PluginProvidedFeatureSet</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Substitution</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="nam">requested_subst</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_require_substitution</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="key">if</span> <span class="nam">hasattr</span><span class="op">(</span><span class="nam">parsed_args</span><span class="op">,</span> <span class="str">"substitution"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="nam">requested_subst</span> <span class="op">=</span> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">substitution</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="key">if</span> <span class="nam">requested_subst</span> <span class="key">is</span> <span class="key">False</span> <span class="key">and</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_require_substitution</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span><span class="str">f"--no-substitution cannot be used with {parsed_args.command}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_require_substitution</span> <span class="key">or</span> <span class="nam">requested_subst</span> <span class="key">is</span> <span class="key">not</span> <span class="key">False</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="nam">variable_context</span> <span class="op">=</span> <span class="nam">VariableContext</span><span class="op">(</span><span class="nam">debian_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="key">return</span> <span class="nam">SubstitutionImpl</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="nam">plugin_feature_set</span><span class="op">=</span><span class="nam">plugin_feature_set</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="nam">unresolvable_substitutions</span><span class="op">=</span><span class="nam">frozenset</span><span class="op">(</span><span class="op">[</span><span class="str">"PACKAGE"</span><span class="op">]</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="nam">variable_context</span><span class="op">=</span><span class="nam">variable_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="key">return</span> <span class="nam">NULL_SUBSTITUTION</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="key">def</span> <span class="nam">load_plugins</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">PluginProvidedFeatureSet</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugins_loaded</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="nam">requested_plugins</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="nam">required_plugins</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">required_plugins</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_requested_plugins_only</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="nam">requested_plugins</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">requested_plugins</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="nam">debug_mode</span> <span class="op">=</span> <span class="nam">getattr</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">parsed_args</span><span class="op">,</span> <span class="str">"debug_mode"</span><span class="op">,</span> <span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="nam">load_plugin_features</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">plugin_search_dirs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="nam">requested_plugins_only</span><span class="op">=</span><span class="nam">requested_plugins</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="nam">required_plugins</span><span class="op">=</span><span class="nam">required_plugins</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="nam">plugin_feature_set</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">_debputy_plugin_feature_set</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="nam">debug_mode</span><span class="op">=</span><span class="nam">debug_mode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugins_loaded</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_debputy_plugin_feature_set</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="op">@</span><span class="nam">staticmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="key">def</span> <span class="nam">_plugin_from_dependency_field</span><span class="op">(</span><span class="nam">dep_field</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="nam">package_prefix</span> <span class="op">=</span> <span class="str">"debputy-plugin-"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="key">for</span> <span class="nam">dep_clause</span> <span class="key">in</span> <span class="op">(</span><span class="nam">d</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span> <span class="key">for</span> <span class="nam">d</span> <span class="key">in</span> <span class="nam">dep_field</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="str">","</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="nam">dep</span> <span class="op">=</span> <span class="nam">dep_clause</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="str">"|"</span><span class="op">)</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">dep</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="nam">package_prefix</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="nam">PKGNAME_REGEX</span><span class="op">.</span><span class="nam">search</span><span class="op">(</span><span class="nam">dep</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="key">assert</span> <span class="nam">m</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="nam">package_name</span> <span class="op">=</span> <span class="nam">m</span><span class="op">.</span><span class="nam">group</span><span class="op">(</span><span class="num">0</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="nam">plugin_name</span> <span class="op">=</span> <span class="nam">package_name</span><span class="op">[</span><span class="nam">len</span><span class="op">(</span><span class="nam">package_prefix</span><span class="op">)</span> <span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="key">yield</span> <span class="nam">plugin_name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="key">def</span> <span class="nam">_resolve_requested_plugins</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="nam">_a</span><span class="op">,</span> <span class="nam">_b</span><span class="op">,</span> <span class="nam">_c</span><span class="op">,</span> <span class="nam">source_package</span><span class="op">,</span> <span class="nam">_d</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parse_dctrl</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="nam">bd</span> <span class="op">=</span> <span class="nam">source_package</span><span class="op">.</span><span class="nam">fields</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"Build-Depends"</span><span class="op">,</span> <span class="str">""</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="nam">plugins</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_from_dependency_field</span><span class="op">(</span><span class="nam">bd</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="key">for</span> <span class="nam">field_name</span> <span class="key">in</span> <span class="op">(</span><span class="str">"Build-Depends-Arch"</span><span class="op">,</span> <span class="str">"Build-Depends-Indep"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="nam">f</span> <span class="op">=</span> <span class="nam">source_package</span><span class="op">.</span><span class="nam">fields</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">field_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">f</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="key">for</span> <span class="nam">plugin</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_plugin_from_dependency_field</span><span class="op">(</span><span class="nam">f</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="key">raise</span> <span class="nam">DebputyRuntimeError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="str">f"Cannot load plugins via {field_name}:"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="str">f" Please move debputy-plugin-{plugin} dependency to Build-Depends."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="key">return</span> <span class="nam">plugins</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="key">def</span> <span class="nam">substitution</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Substitution</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_substitution</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_substitution</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_create_substitution</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">parsed_args</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_debputy_plugin_feature_set</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">debian_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_substitution</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="key">def</span> <span class="nam">must_be_called_in_source_root</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">debian_dir</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"control"</span><span class="op">)</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="str">"This subcommand must be run from a source package root; expecting debian/control to exist."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="key">def</span> <span class="nam">_parse_dctrl</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="nam">DpkgArchitectureBuildProcessValuesTable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="nam">DpkgArchTable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="nam">DebBuildOptionsAndProfiles</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="str">"SourcePackage"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="str">"BinaryPackage"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_dctrl_data</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="nam">build_env</span> <span class="op">=</span> <span class="nam">DebBuildOptionsAndProfiles</span><span class="op">.</span><span class="nam">instance</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="nam">dpkg_architecture_variables</span> <span class="op">=</span> <span class="nam">dpkg_architecture_table</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="nam">dpkg_arch_query_table</span> <span class="op">=</span> <span class="nam">DpkgArchTable</span><span class="op">.</span><span class="nam">load_arch_table</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="nam">packages</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">Set</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="key">if</span> <span class="nam">hasattr</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">parsed_args</span><span class="op">,</span> <span class="str">"packages"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="nam">packages</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">parsed_args</span><span class="op">.</span><span class="nam">packages</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="nam">debian_control</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">debian_dir</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"control"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="key">if</span> <span class="nam">debian_control</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="key">raise</span> <span class="nam">FileNotFoundError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="nam">errno</span><span class="op">.</span><span class="nam">ENOENT</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">strerror</span><span class="op">(</span><span class="nam">errno</span><span class="op">.</span><span class="nam">ENOENT</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">debian_dir</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">,</span> <span class="str">"control"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="nam">source_package</span><span class="op">,</span> <span class="nam">binary_packages</span> <span class="op">=</span> <span class="nam">parse_source_debian_control</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="nam">debian_control</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="nam">packages</span><span class="op">,</span> <span class="com"># -p/--package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="nam">set</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> <span class="com"># -N/--no-package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="key">False</span><span class="op">,</span> <span class="com"># -i</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="key">False</span><span class="op">,</span> <span class="com"># -a</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="nam">dpkg_architecture_variables</span><span class="op">=</span><span class="nam">dpkg_architecture_variables</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="nam">dpkg_arch_query_table</span><span class="op">=</span><span class="nam">dpkg_arch_query_table</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="nam">build_env</span><span class="op">=</span><span class="nam">build_env</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="key">assert</span> <span class="nam">packages</span> <span class="op"><=</span> <span class="nam">binary_packages</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="key">except</span> <span class="nam">FileNotFoundError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="com"># We are not using `must_be_called_in_source_root`, because we (in this case) require</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="com"># the file to be readable (that is, parse_source_debian_control can also raise a</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="com"># FileNotFoundError when trying to open the file).</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="str">"This subcommand must be run from a source package root; expecting debian/control to exist."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_dctrl_data</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="nam">dpkg_architecture_variables</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="nam">dpkg_arch_query_table</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="nam">build_env</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="nam">source_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="nam">binary_packages</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_dctrl_data</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="key">def</span> <span class="nam">has_dctrl_file</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="nam">debian_control</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">debian_dir</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"control"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="key">return</span> <span class="nam">debian_control</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="key">def</span> <span class="nam">manifest_parser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="nam">manifest_path</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">YAMLManifestParser</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="nam">substitution</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">substitution</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> <span class="nam">dpkg_architecture_variables</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="nam">dpkg_arch_query_table</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="nam">build_env</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="nam">source_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="nam">binary_packages</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="op">)</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parse_dctrl</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">parsed_args</span><span class="op">.</span><span class="nam">debputy_manifest</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> <span class="nam">manifest_path</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">parsed_args</span><span class="op">.</span><span class="nam">debputy_manifest</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="key">if</span> <span class="nam">manifest_path</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> <span class="nam">manifest_path</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">debian_dir</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">,</span> <span class="str">"debputy.manifest"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="key">return</span> <span class="nam">YAMLManifestParser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="nam">manifest_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="nam">source_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="nam">binary_packages</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="nam">substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="nam">dpkg_architecture_variables</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="nam">dpkg_arch_query_table</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="nam">build_env</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">load_plugins</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">debian_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="key">def</span> <span class="nam">parse_manifest</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="nam">manifest_path</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">HighLevelManifest</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> <span class="nam">substitution</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">substitution</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> <span class="nam">manifest_required</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> <span class="nam">dpkg_architecture_variables</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> <span class="nam">dpkg_arch_query_table</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> <span class="nam">build_env</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> <span class="nam">_</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> <span class="nam">binary_packages</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> <span class="op">)</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parse_dctrl</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">parsed_args</span><span class="op">.</span><span class="nam">debputy_manifest</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> <span class="nam">manifest_path</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">parsed_args</span><span class="op">.</span><span class="nam">debputy_manifest</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> <span class="nam">manifest_required</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> <span class="key">if</span> <span class="nam">manifest_path</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"> <span class="nam">manifest_path</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">debian_dir</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">,</span> <span class="str">"debputy.manifest"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> <span class="nam">parser</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">(</span><span class="nam">manifest_path</span><span class="op">=</span><span class="nam">manifest_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">environ</span><span class="op">[</span><span class="str">"SOURCE_DATE_EPOCH"</span><span class="op">]</span> <span class="op">=</span> <span class="nam">substitution</span><span class="op">.</span><span class="nam">substitute</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"> <span class="str">"{{SOURCE_DATE_EPOCH}}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> <span class="str">"Internal resolution"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"> <span class="key">if</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">isfile</span><span class="op">(</span><span class="nam">manifest_path</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"> <span class="key">return</span> <span class="nam">parser</span><span class="op">.</span><span class="nam">parse_manifest</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"> <span class="key">if</span> <span class="nam">manifest_required</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span><span class="str">f'The path "{manifest_path}" is not a file!'</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"> <span class="key">return</span> <span class="nam">parser</span><span class="op">.</span><span class="nam">build_manifest</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"><span class="key">class</span> <span class="nam">CommandBase</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"> <span class="key">def</span> <span class="nam">configure</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">argparser</span><span class="op">:</span> <span class="nam">argparse</span><span class="op">.</span><span class="nam">ArgumentParser</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"> <span class="com"># Does nothing by default</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"> <span class="key">def</span> <span class="nam">__call__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">command_arg</span><span class="op">:</span> <span class="nam">CommandArg</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"><span class="key">class</span> <span class="nam">SubcommandBase</span><span class="op">(</span><span class="nam">CommandBase</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"name"</span><span class="op">,</span> <span class="str">"aliases"</span><span class="op">,</span> <span class="str">"help_description"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"> <span class="nam">name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"> <span class="nam">aliases</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="nam">tuple</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"> <span class="nam">help_description</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">name</span> <span class="op">=</span> <span class="nam">name</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">aliases</span> <span class="op">=</span> <span class="nam">aliases</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">help_description</span> <span class="op">=</span> <span class="nam">help_description</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"> <span class="key">def</span> <span class="nam">add_subcommand_to_subparser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"> <span class="nam">subparser</span><span class="op">:</span> <span class="str">"_SubParsersAction"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">argparse</span><span class="op">.</span><span class="nam">ArgumentParser</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"> <span class="nam">parser</span> <span class="op">=</span> <span class="nam">subparser</span><span class="op">.</span><span class="nam">add_parser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"> <span class="nam">aliases</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">aliases</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t385" href="#t385">385</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">help_description</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t386" href="#t386">386</a></span><span class="t"> <span class="nam">allow_abbrev</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t387" href="#t387">387</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t388" href="#t388">388</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">configure</span><span class="op">(</span><span class="nam">parser</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t389" href="#t389">389</a></span><span class="t"> <span class="key">return</span> <span class="nam">parser</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t390" href="#t390">390</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t391" href="#t391">391</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t392" href="#t392">392</a></span><span class="t"><span class="key">class</span> <span class="nam">GenericSubCommand</span><span class="op">(</span><span class="nam">SubcommandBase</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t393" href="#t393">393</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t394" href="#t394">394</a></span><span class="t"> <span class="str">"_handler"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t395" href="#t395">395</a></span><span class="t"> <span class="str">"_configure_handler"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t396" href="#t396">396</a></span><span class="t"> <span class="str">"_require_substitution"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t397" href="#t397">397</a></span><span class="t"> <span class="str">"_requested_plugins_only"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t398" href="#t398">398</a></span><span class="t"> <span class="str">"_log_only_to_stderr"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t399" href="#t399">399</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t400" href="#t400">400</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t401" href="#t401">401</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t402" href="#t402">402</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t403" href="#t403">403</a></span><span class="t"> <span class="nam">name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t404" href="#t404">404</a></span><span class="t"> <span class="nam">handler</span><span class="op">:</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">CommandContext</span><span class="op">]</span><span class="op">,</span> <span class="key">None</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t405" href="#t405">405</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t406" href="#t406">406</a></span><span class="t"> <span class="nam">aliases</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="nam">tuple</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t407" href="#t407">407</a></span><span class="t"> <span class="nam">help_description</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t408" href="#t408">408</a></span><span class="t"> <span class="nam">configure_handler</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">argparse</span><span class="op">.</span><span class="nam">ArgumentParser</span><span class="op">]</span><span class="op">,</span> <span class="key">None</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t409" href="#t409">409</a></span><span class="t"> <span class="nam">require_substitution</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t410" href="#t410">410</a></span><span class="t"> <span class="nam">requested_plugins_only</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t411" href="#t411">411</a></span><span class="t"> <span class="nam">log_only_to_stderr</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t412" href="#t412">412</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t413" href="#t413">413</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="nam">name</span><span class="op">,</span> <span class="nam">aliases</span><span class="op">=</span><span class="nam">aliases</span><span class="op">,</span> <span class="nam">help_description</span><span class="op">=</span><span class="nam">help_description</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t414" href="#t414">414</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_handler</span> <span class="op">=</span> <span class="nam">handler</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t415" href="#t415">415</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_configure_handler</span> <span class="op">=</span> <span class="nam">configure_handler</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t416" href="#t416">416</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_require_substitution</span> <span class="op">=</span> <span class="nam">require_substitution</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t417" href="#t417">417</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_requested_plugins_only</span> <span class="op">=</span> <span class="nam">requested_plugins_only</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t418" href="#t418">418</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_log_only_to_stderr</span> <span class="op">=</span> <span class="nam">log_only_to_stderr</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t419" href="#t419">419</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t420" href="#t420">420</a></span><span class="t"> <span class="key">def</span> <span class="nam">configure_handler</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t421" href="#t421">421</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t422" href="#t422">422</a></span><span class="t"> <span class="nam">handler</span><span class="op">:</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">argparse</span><span class="op">.</span><span class="nam">ArgumentParser</span><span class="op">]</span><span class="op">,</span> <span class="key">None</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t423" href="#t423">423</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t424" href="#t424">424</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_configure_handler</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">424 ↛ 425</span><span class="annotate long">line 424 didn't jump to line 425, because the condition on line 424 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t425" href="#t425">425</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TypeError</span><span class="op">(</span><span class="str">"Only one argument handler can be provided"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t426" href="#t426">426</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_configure_handler</span> <span class="op">=</span> <span class="nam">handler</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t427" href="#t427">427</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t428" href="#t428">428</a></span><span class="t"> <span class="key">def</span> <span class="nam">configure</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">argparser</span><span class="op">:</span> <span class="nam">argparse</span><span class="op">.</span><span class="nam">ArgumentParser</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t429" href="#t429">429</a></span><span class="t"> <span class="nam">handler</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_configure_handler</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t430" href="#t430">430</a></span><span class="t"> <span class="key">if</span> <span class="nam">handler</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t431" href="#t431">431</a></span><span class="t"> <span class="nam">handler</span><span class="op">(</span><span class="nam">argparser</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t432" href="#t432">432</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t433" href="#t433">433</a></span><span class="t"> <span class="key">def</span> <span class="nam">__call__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">command_arg</span><span class="op">:</span> <span class="nam">CommandArg</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t434" href="#t434">434</a></span><span class="t"> <span class="nam">context</span> <span class="op">=</span> <span class="nam">CommandContext</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t435" href="#t435">435</a></span><span class="t"> <span class="nam">command_arg</span><span class="op">.</span><span class="nam">parsed_args</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t436" href="#t436">436</a></span><span class="t"> <span class="nam">command_arg</span><span class="op">.</span><span class="nam">plugin_search_dirs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t437" href="#t437">437</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_require_substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t438" href="#t438">438</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_requested_plugins_only</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t439" href="#t439">439</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t440" href="#t440">440</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_log_only_to_stderr</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t441" href="#t441">441</a></span><span class="t"> <span class="nam">setup_logging</span><span class="op">(</span><span class="nam">reconfigure_logging</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">log_only_to_stderr</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t442" href="#t442">442</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_handler</span><span class="op">(</span><span class="nam">context</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t443" href="#t443">443</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t444" href="#t444">444</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t445" href="#t445">445</a></span><span class="t"><span class="key">class</span> <span class="nam">DispatchingCommandMixin</span><span class="op">(</span><span class="nam">CommandBase</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t446" href="#t446">446</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t447" href="#t447">447</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t448" href="#t448">448</a></span><span class="t"> <span class="key">def</span> <span class="nam">add_subcommand</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">subcommand</span><span class="op">:</span> <span class="nam">SubcommandBase</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t449" href="#t449">449</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t450" href="#t450">450</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t451" href="#t451">451</a></span><span class="t"> <span class="key">def</span> <span class="nam">add_dispatching_subcommand</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t452" href="#t452">452</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t453" href="#t453">453</a></span><span class="t"> <span class="nam">name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t454" href="#t454">454</a></span><span class="t"> <span class="nam">dest</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t455" href="#t455">455</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t456" href="#t456">456</a></span><span class="t"> <span class="nam">aliases</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="nam">tuple</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t457" href="#t457">457</a></span><span class="t"> <span class="nam">help_description</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t458" href="#t458">458</a></span><span class="t"> <span class="nam">metavar</span><span class="op">:</span> <span class="nam">str</span> <span class="op">=</span> <span class="str">"command"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t459" href="#t459">459</a></span><span class="t"> <span class="nam">default_subcommand</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t460" href="#t460">460</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"DispatcherCommand"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t461" href="#t461">461</a></span><span class="t"> <span class="nam">ds</span> <span class="op">=</span> <span class="nam">DispatcherCommand</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t462" href="#t462">462</a></span><span class="t"> <span class="nam">name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t463" href="#t463">463</a></span><span class="t"> <span class="nam">dest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t464" href="#t464">464</a></span><span class="t"> <span class="nam">aliases</span><span class="op">=</span><span class="nam">aliases</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t465" href="#t465">465</a></span><span class="t"> <span class="nam">help_description</span><span class="op">=</span><span class="nam">help_description</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t466" href="#t466">466</a></span><span class="t"> <span class="nam">metavar</span><span class="op">=</span><span class="nam">metavar</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t467" href="#t467">467</a></span><span class="t"> <span class="nam">default_subcommand</span><span class="op">=</span><span class="nam">default_subcommand</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t468" href="#t468">468</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t469" href="#t469">469</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">add_subcommand</span><span class="op">(</span><span class="nam">ds</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t470" href="#t470">470</a></span><span class="t"> <span class="key">return</span> <span class="nam">ds</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t471" href="#t471">471</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t472" href="#t472">472</a></span><span class="t"> <span class="key">def</span> <span class="nam">register_subcommand</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t473" href="#t473">473</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t474" href="#t474">474</a></span><span class="t"> <span class="nam">name</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t475" href="#t475">475</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t476" href="#t476">476</a></span><span class="t"> <span class="nam">help_description</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t477" href="#t477">477</a></span><span class="t"> <span class="nam">argparser</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t478" href="#t478">478</a></span><span class="t"> <span class="nam">Union</span><span class="op">[</span><span class="nam">ArgparserConfigurator</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">ArgparserConfigurator</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t479" href="#t479">479</a></span><span class="t"> <span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t480" href="#t480">480</a></span><span class="t"> <span class="nam">require_substitution</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t481" href="#t481">481</a></span><span class="t"> <span class="nam">requested_plugins_only</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t482" href="#t482">482</a></span><span class="t"> <span class="nam">log_only_to_stderr</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t483" href="#t483">483</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">CommandHandler</span><span class="op">]</span><span class="op">,</span> <span class="nam">GenericSubCommand</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t484" href="#t484">484</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">name</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t485" href="#t485">485</a></span><span class="t"> <span class="nam">cmd_name</span> <span class="op">=</span> <span class="nam">name</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t486" href="#t486">486</a></span><span class="t"> <span class="nam">aliases</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t487" href="#t487">487</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t488" href="#t488">488</a></span><span class="t"> <span class="nam">cmd_name</span> <span class="op">=</span> <span class="nam">name</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t489" href="#t489">489</a></span><span class="t"> <span class="nam">aliases</span> <span class="op">=</span> <span class="nam">name</span><span class="op">[</span><span class="num">1</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t490" href="#t490">490</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t491" href="#t491">491</a></span><span class="t"> <span class="key">if</span> <span class="nam">argparser</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">callable</span><span class="op">(</span><span class="nam">argparser</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t492" href="#t492">492</a></span><span class="t"> <span class="nam">args</span> <span class="op">=</span> <span class="nam">argparser</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t493" href="#t493">493</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t494" href="#t494">494</a></span><span class="t"> <span class="key">def</span> <span class="nam">_wrapper</span><span class="op">(</span><span class="nam">parser</span><span class="op">:</span> <span class="nam">argparse</span><span class="op">.</span><span class="nam">ArgumentParser</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t495" href="#t495">495</a></span><span class="t"> <span class="key">for</span> <span class="nam">configurator</span> <span class="key">in</span> <span class="nam">args</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t496" href="#t496">496</a></span><span class="t"> <span class="nam">configurator</span><span class="op">(</span><span class="nam">parser</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t497" href="#t497">497</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t498" href="#t498">498</a></span><span class="t"> <span class="nam">argparser</span> <span class="op">=</span> <span class="nam">_wrapper</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t499" href="#t499">499</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t500" href="#t500">500</a></span><span class="t"> <span class="key">def</span> <span class="nam">_annotation_impl</span><span class="op">(</span><span class="nam">func</span><span class="op">:</span> <span class="nam">CommandHandler</span><span class="op">)</span> <span class="op">-></span> <span class="nam">GenericSubCommand</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t501" href="#t501">501</a></span><span class="t"> <span class="nam">subcommand</span> <span class="op">=</span> <span class="nam">GenericSubCommand</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t502" href="#t502">502</a></span><span class="t"> <span class="nam">cmd_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t503" href="#t503">503</a></span><span class="t"> <span class="nam">func</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t504" href="#t504">504</a></span><span class="t"> <span class="nam">aliases</span><span class="op">=</span><span class="nam">aliases</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t505" href="#t505">505</a></span><span class="t"> <span class="nam">help_description</span><span class="op">=</span><span class="nam">help_description</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t506" href="#t506">506</a></span><span class="t"> <span class="nam">require_substitution</span><span class="op">=</span><span class="nam">require_substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t507" href="#t507">507</a></span><span class="t"> <span class="nam">requested_plugins_only</span><span class="op">=</span><span class="nam">requested_plugins_only</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t508" href="#t508">508</a></span><span class="t"> <span class="nam">log_only_to_stderr</span><span class="op">=</span><span class="nam">log_only_to_stderr</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t509" href="#t509">509</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t510" href="#t510">510</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">add_subcommand</span><span class="op">(</span><span class="nam">subcommand</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t511" href="#t511">511</a></span><span class="t"> <span class="key">if</span> <span class="nam">argparser</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t512" href="#t512">512</a></span><span class="t"> <span class="nam">subcommand</span><span class="op">.</span><span class="nam">configure_handler</span><span class="op">(</span><span class="nam">argparser</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t513" href="#t513">513</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t514" href="#t514">514</a></span><span class="t"> <span class="key">return</span> <span class="nam">subcommand</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t515" href="#t515">515</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t516" href="#t516">516</a></span><span class="t"> <span class="key">return</span> <span class="nam">_annotation_impl</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t517" href="#t517">517</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t518" href="#t518">518</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t519" href="#t519">519</a></span><span class="t"><span class="key">class</span> <span class="nam">DispatcherCommand</span><span class="op">(</span><span class="nam">SubcommandBase</span><span class="op">,</span> <span class="nam">DispatchingCommandMixin</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t520" href="#t520">520</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t521" href="#t521">521</a></span><span class="t"> <span class="str">"_subcommands"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t522" href="#t522">522</a></span><span class="t"> <span class="str">"_aliases"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t523" href="#t523">523</a></span><span class="t"> <span class="str">"_dest"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t524" href="#t524">524</a></span><span class="t"> <span class="str">"_metavar"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t525" href="#t525">525</a></span><span class="t"> <span class="str">"_required"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t526" href="#t526">526</a></span><span class="t"> <span class="str">"_default_subcommand"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t527" href="#t527">527</a></span><span class="t"> <span class="str">"_argparser"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t528" href="#t528">528</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t529" href="#t529">529</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t530" href="#t530">530</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t531" href="#t531">531</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t532" href="#t532">532</a></span><span class="t"> <span class="nam">name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t533" href="#t533">533</a></span><span class="t"> <span class="nam">dest</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t534" href="#t534">534</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t535" href="#t535">535</a></span><span class="t"> <span class="nam">aliases</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="nam">tuple</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t536" href="#t536">536</a></span><span class="t"> <span class="nam">help_description</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t537" href="#t537">537</a></span><span class="t"> <span class="nam">metavar</span><span class="op">:</span> <span class="nam">str</span> <span class="op">=</span> <span class="str">"command"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t538" href="#t538">538</a></span><span class="t"> <span class="nam">default_subcommand</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t539" href="#t539">539</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t540" href="#t540">540</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="nam">name</span><span class="op">,</span> <span class="nam">aliases</span><span class="op">=</span><span class="nam">aliases</span><span class="op">,</span> <span class="nam">help_description</span><span class="op">=</span><span class="nam">help_description</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t541" href="#t541">541</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_aliases</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">SubcommandBase</span><span class="op">]</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t542" href="#t542">542</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_subcommands</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">SubcommandBase</span><span class="op">]</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t543" href="#t543">543</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_dest</span> <span class="op">=</span> <span class="nam">dest</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t544" href="#t544">544</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_metavar</span> <span class="op">=</span> <span class="nam">metavar</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t545" href="#t545">545</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_default_subcommand</span> <span class="op">=</span> <span class="nam">default_subcommand</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t546" href="#t546">546</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_argparser</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">argparse</span><span class="op">.</span><span class="nam">ArgumentParser</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t547" href="#t547">547</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t548" href="#t548">548</a></span><span class="t"> <span class="key">def</span> <span class="nam">add_subcommand</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">subcommand</span><span class="op">:</span> <span class="nam">SubcommandBase</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t549" href="#t549">549</a></span><span class="t"> <span class="nam">all_names</span> <span class="op">=</span> <span class="op">[</span><span class="nam">subcommand</span><span class="op">.</span><span class="nam">name</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t550" href="#t550">550</a></span><span class="t"> <span class="key">if</span> <span class="nam">subcommand</span><span class="op">.</span><span class="nam">aliases</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t551" href="#t551">551</a></span><span class="t"> <span class="nam">all_names</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">subcommand</span><span class="op">.</span><span class="nam">aliases</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t552" href="#t552">552</a></span><span class="t"> <span class="nam">aliases</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_aliases</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t553" href="#t553">553</a></span><span class="t"> <span class="key">for</span> <span class="nam">n</span> <span class="key">in</span> <span class="nam">all_names</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t554" href="#t554">554</a></span><span class="t"> <span class="key">if</span> <span class="nam">n</span> <span class="key">in</span> <span class="nam">aliases</span><span class="op">:</span> </span><span class="r"><span class="annotate short">554 ↛ 555</span><span class="annotate long">line 554 didn't jump to line 555, because the condition on line 554 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t555" href="#t555">555</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t556" href="#t556">556</a></span><span class="t"> <span class="str">f"Internal error: Multiple handlers for {n} on topic {self.name}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t557" href="#t557">557</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t558" href="#t558">558</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t559" href="#t559">559</a></span><span class="t"> <span class="nam">aliases</span><span class="op">[</span><span class="nam">n</span><span class="op">]</span> <span class="op">=</span> <span class="nam">subcommand</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t560" href="#t560">560</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_subcommands</span><span class="op">[</span><span class="nam">subcommand</span><span class="op">.</span><span class="nam">name</span><span class="op">]</span> <span class="op">=</span> <span class="nam">subcommand</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t561" href="#t561">561</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t562" href="#t562">562</a></span><span class="t"> <span class="key">def</span> <span class="nam">configure</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">argparser</span><span class="op">:</span> <span class="nam">argparse</span><span class="op">.</span><span class="nam">ArgumentParser</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t563" href="#t563">563</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_argparser</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t564" href="#t564">564</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TypeError</span><span class="op">(</span><span class="str">"Cannot configure twice!"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t565" href="#t565">565</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_argparser</span> <span class="op">=</span> <span class="nam">argparser</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t566" href="#t566">566</a></span><span class="t"> <span class="nam">subcommands</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_subcommands</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t567" href="#t567">567</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">subcommands</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t568" href="#t568">568</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t569" href="#t569">569</a></span><span class="t"> <span class="str">f"Internal error: No subcommands for subcommand {self.name} (then why do we have it?)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t570" href="#t570">570</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t571" href="#t571">571</a></span><span class="t"> <span class="nam">default_subcommand</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_default_subcommand</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t572" href="#t572">572</a></span><span class="t"> <span class="nam">required</span> <span class="op">=</span> <span class="nam">default_subcommand</span> <span class="key">is</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t573" href="#t573">573</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t574" href="#t574">574</a></span><span class="t"> <span class="nam">default_subcommand</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t575" href="#t575">575</a></span><span class="t"> <span class="key">and</span> <span class="nam">default_subcommand</span> <span class="key">not</span> <span class="key">in</span> <span class="op">(</span><span class="str">"--help"</span><span class="op">,</span> <span class="str">"-h"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t576" href="#t576">576</a></span><span class="t"> <span class="key">and</span> <span class="nam">default_subcommand</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">subcommands</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t577" href="#t577">577</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t578" href="#t578">578</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t579" href="#t579">579</a></span><span class="t"> <span class="str">f"Internal error: Subcommand {self.name} should have {default_subcommand} as default,"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t580" href="#t580">580</a></span><span class="t"> <span class="str">" but it was not registered?"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t581" href="#t581">581</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t582" href="#t582">582</a></span><span class="t"> <span class="nam">subparser</span> <span class="op">=</span> <span class="nam">argparser</span><span class="op">.</span><span class="nam">add_subparsers</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t583" href="#t583">583</a></span><span class="t"> <span class="nam">dest</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">_dest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t584" href="#t584">584</a></span><span class="t"> <span class="nam">required</span><span class="op">=</span><span class="nam">required</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t585" href="#t585">585</a></span><span class="t"> <span class="nam">metavar</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">_metavar</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t586" href="#t586">586</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t587" href="#t587">587</a></span><span class="t"> <span class="key">for</span> <span class="nam">subcommand</span> <span class="key">in</span> <span class="nam">subcommands</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t588" href="#t588">588</a></span><span class="t"> <span class="nam">subcommand</span><span class="op">.</span><span class="nam">add_subcommand_to_subparser</span><span class="op">(</span><span class="nam">subparser</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t589" href="#t589">589</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t590" href="#t590">590</a></span><span class="t"> <span class="key">def</span> <span class="nam">has_command</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">command</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t591" href="#t591">591</a></span><span class="t"> <span class="key">return</span> <span class="nam">command</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_aliases</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t592" href="#t592">592</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t593" href="#t593">593</a></span><span class="t"> <span class="key">def</span> <span class="nam">__call__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">command_arg</span><span class="op">:</span> <span class="nam">CommandArg</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t594" href="#t594">594</a></span><span class="t"> <span class="nam">argparser</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_argparser</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t595" href="#t595">595</a></span><span class="t"> <span class="key">assert</span> <span class="nam">argparser</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t596" href="#t596">596</a></span><span class="t"> <span class="nam">v</span> <span class="op">=</span> <span class="nam">getattr</span><span class="op">(</span><span class="nam">command_arg</span><span class="op">.</span><span class="nam">parsed_args</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_dest</span><span class="op">,</span> <span class="key">None</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t597" href="#t597">597</a></span><span class="t"> <span class="key">if</span> <span class="nam">v</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t598" href="#t598">598</a></span><span class="t"> <span class="nam">v</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_default_subcommand</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t599" href="#t599">599</a></span><span class="t"> <span class="key">if</span> <span class="nam">v</span> <span class="key">in</span> <span class="op">(</span><span class="str">"--help"</span><span class="op">,</span> <span class="str">"-h"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t600" href="#t600">600</a></span><span class="t"> <span class="nam">argparser</span><span class="op">.</span><span class="nam">parse_args</span><span class="op">(</span><span class="op">[</span><span class="nam">v</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t601" href="#t601">601</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span><span class="str">"Missing command"</span><span class="op">,</span> <span class="nam">prog</span><span class="op">=</span><span class="nam">argparser</span><span class="op">.</span><span class="nam">prog</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t602" href="#t602">602</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t603" href="#t603">603</a></span><span class="t"> <span class="key">assert</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t604" href="#t604">604</a></span><span class="t"> <span class="nam">v</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t605" href="#t605">605</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> <span class="str">f"Internal error: No default subcommand and argparse did not provide the required subcommand {self._dest}?"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t606" href="#t606">606</a></span><span class="t"> <span class="key">assert</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t607" href="#t607">607</a></span><span class="t"> <span class="nam">v</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_aliases</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t608" href="#t608">608</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> <span class="str">f"Internal error: {v} was accepted as a topic, but it was not registered?"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t609" href="#t609">609</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_aliases</span><span class="op">[</span><span class="nam">v</span><span class="op">]</span><span class="op">(</span><span class="nam">command_arg</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t610" href="#t610">610</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t611" href="#t611">611</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t612" href="#t612">612</a></span><span class="t"><span class="nam">ROOT_COMMAND</span> <span class="op">=</span> <span class="nam">DispatcherCommand</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t613" href="#t613">613</a></span><span class="t"> <span class="str">"root"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t614" href="#t614">614</a></span><span class="t"> <span class="nam">dest</span><span class="op">=</span><span class="str">"command"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t615" href="#t615">615</a></span><span class="t"> <span class="nam">metavar</span><span class="op">=</span><span class="str">"COMMAND"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t616" href="#t616">616</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_6e57078c9ef7177d___init___py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_6e57078c9ef7177d_dc_util_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_6e57078c9ef7177d_dc_util_py.html b/coverage-report/d_6e57078c9ef7177d_dc_util_py.html deleted file mode 100644 index 9b4b879..0000000 --- a/coverage-report/d_6e57078c9ef7177d_dc_util_py.html +++ /dev/null @@ -1,114 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/commands/debputy_cmd/dc_util.py: 27%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/commands/debputy_cmd/dc_util.py</b>: - <span class="pc_cov">27%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">7 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">3<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">4<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_6e57078c9ef7177d_context_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_6e57078c9ef7177d_lint_and_lsp_cmds_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Dict</span><span class="op">,</span> <span class="nam">Iterable</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">packager_provided_files</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> <span class="nam">PerPackagePackagerProvidedResult</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> <span class="nam">PackagerProvidedFile</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="key">def</span> <span class="nam">flatten_ppfs</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">all_ppfs</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">PerPackagePackagerProvidedResult</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">PackagerProvidedFile</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="key">for</span> <span class="nam">matched_ppf</span> <span class="key">in</span> <span class="nam">all_ppfs</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">matched_ppf</span><span class="op">.</span><span class="nam">auto_installable</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="key">for</span> <span class="nam">reserved_ppfs</span> <span class="key">in</span> <span class="nam">matched_ppf</span><span class="op">.</span><span class="nam">reserved_only</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">reserved_ppfs</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_6e57078c9ef7177d_context_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_6e57078c9ef7177d_lint_and_lsp_cmds_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_6e57078c9ef7177d_lint_and_lsp_cmds_py.html b/coverage-report/d_6e57078c9ef7177d_lint_and_lsp_cmds_py.html deleted file mode 100644 index 24b05ad..0000000 --- a/coverage-report/d_6e57078c9ef7177d_lint_and_lsp_cmds_py.html +++ /dev/null @@ -1,340 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/commands/debputy_cmd/lint_and_lsp_cmds.py: 26%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/commands/debputy_cmd/lint_and_lsp_cmds.py</b>: - <span class="pc_cov">26%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">65 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">15<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">50<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_6e57078c9ef7177d_dc_util_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_6e57078c9ef7177d_output_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">textwrap</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">from</span> <span class="nam">argparse</span> <span class="key">import</span> <span class="nam">BooleanOptionalAction</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">commands</span><span class="op">.</span><span class="nam">debputy_cmd</span><span class="op">.</span><span class="nam">context</span> <span class="key">import</span> <span class="nam">ROOT_COMMAND</span><span class="op">,</span> <span class="nam">CommandContext</span><span class="op">,</span> <span class="nam">add_arg</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">_error</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="nam">_EDITOR_SNIPPETS</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="str">"emacs"</span><span class="op">:</span> <span class="str">"emacs+eglot"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="str">"emacs+eglot"</span><span class="op">:</span> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="str"> ;; `deputy lsp server` glue for emacs eglot (eglot is built-in these days)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"><span class="str"> ;;</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"><span class="str"> ;; Add to ~/.emacs or ~/.emacs.d/init.el and then activate via `M-x eglot`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"><span class="str"> ;;</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"><span class="str"> ;; Requires: apt install elpa-dpkg-dev-el elpa-yaml-mode</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"><span class="str"> ;; Recommends: apt install elpa-markdown-mode</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"><span class="str"> ;; Make emacs recognize debian/debputy.manifest as a YAML file</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"><span class="str"> (add-to-list 'auto-mode-alist '("/debian/debputy.manifest\\'" . yaml-mode))</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"><span class="str"> ;; Inform eglot about the debputy LSP</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"><span class="str"> (with-eval-after-load 'eglot</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"><span class="str"> (add-to-list 'eglot-server-programs</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"><span class="str"> '(debian-control-mode . ("debputy" "lsp" "server")))</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"><span class="str"> (add-to-list 'eglot-server-programs</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"><span class="str"> '(debian-changelog-mode . ("debputy" "lsp" "server")))</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"><span class="str"> (add-to-list 'eglot-server-programs</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"><span class="str"> '(debian-copyright-mode . ("debputy" "lsp" "server")))</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"><span class="str"> ;; Requires elpa-dpkg-dev-el (>> 37.11)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"><span class="str"> ;; (add-to-list 'eglot-server-programs</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"><span class="str"> ;; '(debian-autopkgtest-control-mode . ("debputy" "lsp" "server")))</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"><span class="str"> ;; The debian/rules file uses the qmake mode.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"><span class="str"> (add-to-list 'eglot-server-programs</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"><span class="str"> '(makefile-gmake-mode . ("debputy" "lsp" "server")))</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"><span class="str"> (add-to-list 'eglot-server-programs</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"><span class="str"> '(yaml-mode . ("debputy" "lsp" "server")))</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="str"> )</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"><span class="str"> ;; Auto-start eglot for the relevant modes.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"><span class="str"> (add-hook 'debian-control-mode-hook 'eglot-ensure)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"><span class="str"> ;; NOTE: changelog disabled by default because for some reason it</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"><span class="str"> ;; this hook causes perceivable delay (several seconds) when</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"><span class="str"> ;; opening the first changelog. It seems to be related to imenu.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"><span class="str"> ;; (add-hook 'debian-changelog-mode-hook 'eglot-ensure)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"><span class="str"> (add-hook 'debian-copyright-mode-hook 'eglot-ensure)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"><span class="str"> ;; Requires elpa-dpkg-dev-el (>> 37.11)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"><span class="str"> ;; (add-hook 'debian-autopkgtest-control-mode-hook 'eglot-ensure)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"><span class="str"> (add-hook 'makefile-gmake-mode-hook 'eglot-ensure)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"><span class="str"> (add-hook 'yaml-mode-hook 'eglot-ensure)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="str">"vim"</span><span class="op">:</span> <span class="str">"vim+youcompleteme"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="str">"vim+youcompleteme"</span><span class="op">:</span> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"><span class="str"> # debputy lsp server glue for vim with vim-youcompleteme. Add to ~/.vimrc</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"><span class="str"> #</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"><span class="str"> # Requires: apt install vim-youcompleteme</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"><span class="str"> # Make vim recognize debputy.manifest as YAML file</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"><span class="str"> au BufNewFile,BufRead debputy.manifest setf yaml</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"><span class="str"> # Inform vim/ycm about the debputy LSP</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"><span class="str"> # - NB: No known support for debian/tests/control that we can hook into.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"><span class="str"> # Feel free to provide one :)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"><span class="str"> let g:ycm_language_server = [</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"><span class="str"> \\ { 'name': 'debputy',</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"><span class="str"> \\ 'filetypes': [ 'debcontrol', 'debcopyright', 'debchangelog', 'make', 'yaml'],</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"><span class="str"> \\ 'cmdline': [ 'debputy', 'lsp', 'server' ]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"><span class="str"> \\ },</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"><span class="str"> \\ ]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"><span class="str"> packadd! youcompleteme</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"><span class="str"> # Add relevant ycm keybinding such as:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"><span class="str"> # nmap <leader>d <plug>(YCMHover)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"><span class="nam">lsp_command</span> <span class="op">=</span> <span class="nam">ROOT_COMMAND</span><span class="op">.</span><span class="nam">add_dispatching_subcommand</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="str">"lsp"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="nam">dest</span><span class="op">=</span><span class="str">"lsp_command"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="nam">help_description</span><span class="op">=</span><span class="str">"Language server related subcommands"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"><span class="op">@</span><span class="nam">lsp_command</span><span class="op">.</span><span class="nam">register_subcommand</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="str">"server"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="nam">log_only_to_stderr</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="nam">help_description</span><span class="op">=</span><span class="str">"Start the language server"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="nam">argparser</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="nam">add_arg</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="str">"--tcp"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="nam">action</span><span class="op">=</span><span class="str">"store_true"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Use TCP server"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="nam">add_arg</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="str">"--ws"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="nam">action</span><span class="op">=</span><span class="str">"store_true"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Use WebSocket server"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="nam">add_arg</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="str">"--host"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="nam">default</span><span class="op">=</span><span class="str">"127.0.0.1"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Bind to this address (Use with --tcp / --ws)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="nam">add_arg</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="str">"--port"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="nam">type</span><span class="op">=</span><span class="nam">int</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="nam">default</span><span class="op">=</span><span class="num">2087</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Bind to this port (Use with --tcp / --ws)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"><span class="key">def</span> <span class="nam">lsp_server_cmd</span><span class="op">(</span><span class="nam">context</span><span class="op">:</span> <span class="nam">CommandContext</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="nam">parsed_args</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">parsed_args</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="key">import</span> <span class="nam">lsprotocol</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="key">import</span> <span class="nam">pygls</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="key">except</span> <span class="nam">ImportError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="str">"This feature requires lsprotocol and pygls (apt-get install python3-lsprotocol python3-pygls)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="nam">feature_set</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">load_plugins</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">lsp_features</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="nam">ensure_lsp_features_are_loaded</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">lsp_dispatch</span> <span class="key">import</span> <span class="nam">DEBPUTY_LANGUAGE_SERVER</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="nam">ensure_lsp_features_are_loaded</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="nam">debputy_language_server</span> <span class="op">=</span> <span class="nam">DEBPUTY_LANGUAGE_SERVER</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="nam">debputy_language_server</span><span class="op">.</span><span class="nam">plugin_feature_set</span> <span class="op">=</span> <span class="nam">feature_set</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="key">if</span> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">tcp</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="nam">debputy_language_server</span><span class="op">.</span><span class="nam">start_tcp</span><span class="op">(</span><span class="nam">parsed_args</span><span class="op">.</span><span class="nam">host</span><span class="op">,</span> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">port</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="key">elif</span> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">ws</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="nam">debputy_language_server</span><span class="op">.</span><span class="nam">start_ws</span><span class="op">(</span><span class="nam">parsed_args</span><span class="op">.</span><span class="nam">host</span><span class="op">,</span> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">port</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="nam">debputy_language_server</span><span class="op">.</span><span class="nam">start_io</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"><span class="op">@</span><span class="nam">lsp_command</span><span class="op">.</span><span class="nam">register_subcommand</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="str">"editor-config"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="nam">help_description</span><span class="op">=</span><span class="str">"Provide editor configuration snippets"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="nam">argparser</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="nam">add_arg</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="str">"editor_name"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="nam">metavar</span><span class="op">=</span><span class="str">"editor"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="nam">choices</span><span class="op">=</span><span class="nam">_EDITOR_SNIPPETS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="nam">default</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="nam">nargs</span><span class="op">=</span><span class="str">"?"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"The editor to provide a snippet for"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"><span class="key">def</span> <span class="nam">lsp_editor_glue</span><span class="op">(</span><span class="nam">context</span><span class="op">:</span> <span class="nam">CommandContext</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="nam">editor_name</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">parsed_args</span><span class="op">.</span><span class="nam">editor_name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="key">if</span> <span class="nam">editor_name</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="nam">content</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="key">for</span> <span class="nam">editor_name</span><span class="op">,</span> <span class="nam">payload</span> <span class="key">in</span> <span class="nam">_EDITOR_SNIPPETS</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="nam">alias_of</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="key">if</span> <span class="nam">payload</span> <span class="key">in</span> <span class="nam">_EDITOR_SNIPPETS</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="nam">alias_of</span> <span class="op">=</span> <span class="str">f" (short for: {payload})"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="nam">content</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="op">(</span><span class="nam">editor_name</span><span class="op">,</span> <span class="nam">alias_of</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="nam">max_name</span> <span class="op">=</span> <span class="nam">max</span><span class="op">(</span><span class="nam">len</span><span class="op">(</span><span class="nam">c</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">)</span> <span class="key">for</span> <span class="nam">c</span> <span class="key">in</span> <span class="nam">content</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">"This version of debputy has editor snippets for the following editors: "</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="key">for</span> <span class="nam">editor_name</span><span class="op">,</span> <span class="nam">alias_of</span> <span class="key">in</span> <span class="nam">content</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">f" * {editor_name:<{max_name}}{alias_of}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">result</span> <span class="op">=</span> <span class="nam">_EDITOR_SNIPPETS</span><span class="op">[</span><span class="nam">editor_name</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="key">while</span> <span class="nam">result</span> <span class="key">in</span> <span class="nam">_EDITOR_SNIPPETS</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="nam">result</span> <span class="op">=</span> <span class="nam">_EDITOR_SNIPPETS</span><span class="op">[</span><span class="nam">result</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="nam">result</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"><span class="op">@</span><span class="nam">lsp_command</span><span class="op">.</span><span class="nam">register_subcommand</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="str">"features"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="nam">help_description</span><span class="op">=</span><span class="str">"Describe language ids and features"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"><span class="key">def</span> <span class="nam">lsp_editor_glue</span><span class="op">(</span><span class="nam">_context</span><span class="op">:</span> <span class="nam">CommandContext</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="key">import</span> <span class="nam">lsprotocol</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="key">import</span> <span class="nam">pygls</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="key">except</span> <span class="nam">ImportError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="str">"This feature requires lsprotocol and pygls (apt-get install python3-lsprotocol python3-pygls)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">lsp_features</span> <span class="key">import</span> <span class="nam">describe_lsp_features</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="nam">describe_lsp_features</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"><span class="op">@</span><span class="nam">ROOT_COMMAND</span><span class="op">.</span><span class="nam">register_subcommand</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="str">"lint"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="nam">log_only_to_stderr</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="nam">argparser</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="nam">add_arg</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="str">"--spellcheck"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="nam">dest</span><span class="op">=</span><span class="str">"spellcheck"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="nam">action</span><span class="op">=</span><span class="str">"store_true"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="nam">shared</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Enable spellchecking"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="nam">add_arg</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="str">"--auto-fix"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="nam">dest</span><span class="op">=</span><span class="str">"auto_fix"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="nam">action</span><span class="op">=</span><span class="str">"store_true"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="nam">shared</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Automatically fix problems with trivial or obvious corrections."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="nam">add_arg</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="str">"--linter-exit-code"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="nam">dest</span><span class="op">=</span><span class="str">"linter_exit_code"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="nam">default</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="nam">action</span><span class="op">=</span><span class="nam">BooleanOptionalAction</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">'Enable or disable the "linter" convention of exiting with an error if severe issues were found'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"><span class="key">def</span> <span class="nam">lint_cmd</span><span class="op">(</span><span class="nam">context</span><span class="op">:</span> <span class="nam">CommandContext</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="key">import</span> <span class="nam">lsprotocol</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="key">except</span> <span class="nam">ImportError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span><span class="str">"This feature requires lsprotocol (apt-get install python3-lsprotocol)"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">linting</span><span class="op">.</span><span class="nam">lint_impl</span> <span class="key">import</span> <span class="nam">perform_linting</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="nam">context</span><span class="op">.</span><span class="nam">must_be_called_in_source_root</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="nam">perform_linting</span><span class="op">(</span><span class="nam">context</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"><span class="key">def</span> <span class="nam">ensure_lint_and_lsp_commands_are_loaded</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="com"># Loading the module does the heavy lifting</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="com"># However, having this function means that we do not have an "unused" import that some tool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="com"># gets tempted to remove</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="key">assert</span> <span class="nam">ROOT_COMMAND</span><span class="op">.</span><span class="nam">has_command</span><span class="op">(</span><span class="str">"lsp"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="key">assert</span> <span class="nam">ROOT_COMMAND</span><span class="op">.</span><span class="nam">has_command</span><span class="op">(</span><span class="str">"lint"</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_6e57078c9ef7177d_dc_util_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_6e57078c9ef7177d_output_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_6e57078c9ef7177d_output_py.html b/coverage-report/d_6e57078c9ef7177d_output_py.html deleted file mode 100644 index c212f65..0000000 --- a/coverage-report/d_6e57078c9ef7177d_output_py.html +++ /dev/null @@ -1,434 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/commands/debputy_cmd/output.py: 17%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/commands/debputy_cmd/output.py</b>: - <span class="pc_cov">17%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">191 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">41<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">150<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_6e57078c9ef7177d_lint_and_lsp_cmds_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_6e57078c9ef7177d_plugin_cmds_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">argparse</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">contextlib</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">itertools</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">import</span> <span class="nam">re</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">import</span> <span class="nam">shutil</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">import</span> <span class="nam">subprocess</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="key">import</span> <span class="nam">sys</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">Sequence</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">Iterable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">Iterator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">IO</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">Mapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">assume_not_none</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"><span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="key">import</span> <span class="nam">colored</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"><span class="key">except</span> <span class="nam">ImportError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="nam">colored</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"><span class="key">def</span> <span class="nam">_pager</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="nam">pager</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">environ</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"DEBPUTY_PAGER"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="key">if</span> <span class="nam">pager</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="nam">pager</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">environ</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"PAGER"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="key">if</span> <span class="nam">pager</span> <span class="key">is</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">shutil</span><span class="op">.</span><span class="nam">which</span><span class="op">(</span><span class="str">"less"</span><span class="op">)</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="nam">pager</span> <span class="op">=</span> <span class="str">"less"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="key">return</span> <span class="nam">pager</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"><span class="nam">URL_START</span> <span class="op">=</span> <span class="str">"\033]8;;"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"><span class="nam">URL_END</span> <span class="op">=</span> <span class="str">"\033]8;;\a"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"><span class="nam">MAN_URL_REWRITE</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r"man:(\S+)[(](\d+)[)]"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"><span class="nam">_SUPPORTED_COLORS</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="str">"black"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="str">"red"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="str">"green"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="str">"yellow"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="str">"blue"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="str">"magenta"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="str">"cyan"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="str">"white"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"><span class="nam">_SUPPORTED_STYLES</span> <span class="op">=</span> <span class="op">{</span><span class="str">"none"</span><span class="op">,</span> <span class="str">"bold"</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"><span class="key">class</span> <span class="nam">OutputStylingBase</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="nam">stream</span><span class="op">:</span> <span class="nam">IO</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="nam">output_format</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="nam">optimize_for_screen_reader</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">stream</span> <span class="op">=</span> <span class="nam">stream</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">output_format</span> <span class="op">=</span> <span class="nam">output_format</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">optimize_for_screen_reader</span> <span class="op">=</span> <span class="nam">optimize_for_screen_reader</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_color_support</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="key">def</span> <span class="nam">colored</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="nam">text</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="nam">fg</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="nam">bg</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="nam">style</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_check_color</span><span class="op">(</span><span class="nam">fg</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_check_color</span><span class="op">(</span><span class="nam">bg</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_check_text_style</span><span class="op">(</span><span class="nam">style</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="key">return</span> <span class="nam">text</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="key">def</span> <span class="nam">supports_colors</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="key">def</span> <span class="nam">print_list_table</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="nam">headers</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="nam">rows</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="key">if</span> <span class="nam">rows</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="key">if</span> <span class="nam">any</span><span class="op">(</span><span class="nam">len</span><span class="op">(</span><span class="nam">r</span><span class="op">)</span> <span class="op">!=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">rows</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">)</span> <span class="key">for</span> <span class="nam">r</span> <span class="key">in</span> <span class="nam">rows</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="str">"Unbalanced table: All rows must have the same column count"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">rows</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">)</span> <span class="op">!=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">headers</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="str">"Unbalanced table: header list does not agree with row list on number of columns"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">headers</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"No headers provided!?"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="nam">cadjust</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="nam">header_names</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="key">for</span> <span class="nam">c</span> <span class="key">in</span> <span class="nam">headers</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">c</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="nam">header_names</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">c</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="nam">cname</span><span class="op">,</span> <span class="nam">adjust</span> <span class="op">=</span> <span class="nam">c</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="nam">header_names</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">cname</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="nam">cadjust</span><span class="op">[</span><span class="nam">cname</span><span class="op">]</span> <span class="op">=</span> <span class="nam">adjust</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">output_format</span> <span class="op">==</span> <span class="str">"csv"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="key">from</span> <span class="nam">csv</span> <span class="key">import</span> <span class="nam">writer</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="nam">w</span> <span class="op">=</span> <span class="nam">writer</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">stream</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="nam">w</span><span class="op">.</span><span class="nam">writerow</span><span class="op">(</span><span class="nam">header_names</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="nam">w</span><span class="op">.</span><span class="nam">writerows</span><span class="op">(</span><span class="nam">rows</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="nam">column_lengths</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="nam">max</span><span class="op">(</span><span class="op">(</span><span class="nam">len</span><span class="op">(</span><span class="nam">h</span><span class="op">)</span><span class="op">,</span> <span class="nam">max</span><span class="op">(</span><span class="nam">len</span><span class="op">(</span><span class="nam">r</span><span class="op">[</span><span class="nam">i</span><span class="op">]</span><span class="op">)</span> <span class="key">for</span> <span class="nam">r</span> <span class="key">in</span> <span class="nam">rows</span><span class="op">)</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="key">for</span> <span class="nam">i</span><span class="op">,</span> <span class="nam">h</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">header_names</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="com"># divider => "+---+---+-...-+"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="nam">divider</span> <span class="op">=</span> <span class="str">"+-"</span> <span class="op">+</span> <span class="str">"-+-"</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="str">"-"</span> <span class="op">*</span> <span class="nam">x</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">column_lengths</span><span class="op">)</span> <span class="op">+</span> <span class="str">"-+"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="com"># row_format => '| {:<10} | {:<8} | ... |' where the numbers are the column lengths</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="nam">row_format_inner</span> <span class="op">=</span> <span class="str">" | "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="str">f"{{CELL_COLOR}}{{:{cadjust.get(cn, '<')}{x}}}{{CELL_COLOR_RESET}}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="key">for</span> <span class="nam">cn</span><span class="op">,</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">zip</span><span class="op">(</span><span class="nam">header_names</span><span class="op">,</span> <span class="nam">column_lengths</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="nam">row_format</span> <span class="op">=</span> <span class="str">f"| {row_format_inner} |"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">supports_colors</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="nam">c</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_color_support</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="key">assert</span> <span class="nam">c</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="nam">header_color</span> <span class="op">=</span> <span class="nam">c</span><span class="op">.</span><span class="nam">Style</span><span class="op">.</span><span class="nam">bold</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="nam">header_color_reset</span> <span class="op">=</span> <span class="nam">c</span><span class="op">.</span><span class="nam">Style</span><span class="op">.</span><span class="nam">reset</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="nam">header_color</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="nam">header_color_reset</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">print_visual_formatting</span><span class="op">(</span><span class="nam">divider</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="nam">row_format</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="op">*</span><span class="nam">header_names</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="nam">CELL_COLOR</span><span class="op">=</span><span class="nam">header_color</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="nam">CELL_COLOR_RESET</span><span class="op">=</span><span class="nam">header_color_reset</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">print_visual_formatting</span><span class="op">(</span><span class="nam">divider</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="key">for</span> <span class="nam">row</span> <span class="key">in</span> <span class="nam">rows</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="nam">row_format</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span><span class="op">*</span><span class="nam">row</span><span class="op">,</span> <span class="nam">CELL_COLOR</span><span class="op">=</span><span class="str">""</span><span class="op">,</span> <span class="nam">CELL_COLOR_RESET</span><span class="op">=</span><span class="str">""</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">print_visual_formatting</span><span class="op">(</span><span class="nam">divider</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="key">def</span> <span class="nam">print</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">/</span><span class="op">,</span> <span class="nam">string</span><span class="op">:</span> <span class="nam">str</span> <span class="op">=</span> <span class="str">""</span><span class="op">,</span> <span class="op">**</span><span class="nam">kwargs</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="key">if</span> <span class="str">"file"</span> <span class="key">in</span> <span class="nam">kwargs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"Unsupported kwarg file"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="nam">string</span><span class="op">,</span> <span class="nam">file</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">stream</span><span class="op">,</span> <span class="op">**</span><span class="nam">kwargs</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="key">def</span> <span class="nam">print_visual_formatting</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">/</span><span class="op">,</span> <span class="nam">format_sequence</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="op">**</span><span class="nam">kwargs</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">optimize_for_screen_reader</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="nam">format_sequence</span><span class="op">,</span> <span class="op">**</span><span class="nam">kwargs</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="key">def</span> <span class="nam">print_for_screen_reader</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">/</span><span class="op">,</span> <span class="nam">text</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="op">**</span><span class="nam">kwargs</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">optimize_for_screen_reader</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="nam">text</span><span class="op">,</span> <span class="op">**</span><span class="nam">kwargs</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="key">def</span> <span class="nam">_check_color</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">color</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="key">if</span> <span class="nam">color</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">color</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">_SUPPORTED_COLORS</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="str">f"Unsupported color: {color}. Only the following are supported {','.join(_SUPPORTED_COLORS)}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="key">def</span> <span class="nam">_check_text_style</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">style</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="key">if</span> <span class="nam">style</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">style</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">_SUPPORTED_STYLES</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="str">f"Unsupported style: {style}. Only the following are supported {','.join(_SUPPORTED_STYLES)}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="key">def</span> <span class="nam">render_url</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">link_url</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="key">return</span> <span class="nam">link_url</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"><span class="key">class</span> <span class="nam">ANSIOutputStylingBase</span><span class="op">(</span><span class="nam">OutputStylingBase</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="nam">stream</span><span class="op">:</span> <span class="nam">IO</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="nam">output_format</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="nam">support_colors</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="nam">support_clickable_urls</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="op">**</span><span class="nam">kwargs</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="nam">stream</span><span class="op">,</span> <span class="nam">output_format</span><span class="op">,</span> <span class="op">**</span><span class="nam">kwargs</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_stream</span> <span class="op">=</span> <span class="nam">stream</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_color_support</span> <span class="op">=</span> <span class="nam">colored</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_support_colors</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="nam">support_colors</span> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_color_support</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">else</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_support_clickable_urls</span> <span class="op">=</span> <span class="nam">support_clickable_urls</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="key">def</span> <span class="nam">supports_colors</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_support_colors</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="key">def</span> <span class="nam">colored</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="nam">text</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="nam">fg</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="nam">bg</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="nam">style</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_check_color</span><span class="op">(</span><span class="nam">fg</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_check_color</span><span class="op">(</span><span class="nam">bg</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_check_text_style</span><span class="op">(</span><span class="nam">style</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">supports_colors</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="key">return</span> <span class="nam">text</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="nam">_colored</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_color_support</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="nam">codes</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="key">if</span> <span class="nam">style</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="nam">code</span> <span class="op">=</span> <span class="nam">getattr</span><span class="op">(</span><span class="nam">_colored</span><span class="op">.</span><span class="nam">Style</span><span class="op">,</span> <span class="nam">style</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="key">assert</span> <span class="nam">code</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="nam">codes</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">code</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="key">if</span> <span class="nam">fg</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="nam">code</span> <span class="op">=</span> <span class="nam">getattr</span><span class="op">(</span><span class="nam">_colored</span><span class="op">.</span><span class="nam">Fore</span><span class="op">,</span> <span class="nam">fg</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="key">assert</span> <span class="nam">code</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="nam">codes</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">code</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="key">if</span> <span class="nam">bg</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="nam">code</span> <span class="op">=</span> <span class="nam">getattr</span><span class="op">(</span><span class="nam">_colored</span><span class="op">.</span><span class="nam">Back</span><span class="op">,</span> <span class="nam">bg</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="key">assert</span> <span class="nam">code</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="nam">codes</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">code</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">codes</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="key">return</span> <span class="nam">text</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="key">return</span> <span class="str">""</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">codes</span><span class="op">)</span> <span class="op">+</span> <span class="nam">text</span> <span class="op">+</span> <span class="nam">_colored</span><span class="op">.</span><span class="nam">Style</span><span class="op">.</span><span class="nam">reset</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="key">def</span> <span class="nam">render_url</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">link_url</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_support_clickable_urls</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="key">return</span> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">render_url</span><span class="op">(</span><span class="nam">link_url</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="nam">link_text</span> <span class="op">=</span> <span class="nam">link_url</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">optimize_for_screen_reader</span> <span class="key">and</span> <span class="nam">link_url</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"man:"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="com"># Rewrite man page to a clickable link by default. I am not sure how the hyperlink</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="com"># ANSI code works with screen readers, so lets not rewrite the man page link by</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="com"># default. My fear is that both the link url and the link text gets read out.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="nam">MAN_URL_REWRITE</span><span class="op">.</span><span class="nam">match</span><span class="op">(</span><span class="nam">link_url</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="key">if</span> <span class="nam">m</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="nam">page</span><span class="op">,</span> <span class="nam">section</span> <span class="op">=</span> <span class="nam">m</span><span class="op">.</span><span class="nam">groups</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="nam">link_url</span> <span class="op">=</span> <span class="str">f"https://manpages.debian.org/{page}.{section}"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="key">return</span> <span class="nam">URL_START</span> <span class="op">+</span> <span class="str">f"{link_url}\a{link_text}"</span> <span class="op">+</span> <span class="nam">URL_END</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"><span class="key">def</span> <span class="nam">_output_styling</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="nam">parsed_args</span><span class="op">:</span> <span class="nam">argparse</span><span class="op">.</span><span class="nam">Namespace</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="nam">stream</span><span class="op">:</span> <span class="nam">IO</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">OutputStylingBase</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="nam">output_format</span> <span class="op">=</span> <span class="nam">getattr</span><span class="op">(</span><span class="nam">parsed_args</span><span class="op">,</span> <span class="str">"output_format"</span><span class="op">,</span> <span class="key">None</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="key">if</span> <span class="nam">output_format</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="nam">output_format</span> <span class="op">=</span> <span class="str">"text"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="nam">optimize_for_screen_reader</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">environ</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"OPTIMIZE_FOR_SCREEN_READER"</span><span class="op">,</span> <span class="str">""</span><span class="op">)</span> <span class="op">!=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">stream</span><span class="op">.</span><span class="nam">isatty</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="key">return</span> <span class="nam">OutputStylingBase</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="nam">stream</span><span class="op">,</span> <span class="nam">output_format</span><span class="op">,</span> <span class="nam">optimize_for_screen_reader</span><span class="op">=</span><span class="nam">optimize_for_screen_reader</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="key">return</span> <span class="nam">ANSIOutputStylingBase</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="nam">stream</span><span class="op">,</span> <span class="nam">output_format</span><span class="op">,</span> <span class="nam">optimize_for_screen_reader</span><span class="op">=</span><span class="nam">optimize_for_screen_reader</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"><span class="op">@</span><span class="nam">contextlib</span><span class="op">.</span><span class="nam">contextmanager</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"><span class="key">def</span> <span class="nam">_stream_to_pager</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="nam">parsed_args</span><span class="op">:</span> <span class="nam">argparse</span><span class="op">.</span><span class="nam">Namespace</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">IO</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">OutputStylingBase</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="nam">fancy_output</span> <span class="op">=</span> <span class="nam">_output_styling</span><span class="op">(</span><span class="nam">parsed_args</span><span class="op">,</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">stdout</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="key">not</span> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">pager</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="key">or</span> <span class="key">not</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">stdout</span><span class="op">.</span><span class="nam">isatty</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="key">or</span> <span class="nam">fancy_output</span><span class="op">.</span><span class="nam">output_format</span> <span class="op">!=</span> <span class="str">"text"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="key">yield</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">stdout</span><span class="op">,</span> <span class="nam">fancy_output</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="nam">pager</span> <span class="op">=</span> <span class="nam">_pager</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="key">if</span> <span class="nam">pager</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="key">yield</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">stdout</span><span class="op">,</span> <span class="nam">fancy_output</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="nam">env</span><span class="op">:</span> <span class="nam">Mapping</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">environ</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> <span class="key">if</span> <span class="str">"LESS"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">env</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="nam">env_copy</span> <span class="op">=</span> <span class="nam">dict</span><span class="op">(</span><span class="nam">os</span><span class="op">.</span><span class="nam">environ</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> <span class="nam">env_copy</span><span class="op">[</span><span class="str">"LESS"</span><span class="op">]</span> <span class="op">=</span> <span class="str">"-FRSXMQ"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="nam">env</span> <span class="op">=</span> <span class="nam">env_copy</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="nam">cmd</span> <span class="op">=</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">Popen</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="nam">pager</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="nam">stdin</span><span class="op">=</span><span class="nam">subprocess</span><span class="op">.</span><span class="nam">PIPE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="nam">encoding</span><span class="op">=</span><span class="str">"utf-8"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="nam">env</span><span class="op">=</span><span class="nam">env</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="nam">stdin</span> <span class="op">=</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">cmd</span><span class="op">.</span><span class="nam">stdin</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="nam">fancy_output</span><span class="op">.</span><span class="nam">stream</span> <span class="op">=</span> <span class="nam">stdin</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> <span class="key">yield</span> <span class="nam">stdin</span><span class="op">,</span> <span class="nam">fancy_output</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="key">except</span> <span class="nam">Exception</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="nam">stdin</span><span class="op">.</span><span class="nam">close</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="nam">cmd</span><span class="op">.</span><span class="nam">kill</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="nam">cmd</span><span class="op">.</span><span class="nam">wait</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="key">raise</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="key">finally</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="nam">fancy_output</span><span class="op">.</span><span class="nam">stream</span> <span class="op">=</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">stdin</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="nam">stdin</span><span class="op">.</span><span class="nam">close</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="nam">cmd</span><span class="op">.</span><span class="nam">wait</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"><span class="key">def</span> <span class="nam">_normalize_cell</span><span class="op">(</span><span class="nam">cell</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> <span class="nam">times</span><span class="op">:</span> <span class="nam">int</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">cell</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="key">return</span> <span class="nam">itertools</span><span class="op">.</span><span class="nam">chain</span><span class="op">(</span><span class="op">[</span><span class="nam">cell</span><span class="op">]</span><span class="op">,</span> <span class="nam">itertools</span><span class="op">.</span><span class="nam">repeat</span><span class="op">(</span><span class="str">""</span><span class="op">,</span> <span class="nam">times</span><span class="op">=</span><span class="nam">times</span> <span class="op">-</span> <span class="num">1</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">cell</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="key">return</span> <span class="nam">itertools</span><span class="op">.</span><span class="nam">repeat</span><span class="op">(</span><span class="str">""</span><span class="op">,</span> <span class="nam">times</span><span class="op">=</span><span class="nam">times</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> <span class="key">return</span> <span class="nam">itertools</span><span class="op">.</span><span class="nam">chain</span><span class="op">(</span><span class="nam">cell</span><span class="op">,</span> <span class="nam">itertools</span><span class="op">.</span><span class="nam">repeat</span><span class="op">(</span><span class="str">""</span><span class="op">,</span> <span class="nam">times</span><span class="op">=</span><span class="nam">times</span> <span class="op">-</span> <span class="nam">len</span><span class="op">(</span><span class="nam">cell</span><span class="op">)</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"><span class="key">def</span> <span class="nam">_expand_rows</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> <span class="nam">rows</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">Sequence</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> <span class="key">for</span> <span class="nam">row</span> <span class="key">in</span> <span class="nam">rows</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> <span class="key">if</span> <span class="nam">all</span><span class="op">(</span><span class="nam">isinstance</span><span class="op">(</span><span class="nam">c</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span> <span class="key">for</span> <span class="nam">c</span> <span class="key">in</span> <span class="nam">row</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> <span class="key">yield</span> <span class="nam">row</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> <span class="nam">longest</span> <span class="op">=</span> <span class="nam">max</span><span class="op">(</span><span class="nam">len</span><span class="op">(</span><span class="nam">c</span><span class="op">)</span> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">c</span><span class="op">,</span> <span class="nam">list</span><span class="op">)</span> <span class="key">else</span> <span class="num">1</span> <span class="key">for</span> <span class="nam">c</span> <span class="key">in</span> <span class="nam">row</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> <span class="nam">cells</span> <span class="op">=</span> <span class="op">[</span><span class="nam">_normalize_cell</span><span class="op">(</span><span class="nam">c</span><span class="op">,</span> <span class="nam">times</span><span class="op">=</span><span class="nam">longest</span><span class="op">)</span> <span class="key">for</span> <span class="nam">c</span> <span class="key">in</span> <span class="nam">row</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">zip</span><span class="op">(</span><span class="op">*</span><span class="nam">cells</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_6e57078c9ef7177d_lint_and_lsp_cmds_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_6e57078c9ef7177d_plugin_cmds_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_6e57078c9ef7177d_plugin_cmds_py.html b/coverage-report/d_6e57078c9ef7177d_plugin_cmds_py.html deleted file mode 100644 index 2f6123b..0000000 --- a/coverage-report/d_6e57078c9ef7177d_plugin_cmds_py.html +++ /dev/null @@ -1,1295 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/commands/debputy_cmd/plugin_cmds.py: 13%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/commands/debputy_cmd/plugin_cmds.py</b>: - <span class="pc_cov">13%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">541 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">78<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">463<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">1<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_6e57078c9ef7177d_output_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_deb_packaging_support_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">argparse</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">itertools</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">operator</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">import</span> <span class="nam">sys</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">from</span> <span class="nam">itertools</span> <span class="key">import</span> <span class="nam">chain</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">Sequence</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">Iterable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">Type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">Mapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">Callable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span> <span class="key">import</span> <span class="nam">DEBPUTY_DOC_ROOT_DIR</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">commands</span><span class="op">.</span><span class="nam">debputy_cmd</span><span class="op">.</span><span class="nam">context</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">CommandContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">add_arg</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="nam">ROOT_COMMAND</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">commands</span><span class="op">.</span><span class="nam">debputy_cmd</span><span class="op">.</span><span class="nam">dc_util</span> <span class="key">import</span> <span class="nam">flatten_ppfs</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">commands</span><span class="op">.</span><span class="nam">debputy_cmd</span><span class="op">.</span><span class="nam">output</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="nam">_stream_to_pager</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="nam">_output_styling</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="nam">OutputStylingBase</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">exceptions</span> <span class="key">import</span> <span class="nam">DebputySubstitutionError</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">filesystem_scan</span> <span class="key">import</span> <span class="nam">build_virtual_fs</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">base_types</span> <span class="key">import</span> <span class="nam">TypeMapping</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">declarative_parser</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="nam">DeclarativeMappingInputParser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="nam">DeclarativeNonMappingInputParser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="nam">BASIC_SIMPLE_TYPES</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">parser_data</span> <span class="key">import</span> <span class="nam">ParserContextData</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">parser_doc</span> <span class="key">import</span> <span class="nam">render_rule</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">unpack_type</span><span class="op">,</span> <span class="nam">AttributePath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">packager_provided_files</span> <span class="key">import</span> <span class="nam">detect_all_packager_provided_files</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">example_processing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="nam">process_discard_rule_example</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="nam">DiscardVerdict</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">impl</span> <span class="key">import</span> <span class="nam">plugin_metadata_for_debputys_own_plugin</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">impl_types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="nam">PackagerProvidedFileClassSpec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="nam">PluginProvidedManifestVariable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="nam">DispatchingParserBase</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="nam">DeclarativeInputParser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="nam">DebputyPluginMetadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="nam">DispatchingObjectParser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="nam">SUPPORTED_DISPATCHABLE_TABLE_PARSERS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">OPARSER_MANIFEST_ROOT</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="nam">PluginProvidedDiscardRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="nam">AutomaticDiscardRuleExample</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="nam">MetadataOrMaintscriptDetector</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="nam">PluginProvidedTypeMapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">spec</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="nam">ParserDocumentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="nam">reference_documentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="nam">undocumented_attr</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="nam">TypeMappingExample</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">substitution</span> <span class="key">import</span> <span class="nam">Substitution</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">_error</span><span class="op">,</span> <span class="nam">assume_not_none</span><span class="op">,</span> <span class="nam">_warn</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"><span class="nam">plugin_dispatcher</span> <span class="op">=</span> <span class="nam">ROOT_COMMAND</span><span class="op">.</span><span class="nam">add_dispatching_subcommand</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="str">"plugin"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="str">"plugin_subcommand"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="nam">default_subcommand</span><span class="op">=</span><span class="str">"--help"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="nam">help_description</span><span class="op">=</span><span class="str">"Interact with debputy plugins"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="nam">metavar</span><span class="op">=</span><span class="str">"command"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"><span class="nam">plugin_list_cmds</span> <span class="op">=</span> <span class="nam">plugin_dispatcher</span><span class="op">.</span><span class="nam">add_dispatching_subcommand</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="str">"list"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="str">"plugin_subcommand_list"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="nam">metavar</span><span class="op">=</span><span class="str">"topic"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="nam">default_subcommand</span><span class="op">=</span><span class="str">"plugins"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="nam">help_description</span><span class="op">=</span><span class="str">"List plugins or things provided by plugins (unstable format)."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="str">" Pass `--help` *after* `list` get a topic listing"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"><span class="nam">plugin_show_cmds</span> <span class="op">=</span> <span class="nam">plugin_dispatcher</span><span class="op">.</span><span class="nam">add_dispatching_subcommand</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="str">"show"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="str">"plugin_subcommand_show"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="nam">metavar</span><span class="op">=</span><span class="str">"topic"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="nam">help_description</span><span class="op">=</span><span class="str">"Show details about a plugin or things provided by plugins (unstable format)."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="str">" Pass `--help` *after* `show` get a topic listing"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"><span class="key">def</span> <span class="nam">format_output_arg</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="nam">default_format</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="nam">allowed_formats</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="nam">help_text</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">argparse</span><span class="op">.</span><span class="nam">ArgumentParser</span><span class="op">]</span><span class="op">,</span> <span class="key">None</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="key">if</span> <span class="nam">default_format</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">allowed_formats</span><span class="op">:</span> </span><span class="r"><span class="annotate short">102 ↛ 103</span><span class="annotate long">line 102 didn't jump to line 103, because the condition on line 102 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"The default format must be in the allowed_formats..."</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="key">def</span> <span class="nam">_configurator</span><span class="op">(</span><span class="nam">argparser</span><span class="op">:</span> <span class="nam">argparse</span><span class="op">.</span><span class="nam">ArgumentParser</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="nam">argparser</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="str">"--output-format"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="nam">dest</span><span class="op">=</span><span class="str">"output_format"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="nam">default</span><span class="op">=</span><span class="nam">default_format</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="nam">choices</span><span class="op">=</span><span class="nam">allowed_formats</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="nam">help_text</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="key">return</span> <span class="nam">_configurator</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"><span class="com"># To let --output-format=... "always" work</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"><span class="nam">TEXT_ONLY_FORMAT</span> <span class="op">=</span> <span class="nam">format_output_arg</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="str">"text"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="op">[</span><span class="str">"text"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="str">"Select a given output format (options and output are not stable between releases)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"><span class="nam">TEXT_CSV_FORMAT_NO_STABILITY_PROMISE</span> <span class="op">=</span> <span class="nam">format_output_arg</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="str">"text"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="op">[</span><span class="str">"text"</span><span class="op">,</span> <span class="str">"csv"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="str">"Select a given output format (options and output are not stable between releases)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"><span class="op">@</span><span class="nam">plugin_list_cmds</span><span class="op">.</span><span class="nam">register_subcommand</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="str">"plugins"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="nam">help_description</span><span class="op">=</span><span class="str">"List known plugins with their versions"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="nam">argparser</span><span class="op">=</span><span class="nam">TEXT_CSV_FORMAT_NO_STABILITY_PROMISE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"><span class="key">def</span> <span class="nam">_plugin_cmd_list_plugins</span><span class="op">(</span><span class="nam">context</span><span class="op">:</span> <span class="nam">CommandContext</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="nam">plugin_metadata_entries</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">load_plugins</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">plugin_data</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="com"># Because the "plugins" part is optional, we are not guaranteed that TEXT_CSV_FORMAT applies</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="nam">output_format</span> <span class="op">=</span> <span class="nam">getattr</span><span class="op">(</span><span class="nam">context</span><span class="op">.</span><span class="nam">parsed_args</span><span class="op">,</span> <span class="str">"output_format"</span><span class="op">,</span> <span class="str">"text"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="key">assert</span> <span class="nam">output_format</span> <span class="key">in</span> <span class="op">{</span><span class="str">"text"</span><span class="op">,</span> <span class="str">"csv"</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="key">with</span> <span class="nam">_stream_to_pager</span><span class="op">(</span><span class="nam">context</span><span class="op">.</span><span class="nam">parsed_args</span><span class="op">)</span> <span class="key">as</span> <span class="op">(</span><span class="nam">fd</span><span class="op">,</span> <span class="nam">fo</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print_list_table</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="op">[</span><span class="str">"Plugin Name"</span><span class="op">,</span> <span class="str">"Plugin Path"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="op">[</span><span class="op">(</span><span class="nam">p</span><span class="op">.</span><span class="nam">plugin_name</span><span class="op">,</span> <span class="nam">p</span><span class="op">.</span><span class="nam">plugin_path</span><span class="op">)</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">plugin_metadata_entries</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"><span class="key">def</span> <span class="nam">_path</span><span class="op">(</span><span class="nam">path</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"./"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="key">return</span> <span class="nam">path</span><span class="op">[</span><span class="num">1</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="key">return</span> <span class="nam">path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"><span class="key">def</span> <span class="nam">_ppf_flags</span><span class="op">(</span><span class="nam">ppf</span><span class="op">:</span> <span class="nam">PackagerProvidedFileClassSpec</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="nam">flags</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="key">if</span> <span class="nam">ppf</span><span class="op">.</span><span class="nam">allow_name_segment</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="nam">flags</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">"named"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="key">if</span> <span class="nam">ppf</span><span class="op">.</span><span class="nam">allow_architecture_segment</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="nam">flags</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">"arch"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="key">if</span> <span class="nam">ppf</span><span class="op">.</span><span class="nam">supports_priority</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="nam">flags</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">f"priority={ppf.default_priority}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="key">if</span> <span class="nam">ppf</span><span class="op">.</span><span class="nam">packageless_is_fallback_for_all_packages</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="nam">flags</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">"main-all-fallback"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="key">if</span> <span class="nam">ppf</span><span class="op">.</span><span class="nam">post_formatting_rewrite</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="nam">flags</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">"post-format-hook"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="key">return</span> <span class="str">","</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">flags</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"><span class="op">@</span><span class="nam">plugin_list_cmds</span><span class="op">.</span><span class="nam">register_subcommand</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="op">[</span><span class="str">"used-packager-provided-files"</span><span class="op">,</span> <span class="str">"uppf"</span><span class="op">,</span> <span class="str">"u-p-p-f"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="nam">help_description</span><span class="op">=</span><span class="str">"List packager provided files used by this package (debian/pkg.foo)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">argparser</span><span class="op">=</span><span class="nam">TEXT_ONLY_FORMAT</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"><span class="key">def</span> <span class="nam">_plugin_cmd_list_uppf</span><span class="op">(</span><span class="nam">context</span><span class="op">:</span> <span class="nam">CommandContext</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="nam">ppf_table</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">load_plugins</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">packager_provided_files</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="nam">all_ppfs</span> <span class="op">=</span> <span class="nam">detect_all_packager_provided_files</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="nam">ppf_table</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="nam">context</span><span class="op">.</span><span class="nam">debian_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="nam">context</span><span class="op">.</span><span class="nam">binary_packages</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="nam">requested_plugins</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="nam">context</span><span class="op">.</span><span class="nam">requested_plugins</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="nam">requested_plugins</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="str">"debputy"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="nam">all_detected_ppfs</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">flatten_ppfs</span><span class="op">(</span><span class="nam">all_ppfs</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="nam">used_ppfs</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="nam">p</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">all_detected_ppfs</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="key">if</span> <span class="nam">p</span><span class="op">.</span><span class="nam">definition</span><span class="op">.</span><span class="nam">debputy_plugin_metadata</span><span class="op">.</span><span class="nam">plugin_name</span> <span class="key">in</span> <span class="nam">requested_plugins</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="nam">inactive_ppfs</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="nam">p</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">all_detected_ppfs</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="key">if</span> <span class="nam">p</span><span class="op">.</span><span class="nam">definition</span><span class="op">.</span><span class="nam">debputy_plugin_metadata</span><span class="op">.</span><span class="nam">plugin_name</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">requested_plugins</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">used_ppfs</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">inactive_ppfs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">"No packager provided files detected; not even a changelog... ?"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="key">with</span> <span class="nam">_stream_to_pager</span><span class="op">(</span><span class="nam">context</span><span class="op">.</span><span class="nam">parsed_args</span><span class="op">)</span> <span class="key">as</span> <span class="op">(</span><span class="nam">fd</span><span class="op">,</span> <span class="nam">fo</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="key">if</span> <span class="nam">used_ppfs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="nam">headers</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="str">"File"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="str">"Matched Stem"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="str">"Installed Into"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="str">"Installed As"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print_list_table</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="nam">headers</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="nam">ppf</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="nam">ppf</span><span class="op">.</span><span class="nam">definition</span><span class="op">.</span><span class="nam">stem</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="nam">ppf</span><span class="op">.</span><span class="nam">package_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="str">"/"</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">ppf</span><span class="op">.</span><span class="nam">compute_dest</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">.</span><span class="nam">lstrip</span><span class="op">(</span><span class="str">"."</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="key">for</span> <span class="nam">ppf</span> <span class="key">in</span> <span class="nam">sorted</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="nam">used_ppfs</span><span class="op">,</span> <span class="nam">key</span><span class="op">=</span><span class="nam">operator</span><span class="op">.</span><span class="nam">attrgetter</span><span class="op">(</span><span class="str">"package_name"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="key">if</span> <span class="nam">inactive_ppfs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="nam">headers</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="str">"UNUSED FILE"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="str">"Matched Stem"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="str">"Installed Into"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="str">"Could Be Installed As"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="str">"If B-D Had"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print_list_table</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="nam">headers</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="str">f"~{ppf.path.path}~"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="nam">ppf</span><span class="op">.</span><span class="nam">definition</span><span class="op">.</span><span class="nam">stem</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="str">f"~{ppf.package_name}~"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="str">"/"</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">ppf</span><span class="op">.</span><span class="nam">compute_dest</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">.</span><span class="nam">lstrip</span><span class="op">(</span><span class="str">"."</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="str">f"debputy-plugin-{ppf.definition.debputy_plugin_metadata.plugin_name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="key">for</span> <span class="nam">ppf</span> <span class="key">in</span> <span class="nam">sorted</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="nam">inactive_ppfs</span><span class="op">,</span> <span class="nam">key</span><span class="op">=</span><span class="nam">operator</span><span class="op">.</span><span class="nam">attrgetter</span><span class="op">(</span><span class="str">"package_name"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"><span class="op">@</span><span class="nam">plugin_list_cmds</span><span class="op">.</span><span class="nam">register_subcommand</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="op">[</span><span class="str">"packager-provided-files"</span><span class="op">,</span> <span class="str">"ppf"</span><span class="op">,</span> <span class="str">"p-p-f"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="nam">help_description</span><span class="op">=</span><span class="str">"List packager provided file definitions (debian/pkg.foo)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="nam">argparser</span><span class="op">=</span><span class="nam">TEXT_CSV_FORMAT_NO_STABILITY_PROMISE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"><span class="key">def</span> <span class="nam">_plugin_cmd_list_ppf</span><span class="op">(</span><span class="nam">context</span><span class="op">:</span> <span class="nam">CommandContext</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="nam">ppfs</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">PackagerProvidedFileClassSpec</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="nam">ppfs</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">load_plugins</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">packager_provided_files</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="key">with</span> <span class="nam">_stream_to_pager</span><span class="op">(</span><span class="nam">context</span><span class="op">.</span><span class="nam">parsed_args</span><span class="op">)</span> <span class="key">as</span> <span class="op">(</span><span class="nam">fd</span><span class="op">,</span> <span class="nam">fo</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="nam">headers</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="str">"Stem"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="str">"Installed As"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="op">(</span><span class="str">"Mode"</span><span class="op">,</span> <span class="str">">"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="str">"Features"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="str">"Provided by"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print_list_table</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="nam">headers</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="nam">ppf</span><span class="op">.</span><span class="nam">stem</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="nam">_path</span><span class="op">(</span><span class="nam">ppf</span><span class="op">.</span><span class="nam">installed_as_format</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="str">"0"</span> <span class="op">+</span> <span class="nam">oct</span><span class="op">(</span><span class="nam">ppf</span><span class="op">.</span><span class="nam">default_mode</span><span class="op">)</span><span class="op">[</span><span class="num">2</span><span class="op">:</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="nam">_ppf_flags</span><span class="op">(</span><span class="nam">ppf</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="nam">ppf</span><span class="op">.</span><span class="nam">debputy_plugin_metadata</span><span class="op">.</span><span class="nam">plugin_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="key">for</span> <span class="nam">ppf</span> <span class="key">in</span> <span class="nam">sorted</span><span class="op">(</span><span class="nam">ppfs</span><span class="op">,</span> <span class="nam">key</span><span class="op">=</span><span class="nam">operator</span><span class="op">.</span><span class="nam">attrgetter</span><span class="op">(</span><span class="str">"stem"</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="key">if</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">isdir</span><span class="op">(</span><span class="str">"debian/"</span><span class="op">)</span> <span class="key">and</span> <span class="nam">fo</span><span class="op">.</span><span class="nam">output_format</span> <span class="op">==</span> <span class="str">"text"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="str">"Hint: You can use `debputy plugin list used-packager-provided-files` to have `debputy`"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="str">"list all the files in debian/ that matches these definitions."</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"><span class="op">@</span><span class="nam">plugin_list_cmds</span><span class="op">.</span><span class="nam">register_subcommand</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="op">[</span><span class="str">"metadata-detectors"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="nam">help_description</span><span class="op">=</span><span class="str">"List metadata detectors"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="nam">argparser</span><span class="op">=</span><span class="nam">TEXT_CSV_FORMAT_NO_STABILITY_PROMISE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"><span class="key">def</span> <span class="nam">_plugin_cmd_list_metadata_detectors</span><span class="op">(</span><span class="nam">context</span><span class="op">:</span> <span class="nam">CommandContext</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="nam">mds</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> <span class="nam">chain</span><span class="op">.</span><span class="nam">from_iterable</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="nam">context</span><span class="op">.</span><span class="nam">load_plugins</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">metadata_maintscript_detectors</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="key">def</span> <span class="nam">_sort_key</span><span class="op">(</span><span class="nam">md</span><span class="op">:</span> <span class="str">"MetadataOrMaintscriptDetector"</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Any</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="key">return</span> <span class="nam">md</span><span class="op">.</span><span class="nam">plugin_metadata</span><span class="op">.</span><span class="nam">plugin_name</span><span class="op">,</span> <span class="nam">md</span><span class="op">.</span><span class="nam">detector_id</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="key">with</span> <span class="nam">_stream_to_pager</span><span class="op">(</span><span class="nam">context</span><span class="op">.</span><span class="nam">parsed_args</span><span class="op">)</span> <span class="key">as</span> <span class="op">(</span><span class="nam">fd</span><span class="op">,</span> <span class="nam">fo</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print_list_table</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> <span class="op">[</span><span class="str">"Provided by"</span><span class="op">,</span> <span class="str">"Detector Id"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> <span class="op">(</span><span class="nam">md</span><span class="op">.</span><span class="nam">plugin_metadata</span><span class="op">.</span><span class="nam">plugin_name</span><span class="op">,</span> <span class="nam">md</span><span class="op">.</span><span class="nam">detector_id</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="key">for</span> <span class="nam">md</span> <span class="key">in</span> <span class="nam">sorted</span><span class="op">(</span><span class="nam">mds</span><span class="op">,</span> <span class="nam">key</span><span class="op">=</span><span class="nam">_sort_key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"><span class="key">def</span> <span class="nam">_resolve_variable_for_list</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="nam">substitution</span><span class="op">:</span> <span class="nam">Substitution</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="nam">variable</span><span class="op">:</span> <span class="nam">PluginProvidedManifestVariable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="nam">var</span> <span class="op">=</span> <span class="str">"{{"</span> <span class="op">+</span> <span class="nam">variable</span><span class="op">.</span><span class="nam">variable_name</span> <span class="op">+</span> <span class="str">"}}"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="nam">value</span> <span class="op">=</span> <span class="nam">substitution</span><span class="op">.</span><span class="nam">substitute</span><span class="op">(</span><span class="nam">var</span><span class="op">,</span> <span class="str">"CLI request"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="key">except</span> <span class="nam">DebputySubstitutionError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="nam">value</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="key">return</span> <span class="nam">_render_manifest_variable_value</span><span class="op">(</span><span class="nam">value</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"><span class="key">def</span> <span class="nam">_render_manifest_variable_flag</span><span class="op">(</span><span class="nam">variable</span><span class="op">:</span> <span class="nam">PluginProvidedManifestVariable</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> <span class="nam">flags</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> <span class="key">if</span> <span class="nam">variable</span><span class="op">.</span><span class="nam">is_for_special_case</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> <span class="nam">flags</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">"special-use-case"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> <span class="key">if</span> <span class="nam">variable</span><span class="op">.</span><span class="nam">is_internal</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> <span class="nam">flags</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">"internal"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> <span class="key">return</span> <span class="str">","</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">flags</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"><span class="key">def</span> <span class="nam">_render_list_filter</span><span class="op">(</span><span class="nam">v</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> <span class="key">if</span> <span class="nam">v</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> <span class="key">return</span> <span class="str">"N/A"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> <span class="key">return</span> <span class="str">"shown"</span> <span class="key">if</span> <span class="nam">v</span> <span class="key">else</span> <span class="str">"hidden"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"><span class="op">@</span><span class="nam">plugin_list_cmds</span><span class="op">.</span><span class="nam">register_subcommand</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> <span class="op">[</span><span class="str">"manifest-variables"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"> <span class="nam">help_description</span><span class="op">=</span><span class="str">"List plugin provided manifest variables (such as `{{path:FOO}}`)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"><span class="key">def</span> <span class="nam">plugin_cmd_list_manifest_variables</span><span class="op">(</span><span class="nam">context</span><span class="op">:</span> <span class="nam">CommandContext</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> <span class="nam">variables</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">load_plugins</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">manifest_variables</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"> <span class="nam">substitution</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">substitution</span><span class="op">.</span><span class="nam">with_extra_substitutions</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"> <span class="nam">PACKAGE</span><span class="op">=</span><span class="str">"<package-name>"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"> <span class="nam">parsed_args</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">parsed_args</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"> <span class="nam">show_special_case_vars</span> <span class="op">=</span> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">show_special_use_variables</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"> <span class="nam">show_token_vars</span> <span class="op">=</span> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">show_token_variables</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"> <span class="nam">show_all_vars</span> <span class="op">=</span> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">show_all_variables</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"> <span class="key">def</span> <span class="nam">_include_var</span><span class="op">(</span><span class="nam">var</span><span class="op">:</span> <span class="nam">PluginProvidedManifestVariable</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"> <span class="key">if</span> <span class="nam">show_all_vars</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"> <span class="key">if</span> <span class="nam">var</span><span class="op">.</span><span class="nam">is_internal</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"> <span class="key">if</span> <span class="nam">var</span><span class="op">.</span><span class="nam">is_for_special_case</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">show_special_case_vars</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"> <span class="key">if</span> <span class="nam">var</span><span class="op">.</span><span class="nam">is_token</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">show_token_vars</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"> <span class="key">with</span> <span class="nam">_stream_to_pager</span><span class="op">(</span><span class="nam">context</span><span class="op">.</span><span class="nam">parsed_args</span><span class="op">)</span> <span class="key">as</span> <span class="op">(</span><span class="nam">fd</span><span class="op">,</span> <span class="nam">fo</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print_list_table</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"> <span class="op">[</span><span class="str">"Variable (use via: `{{ NAME }}`)"</span><span class="op">,</span> <span class="str">"Value"</span><span class="op">,</span> <span class="str">"Flag"</span><span class="op">,</span> <span class="str">"Provided by"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"> <span class="nam">k</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"> <span class="nam">_resolve_variable_for_list</span><span class="op">(</span><span class="nam">substitution</span><span class="op">,</span> <span class="nam">var</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"> <span class="nam">_render_manifest_variable_flag</span><span class="op">(</span><span class="nam">var</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"> <span class="nam">var</span><span class="op">.</span><span class="nam">plugin_metadata</span><span class="op">.</span><span class="nam">plugin_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"> <span class="key">for</span> <span class="nam">k</span><span class="op">,</span> <span class="nam">var</span> <span class="key">in</span> <span class="nam">sorted</span><span class="op">(</span><span class="nam">variables</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"> <span class="key">if</span> <span class="nam">_include_var</span><span class="op">(</span><span class="nam">var</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"> <span class="nam">filters</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"> <span class="str">"Token variables"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"> <span class="nam">show_token_vars</span> <span class="key">if</span> <span class="key">not</span> <span class="nam">show_all_vars</span> <span class="key">else</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t385" href="#t385">385</a></span><span class="t"> <span class="str">"--show-token-variables"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t386" href="#t386">386</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t387" href="#t387">387</a></span><span class="t"> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t388" href="#t388">388</a></span><span class="t"> <span class="str">"Special use variables"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t389" href="#t389">389</a></span><span class="t"> <span class="nam">show_special_case_vars</span> <span class="key">if</span> <span class="key">not</span> <span class="nam">show_all_vars</span> <span class="key">else</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t390" href="#t390">390</a></span><span class="t"> <span class="str">"--show-special-case-variables"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t391" href="#t391">391</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t392" href="#t392">392</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t393" href="#t393">393</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t394" href="#t394">394</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print_list_table</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t395" href="#t395">395</a></span><span class="t"> <span class="op">[</span><span class="str">"Variable type"</span><span class="op">,</span> <span class="str">"Value"</span><span class="op">,</span> <span class="str">"Option"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t396" href="#t396">396</a></span><span class="t"> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t397" href="#t397">397</a></span><span class="t"> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t398" href="#t398">398</a></span><span class="t"> <span class="nam">fname</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t399" href="#t399">399</a></span><span class="t"> <span class="nam">_render_list_filter</span><span class="op">(</span><span class="nam">value</span> <span class="key">or</span> <span class="nam">show_all_vars</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t400" href="#t400">400</a></span><span class="t"> <span class="str">f"{option} OR --show-all-variables"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t401" href="#t401">401</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t402" href="#t402">402</a></span><span class="t"> <span class="key">for</span> <span class="nam">fname</span><span class="op">,</span> <span class="nam">value</span><span class="op">,</span> <span class="nam">option</span> <span class="key">in</span> <span class="nam">filters</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t403" href="#t403">403</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t404" href="#t404">404</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t405" href="#t405">405</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t406" href="#t406">406</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t407" href="#t407">407</a></span><span class="t"><span class="op">@</span><span class="nam">plugin_cmd_list_manifest_variables</span><span class="op">.</span><span class="nam">configure_handler</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t408" href="#t408">408</a></span><span class="t"><span class="key">def</span> <span class="nam">list_manifest_variable_arg_parser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t409" href="#t409">409</a></span><span class="t"> <span class="nam">plugin_list_manifest_variables_parser</span><span class="op">:</span> <span class="nam">argparse</span><span class="op">.</span><span class="nam">ArgumentParser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t410" href="#t410">410</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t411" href="#t411">411</a></span><span class="t"> <span class="nam">plugin_list_manifest_variables_parser</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t412" href="#t412">412</a></span><span class="t"> <span class="str">"--show-special-case-variables"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t413" href="#t413">413</a></span><span class="t"> <span class="nam">dest</span><span class="op">=</span><span class="str">"show_special_use_variables"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t414" href="#t414">414</a></span><span class="t"> <span class="nam">default</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t415" href="#t415">415</a></span><span class="t"> <span class="nam">action</span><span class="op">=</span><span class="str">"store_true"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t416" href="#t416">416</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Show variables that are only used in special / niche cases"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t417" href="#t417">417</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t418" href="#t418">418</a></span><span class="t"> <span class="nam">plugin_list_manifest_variables_parser</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t419" href="#t419">419</a></span><span class="t"> <span class="str">"--show-token-variables"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t420" href="#t420">420</a></span><span class="t"> <span class="nam">dest</span><span class="op">=</span><span class="str">"show_token_variables"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t421" href="#t421">421</a></span><span class="t"> <span class="nam">default</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t422" href="#t422">422</a></span><span class="t"> <span class="nam">action</span><span class="op">=</span><span class="str">"store_true"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t423" href="#t423">423</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Show token (syntactical) variables like {{token:TAB}}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t424" href="#t424">424</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t425" href="#t425">425</a></span><span class="t"> <span class="nam">plugin_list_manifest_variables_parser</span><span class="op">.</span><span class="nam">add_argument</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t426" href="#t426">426</a></span><span class="t"> <span class="str">"--show-all-variables"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t427" href="#t427">427</a></span><span class="t"> <span class="nam">dest</span><span class="op">=</span><span class="str">"show_all_variables"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t428" href="#t428">428</a></span><span class="t"> <span class="nam">default</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t429" href="#t429">429</a></span><span class="t"> <span class="nam">action</span><span class="op">=</span><span class="str">"store_true"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t430" href="#t430">430</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Show all variables regardless of type/kind (overrules other filter settings)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t431" href="#t431">431</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t432" href="#t432">432</a></span><span class="t"> <span class="nam">TEXT_ONLY_FORMAT</span><span class="op">(</span><span class="nam">plugin_list_manifest_variables_parser</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t433" href="#t433">433</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t434" href="#t434">434</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t435" href="#t435">435</a></span><span class="t"><span class="key">def</span> <span class="nam">_parser_type_name</span><span class="op">(</span><span class="nam">v</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Type</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t436" href="#t436">436</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t437" href="#t437">437</a></span><span class="t"> <span class="key">return</span> <span class="nam">v</span> <span class="key">if</span> <span class="nam">v</span> <span class="op">!=</span> <span class="str">"<ROOT>"</span> <span class="key">else</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t438" href="#t438">438</a></span><span class="t"> <span class="key">return</span> <span class="nam">v</span><span class="op">.</span><span class="nam">__name__</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t439" href="#t439">439</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t440" href="#t440">440</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t441" href="#t441">441</a></span><span class="t"><span class="op">@</span><span class="nam">plugin_list_cmds</span><span class="op">.</span><span class="nam">register_subcommand</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t442" href="#t442">442</a></span><span class="t"> <span class="op">[</span><span class="str">"pluggable-manifest-rules"</span><span class="op">,</span> <span class="str">"p-m-r"</span><span class="op">,</span> <span class="str">"pmr"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t443" href="#t443">443</a></span><span class="t"> <span class="nam">help_description</span><span class="op">=</span><span class="str">"Pluggable manifest rules (such as install rules)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t444" href="#t444">444</a></span><span class="t"> <span class="nam">argparser</span><span class="op">=</span><span class="nam">TEXT_CSV_FORMAT_NO_STABILITY_PROMISE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t445" href="#t445">445</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t446" href="#t446">446</a></span><span class="t"><span class="key">def</span> <span class="nam">_plugin_cmd_list_manifest_rules</span><span class="op">(</span><span class="nam">context</span><span class="op">:</span> <span class="nam">CommandContext</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t447" href="#t447">447</a></span><span class="t"> <span class="nam">feature_set</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">load_plugins</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t448" href="#t448">448</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t449" href="#t449">449</a></span><span class="t"> <span class="com"># Type hint to make the chain call easier for the type checker, which does not seem</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t450" href="#t450">450</a></span><span class="t"> <span class="com"># to derive to this common base type on its own.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t451" href="#t451">451</a></span><span class="t"> <span class="nam">base_type</span> <span class="op">=</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Type</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> <span class="nam">DispatchingParserBase</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t452" href="#t452">452</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t453" href="#t453">453</a></span><span class="t"> <span class="nam">parser_generator</span> <span class="op">=</span> <span class="nam">feature_set</span><span class="op">.</span><span class="nam">manifest_parser_generator</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t454" href="#t454">454</a></span><span class="t"> <span class="nam">table_parsers</span><span class="op">:</span> <span class="nam">base_type</span> <span class="op">=</span> <span class="nam">parser_generator</span><span class="op">.</span><span class="nam">dispatchable_table_parsers</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t455" href="#t455">455</a></span><span class="t"> <span class="nam">object_parsers</span><span class="op">:</span> <span class="nam">base_type</span> <span class="op">=</span> <span class="nam">parser_generator</span><span class="op">.</span><span class="nam">dispatchable_object_parsers</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t456" href="#t456">456</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t457" href="#t457">457</a></span><span class="t"> <span class="nam">parsers</span> <span class="op">=</span> <span class="nam">chain</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t458" href="#t458">458</a></span><span class="t"> <span class="nam">table_parsers</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t459" href="#t459">459</a></span><span class="t"> <span class="nam">object_parsers</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t460" href="#t460">460</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t461" href="#t461">461</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t462" href="#t462">462</a></span><span class="t"> <span class="key">with</span> <span class="nam">_stream_to_pager</span><span class="op">(</span><span class="nam">context</span><span class="op">.</span><span class="nam">parsed_args</span><span class="op">)</span> <span class="key">as</span> <span class="op">(</span><span class="nam">fd</span><span class="op">,</span> <span class="nam">fo</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t463" href="#t463">463</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print_list_table</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t464" href="#t464">464</a></span><span class="t"> <span class="op">[</span><span class="str">"Rule Name"</span><span class="op">,</span> <span class="str">"Rule Type"</span><span class="op">,</span> <span class="str">"Provided By"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t465" href="#t465">465</a></span><span class="t"> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t466" href="#t466">466</a></span><span class="t"> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t467" href="#t467">467</a></span><span class="t"> <span class="nam">rn</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t468" href="#t468">468</a></span><span class="t"> <span class="nam">_parser_type_name</span><span class="op">(</span><span class="nam">rt</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t469" href="#t469">469</a></span><span class="t"> <span class="nam">pt</span><span class="op">.</span><span class="nam">parser_for</span><span class="op">(</span><span class="nam">rn</span><span class="op">)</span><span class="op">.</span><span class="nam">plugin_metadata</span><span class="op">.</span><span class="nam">plugin_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t470" href="#t470">470</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t471" href="#t471">471</a></span><span class="t"> <span class="key">for</span> <span class="nam">rt</span><span class="op">,</span> <span class="nam">pt</span> <span class="key">in</span> <span class="nam">parsers</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t472" href="#t472">472</a></span><span class="t"> <span class="key">for</span> <span class="nam">rn</span> <span class="key">in</span> <span class="nam">pt</span><span class="op">.</span><span class="nam">registered_keywords</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t473" href="#t473">473</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t474" href="#t474">474</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t475" href="#t475">475</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t476" href="#t476">476</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t477" href="#t477">477</a></span><span class="t"><span class="op">@</span><span class="nam">plugin_list_cmds</span><span class="op">.</span><span class="nam">register_subcommand</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t478" href="#t478">478</a></span><span class="t"> <span class="op">[</span><span class="str">"automatic-discard-rules"</span><span class="op">,</span> <span class="str">"a-d-r"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t479" href="#t479">479</a></span><span class="t"> <span class="nam">help_description</span><span class="op">=</span><span class="str">"List automatic discard rules"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t480" href="#t480">480</a></span><span class="t"> <span class="nam">argparser</span><span class="op">=</span><span class="nam">TEXT_CSV_FORMAT_NO_STABILITY_PROMISE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t481" href="#t481">481</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t482" href="#t482">482</a></span><span class="t"><span class="key">def</span> <span class="nam">_plugin_cmd_list_automatic_discard_rules</span><span class="op">(</span><span class="nam">context</span><span class="op">:</span> <span class="nam">CommandContext</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t483" href="#t483">483</a></span><span class="t"> <span class="nam">auto_discard_rules</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">load_plugins</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">auto_discard_rules</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t484" href="#t484">484</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t485" href="#t485">485</a></span><span class="t"> <span class="key">with</span> <span class="nam">_stream_to_pager</span><span class="op">(</span><span class="nam">context</span><span class="op">.</span><span class="nam">parsed_args</span><span class="op">)</span> <span class="key">as</span> <span class="op">(</span><span class="nam">fd</span><span class="op">,</span> <span class="nam">fo</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t486" href="#t486">486</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print_list_table</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t487" href="#t487">487</a></span><span class="t"> <span class="op">[</span><span class="str">"Name"</span><span class="op">,</span> <span class="str">"Provided By"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t488" href="#t488">488</a></span><span class="t"> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t489" href="#t489">489</a></span><span class="t"> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t490" href="#t490">490</a></span><span class="t"> <span class="nam">name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t491" href="#t491">491</a></span><span class="t"> <span class="nam">ppdr</span><span class="op">.</span><span class="nam">plugin_metadata</span><span class="op">.</span><span class="nam">plugin_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t492" href="#t492">492</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t493" href="#t493">493</a></span><span class="t"> <span class="key">for</span> <span class="nam">name</span><span class="op">,</span> <span class="nam">ppdr</span> <span class="key">in</span> <span class="nam">auto_discard_rules</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t494" href="#t494">494</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t495" href="#t495">495</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t496" href="#t496">496</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t497" href="#t497">497</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t498" href="#t498">498</a></span><span class="t"><span class="key">def</span> <span class="nam">_render_manifest_variable_value</span><span class="op">(</span><span class="nam">v</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t499" href="#t499">499</a></span><span class="t"> <span class="key">if</span> <span class="nam">v</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t500" href="#t500">500</a></span><span class="t"> <span class="key">return</span> <span class="str">"(N/A: Cannot resolve the variable)"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t501" href="#t501">501</a></span><span class="t"> <span class="nam">v</span> <span class="op">=</span> <span class="nam">v</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">"\n"</span><span class="op">,</span> <span class="str">"\\n"</span><span class="op">)</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">"\t"</span><span class="op">,</span> <span class="str">"\\t"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t502" href="#t502">502</a></span><span class="t"> <span class="key">return</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t503" href="#t503">503</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t504" href="#t504">504</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t505" href="#t505">505</a></span><span class="t"><span class="key">def</span> <span class="nam">_render_multiline_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t506" href="#t506">506</a></span><span class="t"> <span class="nam">documentation</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t507" href="#t507">507</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t508" href="#t508">508</a></span><span class="t"> <span class="nam">first_line_prefix</span><span class="op">:</span> <span class="nam">str</span> <span class="op">=</span> <span class="str">"Documentation: "</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t509" href="#t509">509</a></span><span class="t"> <span class="nam">following_line_prefix</span><span class="op">:</span> <span class="nam">str</span> <span class="op">=</span> <span class="str">" "</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t510" href="#t510">510</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t511" href="#t511">511</a></span><span class="t"> <span class="nam">current_prefix</span> <span class="op">=</span> <span class="nam">first_line_prefix</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t512" href="#t512">512</a></span><span class="t"> <span class="key">for</span> <span class="nam">line</span> <span class="key">in</span> <span class="nam">documentation</span><span class="op">.</span><span class="nam">splitlines</span><span class="op">(</span><span class="nam">keepends</span><span class="op">=</span><span class="key">False</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t513" href="#t513">513</a></span><span class="t"> <span class="key">if</span> <span class="nam">line</span><span class="op">.</span><span class="nam">isspace</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t514" href="#t514">514</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">current_prefix</span><span class="op">.</span><span class="nam">isspace</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t515" href="#t515">515</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="nam">current_prefix</span><span class="op">.</span><span class="nam">rstrip</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t516" href="#t516">516</a></span><span class="t"> <span class="nam">current_prefix</span> <span class="op">=</span> <span class="nam">following_line_prefix</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t517" href="#t517">517</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t518" href="#t518">518</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t519" href="#t519">519</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t520" href="#t520">520</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">f"{current_prefix}{line}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t521" href="#t521">521</a></span><span class="t"> <span class="nam">current_prefix</span> <span class="op">=</span> <span class="nam">following_line_prefix</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t522" href="#t522">522</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t523" href="#t523">523</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t524" href="#t524">524</a></span><span class="t"><span class="op">@</span><span class="nam">plugin_show_cmds</span><span class="op">.</span><span class="nam">register_subcommand</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t525" href="#t525">525</a></span><span class="t"> <span class="op">[</span><span class="str">"manifest-variables"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t526" href="#t526">526</a></span><span class="t"> <span class="nam">help_description</span><span class="op">=</span><span class="str">"Plugin provided manifest variables (such as `{{path:FOO}}`)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t527" href="#t527">527</a></span><span class="t"> <span class="nam">argparser</span><span class="op">=</span><span class="nam">add_arg</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t528" href="#t528">528</a></span><span class="t"> <span class="str">"manifest_variable"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t529" href="#t529">529</a></span><span class="t"> <span class="nam">metavar</span><span class="op">=</span><span class="str">"manifest-variable"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t530" href="#t530">530</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Name of the variable (such as `path:FOO` or `{{path:FOO}}`) to display details about"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t531" href="#t531">531</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t532" href="#t532">532</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t533" href="#t533">533</a></span><span class="t"><span class="key">def</span> <span class="nam">_plugin_cmd_show_manifest_variables</span><span class="op">(</span><span class="nam">context</span><span class="op">:</span> <span class="nam">CommandContext</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t534" href="#t534">534</a></span><span class="t"> <span class="nam">plugin_feature_set</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">load_plugins</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t535" href="#t535">535</a></span><span class="t"> <span class="nam">variables</span> <span class="op">=</span> <span class="nam">plugin_feature_set</span><span class="op">.</span><span class="nam">manifest_variables</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t536" href="#t536">536</a></span><span class="t"> <span class="nam">substitution</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">substitution</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t537" href="#t537">537</a></span><span class="t"> <span class="nam">parsed_args</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">parsed_args</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t538" href="#t538">538</a></span><span class="t"> <span class="nam">variable_name</span> <span class="op">=</span> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">manifest_variable</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t539" href="#t539">539</a></span><span class="t"> <span class="nam">fo</span> <span class="op">=</span> <span class="nam">_output_styling</span><span class="op">(</span><span class="nam">context</span><span class="op">.</span><span class="nam">parsed_args</span><span class="op">,</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">stdout</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t540" href="#t540">540</a></span><span class="t"> <span class="key">if</span> <span class="nam">variable_name</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"{{"</span><span class="op">)</span> <span class="key">and</span> <span class="nam">variable_name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"}}"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t541" href="#t541">541</a></span><span class="t"> <span class="nam">variable_name</span> <span class="op">=</span> <span class="nam">variable_name</span><span class="op">[</span><span class="num">2</span><span class="op">:</span><span class="op">-</span><span class="num">2</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t542" href="#t542">542</a></span><span class="t"> <span class="nam">variable</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">PluginProvidedManifestVariable</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t543" href="#t543">543</a></span><span class="t"> <span class="key">if</span> <span class="nam">variable_name</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"env:"</span><span class="op">)</span> <span class="key">and</span> <span class="nam">len</span><span class="op">(</span><span class="nam">variable_name</span><span class="op">)</span> <span class="op">></span> <span class="num">4</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t544" href="#t544">544</a></span><span class="t"> <span class="nam">env_var</span> <span class="op">=</span> <span class="nam">variable_name</span><span class="op">[</span><span class="num">4</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t545" href="#t545">545</a></span><span class="t"> <span class="nam">variable</span> <span class="op">=</span> <span class="nam">PluginProvidedManifestVariable</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t546" href="#t546">546</a></span><span class="t"> <span class="nam">plugin_feature_set</span><span class="op">.</span><span class="nam">plugin_data</span><span class="op">[</span><span class="str">"debputy"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t547" href="#t547">547</a></span><span class="t"> <span class="nam">variable_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t548" href="#t548">548</a></span><span class="t"> <span class="nam">variable_value</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t549" href="#t549">549</a></span><span class="t"> <span class="nam">is_context_specific_variable</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t550" href="#t550">550</a></span><span class="t"> <span class="nam">is_documentation_placeholder</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t551" href="#t551">551</a></span><span class="t"> <span class="nam">variable_reference_documentation</span><span class="op">=</span><span class="str">f'Environment variable "{env_var}"'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t552" href="#t552">552</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t553" href="#t553">553</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t554" href="#t554">554</a></span><span class="t"> <span class="nam">variable</span> <span class="op">=</span> <span class="nam">variables</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">variable_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t555" href="#t555">555</a></span><span class="t"> <span class="key">if</span> <span class="nam">variable</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t556" href="#t556">556</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t557" href="#t557">557</a></span><span class="t"> <span class="str">f'Cannot resolve "{variable_name}" as a known variable from any of the available'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t558" href="#t558">558</a></span><span class="t"> <span class="str">f" plugins. Please use `debputy plugin list manifest-variables` to list all known"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t559" href="#t559">559</a></span><span class="t"> <span class="str">f" provided variables."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t560" href="#t560">560</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t561" href="#t561">561</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t562" href="#t562">562</a></span><span class="t"> <span class="nam">var_with_braces</span> <span class="op">=</span> <span class="str">"{{"</span> <span class="op">+</span> <span class="nam">variable_name</span> <span class="op">+</span> <span class="str">"}}"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t563" href="#t563">563</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t564" href="#t564">564</a></span><span class="t"> <span class="nam">source_value</span> <span class="op">=</span> <span class="nam">substitution</span><span class="op">.</span><span class="nam">substitute</span><span class="op">(</span><span class="nam">var_with_braces</span><span class="op">,</span> <span class="str">"CLI request"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t565" href="#t565">565</a></span><span class="t"> <span class="key">except</span> <span class="nam">DebputySubstitutionError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t566" href="#t566">566</a></span><span class="t"> <span class="nam">source_value</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t567" href="#t567">567</a></span><span class="t"> <span class="nam">binary_value</span> <span class="op">=</span> <span class="nam">source_value</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t568" href="#t568">568</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">f"Variable: {variable_name}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t569" href="#t569">569</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print_visual_formatting</span><span class="op">(</span><span class="str">f"=========={'=' * len(variable_name)}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t570" href="#t570">570</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t571" href="#t571">571</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t572" href="#t572">572</a></span><span class="t"> <span class="key">if</span> <span class="nam">variable</span><span class="op">.</span><span class="nam">is_context_specific_variable</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t573" href="#t573">573</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t574" href="#t574">574</a></span><span class="t"> <span class="nam">binary_value</span> <span class="op">=</span> <span class="nam">substitution</span><span class="op">.</span><span class="nam">with_extra_substitutions</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t575" href="#t575">575</a></span><span class="t"> <span class="nam">PACKAGE</span><span class="op">=</span><span class="str">"<package-name>"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t576" href="#t576">576</a></span><span class="t"> <span class="op">)</span><span class="op">.</span><span class="nam">substitute</span><span class="op">(</span><span class="nam">var_with_braces</span><span class="op">,</span> <span class="str">"CLI request"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t577" href="#t577">577</a></span><span class="t"> <span class="key">except</span> <span class="nam">DebputySubstitutionError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t578" href="#t578">578</a></span><span class="t"> <span class="nam">binary_value</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t579" href="#t579">579</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t580" href="#t580">580</a></span><span class="t"> <span class="nam">doc</span> <span class="op">=</span> <span class="nam">variable</span><span class="op">.</span><span class="nam">variable_reference_documentation</span> <span class="key">or</span> <span class="str">"No documentation provided"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t581" href="#t581">581</a></span><span class="t"> <span class="nam">_render_multiline_documentation</span><span class="op">(</span><span class="nam">doc</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t582" href="#t582">582</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t583" href="#t583">583</a></span><span class="t"> <span class="key">if</span> <span class="nam">source_value</span> <span class="op">==</span> <span class="nam">binary_value</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t584" href="#t584">584</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">f"Resolved: {_render_manifest_variable_value(source_value)}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t585" href="#t585">585</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t586" href="#t586">586</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">"Resolved:"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t587" href="#t587">587</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">f" [source context]: {_render_manifest_variable_value(source_value)}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t588" href="#t588">588</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">f" [binary context]: {_render_manifest_variable_value(binary_value)}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t589" href="#t589">589</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t590" href="#t590">590</a></span><span class="t"> <span class="key">if</span> <span class="nam">variable</span><span class="op">.</span><span class="nam">is_for_special_case</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t591" href="#t591">591</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t592" href="#t592">592</a></span><span class="t"> <span class="str">'Special-case: The variable has been marked as a "special-case"-only variable.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t593" href="#t593">593</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t594" href="#t594">594</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t595" href="#t595">595</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">variable</span><span class="op">.</span><span class="nam">is_documentation_placeholder</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t596" href="#t596">596</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">f"Plugin: {variable.plugin_metadata.plugin_name}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t597" href="#t597">597</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t598" href="#t598">598</a></span><span class="t"> <span class="key">if</span> <span class="nam">variable</span><span class="op">.</span><span class="nam">is_internal</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t599" href="#t599">599</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t600" href="#t600">600</a></span><span class="t"> <span class="com"># I knew everything I felt was showing on my face, and I hate that. I grated out,</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t601" href="#t601">601</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">"That was private."</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t602" href="#t602">602</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t603" href="#t603">603</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t604" href="#t604">604</a></span><span class="t"><span class="key">def</span> <span class="nam">_determine_ppf</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t605" href="#t605">605</a></span><span class="t"> <span class="nam">context</span><span class="op">:</span> <span class="nam">CommandContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t606" href="#t606">606</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">PackagerProvidedFileClassSpec</span><span class="op">,</span> <span class="nam">bool</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t607" href="#t607">607</a></span><span class="t"> <span class="nam">feature_set</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">load_plugins</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t608" href="#t608">608</a></span><span class="t"> <span class="nam">ppf_name</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">parsed_args</span><span class="op">.</span><span class="nam">ppf_name</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t609" href="#t609">609</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t610" href="#t610">610</a></span><span class="t"> <span class="key">return</span> <span class="nam">feature_set</span><span class="op">.</span><span class="nam">packager_provided_files</span><span class="op">[</span><span class="nam">ppf_name</span><span class="op">]</span><span class="op">,</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t611" href="#t611">611</a></span><span class="t"> <span class="key">except</span> <span class="nam">KeyError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t612" href="#t612">612</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t613" href="#t613">613</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t614" href="#t614">614</a></span><span class="t"> <span class="nam">orig_ppf_name</span> <span class="op">=</span> <span class="nam">ppf_name</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t615" href="#t615">615</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t616" href="#t616">616</a></span><span class="t"> <span class="nam">ppf_name</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"d/"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t617" href="#t617">617</a></span><span class="t"> <span class="key">and</span> <span class="key">not</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">lexists</span><span class="op">(</span><span class="nam">ppf_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t618" href="#t618">618</a></span><span class="t"> <span class="key">and</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">lexists</span><span class="op">(</span><span class="str">"debian/"</span> <span class="op">+</span> <span class="nam">ppf_name</span><span class="op">[</span><span class="num">2</span><span class="op">:</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t619" href="#t619">619</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t620" href="#t620">620</a></span><span class="t"> <span class="nam">ppf_name</span> <span class="op">=</span> <span class="str">"debian/"</span> <span class="op">+</span> <span class="nam">ppf_name</span><span class="op">[</span><span class="num">2</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t621" href="#t621">621</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t622" href="#t622">622</a></span><span class="t"> <span class="key">if</span> <span class="nam">ppf_name</span> <span class="key">in</span> <span class="op">(</span><span class="str">"debian/control"</span><span class="op">,</span> <span class="str">"debian/debputy.manifest"</span><span class="op">,</span> <span class="str">"debian/rules"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t623" href="#t623">623</a></span><span class="t"> <span class="key">if</span> <span class="nam">ppf_name</span> <span class="op">==</span> <span class="str">"debian/debputy.manifest"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t624" href="#t624">624</a></span><span class="t"> <span class="nam">doc</span> <span class="op">=</span> <span class="str">f"{DEBPUTY_DOC_ROOT_DIR}/MANIFEST-FORMAT.md"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t625" href="#t625">625</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t626" href="#t626">626</a></span><span class="t"> <span class="nam">doc</span> <span class="op">=</span> <span class="str">"Debian Policy Manual or a packaging tutorial"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t627" href="#t627">627</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t628" href="#t628">628</a></span><span class="t"> <span class="str">f"Sorry. While {orig_ppf_name} is a well-defined packaging file, it does not match the definition of"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t629" href="#t629">629</a></span><span class="t"> <span class="str">f" a packager provided file. Please see {doc} for more information about this file"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t630" href="#t630">630</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t631" href="#t631">631</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t632" href="#t632">632</a></span><span class="t"> <span class="key">if</span> <span class="nam">context</span><span class="op">.</span><span class="nam">has_dctrl_file</span> <span class="key">and</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">lexists</span><span class="op">(</span><span class="nam">ppf_name</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t633" href="#t633">633</a></span><span class="t"> <span class="nam">basename</span> <span class="op">=</span> <span class="nam">ppf_name</span><span class="op">[</span><span class="num">7</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t634" href="#t634">634</a></span><span class="t"> <span class="key">if</span> <span class="str">"/"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">basename</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t635" href="#t635">635</a></span><span class="t"> <span class="nam">debian_dir</span> <span class="op">=</span> <span class="nam">build_virtual_fs</span><span class="op">(</span><span class="op">[</span><span class="nam">basename</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t636" href="#t636">636</a></span><span class="t"> <span class="nam">all_ppfs</span> <span class="op">=</span> <span class="nam">detect_all_packager_provided_files</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t637" href="#t637">637</a></span><span class="t"> <span class="nam">feature_set</span><span class="op">.</span><span class="nam">packager_provided_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t638" href="#t638">638</a></span><span class="t"> <span class="nam">debian_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t639" href="#t639">639</a></span><span class="t"> <span class="nam">context</span><span class="op">.</span><span class="nam">binary_packages</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t640" href="#t640">640</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t641" href="#t641">641</a></span><span class="t"> <span class="key">if</span> <span class="nam">all_ppfs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t642" href="#t642">642</a></span><span class="t"> <span class="nam">matched</span> <span class="op">=</span> <span class="nam">next</span><span class="op">(</span><span class="nam">iter</span><span class="op">(</span><span class="nam">all_ppfs</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t643" href="#t643">643</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">matched</span><span class="op">.</span><span class="nam">auto_installable</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">matched</span><span class="op">.</span><span class="nam">reserved_only</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t644" href="#t644">644</a></span><span class="t"> <span class="key">return</span> <span class="nam">matched</span><span class="op">.</span><span class="nam">auto_installable</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">.</span><span class="nam">definition</span><span class="op">,</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t645" href="#t645">645</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">matched</span><span class="op">.</span><span class="nam">auto_installable</span> <span class="key">and</span> <span class="nam">len</span><span class="op">(</span><span class="nam">matched</span><span class="op">.</span><span class="nam">reserved_only</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t646" href="#t646">646</a></span><span class="t"> <span class="nam">reserved</span> <span class="op">=</span> <span class="nam">next</span><span class="op">(</span><span class="nam">iter</span><span class="op">(</span><span class="nam">matched</span><span class="op">.</span><span class="nam">reserved_only</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t647" href="#t647">647</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">reserved</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t648" href="#t648">648</a></span><span class="t"> <span class="key">return</span> <span class="nam">reserved</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">.</span><span class="nam">definition</span><span class="op">,</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t649" href="#t649">649</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t650" href="#t650">650</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t651" href="#t651">651</a></span><span class="t"> <span class="str">f'Unknown packager provided file "{orig_ppf_name}". Please use'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t652" href="#t652">652</a></span><span class="t"> <span class="str">f" `debputy plugin list packager-provided-files` to see them all."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t653" href="#t653">653</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t654" href="#t654">654</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t655" href="#t655">655</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t656" href="#t656">656</a></span><span class="t"><span class="op">@</span><span class="nam">plugin_show_cmds</span><span class="op">.</span><span class="nam">register_subcommand</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t657" href="#t657">657</a></span><span class="t"> <span class="op">[</span><span class="str">"packager-provided-files"</span><span class="op">,</span> <span class="str">"ppf"</span><span class="op">,</span> <span class="str">"p-p-f"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t658" href="#t658">658</a></span><span class="t"> <span class="nam">help_description</span><span class="op">=</span><span class="str">"Show details about a given packager provided file (debian/pkg.foo)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t659" href="#t659">659</a></span><span class="t"> <span class="nam">argparser</span><span class="op">=</span><span class="nam">add_arg</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t660" href="#t660">660</a></span><span class="t"> <span class="str">"ppf_name"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t661" href="#t661">661</a></span><span class="t"> <span class="nam">metavar</span><span class="op">=</span><span class="str">"name"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t662" href="#t662">662</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Name of the packager provided file (such as `changelog`) to display details about"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t663" href="#t663">663</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t664" href="#t664">664</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t665" href="#t665">665</a></span><span class="t"><span class="key">def</span> <span class="nam">_plugin_cmd_show_ppf</span><span class="op">(</span><span class="nam">context</span><span class="op">:</span> <span class="nam">CommandContext</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t666" href="#t666">666</a></span><span class="t"> <span class="nam">ppf</span><span class="op">,</span> <span class="nam">matched_file</span> <span class="op">=</span> <span class="nam">_determine_ppf</span><span class="op">(</span><span class="nam">context</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t667" href="#t667">667</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t668" href="#t668">668</a></span><span class="t"> <span class="nam">fo</span> <span class="op">=</span> <span class="nam">_output_styling</span><span class="op">(</span><span class="nam">context</span><span class="op">.</span><span class="nam">parsed_args</span><span class="op">,</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">stdout</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t669" href="#t669">669</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t670" href="#t670">670</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="str">f"Packager Provided File: {ppf.stem}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t671" href="#t671">671</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print_visual_formatting</span><span class="op">(</span><span class="str">f"========================{'=' * len(ppf.stem)}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t672" href="#t672">672</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t673" href="#t673">673</a></span><span class="t"> <span class="nam">ref_doc</span> <span class="op">=</span> <span class="nam">ppf</span><span class="op">.</span><span class="nam">reference_documentation</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t674" href="#t674">674</a></span><span class="t"> <span class="nam">description</span> <span class="op">=</span> <span class="nam">ref_doc</span><span class="op">.</span><span class="nam">description</span> <span class="key">if</span> <span class="nam">ref_doc</span> <span class="key">else</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t675" href="#t675">675</a></span><span class="t"> <span class="nam">doc_uris</span> <span class="op">=</span> <span class="nam">ref_doc</span><span class="op">.</span><span class="nam">format_documentation_uris</span> <span class="key">if</span> <span class="nam">ref_doc</span> <span class="key">else</span> <span class="nam">tuple</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t676" href="#t676">676</a></span><span class="t"> <span class="key">if</span> <span class="nam">description</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t677" href="#t677">677</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t678" href="#t678">678</a></span><span class="t"> <span class="str">f"Sorry, no description provided by the plugin {ppf.debputy_plugin_metadata.plugin_name}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t679" href="#t679">679</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t680" href="#t680">680</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t681" href="#t681">681</a></span><span class="t"> <span class="key">for</span> <span class="nam">line</span> <span class="key">in</span> <span class="nam">description</span><span class="op">.</span><span class="nam">splitlines</span><span class="op">(</span><span class="nam">keepends</span><span class="op">=</span><span class="key">False</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t682" href="#t682">682</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="nam">line</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t683" href="#t683">683</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t684" href="#t684">684</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t685" href="#t685">685</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="str">"Features:"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t686" href="#t686">686</a></span><span class="t"> <span class="key">if</span> <span class="nam">ppf</span><span class="op">.</span><span class="nam">packageless_is_fallback_for_all_packages</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t687" href="#t687">687</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="str">f" * debian/{ppf.stem} is used for *ALL* packages"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t688" href="#t688">688</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t689" href="#t689">689</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="str">f' * debian/{ppf.stem} is used for only for the "main" package'</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t690" href="#t690">690</a></span><span class="t"> <span class="key">if</span> <span class="nam">ppf</span><span class="op">.</span><span class="nam">allow_name_segment</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t691" href="#t691">691</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="str">" * Supports naming segment (multiple files and custom naming)."</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t692" href="#t692">692</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t693" href="#t693">693</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t694" href="#t694">694</a></span><span class="t"> <span class="str">" * No naming support; at most one per package and it is named after the package."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t695" href="#t695">695</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t696" href="#t696">696</a></span><span class="t"> <span class="key">if</span> <span class="nam">ppf</span><span class="op">.</span><span class="nam">allow_architecture_segment</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t697" href="#t697">697</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="str">" * Supports architecture specific variants."</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t698" href="#t698">698</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t699" href="#t699">699</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="str">" * No architecture specific variants."</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t700" href="#t700">700</a></span><span class="t"> <span class="key">if</span> <span class="nam">ppf</span><span class="op">.</span><span class="nam">supports_priority</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t701" href="#t701">701</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t702" href="#t702">702</a></span><span class="t"> <span class="str">f" * Has a priority system (default priority: {ppf.default_priority})."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t703" href="#t703">703</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t704" href="#t704">704</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t705" href="#t705">705</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t706" href="#t706">706</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="str">"Examples matches:"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t707" href="#t707">707</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t708" href="#t708">708</a></span><span class="t"> <span class="key">if</span> <span class="nam">context</span><span class="op">.</span><span class="nam">has_dctrl_file</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t709" href="#t709">709</a></span><span class="t"> <span class="nam">first_pkg</span> <span class="op">=</span> <span class="nam">next</span><span class="op">(</span><span class="nam">iter</span><span class="op">(</span><span class="nam">context</span><span class="op">.</span><span class="nam">binary_packages</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t710" href="#t710">710</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t711" href="#t711">711</a></span><span class="t"> <span class="nam">first_pkg</span> <span class="op">=</span> <span class="str">"example-package"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t712" href="#t712">712</a></span><span class="t"> <span class="nam">example_files</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t713" href="#t713">713</a></span><span class="t"> <span class="op">(</span><span class="str">f"debian/{ppf.stem}"</span><span class="op">,</span> <span class="nam">first_pkg</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t714" href="#t714">714</a></span><span class="t"> <span class="op">(</span><span class="str">f"debian/{first_pkg}.{ppf.stem}"</span><span class="op">,</span> <span class="nam">first_pkg</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t715" href="#t715">715</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t716" href="#t716">716</a></span><span class="t"> <span class="key">if</span> <span class="nam">ppf</span><span class="op">.</span><span class="nam">allow_name_segment</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t717" href="#t717">717</a></span><span class="t"> <span class="nam">example_files</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t718" href="#t718">718</a></span><span class="t"> <span class="op">(</span><span class="str">f"debian/{first_pkg}.my.custom.name.{ppf.stem}"</span><span class="op">,</span> <span class="str">"my.custom.name"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t719" href="#t719">719</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t720" href="#t720">720</a></span><span class="t"> <span class="key">if</span> <span class="nam">ppf</span><span class="op">.</span><span class="nam">allow_architecture_segment</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t721" href="#t721">721</a></span><span class="t"> <span class="nam">example_files</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="op">(</span><span class="str">f"debian/{first_pkg}.{ppf.stem}.amd64"</span><span class="op">,</span> <span class="nam">first_pkg</span><span class="op">)</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t722" href="#t722">722</a></span><span class="t"> <span class="key">if</span> <span class="nam">ppf</span><span class="op">.</span><span class="nam">allow_name_segment</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t723" href="#t723">723</a></span><span class="t"> <span class="nam">example_files</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t724" href="#t724">724</a></span><span class="t"> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t725" href="#t725">725</a></span><span class="t"> <span class="str">f"debian/{first_pkg}.my.custom.name.{ppf.stem}.amd64"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t726" href="#t726">726</a></span><span class="t"> <span class="str">"my.custom.name"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t727" href="#t727">727</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t728" href="#t728">728</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t729" href="#t729">729</a></span><span class="t"> <span class="nam">fs_root</span> <span class="op">=</span> <span class="nam">build_virtual_fs</span><span class="op">(</span><span class="op">[</span><span class="nam">x</span> <span class="key">for</span> <span class="nam">x</span><span class="op">,</span> <span class="nam">_</span> <span class="key">in</span> <span class="nam">example_files</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t730" href="#t730">730</a></span><span class="t"> <span class="nam">priority</span> <span class="op">=</span> <span class="nam">ppf</span><span class="op">.</span><span class="nam">default_priority</span> <span class="key">if</span> <span class="nam">ppf</span><span class="op">.</span><span class="nam">supports_priority</span> <span class="key">else</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t731" href="#t731">731</a></span><span class="t"> <span class="nam">rendered_examples</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t732" href="#t732">732</a></span><span class="t"> <span class="key">for</span> <span class="nam">example_file</span><span class="op">,</span> <span class="nam">assigned_name</span> <span class="key">in</span> <span class="nam">example_files</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t733" href="#t733">733</a></span><span class="t"> <span class="nam">example_path</span> <span class="op">=</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="nam">example_file</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t734" href="#t734">734</a></span><span class="t"> <span class="key">assert</span> <span class="nam">example_path</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">example_path</span><span class="op">.</span><span class="nam">is_file</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t735" href="#t735">735</a></span><span class="t"> <span class="nam">dest</span> <span class="op">=</span> <span class="nam">ppf</span><span class="op">.</span><span class="nam">compute_dest</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t736" href="#t736">736</a></span><span class="t"> <span class="nam">assigned_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t737" href="#t737">737</a></span><span class="t"> <span class="nam">owning_package</span><span class="op">=</span><span class="nam">first_pkg</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t738" href="#t738">738</a></span><span class="t"> <span class="nam">assigned_priority</span><span class="op">=</span><span class="nam">priority</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t739" href="#t739">739</a></span><span class="t"> <span class="nam">path</span><span class="op">=</span><span class="nam">example_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t740" href="#t740">740</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t741" href="#t741">741</a></span><span class="t"> <span class="nam">dest_path</span> <span class="op">=</span> <span class="str">"/"</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">dest</span><span class="op">)</span><span class="op">.</span><span class="nam">lstrip</span><span class="op">(</span><span class="str">"."</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t742" href="#t742">742</a></span><span class="t"> <span class="nam">rendered_examples</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="op">(</span><span class="nam">example_file</span><span class="op">,</span> <span class="nam">dest_path</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t743" href="#t743">743</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t744" href="#t744">744</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print_list_table</span><span class="op">(</span><span class="op">[</span><span class="str">"Source file"</span><span class="op">,</span> <span class="str">"Installed As"</span><span class="op">]</span><span class="op">,</span> <span class="nam">rendered_examples</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t745" href="#t745">745</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t746" href="#t746">746</a></span><span class="t"> <span class="key">if</span> <span class="nam">doc_uris</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t747" href="#t747">747</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t748" href="#t748">748</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="str">"Documentation URIs:"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t749" href="#t749">749</a></span><span class="t"> <span class="key">for</span> <span class="nam">uri</span> <span class="key">in</span> <span class="nam">doc_uris</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t750" href="#t750">750</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="str">f" * {fo.render_url(uri)}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t751" href="#t751">751</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t752" href="#t752">752</a></span><span class="t"> <span class="nam">plugin_name</span> <span class="op">=</span> <span class="nam">ppf</span><span class="op">.</span><span class="nam">debputy_plugin_metadata</span><span class="op">.</span><span class="nam">plugin_name</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t753" href="#t753">753</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t754" href="#t754">754</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="str">f"Install Mode: 0{oct(ppf.default_mode)[2:]}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t755" href="#t755">755</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="str">f"Provided by plugin: {plugin_name}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t756" href="#t756">756</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t757" href="#t757">757</a></span><span class="t"> <span class="nam">matched_file</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t758" href="#t758">758</a></span><span class="t"> <span class="key">and</span> <span class="nam">plugin_name</span> <span class="op">!=</span> <span class="str">"debputy"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t759" href="#t759">759</a></span><span class="t"> <span class="key">and</span> <span class="nam">plugin_name</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">context</span><span class="op">.</span><span class="nam">requested_plugins</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t760" href="#t760">760</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t761" href="#t761">761</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t762" href="#t762">762</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t763" href="#t763">763</a></span><span class="t"> <span class="str">f"The file might *NOT* be used due to missing Build-Depends on debputy-plugin-{plugin_name}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t764" href="#t764">764</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t765" href="#t765">765</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t766" href="#t766">766</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t767" href="#t767">767</a></span><span class="t"><span class="op">@</span><span class="nam">plugin_show_cmds</span><span class="op">.</span><span class="nam">register_subcommand</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t768" href="#t768">768</a></span><span class="t"> <span class="op">[</span><span class="str">"pluggable-manifest-rules"</span><span class="op">,</span> <span class="str">"p-m-r"</span><span class="op">,</span> <span class="str">"pmr"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t769" href="#t769">769</a></span><span class="t"> <span class="nam">help_description</span><span class="op">=</span><span class="str">"Pluggable manifest rules (such as install rules)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t770" href="#t770">770</a></span><span class="t"> <span class="nam">argparser</span><span class="op">=</span><span class="nam">add_arg</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t771" href="#t771">771</a></span><span class="t"> <span class="str">"pmr_rule_name"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t772" href="#t772">772</a></span><span class="t"> <span class="nam">metavar</span><span class="op">=</span><span class="str">"rule-name"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t773" href="#t773">773</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Name of the rule (such as `install`) to display details about"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t774" href="#t774">774</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t775" href="#t775">775</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t776" href="#t776">776</a></span><span class="t"><span class="key">def</span> <span class="nam">_plugin_cmd_show_manifest_rule</span><span class="op">(</span><span class="nam">context</span><span class="op">:</span> <span class="nam">CommandContext</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t777" href="#t777">777</a></span><span class="t"> <span class="nam">feature_set</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">load_plugins</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t778" href="#t778">778</a></span><span class="t"> <span class="nam">parsed_args</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">parsed_args</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t779" href="#t779">779</a></span><span class="t"> <span class="nam">req_rule_type</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t780" href="#t780">780</a></span><span class="t"> <span class="nam">rule_name</span> <span class="op">=</span> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">pmr_rule_name</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t781" href="#t781">781</a></span><span class="t"> <span class="key">if</span> <span class="str">"::"</span> <span class="key">in</span> <span class="nam">rule_name</span> <span class="key">and</span> <span class="nam">rule_name</span> <span class="op">!=</span> <span class="str">"::"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t782" href="#t782">782</a></span><span class="t"> <span class="nam">req_rule_type</span><span class="op">,</span> <span class="nam">rule_name</span> <span class="op">=</span> <span class="nam">rule_name</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="str">"::"</span><span class="op">,</span> <span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t783" href="#t783">783</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t784" href="#t784">784</a></span><span class="t"> <span class="nam">matched</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t785" href="#t785">785</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t786" href="#t786">786</a></span><span class="t"> <span class="nam">base_type</span> <span class="op">=</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Tuple</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Type</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> <span class="nam">DispatchingParserBase</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t787" href="#t787">787</a></span><span class="t"> <span class="nam">parser_generator</span> <span class="op">=</span> <span class="nam">feature_set</span><span class="op">.</span><span class="nam">manifest_parser_generator</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t788" href="#t788">788</a></span><span class="t"> <span class="nam">table_parsers</span><span class="op">:</span> <span class="nam">base_type</span> <span class="op">=</span> <span class="nam">parser_generator</span><span class="op">.</span><span class="nam">dispatchable_table_parsers</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t789" href="#t789">789</a></span><span class="t"> <span class="nam">object_parsers</span><span class="op">:</span> <span class="nam">base_type</span> <span class="op">=</span> <span class="nam">parser_generator</span><span class="op">.</span><span class="nam">dispatchable_object_parsers</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t790" href="#t790">790</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t791" href="#t791">791</a></span><span class="t"> <span class="nam">parsers</span> <span class="op">=</span> <span class="nam">chain</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t792" href="#t792">792</a></span><span class="t"> <span class="nam">table_parsers</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t793" href="#t793">793</a></span><span class="t"> <span class="nam">object_parsers</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t794" href="#t794">794</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t795" href="#t795">795</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t796" href="#t796">796</a></span><span class="t"> <span class="key">for</span> <span class="nam">rule_type</span><span class="op">,</span> <span class="nam">dispatching_parser</span> <span class="key">in</span> <span class="nam">parsers</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t797" href="#t797">797</a></span><span class="t"> <span class="key">if</span> <span class="nam">req_rule_type</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">req_rule_type</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">_parser_type_name</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t798" href="#t798">798</a></span><span class="t"> <span class="nam">rule_type</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t799" href="#t799">799</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t800" href="#t800">800</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t801" href="#t801">801</a></span><span class="t"> <span class="key">if</span> <span class="nam">dispatching_parser</span><span class="op">.</span><span class="nam">is_known_keyword</span><span class="op">(</span><span class="nam">rule_name</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t802" href="#t802">802</a></span><span class="t"> <span class="nam">matched</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="op">(</span><span class="nam">rule_type</span><span class="op">,</span> <span class="nam">dispatching_parser</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t803" href="#t803">803</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t804" href="#t804">804</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">matched</span><span class="op">)</span> <span class="op">!=</span> <span class="num">1</span> <span class="key">and</span> <span class="op">(</span><span class="nam">matched</span> <span class="key">or</span> <span class="nam">rule_name</span> <span class="op">!=</span> <span class="str">"::"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t805" href="#t805">805</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">matched</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t806" href="#t806">806</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t807" href="#t807">807</a></span><span class="t"> <span class="str">f"Could not find any pluggable manifest rule related to {parsed_args.pmr_rule_name}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t808" href="#t808">808</a></span><span class="t"> <span class="str">f" Please use `debputy plugin list pluggable-manifest-rules` to see the list of rules."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t809" href="#t809">809</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t810" href="#t810">810</a></span><span class="t"> <span class="nam">match_a</span> <span class="op">=</span> <span class="nam">matched</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t811" href="#t811">811</a></span><span class="t"> <span class="nam">match_b</span> <span class="op">=</span> <span class="nam">matched</span><span class="op">[</span><span class="num">1</span><span class="op">]</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t812" href="#t812">812</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t813" href="#t813">813</a></span><span class="t"> <span class="str">f"The name {rule_name} was ambiguous and matched multiple rule types. Please use"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t814" href="#t814">814</a></span><span class="t"> <span class="str">f" <rule-type>::{rule_name} to clarify which rule to use"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t815" href="#t815">815</a></span><span class="t"> <span class="str">f" (such as {_parser_type_name(match_a)}::{rule_name} or {_parser_type_name(match_b)}::{rule_name})."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t816" href="#t816">816</a></span><span class="t"> <span class="str">f" Please use `debputy plugin list pluggable-manifest-rules` to see the list of rules."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t817" href="#t817">817</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t818" href="#t818">818</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t819" href="#t819">819</a></span><span class="t"> <span class="key">if</span> <span class="nam">matched</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t820" href="#t820">820</a></span><span class="t"> <span class="nam">rule_type</span><span class="op">,</span> <span class="nam">matched_dispatching_parser</span> <span class="op">=</span> <span class="nam">matched</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t821" href="#t821">821</a></span><span class="t"> <span class="nam">plugin_provided_parser</span> <span class="op">=</span> <span class="nam">matched_dispatching_parser</span><span class="op">.</span><span class="nam">parser_for</span><span class="op">(</span><span class="nam">rule_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t822" href="#t822">822</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">rule_type</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t823" href="#t823">823</a></span><span class="t"> <span class="nam">manifest_attribute_path</span> <span class="op">=</span> <span class="nam">rule_type</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t824" href="#t824">824</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t825" href="#t825">825</a></span><span class="t"> <span class="nam">manifest_attribute_path</span> <span class="op">=</span> <span class="nam">SUPPORTED_DISPATCHABLE_TABLE_PARSERS</span><span class="op">[</span><span class="nam">rule_type</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t826" href="#t826">826</a></span><span class="t"> <span class="nam">parser_type_name</span> <span class="op">=</span> <span class="nam">_parser_type_name</span><span class="op">(</span><span class="nam">rule_type</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t827" href="#t827">827</a></span><span class="t"> <span class="nam">parser</span> <span class="op">=</span> <span class="nam">plugin_provided_parser</span><span class="op">.</span><span class="nam">parser</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t828" href="#t828">828</a></span><span class="t"> <span class="nam">plugin_metadata</span> <span class="op">=</span> <span class="nam">plugin_provided_parser</span><span class="op">.</span><span class="nam">plugin_metadata</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t829" href="#t829">829</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t830" href="#t830">830</a></span><span class="t"> <span class="nam">rule_name</span> <span class="op">=</span> <span class="str">"::"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t831" href="#t831">831</a></span><span class="t"> <span class="nam">parser</span> <span class="op">=</span> <span class="nam">parser_generator</span><span class="op">.</span><span class="nam">dispatchable_object_parsers</span><span class="op">[</span><span class="nam">OPARSER_MANIFEST_ROOT</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t832" href="#t832">832</a></span><span class="t"> <span class="nam">parser_type_name</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t833" href="#t833">833</a></span><span class="t"> <span class="nam">plugin_metadata</span> <span class="op">=</span> <span class="nam">plugin_metadata_for_debputys_own_plugin</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t834" href="#t834">834</a></span><span class="t"> <span class="nam">manifest_attribute_path</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t835" href="#t835">835</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t836" href="#t836">836</a></span><span class="t"> <span class="nam">is_root_rule</span> <span class="op">=</span> <span class="nam">rule_name</span> <span class="op">==</span> <span class="str">"::"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t837" href="#t837">837</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t838" href="#t838">838</a></span><span class="t"> <span class="nam">render_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t839" href="#t839">839</a></span><span class="t"> <span class="nam">rule_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t840" href="#t840">840</a></span><span class="t"> <span class="nam">parser</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t841" href="#t841">841</a></span><span class="t"> <span class="nam">plugin_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t842" href="#t842">842</a></span><span class="t"> <span class="nam">is_root_rule</span><span class="op">=</span><span class="nam">is_root_rule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t843" href="#t843">843</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t844" href="#t844">844</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t845" href="#t845">845</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t846" href="#t846">846</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">is_root_rule</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t847" href="#t847">847</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t848" href="#t848">848</a></span><span class="t"> <span class="str">f"Used in: {manifest_attribute_path if manifest_attribute_path != '<ROOT>' else 'The manifest root'}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t849" href="#t849">849</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t850" href="#t850">850</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">f"Rule reference: {parser_type_name}::{rule_name}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t851" href="#t851">851</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">f"Plugin: {plugin_metadata.plugin_name}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t852" href="#t852">852</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t853" href="#t853">853</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">f"Rule reference: {rule_name}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t854" href="#t854">854</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t855" href="#t855">855</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t856" href="#t856">856</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t857" href="#t857">857</a></span><span class="t"> <span class="str">"PS: If you want to know more about a non-trivial type of an attribute such as `FileSystemMatchRule`,"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t858" href="#t858">858</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t859" href="#t859">859</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t860" href="#t860">860</a></span><span class="t"> <span class="str">"you can use `debputy plugin show type-mappings FileSystemMatchRule` to look it up "</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t861" href="#t861">861</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t862" href="#t862">862</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t863" href="#t863">863</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t864" href="#t864">864</a></span><span class="t"><span class="key">def</span> <span class="nam">_render_discard_rule_example</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t865" href="#t865">865</a></span><span class="t"> <span class="nam">fo</span><span class="op">:</span> <span class="nam">OutputStylingBase</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t866" href="#t866">866</a></span><span class="t"> <span class="nam">discard_rule</span><span class="op">:</span> <span class="nam">PluginProvidedDiscardRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t867" href="#t867">867</a></span><span class="t"> <span class="nam">example</span><span class="op">:</span> <span class="nam">AutomaticDiscardRuleExample</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t868" href="#t868">868</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t869" href="#t869">869</a></span><span class="t"> <span class="nam">processed</span> <span class="op">=</span> <span class="nam">process_discard_rule_example</span><span class="op">(</span><span class="nam">discard_rule</span><span class="op">,</span> <span class="nam">example</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t870" href="#t870">870</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t871" href="#t871">871</a></span><span class="t"> <span class="key">if</span> <span class="nam">processed</span><span class="op">.</span><span class="nam">inconsistent_paths</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t872" href="#t872">872</a></span><span class="t"> <span class="nam">plugin_name</span> <span class="op">=</span> <span class="nam">discard_rule</span><span class="op">.</span><span class="nam">plugin_metadata</span><span class="op">.</span><span class="nam">plugin_name</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t873" href="#t873">873</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t874" href="#t874">874</a></span><span class="t"> <span class="str">f"This example is inconsistent with what the code actually does."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t875" href="#t875">875</a></span><span class="t"> <span class="str">f" Please consider filing a bug against the plugin {plugin_name}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t876" href="#t876">876</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t877" href="#t877">877</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t878" href="#t878">878</a></span><span class="t"> <span class="nam">doc</span> <span class="op">=</span> <span class="nam">example</span><span class="op">.</span><span class="nam">description</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t879" href="#t879">879</a></span><span class="t"> <span class="key">if</span> <span class="nam">doc</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t880" href="#t880">880</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="nam">doc</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t881" href="#t881">881</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t882" href="#t882">882</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">"Consider the following source paths matched by a glob or directory match:"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t883" href="#t883">883</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t884" href="#t884">884</a></span><span class="t"> <span class="key">if</span> <span class="nam">fo</span><span class="op">.</span><span class="nam">optimize_for_screen_reader</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t885" href="#t885">885</a></span><span class="t"> <span class="key">for</span> <span class="nam">p</span><span class="op">,</span> <span class="nam">_</span> <span class="key">in</span> <span class="nam">processed</span><span class="op">.</span><span class="nam">rendered_paths</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t886" href="#t886">886</a></span><span class="t"> <span class="nam">path_name</span> <span class="op">=</span> <span class="nam">p</span><span class="op">.</span><span class="nam">absolute</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t887" href="#t887">887</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t888" href="#t888">888</a></span><span class="t"> <span class="str">f"The path {path_name} is a {'directory' if p.is_dir else 'file or symlink.'}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t889" href="#t889">889</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t890" href="#t890">890</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t891" href="#t891">891</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t892" href="#t892">892</a></span><span class="t"> <span class="key">if</span> <span class="nam">any</span><span class="op">(</span><span class="nam">v</span><span class="op">.</span><span class="nam">is_consistent</span> <span class="key">and</span> <span class="nam">v</span><span class="op">.</span><span class="nam">is_discarded</span> <span class="key">for</span> <span class="nam">_</span><span class="op">,</span> <span class="nam">v</span> <span class="key">in</span> <span class="nam">processed</span><span class="op">.</span><span class="nam">rendered_paths</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t893" href="#t893">893</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">"The following paths will be discarded by this rule:"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t894" href="#t894">894</a></span><span class="t"> <span class="key">for</span> <span class="nam">p</span><span class="op">,</span> <span class="nam">verdict</span> <span class="key">in</span> <span class="nam">processed</span><span class="op">.</span><span class="nam">rendered_paths</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t895" href="#t895">895</a></span><span class="t"> <span class="nam">path_name</span> <span class="op">=</span> <span class="nam">p</span><span class="op">.</span><span class="nam">absolute</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t896" href="#t896">896</a></span><span class="t"> <span class="key">if</span> <span class="nam">verdict</span><span class="op">.</span><span class="nam">is_consistent</span> <span class="key">and</span> <span class="nam">verdict</span><span class="op">.</span><span class="nam">is_discarded</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t897" href="#t897">897</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t898" href="#t898">898</a></span><span class="t"> <span class="key">if</span> <span class="nam">p</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t899" href="#t899">899</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">f"{path_name} along with anything beneath it"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t900" href="#t900">900</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t901" href="#t901">901</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="nam">path_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t902" href="#t902">902</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t903" href="#t903">903</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">"No paths will be discarded in this example."</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t904" href="#t904">904</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t905" href="#t905">905</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t906" href="#t906">906</a></span><span class="t"> <span class="key">if</span> <span class="nam">any</span><span class="op">(</span><span class="nam">v</span><span class="op">.</span><span class="nam">is_consistent</span> <span class="key">and</span> <span class="nam">v</span><span class="op">.</span><span class="nam">is_kept</span> <span class="key">for</span> <span class="nam">_</span><span class="op">,</span> <span class="nam">v</span> <span class="key">in</span> <span class="nam">processed</span><span class="op">.</span><span class="nam">rendered_paths</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t907" href="#t907">907</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">"The following paths will be not be discarded by this rule:"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t908" href="#t908">908</a></span><span class="t"> <span class="key">for</span> <span class="nam">p</span><span class="op">,</span> <span class="nam">verdict</span> <span class="key">in</span> <span class="nam">processed</span><span class="op">.</span><span class="nam">rendered_paths</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t909" href="#t909">909</a></span><span class="t"> <span class="nam">path_name</span> <span class="op">=</span> <span class="nam">p</span><span class="op">.</span><span class="nam">absolute</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t910" href="#t910">910</a></span><span class="t"> <span class="key">if</span> <span class="nam">verdict</span><span class="op">.</span><span class="nam">is_consistent</span> <span class="key">and</span> <span class="nam">verdict</span><span class="op">.</span><span class="nam">is_kept</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t911" href="#t911">911</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t912" href="#t912">912</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="nam">path_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t913" href="#t913">913</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t914" href="#t914">914</a></span><span class="t"> <span class="key">if</span> <span class="nam">any</span><span class="op">(</span><span class="key">not</span> <span class="nam">v</span><span class="op">.</span><span class="nam">is_consistent</span> <span class="key">for</span> <span class="nam">_</span><span class="op">,</span> <span class="nam">v</span> <span class="key">in</span> <span class="nam">processed</span><span class="op">.</span><span class="nam">rendered_paths</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t915" href="#t915">915</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t916" href="#t916">916</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t917" href="#t917">917</a></span><span class="t"> <span class="str">"The example was inconsistent with the code. These are the paths where the code disagrees with"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t918" href="#t918">918</a></span><span class="t"> <span class="str">" the provided example:"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t919" href="#t919">919</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t920" href="#t920">920</a></span><span class="t"> <span class="key">for</span> <span class="nam">p</span><span class="op">,</span> <span class="nam">verdict</span> <span class="key">in</span> <span class="nam">processed</span><span class="op">.</span><span class="nam">rendered_paths</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t921" href="#t921">921</a></span><span class="t"> <span class="nam">path_name</span> <span class="op">=</span> <span class="nam">p</span><span class="op">.</span><span class="nam">absolute</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t922" href="#t922">922</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">verdict</span><span class="op">.</span><span class="nam">is_consistent</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t923" href="#t923">923</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t924" href="#t924">924</a></span><span class="t"> <span class="key">if</span> <span class="nam">verdict</span> <span class="op">==</span> <span class="nam">DiscardVerdict</span><span class="op">.</span><span class="nam">DISCARDED_BY_CODE</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t925" href="#t925">925</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t926" href="#t926">926</a></span><span class="t"> <span class="str">f"The path {path_name} was discarded by the code, but the example said it should"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t927" href="#t927">927</a></span><span class="t"> <span class="str">f" have been installed."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t928" href="#t928">928</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t929" href="#t929">929</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t930" href="#t930">930</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t931" href="#t931">931</a></span><span class="t"> <span class="str">f"The path {path_name} was not discarded by the code, but the example said it should"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t932" href="#t932">932</a></span><span class="t"> <span class="str">f" have been discarded."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t933" href="#t933">933</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t934" href="#t934">934</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t935" href="#t935">935</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t936" href="#t936">936</a></span><span class="t"> <span class="com"># Add +1 for dirs because we want trailing slashes in the output</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t937" href="#t937">937</a></span><span class="t"> <span class="nam">max_len</span> <span class="op">=</span> <span class="nam">max</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t938" href="#t938">938</a></span><span class="t"> <span class="op">(</span><span class="nam">len</span><span class="op">(</span><span class="nam">p</span><span class="op">.</span><span class="nam">absolute</span><span class="op">)</span> <span class="op">+</span> <span class="op">(</span><span class="num">1</span> <span class="key">if</span> <span class="nam">p</span><span class="op">.</span><span class="nam">is_dir</span> <span class="key">else</span> <span class="num">0</span><span class="op">)</span><span class="op">)</span> <span class="key">for</span> <span class="nam">p</span><span class="op">,</span> <span class="nam">_</span> <span class="key">in</span> <span class="nam">processed</span><span class="op">.</span><span class="nam">rendered_paths</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t939" href="#t939">939</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t940" href="#t940">940</a></span><span class="t"> <span class="key">for</span> <span class="nam">p</span><span class="op">,</span> <span class="nam">verdict</span> <span class="key">in</span> <span class="nam">processed</span><span class="op">.</span><span class="nam">rendered_paths</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t941" href="#t941">941</a></span><span class="t"> <span class="nam">path_name</span> <span class="op">=</span> <span class="nam">p</span><span class="op">.</span><span class="nam">absolute</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t942" href="#t942">942</a></span><span class="t"> <span class="key">if</span> <span class="nam">p</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t943" href="#t943">943</a></span><span class="t"> <span class="nam">path_name</span> <span class="op">+=</span> <span class="str">"/"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t944" href="#t944">944</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t945" href="#t945">945</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">verdict</span><span class="op">.</span><span class="nam">is_consistent</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t946" href="#t946">946</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">f" {path_name:<{max_len}} !! {verdict.message}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t947" href="#t947">947</a></span><span class="t"> <span class="key">elif</span> <span class="nam">verdict</span><span class="op">.</span><span class="nam">is_discarded</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t948" href="#t948">948</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">f" {path_name:<{max_len}} << {verdict.message}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t949" href="#t949">949</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t950" href="#t950">950</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">f" {path_name:<{max_len}}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t951" href="#t951">951</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t952" href="#t952">952</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t953" href="#t953">953</a></span><span class="t"><span class="key">def</span> <span class="nam">_render_discard_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t954" href="#t954">954</a></span><span class="t"> <span class="nam">context</span><span class="op">:</span> <span class="nam">CommandContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t955" href="#t955">955</a></span><span class="t"> <span class="nam">discard_rule</span><span class="op">:</span> <span class="nam">PluginProvidedDiscardRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t956" href="#t956">956</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t957" href="#t957">957</a></span><span class="t"> <span class="nam">fo</span> <span class="op">=</span> <span class="nam">_output_styling</span><span class="op">(</span><span class="nam">context</span><span class="op">.</span><span class="nam">parsed_args</span><span class="op">,</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">stdout</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t958" href="#t958">958</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="nam">fo</span><span class="op">.</span><span class="nam">colored</span><span class="op">(</span><span class="str">f"Automatic Discard Rule: {discard_rule.name}"</span><span class="op">,</span> <span class="nam">style</span><span class="op">=</span><span class="str">"bold"</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t959" href="#t959">959</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print_visual_formatting</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t960" href="#t960">960</a></span><span class="t"> <span class="str">f"========================{'=' * len(discard_rule.name)}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t961" href="#t961">961</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t962" href="#t962">962</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t963" href="#t963">963</a></span><span class="t"> <span class="nam">doc</span> <span class="op">=</span> <span class="nam">discard_rule</span><span class="op">.</span><span class="nam">reference_documentation</span> <span class="key">or</span> <span class="str">"No documentation provided"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t964" href="#t964">964</a></span><span class="t"> <span class="nam">_render_multiline_documentation</span><span class="op">(</span><span class="nam">doc</span><span class="op">,</span> <span class="nam">first_line_prefix</span><span class="op">=</span><span class="str">""</span><span class="op">,</span> <span class="nam">following_line_prefix</span><span class="op">=</span><span class="str">""</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t965" href="#t965">965</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t966" href="#t966">966</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">discard_rule</span><span class="op">.</span><span class="nam">examples</span><span class="op">)</span> <span class="op">></span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t967" href="#t967">967</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t968" href="#t968">968</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print_visual_formatting</span><span class="op">(</span><span class="str">"Examples"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t969" href="#t969">969</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print_visual_formatting</span><span class="op">(</span><span class="str">"--------"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t970" href="#t970">970</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t971" href="#t971">971</a></span><span class="t"> <span class="key">for</span> <span class="nam">no</span><span class="op">,</span> <span class="nam">example</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">discard_rule</span><span class="op">.</span><span class="nam">examples</span><span class="op">,</span> <span class="nam">start</span><span class="op">=</span><span class="num">1</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t972" href="#t972">972</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t973" href="#t973">973</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">colored</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t974" href="#t974">974</a></span><span class="t"> <span class="str">f"Example {no} of {len(discard_rule.examples)}"</span><span class="op">,</span> <span class="nam">style</span><span class="op">=</span><span class="str">"bold"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t975" href="#t975">975</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t976" href="#t976">976</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t977" href="#t977">977</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print_visual_formatting</span><span class="op">(</span><span class="str">f"........{'.' * len(str(no))}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t978" href="#t978">978</a></span><span class="t"> <span class="nam">_render_discard_rule_example</span><span class="op">(</span><span class="nam">fo</span><span class="op">,</span> <span class="nam">discard_rule</span><span class="op">,</span> <span class="nam">example</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t979" href="#t979">979</a></span><span class="t"> <span class="key">elif</span> <span class="nam">discard_rule</span><span class="op">.</span><span class="nam">examples</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t980" href="#t980">980</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t981" href="#t981">981</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="nam">fo</span><span class="op">.</span><span class="nam">colored</span><span class="op">(</span><span class="str">"Example"</span><span class="op">,</span> <span class="nam">style</span><span class="op">=</span><span class="str">"bold"</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t982" href="#t982">982</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print_visual_formatting</span><span class="op">(</span><span class="str">"-------"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t983" href="#t983">983</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t984" href="#t984">984</a></span><span class="t"> <span class="nam">_render_discard_rule_example</span><span class="op">(</span><span class="nam">fo</span><span class="op">,</span> <span class="nam">discard_rule</span><span class="op">,</span> <span class="nam">discard_rule</span><span class="op">.</span><span class="nam">examples</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t985" href="#t985">985</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t986" href="#t986">986</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t987" href="#t987">987</a></span><span class="t"><span class="op">@</span><span class="nam">plugin_show_cmds</span><span class="op">.</span><span class="nam">register_subcommand</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t988" href="#t988">988</a></span><span class="t"> <span class="op">[</span><span class="str">"automatic-discard-rules"</span><span class="op">,</span> <span class="str">"a-d-r"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t989" href="#t989">989</a></span><span class="t"> <span class="nam">help_description</span><span class="op">=</span><span class="str">"Pluggable manifest rules (such as install rules)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t990" href="#t990">990</a></span><span class="t"> <span class="nam">argparser</span><span class="op">=</span><span class="nam">add_arg</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t991" href="#t991">991</a></span><span class="t"> <span class="str">"discard_rule"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t992" href="#t992">992</a></span><span class="t"> <span class="nam">metavar</span><span class="op">=</span><span class="str">"automatic-discard-rule"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t993" href="#t993">993</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Name of the automatic discard rule (such as `backup-files`)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t994" href="#t994">994</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t995" href="#t995">995</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t996" href="#t996">996</a></span><span class="t"><span class="key">def</span> <span class="nam">_plugin_cmd_show_automatic_discard_rules</span><span class="op">(</span><span class="nam">context</span><span class="op">:</span> <span class="nam">CommandContext</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t997" href="#t997">997</a></span><span class="t"> <span class="nam">auto_discard_rules</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">load_plugins</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">auto_discard_rules</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t998" href="#t998">998</a></span><span class="t"> <span class="nam">name</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">parsed_args</span><span class="op">.</span><span class="nam">discard_rule</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t999" href="#t999">999</a></span><span class="t"> <span class="nam">discard_rule</span> <span class="op">=</span> <span class="nam">auto_discard_rules</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1000" href="#t1000">1000</a></span><span class="t"> <span class="key">if</span> <span class="nam">discard_rule</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1001" href="#t1001">1001</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1002" href="#t1002">1002</a></span><span class="t"> <span class="str">f'No automatic discard rule with the name "{name}". Please use'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1003" href="#t1003">1003</a></span><span class="t"> <span class="str">f" `debputy plugin list automatic-discard-rules` to see the list of automatic discard rules"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1004" href="#t1004">1004</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1005" href="#t1005">1005</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1006" href="#t1006">1006</a></span><span class="t"> <span class="nam">_render_discard_rule</span><span class="op">(</span><span class="nam">context</span><span class="op">,</span> <span class="nam">discard_rule</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1007" href="#t1007">1007</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1008" href="#t1008">1008</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1009" href="#t1009">1009</a></span><span class="t"><span class="key">def</span> <span class="nam">_render_source_type</span><span class="op">(</span><span class="nam">t</span><span class="op">:</span> <span class="nam">Any</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1010" href="#t1010">1010</a></span><span class="t"> <span class="nam">_</span><span class="op">,</span> <span class="nam">origin_type</span><span class="op">,</span> <span class="nam">args</span> <span class="op">=</span> <span class="nam">unpack_type</span><span class="op">(</span><span class="nam">t</span><span class="op">,</span> <span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1011" href="#t1011">1011</a></span><span class="t"> <span class="key">if</span> <span class="nam">origin_type</span> <span class="op">==</span> <span class="nam">Union</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1012" href="#t1012">1012</a></span><span class="t"> <span class="nam">at</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">_render_source_type</span><span class="op">(</span><span class="nam">st</span><span class="op">)</span> <span class="key">for</span> <span class="nam">st</span> <span class="key">in</span> <span class="nam">args</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1013" href="#t1013">1013</a></span><span class="t"> <span class="key">return</span> <span class="str">f"One of: {at}"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1014" href="#t1014">1014</a></span><span class="t"> <span class="nam">name</span> <span class="op">=</span> <span class="nam">BASIC_SIMPLE_TYPES</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">t</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1015" href="#t1015">1015</a></span><span class="t"> <span class="key">if</span> <span class="nam">name</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1016" href="#t1016">1016</a></span><span class="t"> <span class="key">return</span> <span class="nam">name</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1017" href="#t1017">1017</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1018" href="#t1018">1018</a></span><span class="t"> <span class="key">return</span> <span class="nam">t</span><span class="op">.</span><span class="nam">__name__</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1019" href="#t1019">1019</a></span><span class="t"> <span class="key">except</span> <span class="nam">AttributeError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1020" href="#t1020">1020</a></span><span class="t"> <span class="key">return</span> <span class="nam">str</span><span class="op">(</span><span class="nam">t</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1021" href="#t1021">1021</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1022" href="#t1022">1022</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1023" href="#t1023">1023</a></span><span class="t"><span class="op">@</span><span class="nam">plugin_list_cmds</span><span class="op">.</span><span class="nam">register_subcommand</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1024" href="#t1024">1024</a></span><span class="t"> <span class="str">"type-mappings"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1025" href="#t1025">1025</a></span><span class="t"> <span class="nam">help_description</span><span class="op">=</span><span class="str">"Registered type mappings/descriptions"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1026" href="#t1026">1026</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1027" href="#t1027">1027</a></span><span class="t"><span class="key">def</span> <span class="nam">_plugin_cmd_list_type_mappings</span><span class="op">(</span><span class="nam">context</span><span class="op">:</span> <span class="nam">CommandContext</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1028" href="#t1028">1028</a></span><span class="t"> <span class="nam">type_mappings</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">load_plugins</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">mapped_types</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1029" href="#t1029">1029</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1030" href="#t1030">1030</a></span><span class="t"> <span class="key">with</span> <span class="nam">_stream_to_pager</span><span class="op">(</span><span class="nam">context</span><span class="op">.</span><span class="nam">parsed_args</span><span class="op">)</span> <span class="key">as</span> <span class="op">(</span><span class="nam">fd</span><span class="op">,</span> <span class="nam">fo</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1031" href="#t1031">1031</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print_list_table</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1032" href="#t1032">1032</a></span><span class="t"> <span class="op">[</span><span class="str">"Type"</span><span class="op">,</span> <span class="str">"Base Type"</span><span class="op">,</span> <span class="str">"Provided By"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1033" href="#t1033">1033</a></span><span class="t"> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1034" href="#t1034">1034</a></span><span class="t"> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1035" href="#t1035">1035</a></span><span class="t"> <span class="nam">target_type</span><span class="op">.</span><span class="nam">__name__</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1036" href="#t1036">1036</a></span><span class="t"> <span class="nam">_render_source_type</span><span class="op">(</span><span class="nam">type_mapping</span><span class="op">.</span><span class="nam">mapped_type</span><span class="op">.</span><span class="nam">source_type</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1037" href="#t1037">1037</a></span><span class="t"> <span class="nam">type_mapping</span><span class="op">.</span><span class="nam">plugin_metadata</span><span class="op">.</span><span class="nam">plugin_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1038" href="#t1038">1038</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1039" href="#t1039">1039</a></span><span class="t"> <span class="key">for</span> <span class="nam">target_type</span><span class="op">,</span> <span class="nam">type_mapping</span> <span class="key">in</span> <span class="nam">type_mappings</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1040" href="#t1040">1040</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1041" href="#t1041">1041</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1042" href="#t1042">1042</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1043" href="#t1043">1043</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1044" href="#t1044">1044</a></span><span class="t"><span class="op">@</span><span class="nam">plugin_show_cmds</span><span class="op">.</span><span class="nam">register_subcommand</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1045" href="#t1045">1045</a></span><span class="t"> <span class="str">"type-mappings"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1046" href="#t1046">1046</a></span><span class="t"> <span class="nam">help_description</span><span class="op">=</span><span class="str">"Register type mappings/descriptions"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1047" href="#t1047">1047</a></span><span class="t"> <span class="nam">argparser</span><span class="op">=</span><span class="nam">add_arg</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1048" href="#t1048">1048</a></span><span class="t"> <span class="str">"type_mapping"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1049" href="#t1049">1049</a></span><span class="t"> <span class="nam">metavar</span><span class="op">=</span><span class="str">"type-mapping"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1050" href="#t1050">1050</a></span><span class="t"> <span class="nam">help</span><span class="op">=</span><span class="str">"Name of the type"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1051" href="#t1051">1051</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1052" href="#t1052">1052</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1053" href="#t1053">1053</a></span><span class="t"><span class="key">def</span> <span class="nam">_plugin_cmd_show_type_mappings</span><span class="op">(</span><span class="nam">context</span><span class="op">:</span> <span class="nam">CommandContext</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1054" href="#t1054">1054</a></span><span class="t"> <span class="nam">type_mapping_name</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">parsed_args</span><span class="op">.</span><span class="nam">type_mapping</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1055" href="#t1055">1055</a></span><span class="t"> <span class="nam">type_mappings</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">load_plugins</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">mapped_types</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1056" href="#t1056">1056</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1057" href="#t1057">1057</a></span><span class="t"> <span class="nam">matches</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1058" href="#t1058">1058</a></span><span class="t"> <span class="key">for</span> <span class="nam">type_</span> <span class="key">in</span> <span class="nam">type_mappings</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1059" href="#t1059">1059</a></span><span class="t"> <span class="key">if</span> <span class="nam">type_</span><span class="op">.</span><span class="nam">__name__</span> <span class="op">==</span> <span class="nam">type_mapping_name</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1060" href="#t1060">1060</a></span><span class="t"> <span class="nam">matches</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">type_</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1061" href="#t1061">1061</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1062" href="#t1062">1062</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">matches</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1063" href="#t1063">1063</a></span><span class="t"> <span class="nam">simple_types</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="nam">BASIC_SIMPLE_TYPES</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1064" href="#t1064">1064</a></span><span class="t"> <span class="nam">simple_types</span><span class="op">.</span><span class="nam">update</span><span class="op">(</span><span class="nam">t</span><span class="op">.</span><span class="nam">__name__</span> <span class="key">for</span> <span class="nam">t</span> <span class="key">in</span> <span class="nam">BASIC_SIMPLE_TYPES</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1065" href="#t1065">1065</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1066" href="#t1066">1066</a></span><span class="t"> <span class="key">if</span> <span class="nam">type_mapping_name</span> <span class="key">in</span> <span class="nam">simple_types</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1067" href="#t1067">1067</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">f"The type {type_mapping_name} is a YAML scalar."</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1068" href="#t1068">1068</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1069" href="#t1069">1069</a></span><span class="t"> <span class="key">if</span> <span class="nam">type_mapping_name</span> <span class="op">==</span> <span class="str">"Any"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1070" href="#t1070">1070</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1071" href="#t1071">1071</a></span><span class="t"> <span class="str">"The Any type is a placeholder for when no typing information is provided. Often this implies"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1072" href="#t1072">1072</a></span><span class="t"> <span class="str">" custom parse logic."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1073" href="#t1073">1073</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1074" href="#t1074">1074</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1075" href="#t1075">1075</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1076" href="#t1076">1076</a></span><span class="t"> <span class="key">if</span> <span class="nam">type_mapping_name</span> <span class="key">in</span> <span class="op">(</span><span class="str">"List"</span><span class="op">,</span> <span class="str">"list"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1077" href="#t1077">1077</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1078" href="#t1078">1078</a></span><span class="t"> <span class="str">f"The {type_mapping_name} is a YAML Sequence. Please see the YAML documentation for examples."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1079" href="#t1079">1079</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1080" href="#t1080">1080</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1081" href="#t1081">1081</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1082" href="#t1082">1082</a></span><span class="t"> <span class="key">if</span> <span class="nam">type_mapping_name</span> <span class="key">in</span> <span class="op">(</span><span class="str">"Mapping"</span><span class="op">,</span> <span class="str">"dict"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1083" href="#t1083">1083</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1084" href="#t1084">1084</a></span><span class="t"> <span class="str">f"The {type_mapping_name} is a YAML mapping. Please see the YAML documentation for examples."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1085" href="#t1085">1085</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1086" href="#t1086">1086</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1087" href="#t1087">1087</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1088" href="#t1088">1088</a></span><span class="t"> <span class="key">if</span> <span class="str">"["</span> <span class="key">in</span> <span class="nam">type_mapping_name</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1089" href="#t1089">1089</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1090" href="#t1090">1090</a></span><span class="t"> <span class="str">f"No known matches for {type_mapping_name}. Note: It looks like a composite type. Try searching"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1091" href="#t1091">1091</a></span><span class="t"> <span class="str">" for its component parts. As an example, replace List[FileSystemMatchRule] with FileSystemMatchRule."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1092" href="#t1092">1092</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1093" href="#t1093">1093</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1094" href="#t1094">1094</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span><span class="str">f"Sorry, no known matches for {type_mapping_name}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1095" href="#t1095">1095</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1096" href="#t1096">1096</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">matches</span><span class="op">)</span> <span class="op">></span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1097" href="#t1097">1097</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1098" href="#t1098">1098</a></span><span class="t"> <span class="str">f"Too many matches for {type_mapping_name}... Sorry, there is no way to avoid this right now :'("</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1099" href="#t1099">1099</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1100" href="#t1100">1100</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1101" href="#t1101">1101</a></span><span class="t"> <span class="nam">match</span> <span class="op">=</span> <span class="nam">matches</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1102" href="#t1102">1102</a></span><span class="t"> <span class="nam">_render_type</span><span class="op">(</span><span class="nam">context</span><span class="op">,</span> <span class="nam">type_mappings</span><span class="op">[</span><span class="nam">match</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1103" href="#t1103">1103</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1104" href="#t1104">1104</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1105" href="#t1105">1105</a></span><span class="t"><span class="key">def</span> <span class="nam">_render_type_example</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1106" href="#t1106">1106</a></span><span class="t"> <span class="nam">context</span><span class="op">:</span> <span class="nam">CommandContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1107" href="#t1107">1107</a></span><span class="t"> <span class="nam">fo</span><span class="op">:</span> <span class="nam">OutputStylingBase</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1108" href="#t1108">1108</a></span><span class="t"> <span class="nam">parser_context</span><span class="op">:</span> <span class="nam">ParserContextData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1109" href="#t1109">1109</a></span><span class="t"> <span class="nam">type_mapping</span><span class="op">:</span> <span class="nam">TypeMapping</span><span class="op">[</span><span class="nam">Any</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1110" href="#t1110">1110</a></span><span class="t"> <span class="nam">example</span><span class="op">:</span> <span class="nam">TypeMappingExample</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1111" href="#t1111">1111</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">bool</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1112" href="#t1112">1112</a></span><span class="t"> <span class="nam">attr_path</span> <span class="op">=</span> <span class="nam">AttributePath</span><span class="op">.</span><span class="nam">builtin_path</span><span class="op">(</span><span class="op">)</span><span class="op">[</span><span class="str">"CLI Request"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1113" href="#t1113">1113</a></span><span class="t"> <span class="nam">v</span> <span class="op">=</span> <span class="nam">_render_value</span><span class="op">(</span><span class="nam">example</span><span class="op">.</span><span class="nam">source_input</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1114" href="#t1114">1114</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1115" href="#t1115">1115</a></span><span class="t"> <span class="nam">type_mapping</span><span class="op">.</span><span class="nam">mapper</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1116" href="#t1116">1116</a></span><span class="t"> <span class="nam">example</span><span class="op">.</span><span class="nam">source_input</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1117" href="#t1117">1117</a></span><span class="t"> <span class="nam">attr_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1118" href="#t1118">1118</a></span><span class="t"> <span class="nam">parser_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1119" href="#t1119">1119</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1120" href="#t1120">1120</a></span><span class="t"> <span class="key">except</span> <span class="nam">RuntimeError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1121" href="#t1121">1121</a></span><span class="t"> <span class="key">if</span> <span class="nam">context</span><span class="op">.</span><span class="nam">parsed_args</span><span class="op">.</span><span class="nam">debug_mode</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1122" href="#t1122">1122</a></span><span class="t"> <span class="key">raise</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1123" href="#t1123">1123</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1124" href="#t1124">1124</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">colored</span><span class="op">(</span><span class="str">"Broken example: "</span><span class="op">,</span> <span class="nam">fg</span><span class="op">=</span><span class="str">"red"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1125" href="#t1125">1125</a></span><span class="t"> <span class="op">+</span> <span class="str">f"Provided example input ({v})"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1126" href="#t1126">1126</a></span><span class="t"> <span class="op">+</span> <span class="str">" caused an exception when parsed. Please file a bug against the plugin."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1127" href="#t1127">1127</a></span><span class="t"> <span class="op">+</span> <span class="str">" Use --debug to see the stack trace"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1128" href="#t1128">1128</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1129" href="#t1129">1129</a></span><span class="t"> <span class="key">return</span> <span class="nam">fo</span><span class="op">.</span><span class="nam">colored</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">fg</span><span class="op">=</span><span class="str">"red"</span><span class="op">)</span> <span class="op">+</span> <span class="str">" [Example value could not be parsed]"</span><span class="op">,</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1130" href="#t1130">1130</a></span><span class="t"> <span class="key">return</span> <span class="nam">fo</span><span class="op">.</span><span class="nam">colored</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">fg</span><span class="op">=</span><span class="str">"green"</span><span class="op">)</span><span class="op">,</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1131" href="#t1131">1131</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1132" href="#t1132">1132</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1133" href="#t1133">1133</a></span><span class="t"><span class="key">def</span> <span class="nam">_render_type</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1134" href="#t1134">1134</a></span><span class="t"> <span class="nam">context</span><span class="op">:</span> <span class="nam">CommandContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1135" href="#t1135">1135</a></span><span class="t"> <span class="nam">pptm</span><span class="op">:</span> <span class="nam">PluginProvidedTypeMapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1136" href="#t1136">1136</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1137" href="#t1137">1137</a></span><span class="t"> <span class="nam">fo</span> <span class="op">=</span> <span class="nam">_output_styling</span><span class="op">(</span><span class="nam">context</span><span class="op">.</span><span class="nam">parsed_args</span><span class="op">,</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">stdout</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1138" href="#t1138">1138</a></span><span class="t"> <span class="nam">type_mapping</span> <span class="op">=</span> <span class="nam">pptm</span><span class="op">.</span><span class="nam">mapped_type</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1139" href="#t1139">1139</a></span><span class="t"> <span class="nam">target_type</span> <span class="op">=</span> <span class="nam">type_mapping</span><span class="op">.</span><span class="nam">target_type</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1140" href="#t1140">1140</a></span><span class="t"> <span class="nam">ref_doc</span> <span class="op">=</span> <span class="nam">pptm</span><span class="op">.</span><span class="nam">reference_documentation</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1141" href="#t1141">1141</a></span><span class="t"> <span class="nam">desc</span> <span class="op">=</span> <span class="nam">ref_doc</span><span class="op">.</span><span class="nam">description</span> <span class="key">if</span> <span class="nam">ref_doc</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">else</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1142" href="#t1142">1142</a></span><span class="t"> <span class="nam">examples</span> <span class="op">=</span> <span class="nam">ref_doc</span><span class="op">.</span><span class="nam">examples</span> <span class="key">if</span> <span class="nam">ref_doc</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">else</span> <span class="nam">tuple</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1143" href="#t1143">1143</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1144" href="#t1144">1144</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="nam">fo</span><span class="op">.</span><span class="nam">colored</span><span class="op">(</span><span class="str">f"# Type Mapping: {target_type.__name__}"</span><span class="op">,</span> <span class="nam">style</span><span class="op">=</span><span class="str">"bold"</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1145" href="#t1145">1145</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1146" href="#t1146">1146</a></span><span class="t"> <span class="key">if</span> <span class="nam">desc</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1147" href="#t1147">1147</a></span><span class="t"> <span class="nam">_render_multiline_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1148" href="#t1148">1148</a></span><span class="t"> <span class="nam">desc</span><span class="op">,</span> <span class="nam">first_line_prefix</span><span class="op">=</span><span class="str">""</span><span class="op">,</span> <span class="nam">following_line_prefix</span><span class="op">=</span><span class="str">""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1149" href="#t1149">1149</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1150" href="#t1150">1150</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1151" href="#t1151">1151</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="str">"No documentation provided."</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1152" href="#t1152">1152</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1153" href="#t1153">1153</a></span><span class="t"> <span class="nam">context</span><span class="op">.</span><span class="nam">parse_manifest</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1154" href="#t1154">1154</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1155" href="#t1155">1155</a></span><span class="t"> <span class="nam">manifest_parser</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1156" href="#t1156">1156</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1157" href="#t1157">1157</a></span><span class="t"> <span class="key">if</span> <span class="nam">examples</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1158" href="#t1158">1158</a></span><span class="t"> <span class="nam">had_issues</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1159" href="#t1159">1159</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1160" href="#t1160">1160</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="nam">fo</span><span class="op">.</span><span class="nam">colored</span><span class="op">(</span><span class="str">"## Example values"</span><span class="op">,</span> <span class="nam">style</span><span class="op">=</span><span class="str">"bold"</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1161" href="#t1161">1161</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1162" href="#t1162">1162</a></span><span class="t"> <span class="key">for</span> <span class="nam">no</span><span class="op">,</span> <span class="nam">example</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">examples</span><span class="op">,</span> <span class="nam">start</span><span class="op">=</span><span class="num">1</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1163" href="#t1163">1163</a></span><span class="t"> <span class="nam">v</span><span class="op">,</span> <span class="nam">i</span> <span class="op">=</span> <span class="nam">_render_type_example</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1164" href="#t1164">1164</a></span><span class="t"> <span class="nam">context</span><span class="op">,</span> <span class="nam">fo</span><span class="op">,</span> <span class="nam">manifest_parser</span><span class="op">,</span> <span class="nam">type_mapping</span><span class="op">,</span> <span class="nam">example</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1165" href="#t1165">1165</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1166" href="#t1166">1166</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="str">f" * {v}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1167" href="#t1167">1167</a></span><span class="t"> <span class="key">if</span> <span class="nam">i</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1168" href="#t1168">1168</a></span><span class="t"> <span class="nam">had_issues</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1169" href="#t1169">1169</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1170" href="#t1170">1170</a></span><span class="t"> <span class="nam">had_issues</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1171" href="#t1171">1171</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1172" href="#t1172">1172</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1173" href="#t1173">1173</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="str">f"Provided by plugin: {pptm.plugin_metadata.plugin_name}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1174" href="#t1174">1174</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1175" href="#t1175">1175</a></span><span class="t"> <span class="key">if</span> <span class="nam">had_issues</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1176" href="#t1176">1176</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1177" href="#t1177">1177</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1178" href="#t1178">1178</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">colored</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1179" href="#t1179">1179</a></span><span class="t"> <span class="str">"Examples had issues. Please file a bug against the plugin"</span><span class="op">,</span> <span class="nam">fg</span><span class="op">=</span><span class="str">"red"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1180" href="#t1180">1180</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1181" href="#t1181">1181</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1182" href="#t1182">1182</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1183" href="#t1183">1183</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">print</span><span class="op">(</span><span class="str">"Use --debug to see the stacktrace"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1184" href="#t1184">1184</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1185" href="#t1185">1185</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1186" href="#t1186">1186</a></span><span class="t"><span class="key">def</span> <span class="nam">_render_value</span><span class="op">(</span><span class="nam">v</span><span class="op">:</span> <span class="nam">Any</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1187" href="#t1187">1187</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span> <span class="key">and</span> <span class="str">'"'</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">v</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1188" href="#t1188">1188</a></span><span class="t"> <span class="key">return</span> <span class="str">f'"{v}"'</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1189" href="#t1189">1189</a></span><span class="t"> <span class="key">return</span> <span class="nam">str</span><span class="op">(</span><span class="nam">v</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1190" href="#t1190">1190</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1191" href="#t1191">1191</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1192" href="#t1192">1192</a></span><span class="t"><span class="key">def</span> <span class="nam">ensure_plugin_commands_are_loaded</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1193" href="#t1193">1193</a></span><span class="t"> <span class="com"># Loading the module does the heavy lifting</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1194" href="#t1194">1194</a></span><span class="t"> <span class="com"># However, having this function means that we do not have an "unused" import that some tool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1195" href="#t1195">1195</a></span><span class="t"> <span class="com"># gets tempted to remove</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1196" href="#t1196">1196</a></span><span class="t"> <span class="key">assert</span> <span class="nam">ROOT_COMMAND</span><span class="op">.</span><span class="nam">has_command</span><span class="op">(</span><span class="str">"plugin"</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_6e57078c9ef7177d_output_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_deb_packaging_support_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_7764373ba25ba45b___init___py.html b/coverage-report/d_7764373ba25ba45b___init___py.html deleted file mode 100644 index 531f4cd..0000000 --- a/coverage-report/d_7764373ba25ba45b___init___py.html +++ /dev/null @@ -1,99 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/linting/__init__.py: 100%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/linting/__init__.py</b>: - <span class="pc_cov">100%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">0 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">0<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">0<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_interpreter_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_7764373ba25ba45b_lint_impl_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_267b6307937f1878_interpreter_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_7764373ba25ba45b_lint_impl_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_7764373ba25ba45b_lint_impl_py.html b/coverage-report/d_7764373ba25ba45b_lint_impl_py.html deleted file mode 100644 index 6214efe..0000000 --- a/coverage-report/d_7764373ba25ba45b_lint_impl_py.html +++ /dev/null @@ -1,448 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/linting/lint_impl.py: 12%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/linting/lint_impl.py</b>: - <span class="pc_cov">12%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">152 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">27<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">125<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_7764373ba25ba45b___init___py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_7764373ba25ba45b_lint_util_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">stat</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">sys</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Optional</span><span class="op">,</span> <span class="nam">List</span><span class="op">,</span> <span class="nam">Union</span><span class="op">,</span> <span class="nam">NoReturn</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">from</span> <span class="nam">lsprotocol</span><span class="op">.</span><span class="nam">types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">CodeAction</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">Command</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">CodeActionParams</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">CodeActionContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">TextDocumentIdentifier</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">TextEdit</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">Position</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">DiagnosticSeverity</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">commands</span><span class="op">.</span><span class="nam">debputy_cmd</span><span class="op">.</span><span class="nam">context</span> <span class="key">import</span> <span class="nam">CommandContext</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">commands</span><span class="op">.</span><span class="nam">debputy_cmd</span><span class="op">.</span><span class="nam">output</span> <span class="key">import</span> <span class="nam">_output_styling</span><span class="op">,</span> <span class="nam">OutputStylingBase</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">linting</span><span class="op">.</span><span class="nam">lint_util</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">report_diagnostic</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">LinterImpl</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">LintReport</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="nam">LintStateImpl</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">lsp_debian_changelog</span> <span class="key">import</span> <span class="nam">_lint_debian_changelog</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">lsp_debian_control</span> <span class="key">import</span> <span class="nam">_lint_debian_control</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">lsp_debian_copyright</span> <span class="key">import</span> <span class="nam">_lint_debian_copyright</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">lsp_debian_debputy_manifest</span> <span class="key">import</span> <span class="nam">_lint_debian_debputy_manifest</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">lsp_debian_rules</span> <span class="key">import</span> <span class="nam">_lint_debian_rules_impl</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">lsp_debian_tests_control</span> <span class="key">import</span> <span class="nam">_lint_debian_tests_control</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">quickfixes</span> <span class="key">import</span> <span class="nam">provide_standard_quickfixes_from_diagnostics</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">spellchecking</span> <span class="key">import</span> <span class="nam">disable_spellchecking</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">text_edit</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="nam">get_well_formatted_edit</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="nam">merge_sort_text_edits</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="nam">apply_text_edits</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">feature_set</span> <span class="key">import</span> <span class="nam">PluginProvidedFeatureSet</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">_warn</span><span class="op">,</span> <span class="nam">_error</span><span class="op">,</span> <span class="nam">_info</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"><span class="nam">LINTER_FORMATS</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="str">"debian/changelog"</span><span class="op">:</span> <span class="nam">_lint_debian_changelog</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="str">"debian/control"</span><span class="op">:</span> <span class="nam">_lint_debian_control</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="str">"debian/copyright"</span><span class="op">:</span> <span class="nam">_lint_debian_copyright</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="str">"debian/debputy.manifest"</span><span class="op">:</span> <span class="nam">_lint_debian_debputy_manifest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="str">"debian/rules"</span><span class="op">:</span> <span class="nam">_lint_debian_rules_impl</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="str">"debian/tests/control"</span><span class="op">:</span> <span class="nam">_lint_debian_tests_control</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"><span class="key">def</span> <span class="nam">perform_linting</span><span class="op">(</span><span class="nam">context</span><span class="op">:</span> <span class="nam">CommandContext</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="nam">parsed_args</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">parsed_args</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">spellcheck</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="nam">disable_spellchecking</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="nam">linter_exit_code</span> <span class="op">=</span> <span class="nam">parsed_args</span><span class="op">.</span><span class="nam">linter_exit_code</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">lint_report</span> <span class="op">=</span> <span class="nam">LintReport</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="nam">fo</span> <span class="op">=</span> <span class="nam">_output_styling</span><span class="op">(</span><span class="nam">context</span><span class="op">.</span><span class="nam">parsed_args</span><span class="op">,</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">stdout</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="nam">plugin_feature_set</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">load_plugins</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="key">for</span> <span class="nam">name_stem</span> <span class="key">in</span> <span class="nam">LINTER_FORMATS</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="nam">filename</span> <span class="op">=</span> <span class="str">f"./{name_stem}"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">isfile</span><span class="op">(</span><span class="nam">filename</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="nam">perform_linting_of_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="nam">fo</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="nam">plugin_feature_set</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="nam">filename</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="nam">name_stem</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="nam">context</span><span class="op">.</span><span class="nam">parsed_args</span><span class="op">.</span><span class="nam">auto_fix</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="nam">lint_report</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="key">if</span> <span class="nam">lint_report</span><span class="op">.</span><span class="nam">diagnostics_without_severity</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="str">"Some diagnostics did not explicitly set severity. Please report the bug and include the output"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="key">if</span> <span class="nam">lint_report</span><span class="op">.</span><span class="nam">diagnostic_errors</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="str">"Some sub-linters reported issues. Please report the bug and include the output"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="key">if</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">isfile</span><span class="op">(</span><span class="str">"debian/debputy.manifest"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">"Note: Due to a limitation in the linter, debian/debputy.manifest is"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">"only **partially** checked by this command at the time of writing."</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">"Please use `debputy check-manifest` to fully check the manifest."</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="key">if</span> <span class="nam">linter_exit_code</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="nam">_exit_with_lint_code</span><span class="op">(</span><span class="nam">lint_report</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"><span class="key">def</span> <span class="nam">_exit_with_lint_code</span><span class="op">(</span><span class="nam">lint_report</span><span class="op">:</span> <span class="nam">LintReport</span><span class="op">)</span> <span class="op">-></span> <span class="nam">NoReturn</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="nam">diagnostics_count</span> <span class="op">=</span> <span class="nam">lint_report</span><span class="op">.</span><span class="nam">diagnostics_count</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="nam">diagnostics_count</span><span class="op">[</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="key">or</span> <span class="nam">diagnostics_count</span><span class="op">[</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Warning</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="nam">sys</span><span class="op">.</span><span class="nam">exit</span><span class="op">(</span><span class="num">2</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="nam">sys</span><span class="op">.</span><span class="nam">exit</span><span class="op">(</span><span class="num">0</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"><span class="key">def</span> <span class="nam">perform_linting_of_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="nam">fo</span><span class="op">:</span> <span class="nam">OutputStylingBase</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="nam">plugin_feature_set</span><span class="op">:</span> <span class="nam">PluginProvidedFeatureSet</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="nam">filename</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="nam">file_format</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="nam">auto_fixing_enabled</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="nam">lint_report</span><span class="op">:</span> <span class="nam">LintReport</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="nam">handler</span> <span class="op">=</span> <span class="nam">LINTER_FORMATS</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">file_format</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="key">if</span> <span class="nam">handler</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="key">with</span> <span class="nam">open</span><span class="op">(</span><span class="nam">filename</span><span class="op">,</span> <span class="str">"rt"</span><span class="op">,</span> <span class="nam">encoding</span><span class="op">=</span><span class="str">"utf-8"</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="nam">text</span> <span class="op">=</span> <span class="nam">fd</span><span class="op">.</span><span class="nam">read</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="key">if</span> <span class="nam">auto_fixing_enabled</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="nam">_auto_fix_run</span><span class="op">(</span><span class="nam">fo</span><span class="op">,</span> <span class="nam">plugin_feature_set</span><span class="op">,</span> <span class="nam">filename</span><span class="op">,</span> <span class="nam">text</span><span class="op">,</span> <span class="nam">handler</span><span class="op">,</span> <span class="nam">lint_report</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="nam">_diagnostics_run</span><span class="op">(</span><span class="nam">fo</span><span class="op">,</span> <span class="nam">plugin_feature_set</span><span class="op">,</span> <span class="nam">filename</span><span class="op">,</span> <span class="nam">text</span><span class="op">,</span> <span class="nam">handler</span><span class="op">,</span> <span class="nam">lint_report</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"><span class="key">def</span> <span class="nam">_edit_happens_before_last_fix</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="nam">last_edit_pos</span><span class="op">:</span> <span class="nam">Position</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="nam">last_fix_position</span><span class="op">:</span> <span class="nam">Position</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="key">if</span> <span class="nam">last_edit_pos</span><span class="op">.</span><span class="nam">line</span> <span class="op"><</span> <span class="nam">last_fix_position</span><span class="op">.</span><span class="nam">line</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="key">return</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="nam">last_edit_pos</span><span class="op">.</span><span class="nam">line</span> <span class="op">==</span> <span class="nam">last_fix_position</span><span class="op">.</span><span class="nam">character</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="key">and</span> <span class="nam">last_edit_pos</span><span class="op">.</span><span class="nam">character</span> <span class="op"><</span> <span class="nam">last_fix_position</span><span class="op">.</span><span class="nam">character</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"><span class="key">def</span> <span class="nam">_auto_fix_run</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="nam">fo</span><span class="op">:</span> <span class="nam">OutputStylingBase</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="nam">plugin_feature_set</span><span class="op">:</span> <span class="nam">PluginProvidedFeatureSet</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="nam">filename</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="nam">text</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="nam">linter</span><span class="op">:</span> <span class="nam">LinterImpl</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="nam">lint_report</span><span class="op">:</span> <span class="nam">LintReport</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="nam">another_round</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="nam">unfixed_diagnostics</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="nam">remaining_rounds</span> <span class="op">=</span> <span class="num">10</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="nam">fixed_count</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="nam">too_many_rounds</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="nam">lines</span> <span class="op">=</span> <span class="nam">text</span><span class="op">.</span><span class="nam">splitlines</span><span class="op">(</span><span class="nam">keepends</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="nam">lint_state</span> <span class="op">=</span> <span class="nam">LintStateImpl</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="nam">plugin_feature_set</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="nam">filename</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="nam">current_issues</span> <span class="op">=</span> <span class="nam">linter</span><span class="op">(</span><span class="nam">lint_state</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="nam">issue_count_start</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">current_issues</span><span class="op">)</span> <span class="key">if</span> <span class="nam">current_issues</span> <span class="key">else</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="key">while</span> <span class="nam">another_round</span> <span class="key">and</span> <span class="nam">current_issues</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="nam">another_round</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="nam">last_fix_position</span> <span class="op">=</span> <span class="nam">Position</span><span class="op">(</span><span class="num">0</span><span class="op">,</span> <span class="num">0</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="nam">unfixed_diagnostics</span><span class="op">.</span><span class="nam">clear</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="nam">edits</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="nam">fixed_diagnostics</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="key">for</span> <span class="nam">diagnostic</span> <span class="key">in</span> <span class="nam">current_issues</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="nam">actions</span> <span class="op">=</span> <span class="nam">provide_standard_quickfixes_from_diagnostics</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="nam">CodeActionParams</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="nam">TextDocumentIdentifier</span><span class="op">(</span><span class="nam">filename</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="nam">diagnostic</span><span class="op">.</span><span class="nam">range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="nam">CodeActionContext</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="op">[</span><span class="nam">diagnostic</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="nam">auto_fixing_edits</span> <span class="op">=</span> <span class="nam">resolve_auto_fixer</span><span class="op">(</span><span class="nam">filename</span><span class="op">,</span> <span class="nam">actions</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">auto_fixing_edits</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="nam">unfixed_diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">diagnostic</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="nam">sorted_edits</span> <span class="op">=</span> <span class="nam">merge_sort_text_edits</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="op">[</span><span class="nam">get_well_formatted_edit</span><span class="op">(</span><span class="nam">e</span><span class="op">)</span> <span class="key">for</span> <span class="nam">e</span> <span class="key">in</span> <span class="nam">auto_fixing_edits</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="nam">last_edit</span> <span class="op">=</span> <span class="nam">sorted_edits</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="nam">last_edit_pos</span> <span class="op">=</span> <span class="nam">last_edit</span><span class="op">.</span><span class="nam">range</span><span class="op">.</span><span class="nam">start</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="key">if</span> <span class="nam">_edit_happens_before_last_fix</span><span class="op">(</span><span class="nam">last_edit_pos</span><span class="op">,</span> <span class="nam">last_fix_position</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">another_round</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="key">if</span> <span class="nam">remaining_rounds</span> <span class="op">></span> <span class="num">0</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="nam">remaining_rounds</span> <span class="op">-=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="str">"Detected overlapping edit; scheduling another edit round."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="nam">another_round</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="str">"Too many overlapping edits; stopping after this round (circuit breaker)."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="nam">too_many_rounds</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="nam">edits</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">sorted_edits</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="nam">fixed_diagnostics</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">diagnostic</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="nam">last_fix_position</span> <span class="op">=</span> <span class="nam">sorted_edits</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span><span class="op">.</span><span class="nam">range</span><span class="op">.</span><span class="nam">start</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="key">if</span> <span class="nam">another_round</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">edits</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="str">"Internal error: Detected an overlapping edit and yet had no edits to perform..."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="nam">fixed_count</span> <span class="op">+=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">fixed_diagnostics</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="nam">text</span> <span class="op">=</span> <span class="nam">apply_text_edits</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="nam">text</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="nam">edits</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="nam">lines</span> <span class="op">=</span> <span class="nam">text</span><span class="op">.</span><span class="nam">splitlines</span><span class="op">(</span><span class="nam">keepends</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="key">for</span> <span class="nam">diagnostic</span> <span class="key">in</span> <span class="nam">fixed_diagnostics</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="nam">report_diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="nam">fo</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="nam">filename</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="nam">diagnostic</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="nam">lint_report</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="nam">lint_state</span><span class="op">.</span><span class="nam">lines</span> <span class="op">=</span> <span class="nam">lines</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="nam">current_issues</span> <span class="op">=</span> <span class="nam">linter</span><span class="op">(</span><span class="nam">lint_state</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="key">if</span> <span class="nam">fixed_count</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="nam">output_filename</span> <span class="op">=</span> <span class="str">f"{filename}.tmp"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="key">with</span> <span class="nam">open</span><span class="op">(</span><span class="nam">output_filename</span><span class="op">,</span> <span class="str">"wt"</span><span class="op">,</span> <span class="nam">encoding</span><span class="op">=</span><span class="str">"utf-8"</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="nam">fd</span><span class="op">.</span><span class="nam">write</span><span class="op">(</span><span class="nam">text</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="nam">orig_mode</span> <span class="op">=</span> <span class="nam">stat</span><span class="op">.</span><span class="nam">S_IMODE</span><span class="op">(</span><span class="nam">os</span><span class="op">.</span><span class="nam">stat</span><span class="op">(</span><span class="nam">filename</span><span class="op">)</span><span class="op">.</span><span class="nam">st_mode</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">chmod</span><span class="op">(</span><span class="nam">output_filename</span><span class="op">,</span> <span class="nam">orig_mode</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">rename</span><span class="op">(</span><span class="nam">output_filename</span><span class="op">,</span> <span class="nam">filename</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="nam">lines</span> <span class="op">=</span> <span class="nam">text</span><span class="op">.</span><span class="nam">splitlines</span><span class="op">(</span><span class="nam">keepends</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="nam">lint_state</span><span class="op">.</span><span class="nam">lines</span> <span class="op">=</span> <span class="nam">lines</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="nam">remaining_issues</span> <span class="op">=</span> <span class="nam">linter</span><span class="op">(</span><span class="nam">lint_state</span><span class="op">)</span> <span class="key">or</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="nam">remaining_issues</span> <span class="op">=</span> <span class="nam">current_issues</span> <span class="key">or</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="key">for</span> <span class="nam">diagnostic</span> <span class="key">in</span> <span class="nam">remaining_issues</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="nam">report_diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="nam">fo</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="nam">filename</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="nam">diagnostic</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="nam">lint_report</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="key">if</span> <span class="nam">fixed_count</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="nam">remaining_issues_count</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">remaining_issues</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">colored</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="str">f"Fixes applied to {filename}: {fixed_count}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="str">f" Number of issues went from {issue_count_start} to {remaining_issues_count}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="nam">fg</span><span class="op">=</span><span class="str">"green"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="nam">style</span><span class="op">=</span><span class="str">"bold"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="key">elif</span> <span class="nam">remaining_issues</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">colored</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="str">f"None of the issues in {filename} could be fixed automatically. Sorry!"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="nam">fg</span><span class="op">=</span><span class="str">"yellow"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="nam">bg</span><span class="op">=</span><span class="str">"black"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="nam">style</span><span class="op">=</span><span class="str">"bold"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="key">assert</span> <span class="key">not</span> <span class="nam">current_issues</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">colored</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="str">f"No issues detected in {filename}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="nam">fg</span><span class="op">=</span><span class="str">"green"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="nam">style</span><span class="op">=</span><span class="str">"bold"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="key">if</span> <span class="nam">too_many_rounds</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="nam">fo</span><span class="op">.</span><span class="nam">colored</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="str">f"Not all fixes for issues in {filename} could be applied due to overlapping edits."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="nam">fg</span><span class="op">=</span><span class="str">"yellow"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="nam">bg</span><span class="op">=</span><span class="str">"black"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="nam">style</span><span class="op">=</span><span class="str">"bold"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="str">"Running once more may cause more fixes to be applied. However, you may be facing"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="str">" pathological performance."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"><span class="key">def</span> <span class="nam">_diagnostics_run</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="nam">fo</span><span class="op">:</span> <span class="nam">OutputStylingBase</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> <span class="nam">plugin_feature_set</span><span class="op">:</span> <span class="nam">PluginProvidedFeatureSet</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="nam">filename</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> <span class="nam">text</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="nam">linter</span><span class="op">:</span> <span class="nam">LinterImpl</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="nam">lint_report</span><span class="op">:</span> <span class="nam">LintReport</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="nam">lines</span> <span class="op">=</span> <span class="nam">text</span><span class="op">.</span><span class="nam">splitlines</span><span class="op">(</span><span class="nam">keepends</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="nam">lint_state</span> <span class="op">=</span> <span class="nam">LintStateImpl</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="nam">plugin_feature_set</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="nam">filename</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> <span class="nam">issues</span> <span class="op">=</span> <span class="nam">linter</span><span class="op">(</span><span class="nam">lint_state</span><span class="op">)</span> <span class="key">or</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="key">for</span> <span class="nam">diagnostic</span> <span class="key">in</span> <span class="nam">issues</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="nam">actions</span> <span class="op">=</span> <span class="nam">provide_standard_quickfixes_from_diagnostics</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="nam">CodeActionParams</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="nam">TextDocumentIdentifier</span><span class="op">(</span><span class="nam">filename</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="nam">diagnostic</span><span class="op">.</span><span class="nam">range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="nam">CodeActionContext</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="op">[</span><span class="nam">diagnostic</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="nam">auto_fixer</span> <span class="op">=</span> <span class="nam">resolve_auto_fixer</span><span class="op">(</span><span class="nam">filename</span><span class="op">,</span> <span class="nam">actions</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="nam">has_auto_fixer</span> <span class="op">=</span> <span class="nam">bool</span><span class="op">(</span><span class="nam">auto_fixer</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="nam">report_diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="nam">fo</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="nam">filename</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> <span class="nam">diagnostic</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> <span class="nam">lines</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> <span class="nam">has_auto_fixer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> <span class="nam">lint_report</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"><span class="key">def</span> <span class="nam">resolve_auto_fixer</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> <span class="nam">document_ref</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> <span class="nam">actions</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">Command</span><span class="op">,</span> <span class="nam">CodeAction</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">TextEdit</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> <span class="key">if</span> <span class="nam">actions</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">len</span><span class="op">(</span><span class="nam">actions</span><span class="op">)</span> <span class="op">!=</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> <span class="nam">action</span> <span class="op">=</span> <span class="nam">actions</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">action</span><span class="op">,</span> <span class="nam">CodeAction</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> <span class="nam">workspace_edit</span> <span class="op">=</span> <span class="nam">action</span><span class="op">.</span><span class="nam">edit</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"> <span class="key">if</span> <span class="nam">workspace_edit</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">action</span><span class="op">.</span><span class="nam">command</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> <span class="key">not</span> <span class="nam">workspace_edit</span><span class="op">.</span><span class="nam">changes</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"> <span class="key">or</span> <span class="nam">len</span><span class="op">(</span><span class="nam">workspace_edit</span><span class="op">.</span><span class="nam">changes</span><span class="op">)</span> <span class="op">!=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"> <span class="key">or</span> <span class="nam">document_ref</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">workspace_edit</span><span class="op">.</span><span class="nam">changes</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"> <span class="key">return</span> <span class="nam">workspace_edit</span><span class="op">.</span><span class="nam">changes</span><span class="op">[</span><span class="nam">document_ref</span><span class="op">]</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_7764373ba25ba45b___init___py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_7764373ba25ba45b_lint_util_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_7764373ba25ba45b_lint_util_py.html b/coverage-report/d_7764373ba25ba45b_lint_util_py.html deleted file mode 100644 index 7bcc47e..0000000 --- a/coverage-report/d_7764373ba25ba45b_lint_util_py.html +++ /dev/null @@ -1,318 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/linting/lint_util.py: 42%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/linting/lint_util.py</b>: - <span class="pc_cov">42%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">117 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">51<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">66<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">7<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">1<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_7764373ba25ba45b_lint_impl_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_5d0ec0d5422112df___init___py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">dataclasses</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">List</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">,</span> <span class="nam">Callable</span><span class="op">,</span> <span class="nam">Counter</span><span class="op">,</span> <span class="nam">TYPE_CHECKING</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">from</span> <span class="nam">lsprotocol</span><span class="op">.</span><span class="nam">types</span> <span class="key">import</span> <span class="nam">Position</span><span class="op">,</span> <span class="nam">Range</span><span class="op">,</span> <span class="nam">Diagnostic</span><span class="op">,</span> <span class="nam">DiagnosticSeverity</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">commands</span><span class="op">.</span><span class="nam">debputy_cmd</span><span class="op">.</span><span class="nam">output</span> <span class="key">import</span> <span class="nam">OutputStylingBase</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">feature_set</span> <span class="key">import</span> <span class="nam">PluginProvidedFeatureSet</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">_DEFAULT_LOGGER</span><span class="op">,</span> <span class="nam">_warn</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"><span class="key">if</span> <span class="nam">TYPE_CHECKING</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">lsp</span><span class="op">.</span><span class="nam">text_util</span> <span class="key">import</span> <span class="nam">LintCapablePositionCodec</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"><span class="nam">LinterImpl</span> <span class="op">=</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="str">"LintState"</span><span class="op">]</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">Diagnostic</span><span class="op">]</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"><span class="key">class</span> <span class="nam">LintState</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="key">def</span> <span class="nam">plugin_feature_set</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">PluginProvidedFeatureSet</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="key">def</span> <span class="nam">doc_uri</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="key">def</span> <span class="nam">path</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="key">def</span> <span class="nam">lines</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="key">def</span> <span class="nam">position_codec</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="str">"LintCapablePositionCodec"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"><span class="key">class</span> <span class="nam">LintStateImpl</span><span class="op">(</span><span class="nam">LintState</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">plugin_feature_set</span><span class="op">:</span> <span class="nam">PluginProvidedFeatureSet</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="key">def</span> <span class="nam">doc_uri</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="nam">path</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="nam">abs_path</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">curdir</span><span class="op">,</span> <span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="key">return</span> <span class="str">f"file://{abs_path}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="key">def</span> <span class="nam">position_codec</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="str">"LintCapablePositionCodec"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="key">return</span> <span class="nam">LINTER_POSITION_CODEC</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"><span class="key">class</span> <span class="nam">LintReport</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="nam">diagnostics_count</span><span class="op">:</span> <span class="nam">Counter</span><span class="op">[</span><span class="nam">DiagnosticSeverity</span><span class="op">]</span> <span class="op">=</span> <span class="nam">dataclasses</span><span class="op">.</span><span class="nam">field</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="nam">default_factory</span><span class="op">=</span><span class="nam">Counter</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="nam">diagnostics_without_severity</span><span class="op">:</span> <span class="nam">int</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="nam">diagnostic_errors</span><span class="op">:</span> <span class="nam">int</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="nam">fixed</span><span class="op">:</span> <span class="nam">int</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="nam">fixable</span><span class="op">:</span> <span class="nam">int</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"><span class="key">class</span> <span class="nam">LinterPositionCodec</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="key">def</span> <span class="nam">client_num_units</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">chars</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="key">return</span> <span class="nam">len</span><span class="op">(</span><span class="nam">chars</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="key">def</span> <span class="nam">position_from_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">position</span><span class="op">:</span> <span class="nam">Position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Position</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">lines</span><span class="op">)</span> <span class="op">==</span> <span class="num">0</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="key">return</span> <span class="nam">Position</span><span class="op">(</span><span class="num">0</span><span class="op">,</span> <span class="num">0</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="key">if</span> <span class="nam">position</span><span class="op">.</span><span class="nam">line</span> <span class="op">>=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">lines</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="key">return</span> <span class="nam">Position</span><span class="op">(</span><span class="nam">len</span><span class="op">(</span><span class="nam">lines</span><span class="op">)</span> <span class="op">-</span> <span class="num">1</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">client_num_units</span><span class="op">(</span><span class="nam">lines</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="key">return</span> <span class="nam">position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="key">def</span> <span class="nam">position_to_client_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> <span class="nam">_lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">position</span><span class="op">:</span> <span class="nam">Position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Position</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="key">return</span> <span class="nam">position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="key">def</span> <span class="nam">range_from_client_units</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">_lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">range</span><span class="op">:</span> <span class="nam">Range</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Range</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="key">return</span> <span class="nam">range</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="key">def</span> <span class="nam">range_to_client_units</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">_lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">range</span><span class="op">:</span> <span class="nam">Range</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Range</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="key">return</span> <span class="nam">range</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"><span class="nam">LINTER_POSITION_CODEC</span> <span class="op">=</span> <span class="nam">LinterPositionCodec</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"><span class="nam">_SEVERITY2TAG</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"><span class="annotate short">99 ↛ exit</span><span class="annotate long">line 99 didn't jump to the function exit</span></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Error</span><span class="op">:</span> <span class="key">lambda</span> <span class="nam">fo</span><span class="op">:</span> <span class="nam">fo</span><span class="op">.</span><span class="nam">colored</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="str">"error"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="nam">fg</span><span class="op">=</span><span class="str">"red"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="nam">bg</span><span class="op">=</span><span class="str">"black"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="nam">style</span><span class="op">=</span><span class="str">"bold"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Warning</span><span class="op">:</span> <span class="key">lambda</span> <span class="nam">fo</span><span class="op">:</span> <span class="nam">fo</span><span class="op">.</span><span class="nam">colored</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="str">"warning"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="nam">fg</span><span class="op">=</span><span class="str">"yellow"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="nam">bg</span><span class="op">=</span><span class="str">"black"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="nam">style</span><span class="op">=</span><span class="str">"bold"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Information</span><span class="op">:</span> <span class="key">lambda</span> <span class="nam">fo</span><span class="op">:</span> <span class="nam">fo</span><span class="op">.</span><span class="nam">colored</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="str">"informational"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="nam">fg</span><span class="op">=</span><span class="str">"blue"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="nam">bg</span><span class="op">=</span><span class="str">"black"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="nam">style</span><span class="op">=</span><span class="str">"bold"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Hint</span><span class="op">:</span> <span class="key">lambda</span> <span class="nam">fo</span><span class="op">:</span> <span class="nam">fo</span><span class="op">.</span><span class="nam">colored</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="str">"pedantic"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="nam">fg</span><span class="op">=</span><span class="str">"green"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="nam">bg</span><span class="op">=</span><span class="str">"black"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="nam">style</span><span class="op">=</span><span class="str">"bold"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"><span class="key">def</span> <span class="nam">_lines_to_print</span><span class="op">(</span><span class="nam">range_</span><span class="op">:</span> <span class="nam">Range</span><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="nam">count</span> <span class="op">=</span> <span class="nam">range_</span><span class="op">.</span><span class="nam">end</span><span class="op">.</span><span class="nam">line</span> <span class="op">-</span> <span class="nam">range_</span><span class="op">.</span><span class="nam">start</span><span class="op">.</span><span class="nam">line</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="key">if</span> <span class="nam">range_</span><span class="op">.</span><span class="nam">end</span><span class="op">.</span><span class="nam">character</span> <span class="op">></span> <span class="num">0</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="nam">count</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="key">return</span> <span class="nam">count</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"><span class="key">def</span> <span class="nam">_highlight_range</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="nam">fo</span><span class="op">:</span> <span class="nam">OutputStylingBase</span><span class="op">,</span> <span class="nam">line</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">line_no</span><span class="op">:</span> <span class="nam">int</span><span class="op">,</span> <span class="nam">range_</span><span class="op">:</span> <span class="nam">Range</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="nam">line_wo_nl</span> <span class="op">=</span> <span class="nam">line</span><span class="op">.</span><span class="nam">rstrip</span><span class="op">(</span><span class="str">"\r\n"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="nam">start_pos</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="nam">prefix</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="nam">suffix</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="key">if</span> <span class="nam">line_no</span> <span class="op">==</span> <span class="nam">range_</span><span class="op">.</span><span class="nam">start</span><span class="op">.</span><span class="nam">line</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="nam">start_pos</span> <span class="op">=</span> <span class="nam">range_</span><span class="op">.</span><span class="nam">start</span><span class="op">.</span><span class="nam">character</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="nam">prefix</span> <span class="op">=</span> <span class="nam">line_wo_nl</span><span class="op">[</span><span class="num">0</span><span class="op">:</span><span class="nam">start_pos</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="key">if</span> <span class="nam">line_no</span> <span class="op">==</span> <span class="nam">range_</span><span class="op">.</span><span class="nam">end</span><span class="op">.</span><span class="nam">line</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="nam">end_pos</span> <span class="op">=</span> <span class="nam">range_</span><span class="op">.</span><span class="nam">end</span><span class="op">.</span><span class="nam">character</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="nam">suffix</span> <span class="op">=</span> <span class="nam">line_wo_nl</span><span class="op">[</span><span class="nam">end_pos</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="nam">end_pos</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">line_wo_nl</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="nam">marked_part</span> <span class="op">=</span> <span class="nam">fo</span><span class="op">.</span><span class="nam">colored</span><span class="op">(</span><span class="nam">line_wo_nl</span><span class="op">[</span><span class="nam">start_pos</span><span class="op">:</span><span class="nam">end_pos</span><span class="op">]</span><span class="op">,</span> <span class="nam">fg</span><span class="op">=</span><span class="str">"red"</span><span class="op">,</span> <span class="nam">style</span><span class="op">=</span><span class="str">"bold"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="key">return</span> <span class="nam">prefix</span> <span class="op">+</span> <span class="nam">marked_part</span> <span class="op">+</span> <span class="nam">suffix</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"><span class="key">def</span> <span class="nam">report_diagnostic</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="nam">fo</span><span class="op">:</span> <span class="nam">OutputStylingBase</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="nam">filename</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="nam">diagnostic</span><span class="op">:</span> <span class="nam">Diagnostic</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="nam">lines</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="nam">auto_fixable</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="nam">auto_fixed</span><span class="op">:</span> <span class="nam">bool</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="nam">lint_report</span><span class="op">:</span> <span class="nam">LintReport</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="nam">logger</span> <span class="op">=</span> <span class="nam">_DEFAULT_LOGGER</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="key">assert</span> <span class="nam">logger</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="nam">severity</span> <span class="op">=</span> <span class="nam">diagnostic</span><span class="op">.</span><span class="nam">severity</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="nam">missing_severity</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="key">if</span> <span class="nam">severity</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="nam">severity</span> <span class="op">=</span> <span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Warning</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="nam">missing_severity</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">auto_fixed</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="nam">tag_unresolved</span> <span class="op">=</span> <span class="nam">_SEVERITY2TAG</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">severity</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="key">if</span> <span class="nam">tag_unresolved</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="nam">tag_unresolved</span> <span class="op">=</span> <span class="nam">_SEVERITY2TAG</span><span class="op">[</span><span class="nam">DiagnosticSeverity</span><span class="op">.</span><span class="nam">Warning</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="nam">lint_report</span><span class="op">.</span><span class="nam">diagnostics_without_severity</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="nam">lint_report</span><span class="op">.</span><span class="nam">diagnostics_count</span><span class="op">[</span><span class="nam">severity</span><span class="op">]</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="nam">tag</span> <span class="op">=</span> <span class="nam">tag_unresolved</span><span class="op">(</span><span class="nam">fo</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="nam">tag</span> <span class="op">=</span> <span class="nam">fo</span><span class="op">.</span><span class="nam">colored</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="str">"auto-fixing"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="nam">fg</span><span class="op">=</span><span class="str">"magenta"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="nam">bg</span><span class="op">=</span><span class="str">"black"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="nam">style</span><span class="op">=</span><span class="str">"bold"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="nam">start_line</span> <span class="op">=</span> <span class="nam">diagnostic</span><span class="op">.</span><span class="nam">range</span><span class="op">.</span><span class="nam">start</span><span class="op">.</span><span class="nam">line</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="nam">start_position</span> <span class="op">=</span> <span class="nam">diagnostic</span><span class="op">.</span><span class="nam">range</span><span class="op">.</span><span class="nam">start</span><span class="op">.</span><span class="nam">character</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="nam">end_line</span> <span class="op">=</span> <span class="nam">diagnostic</span><span class="op">.</span><span class="nam">range</span><span class="op">.</span><span class="nam">end</span><span class="op">.</span><span class="nam">line</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="nam">end_position</span> <span class="op">=</span> <span class="nam">diagnostic</span><span class="op">.</span><span class="nam">range</span><span class="op">.</span><span class="nam">end</span><span class="op">.</span><span class="nam">character</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="nam">has_fixit</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="nam">line_no_width</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">str</span><span class="op">(</span><span class="nam">len</span><span class="op">(</span><span class="nam">lines</span><span class="op">)</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">auto_fixed</span> <span class="key">and</span> <span class="nam">auto_fixable</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="nam">has_fixit</span> <span class="op">=</span> <span class="str">" [Correctable via --auto-fix]"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="nam">lint_report</span><span class="op">.</span><span class="nam">fixable</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="str">f"{tag}: File: {filename}:{start_line+1}:{start_position}:{end_line+1}:{end_position}: {diagnostic.message}{has_fixit}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="key">if</span> <span class="nam">missing_severity</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="str">" This warning did not have an explicit severity; Used Warning as a fallback!"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="key">if</span> <span class="nam">auto_fixed</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="com"># If it is fixed, there is no reason to show additional context.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="nam">lint_report</span><span class="op">.</span><span class="nam">fixed</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="nam">lines_to_print</span> <span class="op">=</span> <span class="nam">_lines_to_print</span><span class="op">(</span><span class="nam">diagnostic</span><span class="op">.</span><span class="nam">range</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="key">if</span> <span class="nam">diagnostic</span><span class="op">.</span><span class="nam">range</span><span class="op">.</span><span class="nam">end</span><span class="op">.</span><span class="nam">line</span> <span class="op">></span> <span class="nam">len</span><span class="op">(</span><span class="nam">lines</span><span class="op">)</span> <span class="key">or</span> <span class="nam">diagnostic</span><span class="op">.</span><span class="nam">range</span><span class="op">.</span><span class="nam">start</span><span class="op">.</span><span class="nam">line</span> <span class="op"><</span> <span class="num">0</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="nam">lint_report</span><span class="op">.</span><span class="nam">diagnostic_errors</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="str">"Bug in the underlying linter: The line numbers of the warning does not fit in the file..."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="key">if</span> <span class="nam">lines_to_print</span> <span class="op">==</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="nam">line</span> <span class="op">=</span> <span class="nam">_highlight_range</span><span class="op">(</span><span class="nam">fo</span><span class="op">,</span> <span class="nam">lines</span><span class="op">[</span><span class="nam">start_line</span><span class="op">]</span><span class="op">,</span> <span class="nam">start_line</span><span class="op">,</span> <span class="nam">diagnostic</span><span class="op">.</span><span class="nam">range</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">f" {start_line+1:{line_no_width}}: {line}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="key">for</span> <span class="nam">line_no</span> <span class="key">in</span> <span class="nam">range</span><span class="op">(</span><span class="nam">start_line</span><span class="op">,</span> <span class="nam">end_line</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="nam">line</span> <span class="op">=</span> <span class="nam">_highlight_range</span><span class="op">(</span><span class="nam">fo</span><span class="op">,</span> <span class="nam">lines</span><span class="op">[</span><span class="nam">line_no</span><span class="op">]</span><span class="op">,</span> <span class="nam">line_no</span><span class="op">,</span> <span class="nam">diagnostic</span><span class="op">.</span><span class="nam">range</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="nam">print</span><span class="op">(</span><span class="str">f" {line_no+1:{line_no_width}}: {line}"</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_7764373ba25ba45b_lint_impl_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_5d0ec0d5422112df___init___py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_9ae9c81fc31f2694_gnome_py.html b/coverage-report/d_9ae9c81fc31f2694_gnome_py.html deleted file mode 100644 index 90f704d..0000000 --- a/coverage-report/d_9ae9c81fc31f2694_gnome_py.html +++ /dev/null @@ -1,170 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for debputy/plugins/gnome.py: 96%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>debputy/plugins/gnome.py</b>: - <span class="pc_cov">96%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">38 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">37<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">1<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">1<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="deb_packer_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_9ae9c81fc31f2694_numpy3_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">re</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Any</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> <span class="nam">DebputyPluginInitializer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="nam">BinaryCtrlAccessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">_error</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"><span class="nam">GNOME_VERSION1_RE</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r"^(\d+:)?(\d+)\.(\d+)\.[\d.]+.*$"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="nam">GNOME_VERSION2_RE</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="str">r"^(\d+:)?(\d+)(?:\.[\d.]+|~(alpha|beta|rc)[\d.]*|[+~])?.*$"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"><span class="key">def</span> <span class="nam">initialize</span><span class="op">(</span><span class="nam">api</span><span class="op">:</span> <span class="nam">DebputyPluginInitializer</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">metadata_or_maintscript_detector</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="str">"gnome-versions"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">gnome_versions</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="com"># Probably not necessary, but this is the most faithful conversion</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">package_type</span><span class="op">=</span><span class="op">[</span><span class="str">"deb"</span><span class="op">,</span> <span class="str">"udeb"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="com"># Looking for "clean_la_files"? The `debputy` plugin provides a replacement</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="com"># feature.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"><span class="key">def</span> <span class="nam">gnome_versions</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="nam">_unused</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">:</span> <span class="nam">BinaryCtrlAccessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="nam">context</span><span class="op">:</span> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="com"># Conversion note: In debhelper, $dh{VERSION} is actually the "source" version</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="com"># (though sometimes it has a binNMU version too). In `debputy`, we have access</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="com"># to the "true" binary version (dpkg-gencontrol -v<VERSION>). In 99% of all cases,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="com"># the difference is irrelevant as people rarely use dpkg-gencontrol -v<VERSION>.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="nam">version</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">binary_package_version</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="nam">GNOME_VERSION1_RE</span><span class="op">.</span><span class="nam">match</span><span class="op">(</span><span class="nam">version</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">epoch</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="nam">gnome_version</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="nam">gnome_next_version</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="key">if</span> <span class="nam">m</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">major_version</span> <span class="op">=</span> <span class="nam">int</span><span class="op">(</span><span class="nam">m</span><span class="op">.</span><span class="nam">group</span><span class="op">(</span><span class="num">2</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="key">if</span> <span class="nam">major_version</span> <span class="op"><</span> <span class="num">40</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="nam">epoch</span> <span class="op">=</span> <span class="nam">m</span><span class="op">.</span><span class="nam">group</span><span class="op">(</span><span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="nam">minor_version</span> <span class="op">=</span> <span class="nam">int</span><span class="op">(</span><span class="nam">m</span><span class="op">.</span><span class="nam">group</span><span class="op">(</span><span class="num">3</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="nam">gnome_version</span> <span class="op">=</span> <span class="str">f"{major_version}.{minor_version}"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="key">if</span> <span class="nam">major_version</span> <span class="op">==</span> <span class="num">3</span> <span class="key">and</span> <span class="nam">minor_version</span> <span class="op">==</span> <span class="num">38</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="nam">prefix</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="nam">prefix</span> <span class="op">=</span> <span class="str">f"{major_version}."</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="nam">gnome_next_version</span> <span class="op">=</span> <span class="str">f"{prefix}{minor_version + 2}"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="key">if</span> <span class="nam">gnome_version</span> <span class="op">==</span> <span class="str">""</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="nam">GNOME_VERSION2_RE</span><span class="op">.</span><span class="nam">match</span><span class="op">(</span><span class="nam">version</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">m</span><span class="op">:</span> </span><span class="r"><span class="annotate short">55 ↛ 56</span><span class="annotate long">line 55 didn't jump to line 56, because the condition on line 55 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="str">f"Unable to determine the GNOME major version from {version} for package"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="str">f" {context.binary_package.name}. If this is not a GNOME package or it does"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="str">f" not follow the GNOME version standard, please disable the GNOME plugin"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="str">f" (debputy-plugin-gnome)."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="nam">epoch</span> <span class="op">=</span> <span class="nam">m</span><span class="op">.</span><span class="nam">group</span><span class="op">(</span><span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="nam">version</span> <span class="op">=</span> <span class="nam">int</span><span class="op">(</span><span class="nam">m</span><span class="op">.</span><span class="nam">group</span><span class="op">(</span><span class="num">2</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="nam">gnome_version</span> <span class="op">=</span> <span class="str">f"{version}~"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="nam">gnome_next_version</span> <span class="op">=</span> <span class="str">f"{version + 1}~"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="key">if</span> <span class="nam">epoch</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="nam">epoch</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">substvars</span><span class="op">[</span><span class="str">"gnome:Version"</span><span class="op">]</span> <span class="op">=</span> <span class="str">f"{epoch}{gnome_version}"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">substvars</span><span class="op">[</span><span class="str">"gnome:UpstreamVersion"</span><span class="op">]</span> <span class="op">=</span> <span class="str">f"{gnome_version}"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">substvars</span><span class="op">[</span><span class="str">"gnome:NextVersion"</span><span class="op">]</span> <span class="op">=</span> <span class="str">f"{epoch}{gnome_next_version}"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">substvars</span><span class="op">[</span><span class="str">"gnome:NextUpstreamVersion"</span><span class="op">]</span> <span class="op">=</span> <span class="str">f"{gnome_next_version}"</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="deb_packer_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_9ae9c81fc31f2694_numpy3_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_9ae9c81fc31f2694_numpy3_py.html b/coverage-report/d_9ae9c81fc31f2694_numpy3_py.html deleted file mode 100644 index 03e18e1..0000000 --- a/coverage-report/d_9ae9c81fc31f2694_numpy3_py.html +++ /dev/null @@ -1,161 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for debputy/plugins/numpy3.py: 86%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>debputy/plugins/numpy3.py</b>: - <span class="pc_cov">86%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">34 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">28<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">6<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_9ae9c81fc31f2694_gnome_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_9ae9c81fc31f2694_perl_openssl_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">functools</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Any</span><span class="op">,</span> <span class="nam">Tuple</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="nam">DebputyPluginInitializer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">BinaryCtrlAccessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">_error</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"><span class="key">def</span> <span class="nam">initialize</span><span class="op">(</span><span class="nam">api</span><span class="op">:</span> <span class="nam">DebputyPluginInitializer</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">metadata_or_maintscript_detector</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="str">"numpy-depends"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">numpy3_versions</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="com"># Probably not necessary, but this is the most faithful conversion</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">package_type</span><span class="op">=</span><span class="op">[</span><span class="str">"deb"</span><span class="op">,</span> <span class="str">"udeb"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"><span class="op">@</span><span class="nam">functools</span><span class="op">.</span><span class="nam">lru_cache</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"><span class="key">def</span> <span class="nam">_parse_numpy3_versions</span><span class="op">(</span><span class="nam">versions_file</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">attributes</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="key">with</span> <span class="nam">open</span><span class="op">(</span><span class="nam">versions_file</span><span class="op">,</span> <span class="str">"rt"</span><span class="op">,</span> <span class="nam">encoding</span><span class="op">=</span><span class="str">"utf-8"</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="key">for</span> <span class="nam">line</span> <span class="key">in</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="key">if</span> <span class="nam">line</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"#"</span><span class="op">)</span> <span class="key">or</span> <span class="nam">line</span><span class="op">.</span><span class="nam">isspace</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="nam">k</span><span class="op">,</span> <span class="nam">v</span> <span class="op">=</span> <span class="nam">line</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="nam">attributes</span><span class="op">[</span><span class="nam">k</span><span class="op">]</span> <span class="op">=</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="key">except</span> <span class="nam">FileNotFoundError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="str">f"Missing Build-Dependency on python3-numpy to ensure {versions_file}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="str">" is present."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">api_min_version</span> <span class="op">=</span> <span class="nam">attributes</span><span class="op">[</span><span class="str">"api-min-version"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="nam">abi_version</span> <span class="op">=</span> <span class="nam">attributes</span><span class="op">[</span><span class="str">"abi"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="key">except</span> <span class="nam">KeyError</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">k</span> <span class="op">=</span> <span class="nam">e</span><span class="op">.</span><span class="nam">args</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span><span class="str">f'Expected {versions_file} to contain the key "{k}"'</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="key">assert</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="key">return</span> <span class="nam">api_min_version</span><span class="op">,</span> <span class="nam">abi_version</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"><span class="key">def</span> <span class="nam">numpy3_versions</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="nam">_unused</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">:</span> <span class="nam">BinaryCtrlAccessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="nam">context</span><span class="op">:</span> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="key">if</span> <span class="nam">context</span><span class="op">.</span><span class="nam">binary_package</span><span class="op">.</span><span class="nam">is_arch_all</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="nam">dep</span> <span class="op">=</span> <span class="str">"python3-numpy"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="com"># Note we do not support --strict; codesearch.d.n suggests it is not used</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="com"># anywhere and this saves us figuring out how to support it here.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="nam">versions_file</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">environ</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"_NUMPY_TEST_PATH"</span><span class="op">,</span> <span class="str">"/usr/share/numpy3/versions"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="nam">api_min_version</span><span class="op">,</span> <span class="nam">abi_version</span> <span class="op">=</span> <span class="nam">_parse_numpy3_versions</span><span class="op">(</span><span class="nam">versions_file</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="nam">dep</span> <span class="op">=</span> <span class="str">f"python3-numpy (>= {api_min_version}), python3-numpy-abi{abi_version}"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">substvars</span><span class="op">.</span><span class="nam">add_dependency</span><span class="op">(</span><span class="str">"python3:Depends"</span><span class="op">,</span> <span class="nam">dep</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_9ae9c81fc31f2694_gnome_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_9ae9c81fc31f2694_perl_openssl_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_9ae9c81fc31f2694_perl_openssl_py.html b/coverage-report/d_9ae9c81fc31f2694_perl_openssl_py.html deleted file mode 100644 index 715454b..0000000 --- a/coverage-report/d_9ae9c81fc31f2694_perl_openssl_py.html +++ /dev/null @@ -1,142 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for debputy/plugins/perl_openssl.py: 75%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>debputy/plugins/perl_openssl.py</b>: - <span class="pc_cov">75%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">20 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">16<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">4<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_9ae9c81fc31f2694_numpy3_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_08cd1ad648464ded_debputy_self_hosting_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">functools</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">subprocess</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Any</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">DebputyPluginInitializer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">BinaryCtrlAccessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">_error</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"><span class="key">def</span> <span class="nam">initialize</span><span class="op">(</span><span class="nam">api</span><span class="op">:</span> <span class="nam">DebputyPluginInitializer</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">metadata_or_maintscript_detector</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="str">"perl-openssl-abi"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">detect_perl_openssl_abi</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"><span class="op">@</span><span class="nam">functools</span><span class="op">.</span><span class="nam">lru_cache</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"><span class="key">def</span> <span class="nam">_resolve_libssl_abi</span><span class="op">(</span><span class="nam">cmd</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="key">return</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_output</span><span class="op">(</span><span class="op">[</span><span class="nam">cmd</span><span class="op">]</span><span class="op">)</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">decode</span><span class="op">(</span><span class="str">"utf-8"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="key">except</span> <span class="nam">FileNotFoundError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="str">f"The perl-openssl plugin requires that perl-openssl-defaults + libssl-dev is installed"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="key">except</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">CalledProcessError</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span><span class="str">f""</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"><span class="key">def</span> <span class="nam">detect_perl_openssl_abi</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="nam">_unused</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">:</span> <span class="nam">BinaryCtrlAccessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="nam">_context</span><span class="op">:</span> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="nam">cmd</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">environ</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="str">"_PERL_SSL_DEFAULTS_TEST_PATH"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="str">"/usr/share/perl-openssl-defaults/get-libssl-abi"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">abi</span> <span class="op">=</span> <span class="nam">_resolve_libssl_abi</span><span class="op">(</span><span class="nam">cmd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">substvars</span><span class="op">.</span><span class="nam">add_dependency</span><span class="op">(</span><span class="str">"perl:Depends"</span><span class="op">,</span> <span class="str">f"perl-openssl-abi-{abi}"</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_9ae9c81fc31f2694_numpy3_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_08cd1ad648464ded_debputy_self_hosting_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_d5d6843b45eec01e___init___py.html b/coverage-report/d_d5d6843b45eec01e___init___py.html deleted file mode 100644 index 498a761..0000000 --- a/coverage-report/d_d5d6843b45eec01e___init___py.html +++ /dev/null @@ -1,99 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/plugin/debputy/__init__.py: 100%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/plugin/debputy/__init__.py</b>: - <span class="pc_cov">100%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">0 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">0<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">0<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_4b9be07fb6071cd2_test_spec_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_d5d6843b45eec01e_binary_package_rules_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_4b9be07fb6071cd2_test_spec_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_d5d6843b45eec01e_binary_package_rules_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_d5d6843b45eec01e_binary_package_rules_py.html b/coverage-report/d_d5d6843b45eec01e_binary_package_rules_py.html deleted file mode 100644 index c98b3fb..0000000 --- a/coverage-report/d_d5d6843b45eec01e_binary_package_rules_py.html +++ /dev/null @@ -1,817 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/plugin/debputy/binary_package_rules.py: 82%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/plugin/debputy/binary_package_rules.py</b>: - <span class="pc_cov">82%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">173 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">150<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">23<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">6<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_d5d6843b45eec01e___init___py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_d5d6843b45eec01e_debputy_plugin_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">dataclasses</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">textwrap</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="nam">List</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">NotRequired</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">Literal</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">TypedDict</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">Annotated</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">FrozenSet</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">Self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">cast</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span> <span class="key">import</span> <span class="nam">DEBPUTY_DOC_ROOT_DIR</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">maintscript_snippet</span> <span class="key">import</span> <span class="nam">DpkgMaintscriptHelperCommand</span><span class="op">,</span> <span class="nam">MaintscriptSnippet</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">base_types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">DebputyParsedContent</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">FileSystemExactMatchRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">declarative_parser</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="nam">DebputyParseHint</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="nam">ParserGenerator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">exceptions</span> <span class="key">import</span> <span class="nam">ManifestParseException</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">parser_data</span> <span class="key">import</span> <span class="nam">ParserContextData</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">AttributePath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">path_matcher</span> <span class="key">import</span> <span class="nam">MatchRule</span><span class="op">,</span> <span class="nam">MATCH_ANYTHING</span><span class="op">,</span> <span class="nam">ExactFileSystemPath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="nam">reference_documentation</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">impl</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="nam">DebputyPluginInitializerProvider</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="nam">ServiceDefinitionImpl</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">impl_types</span> <span class="key">import</span> <span class="nam">OPARSER_PACKAGES</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">spec</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">ServiceUpgradeRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="nam">ServiceDefinition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="nam">DSD</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">transformation_rules</span> <span class="key">import</span> <span class="nam">TransformationRule</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">_error</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"><span class="nam">ACCEPTABLE_CLEAN_ON_REMOVAL_FOR_GLOBS_AND_EXACT_MATCHES</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="str">"./var/log"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"><span class="nam">ACCEPTABLE_CLEAN_ON_REMOVAL_IF_EXACT_MATCH_OR_SUBDIR_OF</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="str">"./etc"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="str">"./run"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="str">"./var/lib"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="str">"./var/cache"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="str">"./var/backups"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="str">"./var/spool"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="com"># linux-image uses these paths with some `rm -f`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="str">"./usr/lib/modules"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="str">"./lib/modules"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="com"># udev special case</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="str">"./lib/udev"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="str">"./usr/lib/udev"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="com"># pciutils deletes /usr/share/misc/pci.ids.<ext></span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="str">"./usr/share/misc"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"><span class="key">def</span> <span class="nam">register_binary_package_rules</span><span class="op">(</span><span class="nam">api</span><span class="op">:</span> <span class="nam">DebputyPluginInitializerProvider</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">pluggable_manifest_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="nam">OPARSER_PACKAGES</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="str">"binary-version"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="nam">BinaryVersionParsedFormat</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="nam">_parse_binary_version</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="nam">source_format</span><span class="op">=</span><span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="nam">title</span><span class="op">=</span><span class="str">"Custom binary version (`binary-version`)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"><span class="str"> In the *rare* case that you need a binary package to have a custom version, you can use</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"><span class="str"> the `binary-version:` key to describe the desired package version. An example being:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"><span class="str"> packages:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"><span class="str"> foo:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"><span class="str"> # The foo package needs a different epoch because we took it over from a different</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"><span class="str"> # source package with higher epoch version</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"><span class="str"> binary-version: '1:{{DEB_VERSION_UPSTREAM_REVISION}}'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"><span class="str"> Use this feature sparingly as it is generally not possible to undo as each version must be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"><span class="str"> monotonously higher than the previous one. This feature translates into `-v` option for</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"><span class="str"> `dpkg-gencontrol`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"><span class="str"> The value for the `binary-version` key is a string that defines the binary version. Generally,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"><span class="str"> you will want it to contain one of the versioned related substitution variables such as</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"><span class="str"> `{{DEB_VERSION_UPSTREAM_REVISION}}`. Otherwise, you will have to remember to bump the version</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"><span class="str"> manually with each upload as versions cannot be reused and the package would not support binNMUs</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"><span class="str"> either.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="nam">reference_documentation_url</span><span class="op">=</span><span class="str">f"{DEBPUTY_DOC_ROOT_DIR}/MANIFEST-FORMAT.md#custom-binary-version-binary-version"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">pluggable_manifest_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="nam">OPARSER_PACKAGES</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="str">"transformations"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="nam">List</span><span class="op">[</span><span class="nam">TransformationRule</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="nam">_unpack_list</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="nam">title</span><span class="op">=</span><span class="str">"Transformations (`transformations`)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"><span class="str"> You can define a `transformations` under the package definition, which is a list a transformation</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"><span class="str"> rules. An example:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"><span class="str"> packages:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"><span class="str"> foo:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"><span class="str"> transformations:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"><span class="str"> - remove: 'usr/share/doc/{{PACKAGE}}/INSTALL.md'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"><span class="str"> - move:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"><span class="str"> source: bar/*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"><span class="str"> target: foo/</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"><span class="str"> Transformations are ordered and are applied in the listed order. A path can be matched by multiple</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"><span class="str"> transformations; how that plays out depends on which transformations are applied and in which order.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"><span class="str"> A quick summary:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"><span class="str"> - Transformations that modify the file system layout affect how path matches in later transformations.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"><span class="str"> As an example, `move` and `remove` transformations affects what globs and path matches expand to in</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"><span class="str"> later transformation rules.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"><span class="str"> - For other transformations generally the latter transformation overrules the earlier one, when they</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"><span class="str"> overlap or conflict.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="nam">reference_documentation_url</span><span class="op">=</span><span class="str">f"{DEBPUTY_DOC_ROOT_DIR}/MANIFEST-FORMAT.md#transformations-transformations"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">pluggable_manifest_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="nam">OPARSER_PACKAGES</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="str">"conffile-management"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="nam">List</span><span class="op">[</span><span class="nam">DpkgMaintscriptHelperCommand</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="nam">_unpack_list</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">pluggable_manifest_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="nam">OPARSER_PACKAGES</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="str">"services"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="nam">List</span><span class="op">[</span><span class="nam">ServiceRuleParsedFormat</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="nam">_process_service_rules</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="nam">source_format</span><span class="op">=</span><span class="nam">List</span><span class="op">[</span><span class="nam">ServiceRuleSourceFormat</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="nam">title</span><span class="op">=</span><span class="str">"Define how services in the package will be handled (`services`)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"><span class="str"> If you have non-standard requirements for certain services in the package, you can define those via</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"><span class="str"> the `services` attribute. The `services` attribute is a list of service rules. Example:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"><span class="str"> packages:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"><span class="str"> foo:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"><span class="str"> services:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"><span class="str"> - service: "foo"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"><span class="str"> enable-on-install: false</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"><span class="str"> - service: "bar"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"><span class="str"> on-upgrade: stop-then-start</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="nam">attributes</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="str">"service"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="str">f"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"><span class="str"> Name of the service to match. The name is usually the basename of the service file.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"><span class="str"> However, aliases can also be used for relevant system managers. When aliases **and**</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"><span class="str"> multiple service managers are involved, then the rule will apply to all matches.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"><span class="str"> For details on aliases, please see</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"><span class="str"> {DEBPUTY_DOC_ROOT_DIR}/MANIFEST-FORMAT.md#service-managers-and-aliases.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"><span class="str"> - Note: For systemd, the `.service` suffix can be omitted from name, but other</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"><span class="str"> suffixes such as `.timer` cannot.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="str">"type_of_service"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"><span class="str"> The type of service this rule applies to. To act on a `systemd` timer, you would</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"><span class="str"> set this to `timer` (etc.). Each service manager defines its own set of types</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"><span class="str"> of services.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="str">"service_scope"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"><span class="str"> The scope of the service. It must be either `system` and `user`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"><span class="str"> - Note: The keyword is defined to support `user`, but `debputy` does not support `user`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"><span class="str"> services at the moment (the detection logic is missing).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="op">[</span><span class="str">"service_manager"</span><span class="op">,</span> <span class="str">"service_managers"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"><span class="str"> Which service managers this rule is for. When omitted, all service managers with this</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"><span class="str"> service will be affected. This can be used to specify separate rules for the same</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"><span class="str"> service under different service managers.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"><span class="str"> - When this attribute is explicitly given, then all the listed service managers must</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"><span class="str"> provide at least one service matching the definition. In contract, when it is omitted,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"><span class="str"> then all service manager integrations are consulted but as long as at least one</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"><span class="str"> service is match from any service manager, the rule is accepted.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="str">"enable_on_install"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"><span class="str"> Whether to automatically enable the service on installation. Note: This does</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"><span class="str"> **not** affect whether the service will be started nor how restarts during</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"><span class="str"> upgrades will happen.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"><span class="str"> - If omitted, the plugin detecting the service decides the default.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="str">"start_on_install"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"><span class="str"> Whether to automatically start the service on installation. Whether it is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"><span class="str"> enabled or how upgrades are handled have separate attributes.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"><span class="str"> - If omitted, the plugin detecting the service decides the default.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="str">"on_upgrade"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"><span class="str"> How `debputy` should handle the service during upgrades. The default depends on the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"><span class="str"> plugin detecting the service. Valid values are:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"><span class="str"> - `do-nothing`: During an upgrade, the package should not attempt to stop, reload or</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"><span class="str"> restart the service.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"><span class="str"> - `reload`: During an upgrade, prefer reloading the service rather than restarting</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"><span class="str"> if possible. Note that the result may become `restart` instead if the service</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"><span class="str"> manager integration determines that `reload` is not supported.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"><span class="str"> - `restart`: During an upgrade, `restart` the service post upgrade. The service</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"><span class="str"> will be left running during the upgrade process.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"><span class="str"> - `stop-then-start`: Stop the service before the upgrade, perform the upgrade and</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"><span class="str"> then start the service.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="nam">reference_documentation_url</span><span class="op">=</span><span class="str">f"{DEBPUTY_DOC_ROOT_DIR}/MANIFEST-FORMAT.md#service-management-services"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">pluggable_manifest_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="nam">OPARSER_PACKAGES</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="str">"clean-after-removal"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="nam">ListParsedFormat</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="nam">_parse_clean_after_removal</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="nam">source_format</span><span class="op">=</span><span class="nam">List</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="com"># FIXME: debputy won't see the attributes for this one :'(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="nam">title</span><span class="op">=</span><span class="str">"Remove runtime created paths on purge or post removal (`clean-after-removal`)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"><span class="str"> For some packages, it is necessary to clean up some run-time created paths. Typical use cases are</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"><span class="str"> deleting log files, cache files, or persistent state. This can be done via the `clean-after-removal`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"><span class="str"> An example being:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"><span class="str"> packages:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"><span class="str"> foo:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"><span class="str"> clean-after-removal:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"><span class="str"> - /var/log/foo/*.log</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"><span class="str"> - /var/log/foo/*.log.gz</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"><span class="str"> - path: /var/log/foo/</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"><span class="str"> ignore-non-empty-dir: true</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"><span class="str"> - /etc/non-conffile-configuration.conf</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"><span class="str"> - path: /var/cache/foo</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"><span class="str"> recursive: true</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"><span class="str"> The `clean-after-removal` key accepts a list, where each element is either a mapping, a string or a list</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"><span class="str"> of strings. When an element is a mapping, then the following key/value pairs are applicable:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"><span class="str"> * `path` or `paths` (required): A path match (`path`) or a list of path matches (`paths`) defining the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"><span class="str"> path(s) that should be removed after clean. The path match(es) can use globs and manifest variables.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"><span class="str"> Every path matched will by default be removed via `rm -f` or `rmdir` depending on whether the path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"><span class="str"> provided ends with a *literal* `/`. Special-rules for matches:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"><span class="str"> - Glob is interpreted by the shell, so shell (`/bin/sh`) rules apply to globs rather than</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"><span class="str"> `debputy`'s glob rules. As an example, `foo/*` will **not** match `foo/.hidden-file`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"><span class="str"> - `debputy` cannot evaluate whether these paths/globs will match the desired paths (or anything at</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"><span class="str"> all). Be sure to test the resulting package.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"><span class="str"> - When a symlink is matched, it is not followed.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"><span class="str"> - Directory handling depends on the `recursive` attribute and whether the pattern ends with a literal</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"><span class="str"> "/".</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"><span class="str"> - `debputy` has restrictions on the globs being used to prevent rules that could cause massive damage</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"><span class="str"> to the system.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"><span class="str"> * `recursive` (optional): When `true`, the removal rule will use `rm -fr` rather than `rm -f` or `rmdir`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"><span class="str"> meaning any directory matched will be deleted along with all of its contents.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"><span class="str"> * `ignore-non-empty-dir` (optional): When `true`, each path must be or match a directory (and as a</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"><span class="str"> consequence each path must with a literal `/`). The affected directories will be deleted only if they</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"><span class="str"> are empty. Non-empty directories will be skipped. This option is mutually exclusive with `recursive`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"><span class="str"> * `delete-on` (optional, defaults to `purge`): This attribute defines when the removal happens. It can</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"><span class="str"> be set to one of the following values:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"><span class="str"> - `purge`: The removal happens with the package is being purged. This is the default. At a technical</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"><span class="str"> level, the removal occurs at `postrm purge`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"><span class="str"> - `removal`: The removal happens immediately after the package has been removed. At a technical level,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"><span class="str"> the removal occurs at `postrm remove`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"><span class="str"> This feature resembles the concept of `rpm`'s `%ghost` files.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> <span class="nam">reference_documentation_url</span><span class="op">=</span><span class="str">f"{DEBPUTY_DOC_ROOT_DIR}/MANIFEST-FORMAT.md#remove-runtime-created-paths-on-purge-or-post-removal-clean-after-removal"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">pluggable_manifest_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> <span class="nam">OPARSER_PACKAGES</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> <span class="str">"installation-search-dirs"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> <span class="nam">InstallationSearchDirsParsedFormat</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> <span class="nam">_parse_installation_search_dirs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"> <span class="nam">source_format</span><span class="op">=</span><span class="nam">List</span><span class="op">[</span><span class="nam">FileSystemExactMatchRule</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"> <span class="nam">title</span><span class="op">=</span><span class="str">"Custom installation time search directories (`installation-search-dirs`)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"><span class="str"> For source packages that does multiple build, it can be an advantage to provide a custom list of</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"><span class="str"> installation-time search directories. This can be done via the `installation-search-dirs` key. A common</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"><span class="str"> example is building the source twice with different optimization and feature settings where the second</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"><span class="str"> build is for the `debian-installer` (in the form of a `udeb` package). A sample manifest snippet could</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"><span class="str"> look something like:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"><span class="str"> installations:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"><span class="str"> - install:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"><span class="str"> # Because of the search order (see below), `foo` installs `debian/tmp/usr/bin/tool`,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"><span class="str"> # while `foo-udeb` installs `debian/tmp-udeb/usr/bin/tool` (assuming both paths are</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"><span class="str"> # available). Note the rule can be split into two with the same effect if that aids</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"><span class="str"> # readability or understanding.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"><span class="str"> source: usr/bin/tool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"><span class="str"> into:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"><span class="str"> - foo</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"><span class="str"> - foo-udeb</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"><span class="str"> packages:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"><span class="str"> foo-udeb:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"><span class="str"> installation-search-dirs:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"><span class="str"> - debian/tmp-udeb</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"><span class="str"> The `installation-search-dirs` key accepts a list, where each element is a path (str) relative from the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"><span class="str"> source root to the directory that should be used as a search directory (absolute paths are still interpreted</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"><span class="str"> as relative to the source root). This list should contain all search directories that should be applicable</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"><span class="str"> for this package (except the source root itself, which is always appended after the provided list). If the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"><span class="str"> key is omitted, then `debputy` will provide a default search order (In the `dh` integration, the default</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"><span class="str"> is the directory `debian/tmp`).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"><span class="str"> If a non-existing or non-directory path is listed, then it will be skipped (info-level note). If the path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"><span class="str"> exists and is a directory, it will also be checked for "not-installed" paths.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"> <span class="nam">reference_documentation_url</span><span class="op">=</span><span class="str">f"{DEBPUTY_DOC_ROOT_DIR}/MANIFEST-FORMAT.md#custom-installation-time-search-directories-installation-search-dirs"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"><span class="key">class</span> <span class="nam">ServiceRuleSourceFormat</span><span class="op">(</span><span class="nam">TypedDict</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"> <span class="nam">service</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"> <span class="nam">type_of_service</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t385" href="#t385">385</a></span><span class="t"> <span class="nam">service_scope</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">Literal</span><span class="op">[</span><span class="str">"system"</span><span class="op">,</span> <span class="str">"user"</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t386" href="#t386">386</a></span><span class="t"> <span class="nam">enable_on_install</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t387" href="#t387">387</a></span><span class="t"> <span class="nam">start_on_install</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t388" href="#t388">388</a></span><span class="t"> <span class="nam">on_upgrade</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">ServiceUpgradeRule</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t389" href="#t389">389</a></span><span class="t"> <span class="nam">service_manager</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t390" href="#t390">390</a></span><span class="t"> <span class="nam">Annotated</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">DebputyParseHint</span><span class="op">.</span><span class="nam">target_attribute</span><span class="op">(</span><span class="str">"service_managers"</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t391" href="#t391">391</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t392" href="#t392">392</a></span><span class="t"> <span class="nam">service_managers</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t393" href="#t393">393</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t394" href="#t394">394</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t395" href="#t395">395</a></span><span class="t"><span class="key">class</span> <span class="nam">ServiceRuleParsedFormat</span><span class="op">(</span><span class="nam">DebputyParsedContent</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t396" href="#t396">396</a></span><span class="t"> <span class="nam">service</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t397" href="#t397">397</a></span><span class="t"> <span class="nam">type_of_service</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t398" href="#t398">398</a></span><span class="t"> <span class="nam">service_scope</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">Literal</span><span class="op">[</span><span class="str">"system"</span><span class="op">,</span> <span class="str">"user"</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t399" href="#t399">399</a></span><span class="t"> <span class="nam">enable_on_install</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t400" href="#t400">400</a></span><span class="t"> <span class="nam">start_on_install</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t401" href="#t401">401</a></span><span class="t"> <span class="nam">on_upgrade</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">ServiceUpgradeRule</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t402" href="#t402">402</a></span><span class="t"> <span class="nam">service_managers</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t403" href="#t403">403</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t404" href="#t404">404</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t405" href="#t405">405</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t406" href="#t406">406</a></span><span class="t"><span class="key">class</span> <span class="nam">ServiceRule</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t407" href="#t407">407</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t408" href="#t408">408</a></span><span class="t"> <span class="nam">service</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t409" href="#t409">409</a></span><span class="t"> <span class="nam">type_of_service</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t410" href="#t410">410</a></span><span class="t"> <span class="nam">service_scope</span><span class="op">:</span> <span class="nam">Literal</span><span class="op">[</span><span class="str">"system"</span><span class="op">,</span> <span class="str">"user"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t411" href="#t411">411</a></span><span class="t"> <span class="nam">enable_on_install</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t412" href="#t412">412</a></span><span class="t"> <span class="nam">start_on_install</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t413" href="#t413">413</a></span><span class="t"> <span class="nam">on_upgrade</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">ServiceUpgradeRule</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t414" href="#t414">414</a></span><span class="t"> <span class="nam">service_managers</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">FrozenSet</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t415" href="#t415">415</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t416" href="#t416">416</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t417" href="#t417">417</a></span><span class="t"> <span class="key">def</span> <span class="nam">from_service_rule_parsed_format</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t418" href="#t418">418</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t419" href="#t419">419</a></span><span class="t"> <span class="nam">data</span><span class="op">:</span> <span class="nam">ServiceRuleParsedFormat</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t420" href="#t420">420</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t421" href="#t421">421</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"Self"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t422" href="#t422">422</a></span><span class="t"> <span class="nam">service_managers</span> <span class="op">=</span> <span class="nam">data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"service_managers"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t423" href="#t423">423</a></span><span class="t"> <span class="key">return</span> <span class="nam">cls</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t424" href="#t424">424</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t425" href="#t425">425</a></span><span class="t"> <span class="nam">data</span><span class="op">[</span><span class="str">"service"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t426" href="#t426">426</a></span><span class="t"> <span class="nam">data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"type_of_service"</span><span class="op">,</span> <span class="str">"service"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t427" href="#t427">427</a></span><span class="t"> <span class="nam">cast</span><span class="op">(</span><span class="str">"Literal['system', 'user']"</span><span class="op">,</span> <span class="nam">data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"service_scope"</span><span class="op">,</span> <span class="str">"system"</span><span class="op">)</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t428" href="#t428">428</a></span><span class="t"> <span class="nam">data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"enable_on_install"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t429" href="#t429">429</a></span><span class="t"> <span class="nam">data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"start_on_install"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t430" href="#t430">430</a></span><span class="t"> <span class="nam">data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"on_upgrade"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t431" href="#t431">431</a></span><span class="t"> <span class="nam">frozenset</span><span class="op">(</span><span class="nam">service_managers</span><span class="op">)</span> <span class="key">if</span> <span class="nam">service_managers</span> <span class="key">else</span> <span class="nam">service_managers</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t432" href="#t432">432</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t433" href="#t433">433</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t434" href="#t434">434</a></span><span class="t"> <span class="key">def</span> <span class="nam">applies_to_service_manager</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">service_manager</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t435" href="#t435">435</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">service_managers</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">service_manager</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">service_managers</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t436" href="#t436">436</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t437" href="#t437">437</a></span><span class="t"> <span class="key">def</span> <span class="nam">apply_to_service_definition</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t438" href="#t438">438</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t439" href="#t439">439</a></span><span class="t"> <span class="nam">service_definition</span><span class="op">:</span> <span class="nam">ServiceDefinition</span><span class="op">[</span><span class="nam">DSD</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t440" href="#t440">440</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">ServiceDefinition</span><span class="op">[</span><span class="nam">DSD</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t441" href="#t441">441</a></span><span class="t"> <span class="key">assert</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">service_definition</span><span class="op">,</span> <span class="nam">ServiceDefinitionImpl</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t442" href="#t442">442</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">service_definition</span><span class="op">.</span><span class="nam">is_plugin_provided_definition</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t443" href="#t443">443</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t444" href="#t444">444</a></span><span class="t"> <span class="str">f"Conflicting definitions related to {self.service} (type: {self.type_of_service},"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t445" href="#t445">445</a></span><span class="t"> <span class="str">f" scope: {self.service_scope}). First definition at {service_definition.definition_source},"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t446" href="#t446">446</a></span><span class="t"> <span class="str">f" the second at {self.definition_source}). If they are for different service managers,"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t447" href="#t447">447</a></span><span class="t"> <span class="str">" you can often avoid this problem by explicitly defining which service managers are applicable"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t448" href="#t448">448</a></span><span class="t"> <span class="str">' to each rule via the "service-managers" keyword.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t449" href="#t449">449</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t450" href="#t450">450</a></span><span class="t"> <span class="nam">changes</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t451" href="#t451">451</a></span><span class="t"> <span class="str">"definition_source"</span><span class="op">:</span> <span class="nam">self</span><span class="op">.</span><span class="nam">definition_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t452" href="#t452">452</a></span><span class="t"> <span class="str">"is_plugin_provided_definition"</span><span class="op">:</span> <span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t453" href="#t453">453</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t454" href="#t454">454</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t455" href="#t455">455</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">service</span> <span class="op">!=</span> <span class="nam">service_definition</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t456" href="#t456">456</a></span><span class="t"> <span class="key">and</span> <span class="nam">self</span><span class="op">.</span><span class="nam">service</span> <span class="key">in</span> <span class="nam">service_definition</span><span class="op">.</span><span class="nam">names</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t457" href="#t457">457</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t458" href="#t458">458</a></span><span class="t"> <span class="nam">changes</span><span class="op">[</span><span class="str">"name"</span><span class="op">]</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">service</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t459" href="#t459">459</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">enable_on_install</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t460" href="#t460">460</a></span><span class="t"> <span class="nam">changes</span><span class="op">[</span><span class="str">"auto_start_on_install"</span><span class="op">]</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">enable_on_install</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t461" href="#t461">461</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">start_on_install</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t462" href="#t462">462</a></span><span class="t"> <span class="nam">changes</span><span class="op">[</span><span class="str">"auto_start_on_install"</span><span class="op">]</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">start_on_install</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t463" href="#t463">463</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">on_upgrade</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t464" href="#t464">464</a></span><span class="t"> <span class="nam">changes</span><span class="op">[</span><span class="str">"on_upgrade"</span><span class="op">]</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">on_upgrade</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t465" href="#t465">465</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t466" href="#t466">466</a></span><span class="t"> <span class="key">return</span> <span class="nam">service_definition</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="op">**</span><span class="nam">changes</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t467" href="#t467">467</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t468" href="#t468">468</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t469" href="#t469">469</a></span><span class="t"><span class="key">class</span> <span class="nam">BinaryVersionParsedFormat</span><span class="op">(</span><span class="nam">DebputyParsedContent</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t470" href="#t470">470</a></span><span class="t"> <span class="nam">binary_version</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t471" href="#t471">471</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t472" href="#t472">472</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t473" href="#t473">473</a></span><span class="t"><span class="key">class</span> <span class="nam">ListParsedFormat</span><span class="op">(</span><span class="nam">DebputyParsedContent</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t474" href="#t474">474</a></span><span class="t"> <span class="nam">elements</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t475" href="#t475">475</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t476" href="#t476">476</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t477" href="#t477">477</a></span><span class="t"><span class="key">class</span> <span class="nam">ListOfTransformationRulesFormat</span><span class="op">(</span><span class="nam">DebputyParsedContent</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t478" href="#t478">478</a></span><span class="t"> <span class="nam">elements</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">TransformationRule</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t479" href="#t479">479</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t480" href="#t480">480</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t481" href="#t481">481</a></span><span class="t"><span class="key">class</span> <span class="nam">ListOfDpkgMaintscriptHelperCommandFormat</span><span class="op">(</span><span class="nam">DebputyParsedContent</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t482" href="#t482">482</a></span><span class="t"> <span class="nam">elements</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">DpkgMaintscriptHelperCommand</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t483" href="#t483">483</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t484" href="#t484">484</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t485" href="#t485">485</a></span><span class="t"><span class="key">class</span> <span class="nam">InstallationSearchDirsParsedFormat</span><span class="op">(</span><span class="nam">DebputyParsedContent</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t486" href="#t486">486</a></span><span class="t"> <span class="nam">installation_search_dirs</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">FileSystemExactMatchRule</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t487" href="#t487">487</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t488" href="#t488">488</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t489" href="#t489">489</a></span><span class="t"><span class="key">def</span> <span class="nam">_parse_binary_version</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t490" href="#t490">490</a></span><span class="t"> <span class="nam">_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t491" href="#t491">491</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">:</span> <span class="nam">BinaryVersionParsedFormat</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t492" href="#t492">492</a></span><span class="t"> <span class="nam">_attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t493" href="#t493">493</a></span><span class="t"> <span class="nam">_parser_context</span><span class="op">:</span> <span class="nam">ParserContextData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t494" href="#t494">494</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t495" href="#t495">495</a></span><span class="t"> <span class="key">return</span> <span class="nam">parsed_data</span><span class="op">[</span><span class="str">"binary_version"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t496" href="#t496">496</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t497" href="#t497">497</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t498" href="#t498">498</a></span><span class="t"><span class="key">def</span> <span class="nam">_parse_installation_search_dirs</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t499" href="#t499">499</a></span><span class="t"> <span class="nam">_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t500" href="#t500">500</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">:</span> <span class="nam">InstallationSearchDirsParsedFormat</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t501" href="#t501">501</a></span><span class="t"> <span class="nam">_attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t502" href="#t502">502</a></span><span class="t"> <span class="nam">_parser_context</span><span class="op">:</span> <span class="nam">ParserContextData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t503" href="#t503">503</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">List</span><span class="op">[</span><span class="nam">FileSystemExactMatchRule</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t504" href="#t504">504</a></span><span class="t"> <span class="key">return</span> <span class="nam">parsed_data</span><span class="op">[</span><span class="str">"installation_search_dirs"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t505" href="#t505">505</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t506" href="#t506">506</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t507" href="#t507">507</a></span><span class="t"><span class="key">def</span> <span class="nam">_process_service_rules</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t508" href="#t508">508</a></span><span class="t"> <span class="nam">_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t509" href="#t509">509</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">ServiceRuleParsedFormat</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t510" href="#t510">510</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t511" href="#t511">511</a></span><span class="t"> <span class="nam">_parser_context</span><span class="op">:</span> <span class="nam">ParserContextData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t512" href="#t512">512</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">List</span><span class="op">[</span><span class="nam">ServiceRule</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t513" href="#t513">513</a></span><span class="t"> <span class="key">return</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t514" href="#t514">514</a></span><span class="t"> <span class="nam">ServiceRule</span><span class="op">.</span><span class="nam">from_service_rule_parsed_format</span><span class="op">(</span><span class="nam">x</span><span class="op">,</span> <span class="nam">attribute_path</span><span class="op">[</span><span class="nam">i</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t515" href="#t515">515</a></span><span class="t"> <span class="key">for</span> <span class="nam">i</span><span class="op">,</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">parsed_data</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t516" href="#t516">516</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t517" href="#t517">517</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t518" href="#t518">518</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t519" href="#t519">519</a></span><span class="t"><span class="key">def</span> <span class="nam">_unpack_list</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t520" href="#t520">520</a></span><span class="t"> <span class="nam">_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t521" href="#t521">521</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t522" href="#t522">522</a></span><span class="t"> <span class="nam">_attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t523" href="#t523">523</a></span><span class="t"> <span class="nam">_parser_context</span><span class="op">:</span> <span class="nam">ParserContextData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t524" href="#t524">524</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">List</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t525" href="#t525">525</a></span><span class="t"> <span class="key">return</span> <span class="nam">parsed_data</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t526" href="#t526">526</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t527" href="#t527">527</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t528" href="#t528">528</a></span><span class="t"><span class="key">class</span> <span class="nam">CleanAfterRemovalRuleSourceFormat</span><span class="op">(</span><span class="nam">TypedDict</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t529" href="#t529">529</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">Annotated</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">DebputyParseHint</span><span class="op">.</span><span class="nam">target_attribute</span><span class="op">(</span><span class="str">"paths"</span><span class="op">)</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t530" href="#t530">530</a></span><span class="t"> <span class="nam">paths</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t531" href="#t531">531</a></span><span class="t"> <span class="nam">delete_on</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">Literal</span><span class="op">[</span><span class="str">"purge"</span><span class="op">,</span> <span class="str">"removal"</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t532" href="#t532">532</a></span><span class="t"> <span class="nam">recursive</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t533" href="#t533">533</a></span><span class="t"> <span class="nam">ignore_non_empty_dir</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t534" href="#t534">534</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t535" href="#t535">535</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t536" href="#t536">536</a></span><span class="t"><span class="key">class</span> <span class="nam">CleanAfterRemovalRule</span><span class="op">(</span><span class="nam">DebputyParsedContent</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t537" href="#t537">537</a></span><span class="t"> <span class="nam">paths</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t538" href="#t538">538</a></span><span class="t"> <span class="nam">delete_on</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">Literal</span><span class="op">[</span><span class="str">"purge"</span><span class="op">,</span> <span class="str">"removal"</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t539" href="#t539">539</a></span><span class="t"> <span class="nam">recursive</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t540" href="#t540">540</a></span><span class="t"> <span class="nam">ignore_non_empty_dir</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t541" href="#t541">541</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t542" href="#t542">542</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t543" href="#t543">543</a></span><span class="t"><span class="com"># FIXME: Not optimal that we are doing an initialization of ParserGenerator here. But the rule is not depending on any</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t544" href="#t544">544</a></span><span class="t"><span class="com"># complex types that is registered by plugins, so it will work for now.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t545" href="#t545">545</a></span><span class="t"><span class="nam">_CLEAN_AFTER_REMOVAL_RULE_PARSER</span> <span class="op">=</span> <span class="nam">ParserGenerator</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">generate_parser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t546" href="#t546">546</a></span><span class="t"> <span class="nam">CleanAfterRemovalRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t547" href="#t547">547</a></span><span class="t"> <span class="nam">source_content</span><span class="op">=</span><span class="nam">Union</span><span class="op">[</span><span class="nam">CleanAfterRemovalRuleSourceFormat</span><span class="op">,</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t548" href="#t548">548</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t549" href="#t549">549</a></span><span class="t"> <span class="nam">reference_documentation_url</span><span class="op">=</span><span class="str">f"{DEBPUTY_DOC_ROOT_DIR}/MANIFEST-FORMAT.md#remove-runtime-created-paths-on-purge-or-post-removal-clean-after-removal"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t550" href="#t550">550</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t551" href="#t551">551</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t552" href="#t552">552</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t553" href="#t553">553</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t554" href="#t554">554</a></span><span class="t"><span class="com"># Order between clean_on_removal and conffile_management is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t555" href="#t555">555</a></span><span class="t"><span class="com"># important. We want the dpkg conffile management rules to happen before the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t556" href="#t556">556</a></span><span class="t"><span class="com"># clean clean_on_removal rules. Since the latter only affects `postrm`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t557" href="#t557">557</a></span><span class="t"><span class="com"># and the order is reversed for `postrm` scripts (among other), we need do</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t558" href="#t558">558</a></span><span class="t"><span class="com"># clean_on_removal first to account for the reversing of order.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t559" href="#t559">559</a></span><span class="t"><span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t560" href="#t560">560</a></span><span class="t"><span class="com"># FIXME: All of this is currently not really possible todo, but it should be.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t561" href="#t561">561</a></span><span class="t"><span class="com"># (I think it is the correct order by "mistake" rather than by "design", which is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t562" href="#t562">562</a></span><span class="t"><span class="com"># what this note is about)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t563" href="#t563">563</a></span><span class="t"><span class="key">def</span> <span class="nam">_parse_clean_after_removal</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t564" href="#t564">564</a></span><span class="t"> <span class="nam">_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t565" href="#t565">565</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">:</span> <span class="nam">ListParsedFormat</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t566" href="#t566">566</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t567" href="#t567">567</a></span><span class="t"> <span class="nam">parser_context</span><span class="op">:</span> <span class="nam">ParserContextData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t568" href="#t568">568</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> <span class="com"># TODO: Return and pass to a maintscript helper</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t569" href="#t569">569</a></span><span class="t"> <span class="nam">raw_clean_after_removal</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">[</span><span class="str">"elements"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t570" href="#t570">570</a></span><span class="t"> <span class="nam">package_state</span> <span class="op">=</span> <span class="nam">parser_context</span><span class="op">.</span><span class="nam">current_binary_package_state</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t571" href="#t571">571</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t572" href="#t572">572</a></span><span class="t"> <span class="key">for</span> <span class="nam">no</span><span class="op">,</span> <span class="nam">raw_transformation</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">raw_clean_after_removal</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t573" href="#t573">573</a></span><span class="t"> <span class="nam">definition_source</span> <span class="op">=</span> <span class="nam">attribute_path</span><span class="op">[</span><span class="nam">no</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t574" href="#t574">574</a></span><span class="t"> <span class="nam">clean_after_removal_rules</span> <span class="op">=</span> <span class="nam">_CLEAN_AFTER_REMOVAL_RULE_PARSER</span><span class="op">.</span><span class="nam">parse_input</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t575" href="#t575">575</a></span><span class="t"> <span class="nam">raw_transformation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t576" href="#t576">576</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t577" href="#t577">577</a></span><span class="t"> <span class="nam">parser_context</span><span class="op">=</span><span class="nam">parser_context</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t578" href="#t578">578</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t579" href="#t579">579</a></span><span class="t"> <span class="nam">patterns</span> <span class="op">=</span> <span class="nam">clean_after_removal_rules</span><span class="op">[</span><span class="str">"paths"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t580" href="#t580">580</a></span><span class="t"> <span class="key">if</span> <span class="nam">patterns</span><span class="op">:</span> </span><span class="r"><span class="annotate short">580 ↛ 582</span><span class="annotate long">line 580 didn't jump to line 582, because the condition on line 580 was never false</span></span></p> - <p class="run"><span class="n"><a id="t581" href="#t581">581</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">.</span><span class="nam">path_hint</span> <span class="op">=</span> <span class="nam">patterns</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t582" href="#t582">582</a></span><span class="t"> <span class="nam">delete_on</span> <span class="op">=</span> <span class="nam">clean_after_removal_rules</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"delete_on"</span><span class="op">)</span> <span class="key">or</span> <span class="str">"purge"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t583" href="#t583">583</a></span><span class="t"> <span class="nam">recurse</span> <span class="op">=</span> <span class="nam">clean_after_removal_rules</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"recursive"</span><span class="op">)</span> <span class="key">or</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t584" href="#t584">584</a></span><span class="t"> <span class="nam">ignore_non_empty_dir</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t585" href="#t585">585</a></span><span class="t"> <span class="nam">clean_after_removal_rules</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"ignore_non_empty_dir"</span><span class="op">)</span> <span class="key">or</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t586" href="#t586">586</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t587" href="#t587">587</a></span><span class="t"> <span class="key">if</span> <span class="nam">delete_on</span> <span class="op">==</span> <span class="str">"purge"</span><span class="op">:</span> </span><span class="r"><span class="annotate short">587 ↛ 590</span><span class="annotate long">line 587 didn't jump to line 590, because the condition on line 587 was never false</span></span></p> - <p class="run"><span class="n"><a id="t588" href="#t588">588</a></span><span class="t"> <span class="nam">condition</span> <span class="op">=</span> <span class="str">'[ "$1" = "purge" ]'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t589" href="#t589">589</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t590" href="#t590">590</a></span><span class="t"> <span class="nam">condition</span> <span class="op">=</span> <span class="str">'[ "$1" = "remove" ]'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t591" href="#t591">591</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t592" href="#t592">592</a></span><span class="t"> <span class="key">if</span> <span class="nam">ignore_non_empty_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t593" href="#t593">593</a></span><span class="t"> <span class="key">if</span> <span class="nam">recurse</span><span class="op">:</span> </span><span class="r"><span class="annotate short">593 ↛ 594</span><span class="annotate long">line 593 didn't jump to line 594, because the condition on line 593 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t594" href="#t594">594</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t595" href="#t595">595</a></span><span class="t"> <span class="str">'The "recursive" and "ignore-non-empty-dir" options are mutually exclusive.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t596" href="#t596">596</a></span><span class="t"> <span class="str">f" Both were enabled at the same time in at {definition_source.path}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t597" href="#t597">597</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t598" href="#t598">598</a></span><span class="t"> <span class="key">for</span> <span class="nam">pattern</span> <span class="key">in</span> <span class="nam">patterns</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t599" href="#t599">599</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">pattern</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">599 ↛ 600</span><span class="annotate long">line 599 didn't jump to line 600, because the condition on line 599 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t600" href="#t600">600</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t601" href="#t601">601</a></span><span class="t"> <span class="str">'When ignore-non-empty-dir is True, then all patterns must end with a literal "/"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t602" href="#t602">602</a></span><span class="t"> <span class="str">f' to ensure they only apply to directories. The pattern "{pattern}" at'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t603" href="#t603">603</a></span><span class="t"> <span class="str">f" {definition_source.path} did not."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t604" href="#t604">604</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t605" href="#t605">605</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t606" href="#t606">606</a></span><span class="t"> <span class="nam">substitution</span> <span class="op">=</span> <span class="nam">parser_context</span><span class="op">.</span><span class="nam">substitution</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t607" href="#t607">607</a></span><span class="t"> <span class="nam">match_rules</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t608" href="#t608">608</a></span><span class="t"> <span class="nam">MatchRule</span><span class="op">.</span><span class="nam">from_path_or_glob</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t609" href="#t609">609</a></span><span class="t"> <span class="nam">p</span><span class="op">,</span> <span class="nam">definition_source</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> <span class="nam">substitution</span><span class="op">=</span><span class="nam">substitution</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t610" href="#t610">610</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t611" href="#t611">611</a></span><span class="t"> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">patterns</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t612" href="#t612">612</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t613" href="#t613">613</a></span><span class="t"> <span class="nam">content_lines</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t614" href="#t614">614</a></span><span class="t"> <span class="str">f"if {condition}; then\n"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t615" href="#t615">615</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t616" href="#t616">616</a></span><span class="t"> <span class="key">for</span> <span class="nam">idx</span><span class="op">,</span> <span class="nam">match_rule</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">match_rules</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t617" href="#t617">617</a></span><span class="t"> <span class="nam">original_pattern</span> <span class="op">=</span> <span class="nam">patterns</span><span class="op">[</span><span class="nam">idx</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t618" href="#t618">618</a></span><span class="t"> <span class="key">if</span> <span class="nam">match_rule</span> <span class="key">is</span> <span class="nam">MATCH_ANYTHING</span><span class="op">:</span> </span><span class="r"><span class="annotate short">618 ↛ 619</span><span class="annotate long">line 618 didn't jump to line 619, because the condition on line 618 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t619" href="#t619">619</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t620" href="#t620">620</a></span><span class="t"> <span class="str">f'Using "{original_pattern}" in a clean rule would trash the system.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t621" href="#t621">621</a></span><span class="t"> <span class="str">f" Please restrict this pattern at {definition_source.path} considerably."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t622" href="#t622">622</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t623" href="#t623">623</a></span><span class="t"> <span class="nam">is_subdir_match</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t624" href="#t624">624</a></span><span class="t"> <span class="nam">matched_directory</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t625" href="#t625">625</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">match_rule</span><span class="op">,</span> <span class="nam">ExactFileSystemPath</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t626" href="#t626">626</a></span><span class="t"> <span class="nam">matched_directory</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t627" href="#t627">627</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">dirname</span><span class="op">(</span><span class="nam">match_rule</span><span class="op">.</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t628" href="#t628">628</a></span><span class="t"> <span class="key">if</span> <span class="nam">match_rule</span><span class="op">.</span><span class="nam">path</span> <span class="key">not</span> <span class="key">in</span> <span class="op">(</span><span class="str">"/"</span><span class="op">,</span> <span class="str">"."</span><span class="op">,</span> <span class="str">"./"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t629" href="#t629">629</a></span><span class="t"> <span class="key">else</span> <span class="nam">match_rule</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t630" href="#t630">630</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t631" href="#t631">631</a></span><span class="t"> <span class="nam">is_subdir_match</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t632" href="#t632">632</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t633" href="#t633">633</a></span><span class="t"> <span class="nam">matched_directory</span> <span class="op">=</span> <span class="nam">getattr</span><span class="op">(</span><span class="nam">match_rule</span><span class="op">,</span> <span class="str">"directory"</span><span class="op">,</span> <span class="key">None</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t634" href="#t634">634</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t635" href="#t635">635</a></span><span class="t"> <span class="key">if</span> <span class="nam">matched_directory</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">635 ↛ 636</span><span class="annotate long">line 635 didn't jump to line 636, because the condition on line 635 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t636" href="#t636">636</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t637" href="#t637">637</a></span><span class="t"> <span class="str">f'The pattern "{original_pattern}" defined at {definition_source.path} is not'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t638" href="#t638">638</a></span><span class="t"> <span class="str">f" trivially anchored in a specific directory. Cowardly refusing to use it"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t639" href="#t639">639</a></span><span class="t"> <span class="str">f" in a clean rule as it may trash the system if the pattern is overreaching."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t640" href="#t640">640</a></span><span class="t"> <span class="str">f" Please avoid glob characters in the top level directories."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t641" href="#t641">641</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t642" href="#t642">642</a></span><span class="t"> <span class="key">assert</span> <span class="nam">matched_directory</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"./"</span><span class="op">)</span> <span class="key">or</span> <span class="nam">matched_directory</span> <span class="key">in</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t643" href="#t643">643</a></span><span class="t"> <span class="str">"."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t644" href="#t644">644</a></span><span class="t"> <span class="str">"./"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t645" href="#t645">645</a></span><span class="t"> <span class="str">""</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t646" href="#t646">646</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t647" href="#t647">647</a></span><span class="t"> <span class="nam">acceptable_directory</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t648" href="#t648">648</a></span><span class="t"> <span class="nam">would_have_allowed_direct_match</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t649" href="#t649">649</a></span><span class="t"> <span class="key">while</span> <span class="nam">matched_directory</span> <span class="key">not</span> <span class="key">in</span> <span class="op">(</span><span class="str">"."</span><span class="op">,</span> <span class="str">"./"</span><span class="op">,</span> <span class="str">""</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t650" href="#t650">650</a></span><span class="t"> <span class="com"># Our acceptable paths set includes "/var/lib" or "/etc". We require that the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t651" href="#t651">651</a></span><span class="t"> <span class="com"># pattern is either an exact match, in which case it may match directly inside</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t652" href="#t652">652</a></span><span class="t"> <span class="com"># the acceptable directory OR it is a pattern against a subdirectory of the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t653" href="#t653">653</a></span><span class="t"> <span class="com"># acceptable path. As an example:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t654" href="#t654">654</a></span><span class="t"> <span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t655" href="#t655">655</a></span><span class="t"> <span class="com"># /etc/inputrc <-- OK, exact match</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t656" href="#t656">656</a></span><span class="t"> <span class="com"># /etc/foo/* <-- OK, subdir match</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t657" href="#t657">657</a></span><span class="t"> <span class="com"># /etc/* <-- ERROR, glob directly in the accepted directory.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t658" href="#t658">658</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_subdir_match</span> <span class="key">and</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t659" href="#t659">659</a></span><span class="t"> <span class="nam">matched_directory</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t660" href="#t660">660</a></span><span class="t"> <span class="key">in</span> <span class="nam">ACCEPTABLE_CLEAN_ON_REMOVAL_IF_EXACT_MATCH_OR_SUBDIR_OF</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t661" href="#t661">661</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t662" href="#t662">662</a></span><span class="t"> <span class="nam">acceptable_directory</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t663" href="#t663">663</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t664" href="#t664">664</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t665" href="#t665">665</a></span><span class="t"> <span class="nam">matched_directory</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t666" href="#t666">666</a></span><span class="t"> <span class="key">in</span> <span class="nam">ACCEPTABLE_CLEAN_ON_REMOVAL_FOR_GLOBS_AND_EXACT_MATCHES</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t667" href="#t667">667</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t668" href="#t668">668</a></span><span class="t"> <span class="com"># Special-case: In some directories (such as /var/log), we allow globs directly.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t669" href="#t669">669</a></span><span class="t"> <span class="com"># Notably, X11's log files are /var/log/Xorg.*.log</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t670" href="#t670">670</a></span><span class="t"> <span class="nam">acceptable_directory</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t671" href="#t671">671</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t672" href="#t672">672</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t673" href="#t673">673</a></span><span class="t"> <span class="nam">matched_directory</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t674" href="#t674">674</a></span><span class="t"> <span class="key">in</span> <span class="nam">ACCEPTABLE_CLEAN_ON_REMOVAL_IF_EXACT_MATCH_OR_SUBDIR_OF</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t675" href="#t675">675</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t676" href="#t676">676</a></span><span class="t"> <span class="nam">would_have_allowed_direct_match</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t677" href="#t677">677</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t678" href="#t678">678</a></span><span class="t"> <span class="nam">matched_directory</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">dirname</span><span class="op">(</span><span class="nam">matched_directory</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t679" href="#t679">679</a></span><span class="t"> <span class="nam">is_subdir_match</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t680" href="#t680">680</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t681" href="#t681">681</a></span><span class="t"> <span class="key">if</span> <span class="nam">would_have_allowed_direct_match</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">acceptable_directory</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t682" href="#t682">682</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t683" href="#t683">683</a></span><span class="t"> <span class="str">f'The pattern "{original_pattern}" defined at {definition_source.path} seems to'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t684" href="#t684">684</a></span><span class="t"> <span class="str">" be overreaching. If it has been a path (and not use a glob), the rule would"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t685" href="#t685">685</a></span><span class="t"> <span class="str">" have been permitted."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t686" href="#t686">686</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t687" href="#t687">687</a></span><span class="t"> <span class="key">elif</span> <span class="key">not</span> <span class="nam">acceptable_directory</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t688" href="#t688">688</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t689" href="#t689">689</a></span><span class="t"> <span class="str">f'The pattern or path "{original_pattern}" defined at {definition_source.path} seems to'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t690" href="#t690">690</a></span><span class="t"> <span class="str">f' be overreaching or not limited to the set of "known acceptable" directories.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t691" href="#t691">691</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t692" href="#t692">692</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t693" href="#t693">693</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t694" href="#t694">694</a></span><span class="t"> <span class="nam">shell_escaped_pattern</span> <span class="op">=</span> <span class="nam">match_rule</span><span class="op">.</span><span class="nam">shell_escape_pattern</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t695" href="#t695">695</a></span><span class="t"> <span class="key">except</span> <span class="nam">TypeError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t696" href="#t696">696</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t697" href="#t697">697</a></span><span class="t"> <span class="str">f'Sorry, the pattern "{original_pattern}" defined at {definition_source.path}'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t698" href="#t698">698</a></span><span class="t"> <span class="str">f" is unfortunately not supported by `debputy` for clean-after-removal rules."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t699" href="#t699">699</a></span><span class="t"> <span class="str">f" If you can rewrite the rule to something like `/var/log/foo/*.log` or"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t700" href="#t700">700</a></span><span class="t"> <span class="str">f' similar "trivial" patterns. You may have to rewrite the pattern the rule '</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t701" href="#t701">701</a></span><span class="t"> <span class="str">f" into multiple patterns to achieve this. This restriction is to enable "</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t702" href="#t702">702</a></span><span class="t"> <span class="str">f' `debputy` to ensure the pattern is correctly executed plus catch "obvious'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t703" href="#t703">703</a></span><span class="t"> <span class="str">f' system trashing" patterns. Apologies for the inconvenience.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t704" href="#t704">704</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t705" href="#t705">705</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t706" href="#t706">706</a></span><span class="t"> <span class="key">if</span> <span class="nam">ignore_non_empty_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t707" href="#t707">707</a></span><span class="t"> <span class="nam">cmd</span> <span class="op">=</span> <span class="str">f' rmdir --ignore-fail-on-non-empty "${{DPKG_ROOT}}"{shell_escaped_pattern}\n'</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t708" href="#t708">708</a></span><span class="t"> <span class="key">elif</span> <span class="nam">recurse</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t709" href="#t709">709</a></span><span class="t"> <span class="nam">cmd</span> <span class="op">=</span> <span class="str">f' rm -fr "${{DPKG_ROOT}}"{shell_escaped_pattern}\n'</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t710" href="#t710">710</a></span><span class="t"> <span class="key">elif</span> <span class="nam">original_pattern</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t711" href="#t711">711</a></span><span class="t"> <span class="nam">cmd</span> <span class="op">=</span> <span class="str">f' rmdir "${{DPKG_ROOT}}"{shell_escaped_pattern}\n'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t712" href="#t712">712</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t713" href="#t713">713</a></span><span class="t"> <span class="nam">cmd</span> <span class="op">=</span> <span class="str">f' rm -f "${{DPKG_ROOT}}"{shell_escaped_pattern}\n'</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t714" href="#t714">714</a></span><span class="t"> <span class="nam">content_lines</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">cmd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t715" href="#t715">715</a></span><span class="t"> <span class="nam">content_lines</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">"fi\n"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t716" href="#t716">716</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t717" href="#t717">717</a></span><span class="t"> <span class="nam">snippet</span> <span class="op">=</span> <span class="nam">MaintscriptSnippet</span><span class="op">(</span><span class="nam">definition_source</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> <span class="str">""</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">content_lines</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t718" href="#t718">718</a></span><span class="t"> <span class="nam">package_state</span><span class="op">.</span><span class="nam">maintscript_snippets</span><span class="op">[</span><span class="str">"postrm"</span><span class="op">]</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">snippet</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_d5d6843b45eec01e___init___py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_d5d6843b45eec01e_debputy_plugin_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_d5d6843b45eec01e_debputy_plugin_py.html b/coverage-report/d_d5d6843b45eec01e_debputy_plugin_py.html deleted file mode 100644 index 5a81ca5..0000000 --- a/coverage-report/d_d5d6843b45eec01e_debputy_plugin_py.html +++ /dev/null @@ -1,499 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/plugin/debputy/debputy_plugin.py: 100%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/plugin/debputy/debputy_plugin.py</b>: - <span class="pc_cov">100%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">78 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">78<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">0<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_d5d6843b45eec01e_binary_package_rules_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_d5d6843b45eec01e_discard_rules_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">textwrap</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> <span class="nam">DebputyPluginInitializer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> <span class="nam">packager_provided_file_reference_documentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">debputy</span><span class="op">.</span><span class="nam">metadata_detectors</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">detect_systemd_tmpfiles</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">detect_kernel_modules</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">detect_icons</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">detect_gsettings_dependencies</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">detect_xfonts</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">detect_initramfs_hooks</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">detect_systemd_sysusers</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">detect_pycompile_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">translate_capabilities</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">pam_auth_update</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">auto_depends_arch_any_solink</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">debputy</span><span class="op">.</span><span class="nam">paths</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">SYSTEMD_TMPFILES_DIR</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">INITRAMFS_HOOK_DIR</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="nam">GSETTINGS_SCHEMA_DIR</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">SYSTEMD_SYSUSERS_DIR</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">debputy</span><span class="op">.</span><span class="nam">private_api</span> <span class="key">import</span> <span class="nam">initialize_via_private_api</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"><span class="key">def</span> <span class="nam">initialize_debputy_features</span><span class="op">(</span><span class="nam">api</span><span class="op">:</span> <span class="nam">DebputyPluginInitializer</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="nam">initialize_via_private_api</span><span class="op">(</span><span class="nam">api</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="nam">declare_manifest_variables</span><span class="op">(</span><span class="nam">api</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="nam">register_packager_provided_files</span><span class="op">(</span><span class="nam">api</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="nam">register_package_metadata_detectors</span><span class="op">(</span><span class="nam">api</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"><span class="key">def</span> <span class="nam">declare_manifest_variables</span><span class="op">(</span><span class="nam">api</span><span class="op">:</span> <span class="nam">DebputyPluginInitializer</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">manifest_variable</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="str">"path:BASH_COMPLETION_DIR"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="str">"/usr/share/bash-completion/completions"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="nam">variable_reference_documentation</span><span class="op">=</span><span class="str">"Directory to install bash completions into"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">manifest_variable</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="str">"path:GNU_INFO_DIR"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="str">"/usr/share/info"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="nam">variable_reference_documentation</span><span class="op">=</span><span class="str">"Directory to install GNU INFO files into"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">manifest_variable</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="str">"token:NL"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="str">"\n"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="nam">variable_reference_documentation</span><span class="op">=</span><span class="str">"Literal newline (linefeed) character"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">manifest_variable</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="str">"token:NEWLINE"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="str">"\n"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">variable_reference_documentation</span><span class="op">=</span><span class="str">"Literal newline (linefeed) character"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">manifest_variable</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="str">"token:TAB"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="str">"\t"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="nam">variable_reference_documentation</span><span class="op">=</span><span class="str">"Literal tab character"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">manifest_variable</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="str">"token:OPEN_CURLY_BRACE"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="str">"{"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="nam">variable_reference_documentation</span><span class="op">=</span><span class="str">'Literal "{" character'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">manifest_variable</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="str">"token:CLOSE_CURLY_BRACE"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="str">"}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="nam">variable_reference_documentation</span><span class="op">=</span><span class="str">'Literal "}" character'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">manifest_variable</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="str">"token:DOUBLE_OPEN_CURLY_BRACE"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="str">"{{"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="nam">variable_reference_documentation</span><span class="op">=</span><span class="str">'Literal "{{" character - useful to avoid triggering a substitution'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">manifest_variable</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="str">"token:DOUBLE_CLOSE_CURLY_BRACE"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="str">"}}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="nam">variable_reference_documentation</span><span class="op">=</span><span class="str">'Literal "}}" string - useful to avoid triggering a substitution'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"><span class="key">def</span> <span class="nam">register_package_metadata_detectors</span><span class="op">(</span><span class="nam">api</span><span class="op">:</span> <span class="nam">DebputyPluginInitializer</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">metadata_or_maintscript_detector</span><span class="op">(</span><span class="str">"systemd-tmpfiles"</span><span class="op">,</span> <span class="nam">detect_systemd_tmpfiles</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">metadata_or_maintscript_detector</span><span class="op">(</span><span class="str">"systemd-sysusers"</span><span class="op">,</span> <span class="nam">detect_systemd_sysusers</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">metadata_or_maintscript_detector</span><span class="op">(</span><span class="str">"kernel-modules"</span><span class="op">,</span> <span class="nam">detect_kernel_modules</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">metadata_or_maintscript_detector</span><span class="op">(</span><span class="str">"icon-cache"</span><span class="op">,</span> <span class="nam">detect_icons</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">metadata_or_maintscript_detector</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="str">"gsettings-dependencies"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="nam">detect_gsettings_dependencies</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">metadata_or_maintscript_detector</span><span class="op">(</span><span class="str">"xfonts"</span><span class="op">,</span> <span class="nam">detect_xfonts</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">metadata_or_maintscript_detector</span><span class="op">(</span><span class="str">"initramfs-hooks"</span><span class="op">,</span> <span class="nam">detect_initramfs_hooks</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">metadata_or_maintscript_detector</span><span class="op">(</span><span class="str">"pycompile-files"</span><span class="op">,</span> <span class="nam">detect_pycompile_files</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">metadata_or_maintscript_detector</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="str">"translate-capabilities"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="nam">translate_capabilities</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">metadata_or_maintscript_detector</span><span class="op">(</span><span class="str">"pam-auth-update"</span><span class="op">,</span> <span class="nam">pam_auth_update</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">metadata_or_maintscript_detector</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="str">"auto-depends-arch-any-solink"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="nam">auto_depends_arch_any_solink</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"><span class="key">def</span> <span class="nam">register_packager_provided_files</span><span class="op">(</span><span class="nam">api</span><span class="op">:</span> <span class="nam">DebputyPluginInitializer</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="str">"tmpfiles"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="str">f"{SYSTEMD_TMPFILES_DIR}/{{name}}.conf"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="nam">reference_documentation</span><span class="op">=</span><span class="nam">packager_provided_file_reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="nam">format_documentation_uris</span><span class="op">=</span><span class="op">[</span><span class="str">"man:tmpfiles.d(5)"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="str">"sysusers"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="str">f"{SYSTEMD_SYSUSERS_DIR}/{{name}}.conf"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="nam">reference_documentation</span><span class="op">=</span><span class="nam">packager_provided_file_reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="nam">format_documentation_uris</span><span class="op">=</span><span class="op">[</span><span class="str">"man:sysusers.d(5)"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="str">"bash-completion"</span><span class="op">,</span> <span class="str">"/usr/share/bash-completion/completions/{name}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="str">"bug-script"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="str">"./usr/share/bug/{name}/script"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="nam">default_mode</span><span class="op">=</span><span class="num">0o0755</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="nam">allow_name_segment</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="str">"bug-control"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="str">"/usr/share/bug/{name}/control"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="nam">allow_name_segment</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="str">"bug-presubj"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="str">"/usr/share/bug/{name}/presubj"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="nam">allow_name_segment</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span><span class="str">"pam"</span><span class="op">,</span> <span class="str">"/usr/lib/pam.d/{name}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="str">"ppp.ip-up"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="str">"/etc/ppp/ip-up.d/{name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="nam">default_mode</span><span class="op">=</span><span class="num">0o0755</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="str">"ppp.ip-down"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="str">"/etc/ppp/ip-down.d/{name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="nam">default_mode</span><span class="op">=</span><span class="num">0o0755</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="str">"lintian-overrides"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="str">"/usr/share/lintian/overrides/{name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="nam">allow_name_segment</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span><span class="str">"logrotate"</span><span class="op">,</span> <span class="str">"/etc/logrotate.d/{name}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="str">"logcheck.cracking"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="str">"/etc/logcheck/cracking.d/{name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="nam">post_formatting_rewrite</span><span class="op">=</span><span class="nam">_replace_dot_with_underscore</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="str">"logcheck.violations"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="str">"/etc/logcheck/violations.d/{name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="nam">post_formatting_rewrite</span><span class="op">=</span><span class="nam">_replace_dot_with_underscore</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="str">"logcheck.violations.ignore"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="str">"/etc/logcheck/violations.ignore.d/{name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="nam">post_formatting_rewrite</span><span class="op">=</span><span class="nam">_replace_dot_with_underscore</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="str">"logcheck.ignore.workstation"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="str">"/etc/logcheck/ignore.d.workstation/{name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="nam">post_formatting_rewrite</span><span class="op">=</span><span class="nam">_replace_dot_with_underscore</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="str">"logcheck.ignore.server"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="str">"/etc/logcheck/ignore.d.server/{name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="nam">post_formatting_rewrite</span><span class="op">=</span><span class="nam">_replace_dot_with_underscore</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="str">"logcheck.ignore.paranoid"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="str">"/etc/logcheck/ignore.d.paranoid/{name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="nam">post_formatting_rewrite</span><span class="op">=</span><span class="nam">_replace_dot_with_underscore</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span><span class="str">"mime"</span><span class="op">,</span> <span class="str">"/usr/lib/mime/packages/{name}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span><span class="str">"sharedmimeinfo"</span><span class="op">,</span> <span class="str">"/usr/share/mime/packages/{name}.xml"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="str">"if-pre-up"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="str">"/etc/network/if-pre-up.d/{name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="nam">default_mode</span><span class="op">=</span><span class="num">0o0755</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="str">"if-up"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="str">"/etc/network/if-up.d/{name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="nam">default_mode</span><span class="op">=</span><span class="num">0o0755</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="str">"if-down"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="str">"/etc/network/if-down.d/{name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="nam">default_mode</span><span class="op">=</span><span class="num">0o0755</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="str">"if-post-down"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="str">"/etc/network/if-post-down.d/{name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="nam">default_mode</span><span class="op">=</span><span class="num">0o0755</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="str">"cron.hourly"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="str">"/etc/cron.hourly/{name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="nam">default_mode</span><span class="op">=</span><span class="num">0o0755</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="str">"cron.daily"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="str">"/etc/cron.daily/{name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="nam">default_mode</span><span class="op">=</span><span class="num">0o0755</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="str">"cron.weekly"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="str">"/etc/cron.weekly/{name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="nam">default_mode</span><span class="op">=</span><span class="num">0o0755</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="str">"cron.monthly"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="str">"./etc/cron.monthly/{name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="nam">default_mode</span><span class="op">=</span><span class="num">0o0755</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="str">"cron.yearly"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="str">"/etc/cron.yearly/{name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="nam">default_mode</span><span class="op">=</span><span class="num">0o0755</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="com"># cron.d uses 0644 unlike the others</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="str">"cron.d"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="str">"/etc/cron.d/{name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="nam">reference_documentation</span><span class="op">=</span><span class="nam">packager_provided_file_reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="nam">format_documentation_uris</span><span class="op">=</span><span class="op">[</span><span class="str">"man:crontab(5)"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="str">"initramfs-hook"</span><span class="op">,</span> <span class="str">f"{INITRAMFS_HOOK_DIR}/{{name}}"</span><span class="op">,</span> <span class="nam">default_mode</span><span class="op">=</span><span class="num">0o0755</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span><span class="str">"modprobe"</span><span class="op">,</span> <span class="str">"/etc/modprobe.d/{name}.conf"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="str">"init"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="str">"/etc/init.d/{name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="nam">default_mode</span><span class="op">=</span><span class="num">0o755</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span><span class="str">"default"</span><span class="op">,</span> <span class="str">"/etc/default/{name}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="key">for</span> <span class="nam">stem</span> <span class="key">in</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="str">"mount"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="str">"path"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="str">"service"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="str">"socket"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="str">"target"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="str">"timer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="nam">stem</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="str">f"/usr/lib/systemd/system/{{name}}.{stem}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="nam">reference_documentation</span><span class="op">=</span><span class="nam">packager_provided_file_reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="nam">format_documentation_uris</span><span class="op">=</span><span class="op">[</span><span class="str">f"man:systemd.{stem}(5)"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="key">for</span> <span class="nam">stem</span> <span class="key">in</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="str">"path"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="str">"service"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="str">"socket"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="str">"target"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="str">"timer"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="str">f"@{stem}"</span><span class="op">,</span> <span class="str">f"/usr/lib/systemd/system/{{name}}@.{stem}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="com"># api.packager_provided_file(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="com"># "udev",</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> <span class="com"># "./lib/udev/rules.d/{priority:02}-{name}.rules",</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="com"># default_priority=60,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> <span class="com"># )</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="str">"gsettings-override"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="str">f"{GSETTINGS_SCHEMA_DIR}/{{priority:02}}_{{name}}.gschema.override"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="nam">default_priority</span><span class="op">=</span><span class="num">10</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="com"># Special-cases that will probably not be a good example for other plugins</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> <span class="str">"changelog"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="com"># The "changelog.Debian" gets renamed to "changelog" for native packages elsewhere.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> <span class="com"># Also, the changelog trimming is also done elsewhere.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="str">"/usr/share/doc/{name}/changelog.Debian"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="nam">allow_name_segment</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="nam">packageless_is_fallback_for_all_packages</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="nam">reference_documentation</span><span class="op">=</span><span class="nam">packager_provided_file_reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"><span class="str"> This file is the changelog of the package and is mandatory.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"><span class="str"> The changelog contains the version of the source package and is mandatory for all</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"><span class="str"> packages.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"><span class="str"> Use `dch --create` to create the changelog.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"><span class="str"> In theory, the binary package can have a different changelog than the source</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"><span class="str"> package (by having `debian/binary-package.changelog`). However, it is generally</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"><span class="str"> not useful and leads to double administration. It has not been used in practice.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> <span class="nam">format_documentation_uris</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> <span class="str">"man:deb-changelog(5)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> <span class="str">"https://www.debian.org/doc/debian-policy/ch-source.html#debian-changelog-debian-changelog"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> <span class="str">"man:dch(1)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> <span class="str">"copyright"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> <span class="str">"/usr/share/doc/{name}/copyright"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> <span class="nam">allow_name_segment</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> <span class="nam">packageless_is_fallback_for_all_packages</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> <span class="nam">reference_documentation</span><span class="op">=</span><span class="nam">packager_provided_file_reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"><span class="str"> This file documents the license and copyright information of the binary package.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"><span class="str"> Packages aimed at the Debian archive (and must derivatives thereof) must have this file.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"><span class="str"> For packages not aimed at Debian, the file can still be useful to convey the license</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"><span class="str"> terms of the package (which is often a requirement in many licenses). However, it is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"><span class="str"> not a strict *technical* requirement. Whether it is a legal requirement depends on</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"><span class="str"> license.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"><span class="str"> Often, the same file can be used for all packages. In the extremely rare case where</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"><span class="str"> one binary package has a "vastly different" license than the other packages, you can</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"><span class="str"> provide a package specific version for that package.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"> <span class="nam">format_documentation_uris</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"> <span class="str">"https://www.debian.org/doc/debian-policy/ch-source.html#copyright-debian-copyright"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"> <span class="str">"https://www.debian.org/doc/debian-policy/ch-docs.html#s-copyrightfile"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"> <span class="str">"https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"> <span class="str">"NEWS"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"> <span class="str">"/usr/share/doc/{name}/NEWS.Debian"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"> <span class="nam">allow_name_segment</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"> <span class="nam">packageless_is_fallback_for_all_packages</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"> <span class="nam">reference_documentation</span><span class="op">=</span><span class="nam">packager_provided_file_reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"><span class="str"> Important news that should be shown to the user/admin when upgrading. If a system has</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"><span class="str"> apt-listchanges installed, then contents of this file will be shown prior to upgrading</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"><span class="str"> the package.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"><span class="str"> Uses a similar format to that of debian/changelog (create with `dch --news --create`).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"> <span class="nam">format_documentation_uris</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"> <span class="str">"https://www.debian.org/doc/manuals/developers-reference/best-pkging-practices.en.html#supplementing-changelogs-with-news-debian-files"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"> <span class="str">"man:dch(1)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"> <span class="str">"README.Debian"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"> <span class="str">"/usr/share/doc/{name}/README.Debian"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"> <span class="nam">allow_name_segment</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t385" href="#t385">385</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t386" href="#t386">386</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t387" href="#t387">387</a></span><span class="t"> <span class="str">"TODO"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t388" href="#t388">388</a></span><span class="t"> <span class="str">"/usr/share/doc/{name}/TODO.Debian"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t389" href="#t389">389</a></span><span class="t"> <span class="nam">allow_name_segment</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t390" href="#t390">390</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t391" href="#t391">391</a></span><span class="t"> <span class="com"># From dh-python / dh_python3</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t392" href="#t392">392</a></span><span class="t"> <span class="com"># api.packager_provided_file(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t393" href="#t393">393</a></span><span class="t"> <span class="com"># "bcep",</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t394" href="#t394">394</a></span><span class="t"> <span class="com"># "/usr/share/python3/bcep/{name}",</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t395" href="#t395">395</a></span><span class="t"> <span class="com"># allow_name_segment=False,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t396" href="#t396">396</a></span><span class="t"> <span class="com"># )</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t397" href="#t397">397</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t398" href="#t398">398</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t399" href="#t399">399</a></span><span class="t"><span class="key">def</span> <span class="nam">_replace_dot_with_underscore</span><span class="op">(</span><span class="nam">x</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t400" href="#t400">400</a></span><span class="t"> <span class="key">return</span> <span class="nam">x</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">"."</span><span class="op">,</span> <span class="str">"_"</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_d5d6843b45eec01e_binary_package_rules_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_d5d6843b45eec01e_discard_rules_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_d5d6843b45eec01e_discard_rules_py.html b/coverage-report/d_d5d6843b45eec01e_discard_rules_py.html deleted file mode 100644 index 23adeb8..0000000 --- a/coverage-report/d_d5d6843b45eec01e_discard_rules_py.html +++ /dev/null @@ -1,196 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/plugin/debputy/discard_rules.py: 96%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/plugin/debputy/discard_rules.py</b>: - <span class="pc_cov">96%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">34 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">33<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">1<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">1<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_d5d6843b45eec01e_debputy_plugin_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_d5d6843b45eec01e_manifest_root_rules_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">re</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="nam">VirtualPath</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="nam">_VCS_PATHS</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="str">".arch-inventory"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="str">".arch-ids"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="str">".be"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="str">".bzrbackup"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="str">".bzrignore"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="str">".bzrtags"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="str">".cvsignore"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="str">".hg"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="str">".hgignore"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="str">".hgtags"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="str">".hgsigs"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="str">".git"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="str">".gitignore"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="str">".gitattributes"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="str">".gitmodules"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="str">".gitreview"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="str">".mailmap"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="str">".mtn-ignore"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="str">".svn"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="str">"{arch}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="str">"CVS"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="str">"RCS"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="str">"_MTN"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="str">"_darcs"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"><span class="nam">_BACKUP_FILES_RE</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="str">"|"</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="com"># Common backup files</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="str">r".*~"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="str">r".*[.](?:bak|orig|rej)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="com"># Editor backup/swap files</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="str">r"[.]#.*"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="str">r"[.].*[.]sw."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="com"># Other known stuff</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="str">r"[.]shelf"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="str">r",,.*"</span><span class="op">,</span> <span class="com"># "baz-style junk" (according to dpkg (Dpkg::Source::Package)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="str">r"DEADJOE"</span><span class="op">,</span> <span class="com"># Joe's one line of immortality that just gets cargo cult'ed around ... just in case.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"><span class="nam">_DOXYGEN_DIR_TEST_FILES</span> <span class="op">=</span> <span class="op">[</span><span class="str">"doxygen.css"</span><span class="op">,</span> <span class="str">"doxygen.svg"</span><span class="op">,</span> <span class="str">"index.html"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"><span class="key">def</span> <span class="nam">_debputy_discard_pyc_files</span><span class="op">(</span><span class="nam">path</span><span class="op">:</span> <span class="str">"VirtualPath"</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span><span class="op">.</span><span class="nam">name</span> <span class="op">==</span> <span class="str">"__pycache__"</span> <span class="key">and</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="key">return</span> <span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="op">(</span><span class="str">".pyc"</span><span class="op">,</span> <span class="str">".pyo"</span><span class="op">)</span><span class="op">)</span> <span class="key">and</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_file</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"><span class="key">def</span> <span class="nam">_debputy_prune_la_files</span><span class="op">(</span><span class="nam">path</span><span class="op">:</span> <span class="str">"VirtualPath"</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="key">return</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">".la"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="key">and</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_file</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="key">and</span> <span class="nam">path</span><span class="op">.</span><span class="nam">absolute</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"/usr/lib"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"><span class="key">def</span> <span class="nam">_debputy_prune_backup_files</span><span class="op">(</span><span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="key">return</span> <span class="nam">bool</span><span class="op">(</span><span class="nam">_BACKUP_FILES_RE</span><span class="op">.</span><span class="nam">match</span><span class="op">(</span><span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"><span class="key">def</span> <span class="nam">_debputy_prune_vcs_paths</span><span class="op">(</span><span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="key">return</span> <span class="nam">path</span><span class="op">.</span><span class="nam">name</span> <span class="key">in</span> <span class="nam">_VCS_PATHS</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"><span class="key">def</span> <span class="nam">_debputy_prune_info_dir_file</span><span class="op">(</span><span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="key">return</span> <span class="nam">path</span><span class="op">.</span><span class="nam">absolute</span> <span class="op">==</span> <span class="str">"/usr/share/info/dir"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"><span class="key">def</span> <span class="nam">_debputy_prune_binary_debian_dir</span><span class="op">(</span><span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="key">return</span> <span class="nam">path</span><span class="op">.</span><span class="nam">absolute</span> <span class="op">==</span> <span class="str">"/DEBIAN"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"><span class="key">def</span> <span class="nam">_debputy_prune_doxygen_cruft</span><span class="op">(</span><span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="op">(</span><span class="str">".md5"</span><span class="op">,</span> <span class="str">".map"</span><span class="op">)</span><span class="op">)</span> <span class="key">or</span> <span class="key">not</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_file</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="nam">parent_dir</span> <span class="op">=</span> <span class="nam">path</span><span class="op">.</span><span class="nam">parent_dir</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="key">while</span> <span class="nam">parent_dir</span><span class="op">:</span> </span><span class="r"><span class="annotate short">86 ↛ 97</span><span class="annotate long">line 86 didn't jump to line 97, because the condition on line 86 was never false</span></span></p> - <p class="run"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="nam">is_doxygen_dir</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="key">for</span> <span class="nam">name</span> <span class="key">in</span> <span class="nam">_DOXYGEN_DIR_TEST_FILES</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="nam">test_file</span> <span class="op">=</span> <span class="nam">parent_dir</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="key">if</span> <span class="nam">test_file</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="key">not</span> <span class="nam">test_file</span><span class="op">.</span><span class="nam">is_file</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="nam">is_doxygen_dir</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_doxygen_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="nam">parent_dir</span> <span class="op">=</span> <span class="nam">parent_dir</span><span class="op">.</span><span class="nam">parent_dir</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_d5d6843b45eec01e_debputy_plugin_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_d5d6843b45eec01e_manifest_root_rules_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_d5d6843b45eec01e_manifest_root_rules_py.html b/coverage-report/d_d5d6843b45eec01e_manifest_root_rules_py.html deleted file mode 100644 index e0b43a6..0000000 --- a/coverage-report/d_d5d6843b45eec01e_manifest_root_rules_py.html +++ /dev/null @@ -1,349 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/plugin/debputy/manifest_root_rules.py: 79%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/plugin/debputy/manifest_root_rules.py</b>: - <span class="pc_cov">79%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">57 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">48<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">9<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">2<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">2<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_d5d6843b45eec01e_discard_rules_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_d5d6843b45eec01e_metadata_detectors_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">textwrap</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">List</span><span class="op">,</span> <span class="nam">Any</span><span class="op">,</span> <span class="nam">Dict</span><span class="op">,</span> <span class="nam">Tuple</span><span class="op">,</span> <span class="nam">TYPE_CHECKING</span><span class="op">,</span> <span class="nam">cast</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">_manifest_constants</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> <span class="nam">ManifestVersion</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="nam">MK_MANIFEST_VERSION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">MK_INSTALLATIONS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">SUPPORTED_MANIFEST_VERSIONS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">MK_MANIFEST_DEFINITIONS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">MK_PACKAGES</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">MK_MANIFEST_VARIABLES</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">exceptions</span> <span class="key">import</span> <span class="nam">DebputySubstitutionError</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">installations</span> <span class="key">import</span> <span class="nam">InstallRule</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">base_types</span> <span class="key">import</span> <span class="nam">DebputyParsedContent</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">exceptions</span> <span class="key">import</span> <span class="nam">ManifestParseException</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">parser_data</span> <span class="key">import</span> <span class="nam">ParserContextData</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">AttributePath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="nam">reference_documentation</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">impl</span> <span class="key">import</span> <span class="nam">DebputyPluginInitializerProvider</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">impl_types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">OPARSER_MANIFEST_ROOT</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="nam">OPARSER_MANIFEST_DEFINITIONS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">SUPPORTED_DISPATCHABLE_OBJECT_PARSERS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="nam">OPARSER_PACKAGES</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">substitution</span> <span class="key">import</span> <span class="nam">VariableNameState</span><span class="op">,</span> <span class="nam">SUBST_VAR_RE</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"><span class="key">if</span> <span class="nam">TYPE_CHECKING</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">highlevel_manifest_parser</span> <span class="key">import</span> <span class="nam">YAMLManifestParser</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"><span class="key">def</span> <span class="nam">register_manifest_root_rules</span><span class="op">(</span><span class="nam">api</span><span class="op">:</span> <span class="nam">DebputyPluginInitializerProvider</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="com"># Registration order matters. Notably, definitions must come before anything that can</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="com"># use definitions (variables), which is why it is second only to the manifest version.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">pluggable_manifest_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="nam">OPARSER_MANIFEST_ROOT</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="nam">MK_MANIFEST_VERSION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">ManifestVersionFormat</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="nam">_handle_version</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="nam">source_format</span><span class="op">=</span><span class="nam">ManifestVersion</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">title</span><span class="op">=</span><span class="str">"Manifest version"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"><span class="str"> All `debputy` manifests must include a `debputy` manifest version, which will enable the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"><span class="str"> format to change over time. For now, there is only one version (`"0.1"`) and you have</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"><span class="str"> to include the line:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"><span class="str"> manifest-version: "0.1"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"><span class="str"> On its own, the manifest containing only `manifest-version: "..."` will not do anything. So if you</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"><span class="str"> end up only having the `manifest-version` key in the manifest, you can just remove the manifest and</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"><span class="str"> rely entirely on the built-in rules.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">pluggable_object_parser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="nam">OPARSER_MANIFEST_ROOT</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="nam">MK_MANIFEST_DEFINITIONS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="nam">object_parser_key</span><span class="op">=</span><span class="nam">OPARSER_MANIFEST_DEFINITIONS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="nam">on_end_parse_step</span><span class="op">=</span><span class="key">lambda</span> <span class="nam">_a</span><span class="op">,</span> <span class="nam">_b</span><span class="op">,</span> <span class="nam">_c</span><span class="op">,</span> <span class="nam">mp</span><span class="op">:</span> <span class="nam">mp</span><span class="op">.</span><span class="nam">_ensure_package_states_is_initialized</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">pluggable_manifest_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="nam">OPARSER_MANIFEST_DEFINITIONS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="nam">MK_MANIFEST_VARIABLES</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="nam">ManifestVariablesParsedFormat</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="nam">_handle_manifest_variables</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="nam">source_format</span><span class="op">=</span><span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="nam">title</span><span class="op">=</span><span class="str">"Manifest Variables (`variables`)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"><span class="str"> It is possible to provide custom manifest variables via the `variables` attribute. An example:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"><span class="str"> manifest-version: '0.1'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"><span class="str"> definitions:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"><span class="str"> variables:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"><span class="str"> LIBPATH: "/usr/lib/{{DEB_HOST_MULTIARCH}}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"><span class="str"> SONAME: "1"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"><span class="str"> installations:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"><span class="str"> - install:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"><span class="str"> source: build/libfoo.so.{{SONAME}}*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"><span class="str"> # The quotes here is for the YAML parser's sake.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"><span class="str"> dest-dir: "{{LIBPATH}}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"><span class="str"> into: libfoo{{SONAME}}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"><span class="str"> The value of the `variables` key must be a mapping, where each key is a new variable name and</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"><span class="str"> the related value is the value of said key. The keys must be valid variable name and not shadow</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"><span class="str"> existing variables (that is, variables such as `PACKAGE` and `DEB_HOST_MULTIARCH` *cannot* be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"><span class="str"> redefined). The value for each variable *can* refer to *existing* variables as seen in the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"><span class="str"> example above.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"><span class="str"> As usual, `debputy` will insist that all declared variables must be used.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"><span class="str"> Limitations:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"><span class="str"> * When declaring variables that depends on another variable declared in the manifest, the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"><span class="str"> order is important. The variables are resolved from top to bottom.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"><span class="str"> * When a manifest variable depends on another manifest variable, the existing variable is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"><span class="str"> currently always resolved in source context. As a consequence, some variables such as</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"><span class="str"> `{{PACKAGE}}` cannot be used when defining a variable. This restriction may be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"><span class="str"> lifted in the future.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">pluggable_manifest_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="nam">OPARSER_MANIFEST_ROOT</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="nam">MK_INSTALLATIONS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="nam">List</span><span class="op">[</span><span class="nam">InstallRule</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="nam">_handle_installation_rules</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="nam">title</span><span class="op">=</span><span class="str">"Installations"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"><span class="str"> For source packages building a single binary, the `dh_auto_install` from debhelper will default to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"><span class="str"> providing everything from upstream's install in the binary package. The `debputy` tool matches this</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"><span class="str"> behaviour and accordingly, the `installations` feature is only relevant in this case when you need to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"><span class="str"> manually specify something upstream's install did not cover.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"><span class="str"> For sources, that build multiple binaries, where `dh_auto_install` does not detect anything to install,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"><span class="str"> or when `dh_auto_install --destdir debian/tmp` is used, the `installations` section of the manifest is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"><span class="str"> used to declare what goes into which binary package. An example:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"><span class="str"> installations:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"><span class="str"> - install:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"><span class="str"> sources: "usr/bin/foo"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"><span class="str"> into: foo</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"><span class="str"> - install:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"><span class="str"> sources: "usr/*"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"><span class="str"> into: foo-extra</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"><span class="str"> All installation rules are processed in order (top to bottom). Once a path has been matched, it can</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"><span class="str"> no longer be matched by future rules. In the above example, then `usr/bin/foo` would be in the `foo`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"><span class="str"> package while everything in `usr` *except* `usr/bin/foo` would be in `foo-extra`. If these had been</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"><span class="str"> ordered in reverse, the `usr/bin/foo` rule would not have matched anything and caused `debputy`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"><span class="str"> to reject the input as an error on that basis. This behaviour is similar to "DEP-5" copyright files,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"><span class="str"> except the order is reversed ("DEP-5" uses "last match wins", where here we are doing "first match wins")</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"><span class="str"> In the rare case that some path need to be installed into two packages at the same time, then this is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"><span class="str"> generally done by changing `into` into a list of packages.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"><span class="str"> All installations are currently run in *source* package context. This implies that:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"><span class="str"> 1) No package specific substitutions are available. Notably `{{PACKAGE}}` cannot be resolved.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"><span class="str"> 2) All conditions are evaluated in source context. For 99.9% of users, this makes no difference,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"><span class="str"> but there is a cross-build feature that changes the "per package" architecture which is affected.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"><span class="str"> This is a limitation that should be fixed in `debputy`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"><span class="str"> **Attention debhelper users**: Note the difference between `dh_install` (etc.) vs. `debputy` on</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"><span class="str"> overlapping matches for installation.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">pluggable_object_parser</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="nam">OPARSER_MANIFEST_ROOT</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="nam">MK_PACKAGES</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="nam">object_parser_key</span><span class="op">=</span><span class="nam">OPARSER_PACKAGES</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="nam">on_end_parse_step</span><span class="op">=</span><span class="key">lambda</span> <span class="nam">_a</span><span class="op">,</span> <span class="nam">_b</span><span class="op">,</span> <span class="nam">_c</span><span class="op">,</span> <span class="nam">mp</span><span class="op">:</span> <span class="nam">mp</span><span class="op">.</span><span class="nam">_ensure_package_states_is_initialized</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="nam">nested_in_package_context</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"><span class="key">class</span> <span class="nam">ManifestVersionFormat</span><span class="op">(</span><span class="nam">DebputyParsedContent</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="nam">manifest_version</span><span class="op">:</span> <span class="nam">ManifestVersion</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"><span class="key">class</span> <span class="nam">ListOfInstallRulesFormat</span><span class="op">(</span><span class="nam">DebputyParsedContent</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="nam">elements</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">InstallRule</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"><span class="key">class</span> <span class="nam">DictFormat</span><span class="op">(</span><span class="nam">DebputyParsedContent</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="nam">mapping</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"><span class="key">class</span> <span class="nam">ManifestVariablesParsedFormat</span><span class="op">(</span><span class="nam">DebputyParsedContent</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="nam">variables</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"><span class="key">def</span> <span class="nam">_handle_version</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="nam">_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">:</span> <span class="nam">ManifestVersionFormat</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="nam">_attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="nam">_parser_context</span><span class="op">:</span> <span class="nam">ParserContextData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="nam">manifest_version</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">[</span><span class="str">"manifest_version"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="key">if</span> <span class="nam">manifest_version</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">SUPPORTED_MANIFEST_VERSIONS</span><span class="op">:</span> </span><span class="r"><span class="annotate short">190 ↛ 191</span><span class="annotate long">line 190 didn't jump to line 191, because the condition on line 190 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="str">"Unsupported manifest-version. This implementation supports the following versions:"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="str">f' {", ".join(repr(v) for v in SUPPORTED_MANIFEST_VERSIONS)}"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="key">return</span> <span class="nam">manifest_version</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"><span class="key">def</span> <span class="nam">_handle_manifest_variables</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="nam">_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">:</span> <span class="nam">ManifestVariablesParsedFormat</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="nam">variables_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="nam">parser_context</span><span class="op">:</span> <span class="nam">ParserContextData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="nam">variables</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"variables"</span><span class="op">,</span> <span class="op">{</span><span class="op">}</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="nam">resolved_vars</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">AttributePath</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="nam">manifest_parser</span><span class="op">:</span> <span class="str">"YAMLManifestParser"</span> <span class="op">=</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"YAMLManifestParser"</span><span class="op">,</span> <span class="nam">parser_context</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="nam">substitution</span> <span class="op">=</span> <span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">substitution</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="key">for</span> <span class="nam">key</span><span class="op">,</span> <span class="nam">value_raw</span> <span class="key">in</span> <span class="nam">variables</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="nam">key_path</span> <span class="op">=</span> <span class="nam">variables_path</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">SUBST_VAR_RE</span><span class="op">.</span><span class="nam">match</span><span class="op">(</span><span class="str">"{{"</span> <span class="op">+</span> <span class="nam">key</span> <span class="op">+</span> <span class="str">"}}"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">210 ↛ 211</span><span class="annotate long">line 210 didn't jump to line 211, because the condition on line 210 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="str">f"The variable at {key_path.path} has an invalid name and therefore cannot"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="str">" be used."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="key">if</span> <span class="nam">substitution</span><span class="op">.</span><span class="nam">variable_state</span><span class="op">(</span><span class="nam">key</span><span class="op">)</span> <span class="op">!=</span> <span class="nam">VariableNameState</span><span class="op">.</span><span class="nam">UNDEFINED</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="str">f'The variable "{key}" is already reserved/defined. Error triggered by'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="str">f" {key_path.path}."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="nam">value</span> <span class="op">=</span> <span class="nam">substitution</span><span class="op">.</span><span class="nam">substitute</span><span class="op">(</span><span class="nam">value_raw</span><span class="op">,</span> <span class="nam">key_path</span><span class="op">.</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="key">except</span> <span class="nam">DebputySubstitutionError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">resolved_vars</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="key">raise</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="com"># See if flushing the variables work</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="nam">substitution</span> <span class="op">=</span> <span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">add_extra_substitution_variables</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="op">**</span><span class="nam">resolved_vars</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="nam">resolved_vars</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="nam">value</span> <span class="op">=</span> <span class="nam">substitution</span><span class="op">.</span><span class="nam">substitute</span><span class="op">(</span><span class="nam">value_raw</span><span class="op">,</span> <span class="nam">key_path</span><span class="op">.</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="nam">resolved_vars</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> <span class="op">=</span> <span class="op">(</span><span class="nam">value</span><span class="op">,</span> <span class="nam">key_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="nam">substitution</span> <span class="op">=</span> <span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">add_extra_substitution_variables</span><span class="op">(</span><span class="op">**</span><span class="nam">resolved_vars</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"><span class="key">def</span> <span class="nam">_handle_installation_rules</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="nam">_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">InstallRule</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="nam">_attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="nam">_parser_context</span><span class="op">:</span> <span class="nam">ParserContextData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">List</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="key">return</span> <span class="nam">parsed_data</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"><span class="key">def</span> <span class="nam">_handle_opaque_dict</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="nam">_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">:</span> <span class="nam">DictFormat</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="nam">_attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="nam">_parser_context</span><span class="op">:</span> <span class="nam">ParserContextData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">Any</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="key">return</span> <span class="nam">parsed_data</span><span class="op">[</span><span class="str">"mapping"</span><span class="op">]</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_d5d6843b45eec01e_discard_rules_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_d5d6843b45eec01e_metadata_detectors_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_d5d6843b45eec01e_metadata_detectors_py.html b/coverage-report/d_d5d6843b45eec01e_metadata_detectors_py.html deleted file mode 100644 index 2c3f260..0000000 --- a/coverage-report/d_d5d6843b45eec01e_metadata_detectors_py.html +++ /dev/null @@ -1,649 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/plugin/debputy/metadata_detectors.py: 96%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/plugin/debputy/metadata_detectors.py</b>: - <span class="pc_cov">96%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">228 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">222<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">6<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">7<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_d5d6843b45eec01e_manifest_root_rules_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_d5d6843b45eec01e_package_processors_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">itertools</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">re</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">import</span> <span class="nam">textwrap</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Iterable</span><span class="op">,</span> <span class="nam">Iterator</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">BinaryCtrlAccessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">debputy</span><span class="op">.</span><span class="nam">paths</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">INITRAMFS_HOOK_DIR</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">SYSTEMD_TMPFILES_DIR</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">GSETTINGS_SCHEMA_DIR</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">SYSTEMD_SYSUSERS_DIR</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">debputy</span><span class="op">.</span><span class="nam">types</span> <span class="key">import</span> <span class="nam">DebputyCapability</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">assume_not_none</span><span class="op">,</span> <span class="nam">_warn</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"><span class="nam">DPKG_ROOT</span> <span class="op">=</span> <span class="str">'"${DPKG_ROOT}"'</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"><span class="nam">DPKG_ROOT_UNQUOTED</span> <span class="op">=</span> <span class="str">"${DPKG_ROOT}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"><span class="nam">KERNEL_MODULE_EXTENSIONS</span> <span class="op">=</span> <span class="nam">tuple</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="str">f"{ext}{comp_ext}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="key">for</span> <span class="nam">ext</span><span class="op">,</span> <span class="nam">comp_ext</span> <span class="key">in</span> <span class="nam">itertools</span><span class="op">.</span><span class="nam">product</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="op">(</span><span class="str">".o"</span><span class="op">,</span> <span class="str">".ko"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="op">(</span><span class="str">""</span><span class="op">,</span> <span class="str">".gz"</span><span class="op">,</span> <span class="str">".bz2"</span><span class="op">,</span> <span class="str">".xz"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"><span class="key">def</span> <span class="nam">detect_initramfs_hooks</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">:</span> <span class="nam">BinaryCtrlAccessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="nam">_unused</span><span class="op">:</span> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="nam">hook_dir</span> <span class="op">=</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="nam">INITRAMFS_HOOK_DIR</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">hook_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="key">for</span> <span class="nam">_</span> <span class="key">in</span> <span class="nam">hook_dir</span><span class="op">.</span><span class="nam">iterdir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="com"># Only add the trigger if the directory is non-empty. It is unlikely to matter a lot,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="com"># but we do this to match debhelper.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">dpkg_trigger</span><span class="op">(</span><span class="str">"activate-noawait"</span><span class="op">,</span> <span class="str">"update-initramfs"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"><span class="key">def</span> <span class="nam">_all_tmpfiles_conf</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="nam">seen_tmpfiles</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="nam">tmpfiles_dirs</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="nam">SYSTEMD_TMPFILES_DIR</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="str">"./etc/tmpfiles.d"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="key">for</span> <span class="nam">tmpfiles_dir_path</span> <span class="key">in</span> <span class="nam">tmpfiles_dirs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="nam">tmpfiles_dir</span> <span class="op">=</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="nam">tmpfiles_dir_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">tmpfiles_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="key">for</span> <span class="nam">path</span> <span class="key">in</span> <span class="nam">tmpfiles_dir</span><span class="op">.</span><span class="nam">iterdir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="key">not</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_file</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="key">or</span> <span class="key">not</span> <span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">".conf"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="key">or</span> <span class="nam">path</span><span class="op">.</span><span class="nam">name</span> <span class="key">in</span> <span class="nam">seen_tmpfiles</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="nam">seen_tmpfiles</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="key">yield</span> <span class="nam">path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"><span class="key">def</span> <span class="nam">detect_systemd_tmpfiles</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">:</span> <span class="nam">BinaryCtrlAccessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="nam">_unused</span><span class="op">:</span> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="nam">tmpfiles_confs</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="nam">x</span><span class="op">.</span><span class="nam">name</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">sorted</span><span class="op">(</span><span class="nam">_all_tmpfiles_conf</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">)</span><span class="op">,</span> <span class="nam">key</span><span class="op">=</span><span class="key">lambda</span> <span class="nam">x</span><span class="op">:</span> <span class="nam">x</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">tmpfiles_confs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="nam">tmpfiles_escaped</span> <span class="op">=</span> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">escape_shell_words</span><span class="op">(</span><span class="op">*</span><span class="nam">tmpfiles_confs</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="nam">snippet</span> <span class="op">=</span> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="str">f"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"><span class="str"> if [ -x "$(command -v systemd-tmpfiles)" ]; then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"><span class="str"> systemd-tmpfiles ${{DPKG_ROOT:+--root="$DPKG_ROOT"}} --create {tmpfiles_escaped} || true</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"><span class="str"> fi</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">on_configure</span><span class="op">(</span><span class="nam">snippet</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"><span class="key">def</span> <span class="nam">_all_sysusers_conf</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="nam">sysusers_dir</span> <span class="op">=</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="nam">SYSTEMD_SYSUSERS_DIR</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">sysusers_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="key">for</span> <span class="nam">child</span> <span class="key">in</span> <span class="nam">sysusers_dir</span><span class="op">.</span><span class="nam">iterdir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">child</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">".conf"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="key">yield</span> <span class="nam">child</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"><span class="key">def</span> <span class="nam">detect_systemd_sysusers</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">:</span> <span class="nam">BinaryCtrlAccessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="nam">_unused</span><span class="op">:</span> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="nam">sysusers_confs</span> <span class="op">=</span> <span class="op">[</span><span class="nam">p</span><span class="op">.</span><span class="nam">name</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">_all_sysusers_conf</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">sysusers_confs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="nam">sysusers_escaped</span> <span class="op">=</span> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">escape_shell_words</span><span class="op">(</span><span class="op">*</span><span class="nam">sysusers_confs</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="nam">snippet</span> <span class="op">=</span> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="str">f"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"><span class="str"> systemd-sysusers ${{DPKG_ROOT:+--root="$DPKG_ROOT"}} --create {sysusers_escaped} || true</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">substvars</span><span class="op">.</span><span class="nam">add_dependency</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="str">"misc:Depends"</span><span class="op">,</span> <span class="str">"systemd | systemd-standalone-sysusers | systemd-sysusers"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">on_configure</span><span class="op">(</span><span class="nam">snippet</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"><span class="key">def</span> <span class="nam">detect_icons</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">:</span> <span class="nam">BinaryCtrlAccessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="nam">_unused</span><span class="op">:</span> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="nam">icons_root_dir</span> <span class="op">=</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="str">"./usr/share/icons"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">icons_root_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="nam">icon_dirs</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="key">for</span> <span class="nam">subdir</span> <span class="key">in</span> <span class="nam">icons_root_dir</span><span class="op">.</span><span class="nam">iterdir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="key">if</span> <span class="nam">subdir</span><span class="op">.</span><span class="nam">name</span> <span class="key">in</span> <span class="op">(</span><span class="str">"gnome"</span><span class="op">,</span> <span class="str">"hicolor"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="com"># dh_icons skips this for some reason.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">subdir</span><span class="op">.</span><span class="nam">all_paths</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="key">if</span> <span class="nam">p</span><span class="op">.</span><span class="nam">is_file</span> <span class="key">and</span> <span class="nam">p</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="op">(</span><span class="str">".png"</span><span class="op">,</span> <span class="str">".svg"</span><span class="op">,</span> <span class="str">".xpm"</span><span class="op">,</span> <span class="str">".icon"</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="nam">icon_dirs</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">subdir</span><span class="op">.</span><span class="nam">absolute</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">icon_dirs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="nam">icon_dir_list_escaped</span> <span class="op">=</span> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">escape_shell_words</span><span class="op">(</span><span class="op">*</span><span class="nam">icon_dirs</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="nam">postinst_snippet</span> <span class="op">=</span> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="str">f"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"><span class="str"> if command -v update-icon-caches >/dev/null; then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"><span class="str"> update-icon-caches {icon_dir_list_escaped}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"><span class="str"> fi</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="nam">postrm_snippet</span> <span class="op">=</span> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="str">f"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"><span class="str"> if command -v update-icon-caches >/dev/null; then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"><span class="str"> update-icon-caches {icon_dir_list_escaped}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"><span class="str"> fi</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">on_configure</span><span class="op">(</span><span class="nam">postinst_snippet</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">unconditionally_in_script</span><span class="op">(</span><span class="str">"postrm"</span><span class="op">,</span> <span class="nam">postrm_snippet</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"><span class="key">def</span> <span class="nam">detect_gsettings_dependencies</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">:</span> <span class="nam">BinaryCtrlAccessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="nam">_unused</span><span class="op">:</span> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="nam">gsettings_schema_dir</span> <span class="op">=</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="nam">GSETTINGS_SCHEMA_DIR</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">gsettings_schema_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="key">for</span> <span class="nam">path</span> <span class="key">in</span> <span class="nam">gsettings_schema_dir</span><span class="op">.</span><span class="nam">all_paths</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_file</span> <span class="key">and</span> <span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="op">(</span><span class="str">".xml"</span><span class="op">,</span> <span class="str">".override"</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">substvars</span><span class="op">.</span><span class="nam">add_dependency</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="str">"misc:Depends"</span><span class="op">,</span> <span class="str">"dconf-gsettings-backend | gsettings-backend"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"><span class="key">def</span> <span class="nam">detect_kernel_modules</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">:</span> <span class="nam">BinaryCtrlAccessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="nam">_unused</span><span class="op">:</span> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="key">for</span> <span class="nam">prefix</span> <span class="key">in</span> <span class="op">[</span><span class="str">"."</span><span class="op">,</span> <span class="str">"./usr"</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="nam">module_root_dir</span> <span class="op">=</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="str">f"{prefix}/lib/modules"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">module_root_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="nam">module_version_dirs</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="key">for</span> <span class="nam">module_version_dir</span> <span class="key">in</span> <span class="nam">module_root_dir</span><span class="op">.</span><span class="nam">iterdir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">module_version_dir</span><span class="op">.</span><span class="nam">is_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="key">for</span> <span class="nam">fs_path</span> <span class="key">in</span> <span class="nam">module_version_dir</span><span class="op">.</span><span class="nam">all_paths</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="key">if</span> <span class="nam">fs_path</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="nam">KERNEL_MODULE_EXTENSIONS</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="nam">module_version_dirs</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">module_version_dir</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="key">for</span> <span class="nam">module_version</span> <span class="key">in</span> <span class="nam">module_version_dirs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="nam">module_version_escaped</span> <span class="op">=</span> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">escape_shell_words</span><span class="op">(</span><span class="nam">module_version</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="nam">postinst_snippet</span> <span class="op">=</span> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="str">f"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"><span class="str"> if [ -e /boot/System.map-{module_version_escaped} ]; then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"><span class="str"> depmod -a -F /boot/System.map-{module_version_escaped} {module_version_escaped} || true</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"><span class="str"> fi</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="nam">postrm_snippet</span> <span class="op">=</span> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="str">f"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"><span class="str"> if [ -e /boot/System.map-{module_version_escaped} ]; then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"><span class="str"> depmod -a -F /boot/System.map-{module_version_escaped} {module_version_escaped} || true</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"><span class="str"> fi</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">on_configure</span><span class="op">(</span><span class="nam">postinst_snippet</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="com"># TODO: This should probably be on removal. However, this is what debhelper did and we should</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="com"># do the same until we are sure (not that it matters a lot).</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">unconditionally_in_script</span><span class="op">(</span><span class="str">"postrm"</span><span class="op">,</span> <span class="nam">postrm_snippet</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"><span class="key">def</span> <span class="nam">detect_xfonts</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">:</span> <span class="nam">BinaryCtrlAccessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="nam">context</span><span class="op">:</span> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="nam">xfonts_root_dir</span> <span class="op">=</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="str">"./usr/share/fonts/X11/"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">xfonts_root_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="nam">cmds</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="nam">cmds_postinst</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="nam">cmds_postrm</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="nam">escape_shell_words</span> <span class="op">=</span> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">escape_shell_words</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="nam">package_name</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">binary_package</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="key">for</span> <span class="nam">xfonts_dir</span> <span class="key">in</span> <span class="nam">xfonts_root_dir</span><span class="op">.</span><span class="nam">iterdir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="nam">xfonts_dirname</span> <span class="op">=</span> <span class="nam">xfonts_dir</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">xfonts_dir</span><span class="op">.</span><span class="nam">is_dir</span> <span class="key">or</span> <span class="nam">xfonts_dirname</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"."</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="key">if</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="str">f"./etc/X11/xfonts/{xfonts_dirname}/{package_name}.scale"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="nam">cmds</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">escape_shell_words</span><span class="op">(</span><span class="str">"update-fonts-scale"</span><span class="op">,</span> <span class="nam">xfonts_dirname</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="nam">cmds</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="nam">escape_shell_words</span><span class="op">(</span><span class="str">"update-fonts-dir"</span><span class="op">,</span> <span class="str">"--x11r7-layout"</span><span class="op">,</span> <span class="nam">xfonts_dirname</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="nam">alias_file</span> <span class="op">=</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="str">f"./etc/X11/xfonts/{xfonts_dirname}/{package_name}.alias"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="key">if</span> <span class="nam">alias_file</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="nam">cmds_postinst</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="nam">escape_shell_words</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="str">"update-fonts-alias"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="str">"--include"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="nam">alias_file</span><span class="op">.</span><span class="nam">absolute</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="nam">xfonts_dirname</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="nam">cmds_postrm</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="nam">escape_shell_words</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="str">"update-fonts-alias"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="str">"--exclude"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="nam">alias_file</span><span class="op">.</span><span class="nam">absolute</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="nam">xfonts_dirname</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">cmds</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="nam">postinst_snippet</span> <span class="op">=</span> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="str">f"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"><span class="str"> if command -v update-fonts-dir >/dev/null; then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"><span class="str"> {';'.join(itertools.chain(cmds, cmds_postinst))}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"><span class="str"> fi</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="nam">postrm_snippet</span> <span class="op">=</span> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="str">f"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"><span class="str"> if [ -x "`command -v update-fonts-dir`" ]; then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"><span class="str"> {';'.join(itertools.chain(cmds, cmds_postrm))}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"><span class="str"> fi</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">unconditionally_in_script</span><span class="op">(</span><span class="str">"postinst"</span><span class="op">,</span> <span class="nam">postinst_snippet</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">unconditionally_in_script</span><span class="op">(</span><span class="str">"postrm"</span><span class="op">,</span> <span class="nam">postrm_snippet</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">substvars</span><span class="op">.</span><span class="nam">add_dependency</span><span class="op">(</span><span class="str">"misc:Depends"</span><span class="op">,</span> <span class="str">"xfonts-utils"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"><span class="com"># debputy does not support python2, so we do not list python / python2.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"><span class="nam">_PYTHON_PUBLIC_DIST_DIR_NAMES</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">r"(?:pypy|python)3(?:[.]\d+)?"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"><span class="key">def</span> <span class="nam">_public_python_dist_dirs</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="nam">usr_lib</span> <span class="op">=</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="str">"./usr/lib"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="nam">root_dirs</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="key">if</span> <span class="nam">usr_lib</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="nam">root_dirs</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">usr_lib</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="nam">dbg_root</span> <span class="op">=</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="str">"./usr/lib/debug/usr/lib"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="key">if</span> <span class="nam">dbg_root</span><span class="op">:</span> </span><span class="r"><span class="annotate short">314 ↛ 315</span><span class="annotate long">line 314 didn't jump to line 315, because the condition on line 314 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="nam">root_dirs</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">dbg_root</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="key">for</span> <span class="nam">root_dir</span> <span class="key">in</span> <span class="nam">root_dirs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="nam">python_dirs</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="nam">path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="key">for</span> <span class="nam">path</span> <span class="key">in</span> <span class="nam">root_dir</span><span class="op">.</span><span class="nam">iterdir</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_dir</span> <span class="key">and</span> <span class="nam">_PYTHON_PUBLIC_DIST_DIR_NAMES</span><span class="op">.</span><span class="nam">match</span><span class="op">(</span><span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> <span class="key">for</span> <span class="nam">python_dir</span> <span class="key">in</span> <span class="nam">python_dirs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> <span class="nam">dist_packages</span> <span class="op">=</span> <span class="nam">python_dir</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"dist-packages"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">dist_packages</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> <span class="key">yield</span> <span class="nam">dist_packages</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"><span class="key">def</span> <span class="nam">_has_py_file_in_dir</span><span class="op">(</span><span class="nam">d</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> <span class="key">return</span> <span class="nam">any</span><span class="op">(</span><span class="nam">f</span><span class="op">.</span><span class="nam">is_file</span> <span class="key">and</span> <span class="nam">f</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">".py"</span><span class="op">)</span> <span class="key">for</span> <span class="nam">f</span> <span class="key">in</span> <span class="nam">d</span><span class="op">.</span><span class="nam">all_paths</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"><span class="annotate short">331 ↛ exit</span><span class="annotate long">line 331 didn't finish the generator expression on line 331</span></span></p> - <p class="pln"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"><span class="key">def</span> <span class="nam">detect_pycompile_files</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">:</span> <span class="nam">BinaryCtrlAccessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> <span class="nam">context</span><span class="op">:</span> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"> <span class="nam">package</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">binary_package</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> <span class="com"># TODO: Support configurable list of private dirs</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"> <span class="nam">private_search_dirs</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">d</span><span class="op">,</span> <span class="nam">package</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"> <span class="key">for</span> <span class="nam">d</span> <span class="key">in</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> <span class="str">"./usr/share"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"> <span class="str">"./usr/share/games"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"> <span class="str">"./usr/lib"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"> <span class="str">f"./usr/lib/{context.binary_package.deb_multiarch}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"> <span class="str">"./usr/lib/games"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"> <span class="nam">private_search_dirs_with_py_files</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"> <span class="nam">p</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">private_search_dirs</span> <span class="key">if</span> <span class="nam">p</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">_has_py_file_in_dir</span><span class="op">(</span><span class="nam">p</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"> <span class="nam">public_search_dirs_has_py_files</span> <span class="op">=</span> <span class="nam">any</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"> <span class="nam">p</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">_has_py_file_in_dir</span><span class="op">(</span><span class="nam">p</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">_public_python_dist_dirs</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">public_search_dirs_has_py_files</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">private_search_dirs_with_py_files</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"> <span class="com"># The dh_python3 helper also supports -V and -X. We do not use them. They can be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"> <span class="com"># replaced by bcep support instead, which is how we will be supporting this kind</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"> <span class="com"># of configuration down the line.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">unconditionally_in_script</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"> <span class="str">"prerm"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"> <span class="str">f"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"><span class="str"> if command -v py3clean >/dev/null 2>&1; then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"><span class="str"> py3clean -p {package}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"><span class="str"> else</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"><span class="str"> dpkg -L {package} | sed -En -e '/^(.*)\\/(.+)\\.py$/s,,rm "\\1/__pycache__/\\2".*,e'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"><span class="str"> find /usr/lib/python3/dist-packages/ -type d -name __pycache__ -empty -print0 | xargs --null --no-run-if-empty rmdir</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"><span class="str"> fi</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"> <span class="key">if</span> <span class="nam">public_search_dirs_has_py_files</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">on_configure</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"> <span class="str">f"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"><span class="str"> if command -v py3compile >/dev/null 2>&1; then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"><span class="str"> py3compile -p {package}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"><span class="str"> fi</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t385" href="#t385">385</a></span><span class="t"><span class="str"> if command -v pypy3compile >/dev/null 2>&1; then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t386" href="#t386">386</a></span><span class="t"><span class="str"> pypy3compile -p {package} || true</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t387" href="#t387">387</a></span><span class="t"><span class="str"> fi</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t388" href="#t388">388</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t389" href="#t389">389</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t390" href="#t390">390</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t391" href="#t391">391</a></span><span class="t"> <span class="key">for</span> <span class="nam">private_dir</span> <span class="key">in</span> <span class="nam">private_search_dirs_with_py_files</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t392" href="#t392">392</a></span><span class="t"> <span class="nam">escaped_dir</span> <span class="op">=</span> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">escape_shell_words</span><span class="op">(</span><span class="nam">private_dir</span><span class="op">.</span><span class="nam">absolute</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t393" href="#t393">393</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">on_configure</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t394" href="#t394">394</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t395" href="#t395">395</a></span><span class="t"> <span class="str">f"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t396" href="#t396">396</a></span><span class="t"><span class="str"> if command -v py3compile >/dev/null 2>&1; then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t397" href="#t397">397</a></span><span class="t"><span class="str"> py3compile -p {package} {escaped_dir}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t398" href="#t398">398</a></span><span class="t"><span class="str"> fi</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t399" href="#t399">399</a></span><span class="t"><span class="str"> if command -v pypy3compile >/dev/null 2>&1; then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t400" href="#t400">400</a></span><span class="t"><span class="str"> pypy3compile -p {package} {escaped_dir} || true</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t401" href="#t401">401</a></span><span class="t"><span class="str"> fi</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t402" href="#t402">402</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t403" href="#t403">403</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t404" href="#t404">404</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t405" href="#t405">405</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t406" href="#t406">406</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t407" href="#t407">407</a></span><span class="t"><span class="key">def</span> <span class="nam">translate_capabilities</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t408" href="#t408">408</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t409" href="#t409">409</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">:</span> <span class="nam">BinaryCtrlAccessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t410" href="#t410">410</a></span><span class="t"> <span class="nam">_context</span><span class="op">:</span> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t411" href="#t411">411</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t412" href="#t412">412</a></span><span class="t"> <span class="nam">caps</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t413" href="#t413">413</a></span><span class="t"> <span class="nam">maintscript</span> <span class="op">=</span> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t414" href="#t414">414</a></span><span class="t"> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">all_paths</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t415" href="#t415">415</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">p</span><span class="op">.</span><span class="nam">is_file</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t416" href="#t416">416</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t417" href="#t417">417</a></span><span class="t"> <span class="nam">metadata_ref</span> <span class="op">=</span> <span class="nam">p</span><span class="op">.</span><span class="nam">metadata</span><span class="op">(</span><span class="nam">DebputyCapability</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t418" href="#t418">418</a></span><span class="t"> <span class="nam">capability</span> <span class="op">=</span> <span class="nam">metadata_ref</span><span class="op">.</span><span class="nam">value</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t419" href="#t419">419</a></span><span class="t"> <span class="key">if</span> <span class="nam">capability</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t420" href="#t420">420</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t421" href="#t421">421</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t422" href="#t422">422</a></span><span class="t"> <span class="nam">abs_path</span> <span class="op">=</span> <span class="nam">maintscript</span><span class="op">.</span><span class="nam">escape_shell_words</span><span class="op">(</span><span class="nam">p</span><span class="op">.</span><span class="nam">absolute</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t423" href="#t423">423</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t424" href="#t424">424</a></span><span class="t"> <span class="nam">cap_script</span> <span class="op">=</span> <span class="str">""</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t425" href="#t425">425</a></span><span class="t"> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t426" href="#t426">426</a></span><span class="t"> <span class="str">" # Triggered by: {DEFINITION_SOURCE}\n"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t427" href="#t427">427</a></span><span class="t"> <span class="str">" _TPATH=$(dpkg-divert --truename {ABS_PATH})\n"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t428" href="#t428">428</a></span><span class="t"> <span class="str">' if setcap {CAP} "{DPKG_ROOT_UNQUOTED}${{_TPATH}}"; then\n'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t429" href="#t429">429</a></span><span class="t"> <span class="str">' chmod {MODE} "{DPKG_ROOT_UNQUOTED}${{_TPATH}}"\n'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t430" href="#t430">430</a></span><span class="t"> <span class="str">' echo "Successfully applied capabilities {CAP} on ${{_TPATH}}"\n'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t431" href="#t431">431</a></span><span class="t"> <span class="str">" else\n"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t432" href="#t432">432</a></span><span class="t"> <span class="com"># We do not reset the mode here; generally a re-install or upgrade would re-store both mode,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t433" href="#t433">433</a></span><span class="t"> <span class="com"># and remove the capabilities.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t434" href="#t434">434</a></span><span class="t"> <span class="str">' echo "The setcap failed to processes {CAP} on ${{_TPATH}}; falling back to no capability support" >&2\n'</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t435" href="#t435">435</a></span><span class="t"> <span class="str">" fi\n"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t436" href="#t436">436</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t437" href="#t437">437</a></span><span class="t"> <span class="op">)</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t438" href="#t438">438</a></span><span class="t"> <span class="nam">CAP</span><span class="op">=</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">escape_shell_words</span><span class="op">(</span><span class="nam">capability</span><span class="op">.</span><span class="nam">capabilities</span><span class="op">)</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t439" href="#t439">439</a></span><span class="t"> <span class="str">"\\+"</span><span class="op">,</span> <span class="str">"+"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t440" href="#t440">440</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t441" href="#t441">441</a></span><span class="t"> <span class="nam">DPKG_ROOT_UNQUOTED</span><span class="op">=</span><span class="nam">DPKG_ROOT_UNQUOTED</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t442" href="#t442">442</a></span><span class="t"> <span class="nam">ABS_PATH</span><span class="op">=</span><span class="nam">abs_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t443" href="#t443">443</a></span><span class="t"> <span class="nam">MODE</span><span class="op">=</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">escape_shell_words</span><span class="op">(</span><span class="nam">str</span><span class="op">(</span><span class="nam">capability</span><span class="op">.</span><span class="nam">capability_mode</span><span class="op">)</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t444" href="#t444">444</a></span><span class="t"> <span class="nam">DEFINITION_SOURCE</span><span class="op">=</span><span class="nam">capability</span><span class="op">.</span><span class="nam">definition_source</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">"\n"</span><span class="op">,</span> <span class="str">"\\n"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t445" href="#t445">445</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t446" href="#t446">446</a></span><span class="t"> <span class="key">assert</span> <span class="nam">cap_script</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t447" href="#t447">447</a></span><span class="t"> <span class="nam">caps</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">cap_script</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t448" href="#t448">448</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t449" href="#t449">449</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">caps</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t450" href="#t450">450</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t451" href="#t451">451</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t452" href="#t452">452</a></span><span class="t"> <span class="nam">maintscript</span><span class="op">.</span><span class="nam">on_configure</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t453" href="#t453">453</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t454" href="#t454">454</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t455" href="#t455">455</a></span><span class="t"><span class="str"> if command -v setcap > /dev/null; then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t456" href="#t456">456</a></span><span class="t"><span class="str"> {SET_CAP_COMMANDS}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t457" href="#t457">457</a></span><span class="t"><span class="str"> unset _TPATH</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t458" href="#t458">458</a></span><span class="t"><span class="str"> else</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t459" href="#t459">459</a></span><span class="t"><span class="str"> echo "The setcap utility is not installed available; falling back to no capability support" >&2</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t460" href="#t460">460</a></span><span class="t"><span class="str"> fi</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t461" href="#t461">461</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t462" href="#t462">462</a></span><span class="t"> <span class="op">)</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t463" href="#t463">463</a></span><span class="t"> <span class="nam">SET_CAP_COMMANDS</span><span class="op">=</span><span class="str">""</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">caps</span><span class="op">)</span><span class="op">.</span><span class="nam">rstrip</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t464" href="#t464">464</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t465" href="#t465">465</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t466" href="#t466">466</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t467" href="#t467">467</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t468" href="#t468">468</a></span><span class="t"><span class="key">def</span> <span class="nam">pam_auth_update</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t469" href="#t469">469</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t470" href="#t470">470</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">:</span> <span class="nam">BinaryCtrlAccessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t471" href="#t471">471</a></span><span class="t"> <span class="nam">_context</span><span class="op">:</span> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t472" href="#t472">472</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t473" href="#t473">473</a></span><span class="t"> <span class="nam">pam_configs</span> <span class="op">=</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="str">"/usr/share/pam-configs"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t474" href="#t474">474</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">pam_configs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t475" href="#t475">475</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t476" href="#t476">476</a></span><span class="t"> <span class="nam">maintscript</span> <span class="op">=</span> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t477" href="#t477">477</a></span><span class="t"> <span class="key">for</span> <span class="nam">pam_config</span> <span class="key">in</span> <span class="nam">pam_configs</span><span class="op">.</span><span class="nam">iterdir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t478" href="#t478">478</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">pam_config</span><span class="op">.</span><span class="nam">is_file</span><span class="op">:</span> </span><span class="r"><span class="annotate short">478 ↛ 479</span><span class="annotate long">line 478 didn't jump to line 479, because the condition on line 478 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t479" href="#t479">479</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t480" href="#t480">480</a></span><span class="t"> <span class="nam">maintscript</span><span class="op">.</span><span class="nam">on_configure</span><span class="op">(</span><span class="str">"pam-auth-update --package\n"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t481" href="#t481">481</a></span><span class="t"> <span class="nam">maintscript</span><span class="op">.</span><span class="nam">on_before_removal</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t482" href="#t482">482</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t483" href="#t483">483</a></span><span class="t"> <span class="str">f"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t484" href="#t484">484</a></span><span class="t"><span class="str"> if [ "${{DPKG_MAINTSCRIPT_PACKAGE_REFCOUNT:-1}}" = 1 ]; then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t485" href="#t485">485</a></span><span class="t"><span class="str"> pam-auth-update --package --remove {maintscript.escape_shell_words(pam_config.name)}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t486" href="#t486">486</a></span><span class="t"><span class="str"> fi</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t487" href="#t487">487</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t488" href="#t488">488</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t489" href="#t489">489</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t490" href="#t490">490</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t491" href="#t491">491</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t492" href="#t492">492</a></span><span class="t"><span class="key">def</span> <span class="nam">auto_depends_arch_any_solink</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t493" href="#t493">493</a></span><span class="t"> <span class="nam">fs_foot</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t494" href="#t494">494</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">:</span> <span class="nam">BinaryCtrlAccessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t495" href="#t495">495</a></span><span class="t"> <span class="nam">context</span><span class="op">:</span> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t496" href="#t496">496</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t497" href="#t497">497</a></span><span class="t"> <span class="nam">package</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">binary_package</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t498" href="#t498">498</a></span><span class="t"> <span class="key">if</span> <span class="nam">package</span><span class="op">.</span><span class="nam">is_arch_all</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t499" href="#t499">499</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t500" href="#t500">500</a></span><span class="t"> <span class="nam">libbasedir</span> <span class="op">=</span> <span class="nam">fs_foot</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="str">"usr/lib"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t501" href="#t501">501</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">libbasedir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t502" href="#t502">502</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t503" href="#t503">503</a></span><span class="t"> <span class="nam">libmadir</span> <span class="op">=</span> <span class="nam">libbasedir</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">package</span><span class="op">.</span><span class="nam">deb_multiarch</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t504" href="#t504">504</a></span><span class="t"> <span class="key">if</span> <span class="nam">libmadir</span><span class="op">:</span> </span><span class="r"><span class="annotate short">504 ↛ 507</span><span class="annotate long">line 504 didn't jump to line 507, because the condition on line 504 was never false</span></span></p> - <p class="run"><span class="n"><a id="t505" href="#t505">505</a></span><span class="t"> <span class="nam">libdirs</span> <span class="op">=</span> <span class="op">[</span><span class="nam">libmadir</span><span class="op">,</span> <span class="nam">libbasedir</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t506" href="#t506">506</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t507" href="#t507">507</a></span><span class="t"> <span class="nam">libdirs</span> <span class="op">=</span> <span class="op">[</span><span class="nam">libbasedir</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t508" href="#t508">508</a></span><span class="t"> <span class="nam">targets</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t509" href="#t509">509</a></span><span class="t"> <span class="key">for</span> <span class="nam">libdir</span> <span class="key">in</span> <span class="nam">libdirs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t510" href="#t510">510</a></span><span class="t"> <span class="key">for</span> <span class="nam">path</span> <span class="key">in</span> <span class="nam">libdir</span><span class="op">.</span><span class="nam">iterdir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t511" href="#t511">511</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_symlink</span> <span class="key">or</span> <span class="key">not</span> <span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">".so"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t512" href="#t512">512</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t513" href="#t513">513</a></span><span class="t"> <span class="nam">target</span> <span class="op">=</span> <span class="nam">path</span><span class="op">.</span><span class="nam">readlink</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t514" href="#t514">514</a></span><span class="t"> <span class="nam">resolved</span> <span class="op">=</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">path</span><span class="op">.</span><span class="nam">parent_dir</span><span class="op">)</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="nam">target</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t515" href="#t515">515</a></span><span class="t"> <span class="key">if</span> <span class="nam">resolved</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">515 ↛ 516</span><span class="annotate long">line 515 didn't jump to line 516, because the condition on line 515 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t516" href="#t516">516</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t517" href="#t517">517</a></span><span class="t"> <span class="nam">targets</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="op">(</span><span class="nam">libdir</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> <span class="nam">target</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t518" href="#t518">518</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t519" href="#t519">519</a></span><span class="t"> <span class="nam">roots</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">context</span><span class="op">.</span><span class="nam">accessible_package_roots</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t520" href="#t520">520</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">roots</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t521" href="#t521">521</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t522" href="#t522">522</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t523" href="#t523">523</a></span><span class="t"> <span class="key">for</span> <span class="nam">libdir</span><span class="op">,</span> <span class="nam">target</span> <span class="key">in</span> <span class="nam">targets</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t524" href="#t524">524</a></span><span class="t"> <span class="nam">final_path</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">libdir</span><span class="op">,</span> <span class="nam">target</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t525" href="#t525">525</a></span><span class="t"> <span class="nam">matches</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t526" href="#t526">526</a></span><span class="t"> <span class="key">for</span> <span class="nam">opkg</span><span class="op">,</span> <span class="nam">ofs_root</span> <span class="key">in</span> <span class="nam">roots</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t527" href="#t527">527</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="nam">ofs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="nam">final_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t528" href="#t528">528</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">m</span><span class="op">:</span> </span><span class="r"><span class="annotate short">528 ↛ 529</span><span class="annotate long">line 528 didn't jump to line 529, because the condition on line 528 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t529" href="#t529">529</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t530" href="#t530">530</a></span><span class="t"> <span class="nam">matches</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">opkg</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t531" href="#t531">531</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">matches</span> <span class="key">or</span> <span class="nam">len</span><span class="op">(</span><span class="nam">matches</span><span class="op">)</span> <span class="op">></span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t532" href="#t532">532</a></span><span class="t"> <span class="key">if</span> <span class="nam">matches</span><span class="op">:</span> </span><span class="r"><span class="annotate short">532 ↛ 539</span><span class="annotate long">line 532 didn't jump to line 539, because the condition on line 532 was never false</span></span></p> - <p class="run"><span class="n"><a id="t533" href="#t533">533</a></span><span class="t"> <span class="nam">all_matches</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">p</span><span class="op">.</span><span class="nam">name</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">matches</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t534" href="#t534">534</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t535" href="#t535">535</a></span><span class="t"> <span class="str">f"auto-depends-solink: The {final_path} was found in multiple packages ({all_matches}):"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t536" href="#t536">536</a></span><span class="t"> <span class="str">f" Not generating a dependency."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t537" href="#t537">537</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t538" href="#t538">538</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t539" href="#t539">539</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t540" href="#t540">540</a></span><span class="t"> <span class="str">f"auto-depends-solink: The {final_path} was NOT found in any accessible package:"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t541" href="#t541">541</a></span><span class="t"> <span class="str">" Not generating a dependency. This detection only works when both packages are arch:any"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t542" href="#t542">542</a></span><span class="t"> <span class="str">" and they have the same build-profiles."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t543" href="#t543">543</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t544" href="#t544">544</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t545" href="#t545">545</a></span><span class="t"> <span class="nam">pkg_dep</span> <span class="op">=</span> <span class="nam">matches</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t546" href="#t546">546</a></span><span class="t"> <span class="com"># The debputy API should not allow this constraint to fail</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t547" href="#t547">547</a></span><span class="t"> <span class="key">assert</span> <span class="nam">pkg_dep</span><span class="op">.</span><span class="nam">is_arch_all</span> <span class="op">==</span> <span class="nam">package</span><span class="op">.</span><span class="nam">is_arch_all</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t548" href="#t548">548</a></span><span class="t"> <span class="com"># If both packages are arch:all or both are arch:any, we can generate a tight dependency</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t549" href="#t549">549</a></span><span class="t"> <span class="nam">relation</span> <span class="op">=</span> <span class="str">f"{pkg_dep.name} (= ${{binary:Version}})"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t550" href="#t550">550</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">substvars</span><span class="op">.</span><span class="nam">add_dependency</span><span class="op">(</span><span class="str">"misc:Depends"</span><span class="op">,</span> <span class="nam">relation</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_d5d6843b45eec01e_manifest_root_rules_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_d5d6843b45eec01e_package_processors_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_d5d6843b45eec01e_package_processors_py.html b/coverage-report/d_d5d6843b45eec01e_package_processors_py.html deleted file mode 100644 index 9754ba3..0000000 --- a/coverage-report/d_d5d6843b45eec01e_package_processors_py.html +++ /dev/null @@ -1,419 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/plugin/debputy/package_processors.py: 54%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/plugin/debputy/package_processors.py</b>: - <span class="pc_cov">54%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">168 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">98<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">70<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">6<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_d5d6843b45eec01e_metadata_detectors_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_d5d6843b45eec01e_paths_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">contextlib</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">functools</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">gzip</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">import</span> <span class="nam">re</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">import</span> <span class="nam">subprocess</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">from</span> <span class="nam">contextlib</span> <span class="key">import</span> <span class="nam">ExitStack</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Optional</span><span class="op">,</span> <span class="nam">Iterator</span><span class="op">,</span> <span class="nam">IO</span><span class="op">,</span> <span class="nam">Any</span><span class="op">,</span> <span class="nam">List</span><span class="op">,</span> <span class="nam">Dict</span><span class="op">,</span> <span class="nam">Callable</span><span class="op">,</span> <span class="nam">Union</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="nam">VirtualPath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">_error</span><span class="op">,</span> <span class="nam">xargs</span><span class="op">,</span> <span class="nam">escape_shell</span><span class="op">,</span> <span class="nam">_info</span><span class="op">,</span> <span class="nam">assume_not_none</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"><span class="op">@</span><span class="nam">contextlib</span><span class="op">.</span><span class="nam">contextmanager</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"><span class="key">def</span> <span class="nam">_open_maybe_gzip</span><span class="op">(</span><span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">IO</span><span class="op">[</span><span class="nam">bytes</span><span class="op">]</span><span class="op">,</span> <span class="nam">gzip</span><span class="op">.</span><span class="nam">GzipFile</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">".gz"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="key">with</span> <span class="nam">gzip</span><span class="op">.</span><span class="nam">GzipFile</span><span class="op">(</span><span class="nam">path</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">,</span> <span class="str">"rb"</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="key">yield</span> <span class="nam">fd</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="key">with</span> <span class="nam">path</span><span class="op">.</span><span class="nam">open</span><span class="op">(</span><span class="nam">byte_io</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="key">yield</span> <span class="nam">fd</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"><span class="nam">_SO_LINK_RE</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">rb"[.]so\s+(.*)\s*"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"><span class="nam">_LA_DEP_LIB_RE</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span><span class="str">rb"'.+'"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"><span class="key">def</span> <span class="nam">_detect_so_link</span><span class="op">(</span><span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="nam">so_link_re</span> <span class="op">=</span> <span class="nam">_SO_LINK_RE</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="key">with</span> <span class="nam">_open_maybe_gzip</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="key">for</span> <span class="nam">line</span> <span class="key">in</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="nam">so_link_re</span><span class="op">.</span><span class="nam">search</span><span class="op">(</span><span class="nam">line</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="key">if</span> <span class="nam">m</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="key">return</span> <span class="nam">m</span><span class="op">.</span><span class="nam">group</span><span class="op">(</span><span class="num">1</span><span class="op">)</span><span class="op">.</span><span class="nam">decode</span><span class="op">(</span><span class="str">"utf-8"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"><span class="key">def</span> <span class="nam">_replace_with_symlink</span><span class="op">(</span><span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> <span class="nam">so_link_target</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">adjusted_target</span> <span class="op">=</span> <span class="nam">so_link_target</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="nam">parent_dir</span> <span class="op">=</span> <span class="nam">path</span><span class="op">.</span><span class="nam">parent_dir</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="key">assert</span> <span class="nam">parent_dir</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="com"># For the type checking</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="key">if</span> <span class="nam">parent_dir</span><span class="op">.</span><span class="nam">name</span> <span class="op">==</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">dirname</span><span class="op">(</span><span class="nam">adjusted_target</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="com"># Avoid man8/../man8/foo links</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="nam">adjusted_target</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">basename</span><span class="op">(</span><span class="nam">adjusted_target</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="key">elif</span> <span class="str">"/"</span> <span class="key">in</span> <span class="nam">so_link_target</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="com"># symlinks and so links have a different base directory when the link has a "/".</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="com"># Adjust with an extra "../" to align the result</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="nam">adjusted_target</span> <span class="op">=</span> <span class="str">"../"</span> <span class="op">+</span> <span class="nam">adjusted_target</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="nam">path</span><span class="op">.</span><span class="nam">unlink</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="nam">parent_dir</span><span class="op">.</span><span class="nam">add_symlink</span><span class="op">(</span><span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">,</span> <span class="nam">adjusted_target</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"><span class="op">@</span><span class="nam">functools</span><span class="op">.</span><span class="nam">lru_cache</span><span class="op">(</span><span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"><span class="key">def</span> <span class="nam">_has_man_recode</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="com"># Ideally, we would just use shutil.which or something like that.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="com"># Unfortunately, in debhelper, we experienced problems with which</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="com"># returning "yes" for a man tool that actually could not be run</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="com"># on salsa CI.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="com"># Therefore, we adopt the logic of dh_installman to run the tool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="com"># with --help to confirm it is not broken, because no one could</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="com"># figure out what happened in the salsa CI and my life is still</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="com"># too short to figure it out.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_call</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="op">[</span><span class="str">"man-recode"</span><span class="op">,</span> <span class="str">"--help"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="nam">stdin</span><span class="op">=</span><span class="nam">subprocess</span><span class="op">.</span><span class="nam">DEVNULL</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="nam">stdout</span><span class="op">=</span><span class="nam">subprocess</span><span class="op">.</span><span class="nam">DEVNULL</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="nam">stderr</span><span class="op">=</span><span class="nam">subprocess</span><span class="op">.</span><span class="nam">DEVNULL</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="nam">restore_signals</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="key">except</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">CalledProcessError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"><span class="key">def</span> <span class="nam">process_manpages</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> <span class="nam">_unused1</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> <span class="nam">_unused2</span><span class="op">:</span> <span class="nam">Any</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="nam">man_dir</span> <span class="op">=</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="str">"./usr/share/man"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">man_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="nam">re_encode</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="key">for</span> <span class="nam">path</span> <span class="key">in</span> <span class="op">(</span><span class="nam">p</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">man_dir</span><span class="op">.</span><span class="nam">all_paths</span><span class="op">(</span><span class="op">)</span> <span class="key">if</span> <span class="nam">p</span><span class="op">.</span><span class="nam">is_file</span> <span class="key">and</span> <span class="nam">p</span><span class="op">.</span><span class="nam">has_fs_path</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="nam">size</span> <span class="op">=</span> <span class="nam">path</span><span class="op">.</span><span class="nam">size</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="key">if</span> <span class="nam">size</span> <span class="op">==</span> <span class="num">0</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="nam">so_link_target</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="key">if</span> <span class="nam">size</span> <span class="op"><=</span> <span class="num">1024</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="com"># debhelper has a 1024 byte guard on the basis that ".so file tend to be small".</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="com"># That guard worked well for debhelper, so lets keep it for now on that basis alone.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="nam">so_link_target</span> <span class="op">=</span> <span class="nam">_detect_so_link</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="key">if</span> <span class="nam">so_link_target</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="nam">_replace_with_symlink</span><span class="op">(</span><span class="nam">path</span><span class="op">,</span> <span class="nam">so_link_target</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="nam">re_encode</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">re_encode</span> <span class="key">or</span> <span class="key">not</span> <span class="nam">_has_man_recode</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="key">with</span> <span class="nam">ExitStack</span><span class="op">(</span><span class="op">)</span> <span class="key">as</span> <span class="nam">manager</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="nam">manpages</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="nam">manager</span><span class="op">.</span><span class="nam">enter_context</span><span class="op">(</span><span class="nam">p</span><span class="op">.</span><span class="nam">replace_fs_path_content</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">re_encode</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="nam">static_cmd</span> <span class="op">=</span> <span class="op">[</span><span class="str">"man-recode"</span><span class="op">,</span> <span class="str">"--to-code"</span><span class="op">,</span> <span class="str">"UTF-8"</span><span class="op">,</span> <span class="str">"--suffix"</span><span class="op">,</span> <span class="str">".encoded"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="key">for</span> <span class="nam">cmd</span> <span class="key">in</span> <span class="nam">xargs</span><span class="op">(</span><span class="nam">static_cmd</span><span class="op">,</span> <span class="nam">manpages</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"Ensuring manpages have utf-8 encoding via: {escape_shell(*cmd)}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_call</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="nam">cmd</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="nam">stdin</span><span class="op">=</span><span class="nam">subprocess</span><span class="op">.</span><span class="nam">DEVNULL</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="nam">restore_signals</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="key">except</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">CalledProcessError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="str">"The man-recode process failed. Please review the output of `man-recode` to understand"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="str">" what went wrong."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="key">for</span> <span class="nam">manpage</span> <span class="key">in</span> <span class="nam">manpages</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="nam">dest_name</span> <span class="op">=</span> <span class="nam">manpage</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="key">if</span> <span class="nam">dest_name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">".gz"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="nam">dest_name</span> <span class="op">=</span> <span class="nam">dest_name</span><span class="op">[</span><span class="op">:</span><span class="op">-</span><span class="num">3</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="nam">os</span><span class="op">.</span><span class="nam">rename</span><span class="op">(</span><span class="str">f"{dest_name}.encoded"</span><span class="op">,</span> <span class="nam">manpage</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"><span class="key">def</span> <span class="nam">_filter_compress_paths</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span><span class="op">,</span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="nam">ignore_dir_basenames</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="str">"_sources"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="nam">ignore_basenames</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="str">".htaccess"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="str">"index.sgml"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="str">"objects.inv"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="str">"search_index.json"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="str">"copyright"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="nam">ignore_extensions</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="str">".htm"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="str">".html"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="str">".xhtml"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="str">".gif"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="str">".png"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="str">".jpg"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="str">".jpeg"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="str">".gz"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="str">".taz"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="str">".tgz"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="str">".z"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="str">".bz2"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="str">".epub"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="str">".jar"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="str">".zip"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="str">".odg"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="str">".odp"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="str">".odt"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="str">".css"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="str">".xz"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="str">".lz"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="str">".lzma"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="str">".haddock"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="str">".hs"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="str">".woff"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="str">".woff2"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="str">".svg"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="str">".svgz"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="str">".js"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="str">".devhelp2"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="str">".map"</span><span class="op">,</span> <span class="com"># Technically, dh_compress has this one case-sensitive</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="nam">ignore_special_cases</span> <span class="op">=</span> <span class="op">(</span><span class="str">"-gz"</span><span class="op">,</span> <span class="str">"-z"</span><span class="op">,</span> <span class="str">"_z"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="key">def</span> <span class="nam">_filtered_walk</span><span class="op">(</span><span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="key">for</span> <span class="nam">path</span><span class="op">,</span> <span class="nam">children</span> <span class="key">in</span> <span class="nam">path</span><span class="op">.</span><span class="nam">walk</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span><span class="op">.</span><span class="nam">name</span> <span class="key">in</span> <span class="nam">ignore_dir_basenames</span><span class="op">:</span> </span><span class="r"><span class="annotate short">174 ↛ 175</span><span class="annotate long">line 174 didn't jump to line 175, because the condition on line 174 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="nam">children</span><span class="op">.</span><span class="nam">clear</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_dir</span> <span class="key">and</span> <span class="nam">path</span><span class="op">.</span><span class="nam">name</span> <span class="op">==</span> <span class="str">"examples"</span><span class="op">:</span> </span><span class="r"><span class="annotate short">177 ↛ 179</span><span class="annotate long">line 177 didn't jump to line 179, because the condition on line 177 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="com"># Ignore anything beneath /usr/share/doc/*/examples</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="nam">parent</span> <span class="op">=</span> <span class="nam">path</span><span class="op">.</span><span class="nam">parent_dir</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="nam">grand_parent</span> <span class="op">=</span> <span class="nam">parent</span><span class="op">.</span><span class="nam">parent_dir</span> <span class="key">if</span> <span class="nam">parent</span> <span class="key">else</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="key">if</span> <span class="nam">grand_parent</span> <span class="key">and</span> <span class="nam">grand_parent</span><span class="op">.</span><span class="nam">absolute</span> <span class="op">==</span> <span class="str">"/usr/share/doc"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="nam">children</span><span class="op">.</span><span class="nam">clear</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="nam">name</span> <span class="op">=</span> <span class="nam">path</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="nam">path</span><span class="op">.</span><span class="nam">is_symlink</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="key">or</span> <span class="key">not</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_file</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="key">or</span> <span class="nam">name</span> <span class="key">in</span> <span class="nam">ignore_basenames</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="key">or</span> <span class="key">not</span> <span class="nam">path</span><span class="op">.</span><span class="nam">has_fs_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="nam">name_lc</span> <span class="op">=</span> <span class="nam">name</span><span class="op">.</span><span class="nam">lower</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="nam">_</span><span class="op">,</span> <span class="nam">ext</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">splitext</span><span class="op">(</span><span class="nam">name_lc</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="key">if</span> <span class="nam">ext</span> <span class="key">in</span> <span class="nam">ignore_extensions</span> <span class="key">or</span> <span class="nam">name_lc</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="nam">ignore_special_cases</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">196 ↛ 197</span><span class="annotate long">line 196 didn't jump to line 197, because the condition on line 196 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="key">yield</span> <span class="nam">path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="key">return</span> <span class="nam">_filtered_walk</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"><span class="key">def</span> <span class="nam">_find_compressable_paths</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="nam">path_filter</span> <span class="op">=</span> <span class="nam">_filter_compress_paths</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="key">for</span> <span class="nam">p</span><span class="op">,</span> <span class="nam">compress_size_threshold</span> <span class="key">in</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="op">(</span><span class="str">"./usr/share/info"</span><span class="op">,</span> <span class="num">0</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="op">(</span><span class="str">"./usr/share/man"</span><span class="op">,</span> <span class="num">0</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="op">(</span><span class="str">"./usr/share/doc"</span><span class="op">,</span> <span class="num">4096</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="nam">path</span> <span class="op">=</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="nam">p</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="nam">paths</span> <span class="op">=</span> <span class="nam">path_filter</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="key">if</span> <span class="nam">compress_size_threshold</span><span class="op">:</span> </span><span class="r"><span class="annotate short">215 ↛ 218</span><span class="annotate long">line 215 didn't jump to line 218, because the condition on line 215 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="com"># The special-case for changelog and NEWS is from dh_compress. Generally these files</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="com"># have always been compressed regardless of their size.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="nam">paths</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="nam">p</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">paths</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="key">if</span> <span class="nam">p</span><span class="op">.</span><span class="nam">size</span> <span class="op">></span> <span class="nam">compress_size_threshold</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="key">or</span> <span class="nam">p</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="op">(</span><span class="str">"changelog"</span><span class="op">,</span> <span class="str">"NEWS"</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">paths</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="nam">x11_path</span> <span class="op">=</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="str">"./usr/share/fonts/X11"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="key">if</span> <span class="nam">x11_path</span><span class="op">:</span> </span><span class="r"><span class="annotate short">226 ↛ 227</span><span class="annotate long">line 226 didn't jump to line 227, because the condition on line 226 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="nam">p</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">x11_path</span><span class="op">.</span><span class="nam">all_paths</span><span class="op">(</span><span class="op">)</span> <span class="key">if</span> <span class="nam">p</span><span class="op">.</span><span class="nam">is_file</span> <span class="key">and</span> <span class="nam">p</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">".pcf"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"><span class="key">def</span> <span class="nam">apply_compression</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> <span class="nam">_unused1</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> <span class="nam">_unused2</span><span class="op">:</span> <span class="nam">Any</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="com"># TODO: Support hardlinks</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="nam">compressed_files</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="key">for</span> <span class="nam">path</span> <span class="key">in</span> <span class="nam">_find_compressable_paths</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="nam">parent_dir</span> <span class="op">=</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">path</span><span class="op">.</span><span class="nam">parent_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="key">with</span> <span class="nam">parent_dir</span><span class="op">.</span><span class="nam">add_file</span><span class="op">(</span><span class="str">f"{path.name}.gz"</span><span class="op">,</span> <span class="nam">mtime</span><span class="op">=</span><span class="nam">path</span><span class="op">.</span><span class="nam">mtime</span><span class="op">)</span> <span class="key">as</span> <span class="nam">new_file</span><span class="op">,</span> <span class="nam">open</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="nam">new_file</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">,</span> <span class="str">"wb"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_call</span><span class="op">(</span><span class="op">[</span><span class="str">"gzip"</span><span class="op">,</span> <span class="str">"-9nc"</span><span class="op">,</span> <span class="nam">path</span><span class="op">.</span><span class="nam">fs_path</span><span class="op">]</span><span class="op">,</span> <span class="nam">stdout</span><span class="op">=</span><span class="nam">fd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="key">except</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">CalledProcessError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="nam">full_command</span> <span class="op">=</span> <span class="str">f"gzip -9nc {escape_shell(path.fs_path)} > {escape_shell(new_file.fs_path)}"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="str">f"The compression of {path.path} failed. Please review the error message from gzip to"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="str">f" understand what went wrong. Full command was: {full_command}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="nam">compressed_files</span><span class="op">[</span><span class="nam">path</span><span class="op">.</span><span class="nam">path</span><span class="op">]</span> <span class="op">=</span> <span class="nam">new_file</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="key">del</span> <span class="nam">parent_dir</span><span class="op">[</span><span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="nam">all_remaining_symlinks</span> <span class="op">=</span> <span class="op">{</span><span class="nam">p</span><span class="op">.</span><span class="nam">path</span><span class="op">:</span> <span class="nam">p</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">all_paths</span><span class="op">(</span><span class="op">)</span> <span class="key">if</span> <span class="nam">p</span><span class="op">.</span><span class="nam">is_symlink</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="nam">changed</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="key">while</span> <span class="nam">changed</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="nam">changed</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="nam">remaining</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">all_remaining_symlinks</span><span class="op">.</span><span class="nam">values</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="key">for</span> <span class="nam">symlink</span> <span class="key">in</span> <span class="nam">remaining</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="nam">target</span> <span class="op">=</span> <span class="nam">symlink</span><span class="op">.</span><span class="nam">readlink</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="nam">dir_target</span><span class="op">,</span> <span class="nam">basename_target</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="nam">target</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="nam">new_basename_target</span> <span class="op">=</span> <span class="str">f"{basename_target}.gz"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="nam">symlink_parent_dir</span> <span class="op">=</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">symlink</span><span class="op">.</span><span class="nam">parent_dir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="nam">dir_path</span> <span class="op">=</span> <span class="nam">symlink_parent_dir</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="key">if</span> <span class="nam">dir_target</span> <span class="op">!=</span> <span class="str">""</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="nam">dir_path</span> <span class="op">=</span> <span class="nam">dir_path</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="nam">dir_target</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"><span class="annotate short">264 ↛ 269</span><span class="annotate long">line 264 didn't jump to line 269</span></span></p> - <p class="pln"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="key">not</span> <span class="nam">dir_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="key">or</span> <span class="nam">basename_target</span> <span class="key">in</span> <span class="nam">dir_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="key">or</span> <span class="nam">new_basename_target</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">dir_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="key">del</span> <span class="nam">all_remaining_symlinks</span><span class="op">[</span><span class="nam">symlink</span><span class="op">.</span><span class="nam">path</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="nam">changed</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="nam">new_link_name</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="str">f"{symlink.name}.gz"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">symlink</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">".gz"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="key">else</span> <span class="nam">symlink</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="nam">symlink_parent_dir</span><span class="op">.</span><span class="nam">add_symlink</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="nam">new_link_name</span><span class="op">,</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">dir_target</span><span class="op">,</span> <span class="nam">new_basename_target</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="nam">symlink</span><span class="op">.</span><span class="nam">unlink</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"><span class="key">def</span> <span class="nam">_la_files</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="nam">lib_dir</span> <span class="op">=</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="str">"/usr/lib"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">lib_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="com"># Original code only iterators directly in /usr/lib. To be a faithful conversion, we do the same</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="com"># here.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="com"># Eagerly resolve the list as the replacement can trigger a runtime error otherwise</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="nam">paths</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">lib_dir</span><span class="op">.</span><span class="nam">iterdir</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="op">(</span><span class="nam">p</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">paths</span> <span class="key">if</span> <span class="nam">p</span><span class="op">.</span><span class="nam">is_file</span> <span class="key">and</span> <span class="nam">p</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">".la"</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"><span class="com"># Conceptually, the same feature that dh_gnome provides.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"><span class="com"># The clean_la_files function based on the dh_gnome version written by Luca Falavigna in 2010,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"><span class="com"># who in turn references a Makefile version of the feature.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"><span class="com"># https://salsa.debian.org/gnome-team/gnome-pkg-tools/-/commit/2868e1e41ea45443b0fb340bf4c71c4de87d4a5b</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"><span class="key">def</span> <span class="nam">clean_la_files</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="nam">_unused1</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="nam">_unused2</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> <span class="key">for</span> <span class="nam">path</span> <span class="key">in</span> <span class="nam">_la_files</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="nam">buffer</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> <span class="key">with</span> <span class="nam">path</span><span class="op">.</span><span class="nam">open</span><span class="op">(</span><span class="nam">byte_io</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="nam">replace_file</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="key">for</span> <span class="nam">line</span> <span class="key">in</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="key">if</span> <span class="nam">line</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">b"dependency_libs"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="nam">replacement</span> <span class="op">=</span> <span class="nam">_LA_DEP_LIB_RE</span><span class="op">.</span><span class="nam">sub</span><span class="op">(</span><span class="str">b"''"</span><span class="op">,</span> <span class="nam">line</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="key">if</span> <span class="nam">replacement</span> <span class="op">!=</span> <span class="nam">line</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="nam">replace_file</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="nam">line</span> <span class="op">=</span> <span class="nam">replacement</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="nam">buffer</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">line</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">replace_file</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">f"Clearing the dependency_libs line in {path.path}"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="key">with</span> <span class="nam">path</span><span class="op">.</span><span class="nam">replace_fs_path_content</span><span class="op">(</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fs_path</span><span class="op">,</span> <span class="nam">open</span><span class="op">(</span><span class="nam">fs_path</span><span class="op">,</span> <span class="str">"wb"</span><span class="op">)</span> <span class="key">as</span> <span class="nam">wfd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="nam">wfd</span><span class="op">.</span><span class="nam">writelines</span><span class="op">(</span><span class="nam">buffer</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_d5d6843b45eec01e_metadata_detectors_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_d5d6843b45eec01e_paths_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_d5d6843b45eec01e_paths_py.html b/coverage-report/d_d5d6843b45eec01e_paths_py.html deleted file mode 100644 index 1806c21..0000000 --- a/coverage-report/d_d5d6843b45eec01e_paths_py.html +++ /dev/null @@ -1,103 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/plugin/debputy/paths.py: 100%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/plugin/debputy/paths.py</b>: - <span class="pc_cov">100%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">4 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">4<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">0<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_d5d6843b45eec01e_package_processors_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_d5d6843b45eec01e_private_api_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="nam">GSETTINGS_SCHEMA_DIR</span> <span class="op">=</span> <span class="str">"/usr/share/glib-2.0/schemas"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="nam">INITRAMFS_HOOK_DIR</span> <span class="op">=</span> <span class="str">"/usr/share/initramfs-tools/hooks"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="nam">SYSTEMD_TMPFILES_DIR</span> <span class="op">=</span> <span class="str">"/usr/lib/tmpfiles.d"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="nam">SYSTEMD_SYSUSERS_DIR</span> <span class="op">=</span> <span class="str">"/usr/lib/sysusers.d"</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_d5d6843b45eec01e_package_processors_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_d5d6843b45eec01e_private_api_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_d5d6843b45eec01e_private_api_py.html b/coverage-report/d_d5d6843b45eec01e_private_api_py.html deleted file mode 100644 index 3843e05..0000000 --- a/coverage-report/d_d5d6843b45eec01e_private_api_py.html +++ /dev/null @@ -1,3030 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/plugin/debputy/private_api.py: 82%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/plugin/debputy/private_api.py</b>: - <span class="pc_cov">82%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">541 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">469<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">72<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">2<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">42<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_d5d6843b45eec01e_paths_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_d5d6843b45eec01e_service_management_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">ctypes</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">ctypes</span><span class="op">.</span><span class="nam">util</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">functools</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">import</span> <span class="nam">itertools</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">import</span> <span class="nam">textwrap</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">import</span> <span class="nam">time</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">from</span> <span class="nam">datetime</span> <span class="key">import</span> <span class="nam">datetime</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">cast</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">NotRequired</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">Type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">TypedDict</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">List</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">Annotated</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">Dict</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">Callable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"><span class="key">from</span> <span class="nam">debian</span><span class="op">.</span><span class="nam">changelog</span> <span class="key">import</span> <span class="nam">Changelog</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"><span class="key">from</span> <span class="nam">debian</span><span class="op">.</span><span class="nam">deb822</span> <span class="key">import</span> <span class="nam">Deb822</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span> <span class="key">import</span> <span class="nam">DEBPUTY_DOC_ROOT_DIR</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">_manifest_constants</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="nam">MK_CONFFILE_MANAGEMENT_X_OWNING_PACKAGE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="nam">MK_CONFFILE_MANAGEMENT_X_PRIOR_TO_VERSION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="nam">MK_INSTALLATIONS_INSTALL_EXAMPLES</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="nam">MK_INSTALLATIONS_INSTALL</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="nam">MK_INSTALLATIONS_INSTALL_DOCS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="nam">MK_INSTALLATIONS_INSTALL_MAN</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="nam">MK_INSTALLATIONS_DISCARD</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="nam">MK_INSTALLATIONS_MULTI_DEST_INSTALL</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">exceptions</span> <span class="key">import</span> <span class="nam">DebputyManifestVariableRequiresDebianDirError</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">installations</span> <span class="key">import</span> <span class="nam">InstallRule</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">maintscript_snippet</span> <span class="key">import</span> <span class="nam">DpkgMaintscriptHelperCommand</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_conditions</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="nam">ManifestCondition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">BinaryPackageContextArchMatchManifestCondition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">BuildProfileMatch</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="nam">SourceContextArchMatchManifestCondition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">base_types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="nam">DebputyParsedContent</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="nam">DebputyParsedContentStandardConditional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="nam">FileSystemMode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="nam">StaticFileSystemOwner</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="nam">StaticFileSystemGroup</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="nam">SymlinkTarget</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="nam">FileSystemExactMatchRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="nam">FileSystemMatchRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="nam">SymbolicMode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">TypeMapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="nam">OctalMode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="nam">FileSystemExactNonDirMatchRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">declarative_parser</span> <span class="key">import</span> <span class="nam">DebputyParseHint</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">exceptions</span> <span class="key">import</span> <span class="nam">ManifestParseException</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">mapper_code</span> <span class="key">import</span> <span class="nam">type_mapper_str2package</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">parser_data</span> <span class="key">import</span> <span class="nam">ParserContextData</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">AttributePath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">packages</span> <span class="key">import</span> <span class="nam">BinaryPackage</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">path_matcher</span> <span class="key">import</span> <span class="nam">ExactFileSystemPath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="nam">DebputyPluginInitializer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="nam">reference_documentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="nam">packager_provided_file_reference_documentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">impl</span> <span class="key">import</span> <span class="nam">DebputyPluginInitializerProvider</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">impl_types</span> <span class="key">import</span> <span class="nam">automatic_discard_rule_example</span><span class="op">,</span> <span class="nam">PPFFormatParam</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">spec</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="nam">type_mapping_reference_documentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="nam">type_mapping_example</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">debputy</span><span class="op">.</span><span class="nam">binary_package_rules</span> <span class="key">import</span> <span class="nam">register_binary_package_rules</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">debputy</span><span class="op">.</span><span class="nam">discard_rules</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="nam">_debputy_discard_pyc_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="nam">_debputy_prune_la_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="nam">_debputy_prune_doxygen_cruft</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="nam">_debputy_prune_binary_debian_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="nam">_debputy_prune_info_dir_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="nam">_debputy_prune_backup_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="nam">_debputy_prune_vcs_paths</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_root_rules</span> <span class="key">import</span> <span class="nam">register_manifest_root_rules</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">debputy</span><span class="op">.</span><span class="nam">package_processors</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="nam">process_manpages</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="nam">apply_compression</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="nam">clean_la_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">debputy</span><span class="op">.</span><span class="nam">service_management</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="nam">detect_systemd_service_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="nam">generate_snippets_for_systemd_units</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="nam">detect_sysv_init_service_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="nam">generate_snippets_for_init_scripts</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">debputy</span><span class="op">.</span><span class="nam">shlib_metadata_detectors</span> <span class="key">import</span> <span class="nam">detect_shlibdeps</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">debputy</span><span class="op">.</span><span class="nam">strip_non_determinism</span> <span class="key">import</span> <span class="nam">strip_non_determinism</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">substitution</span> <span class="key">import</span> <span class="nam">VariableContext</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">transformation_rules</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="nam">CreateSymlinkReplacementRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="nam">TransformationRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="nam">CreateDirectoryTransformationRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="nam">RemoveTransformationRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="nam">MoveTransformationRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="nam">PathMetadataTransformationRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="nam">CreateSymlinkPathTransformationRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="nam">_normalize_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="nam">PKGNAME_REGEX</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="nam">PKGVERSION_REGEX</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="nam">debian_policy_normalize_symlink_target</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="nam">active_profiles_match</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="nam">_error</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="nam">_warn</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="nam">_info</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="nam">assume_not_none</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"><span class="nam">_DOCUMENTED_DPKG_ARCH_TYPES</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="str">"HOST"</span><span class="op">:</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="str">"installed on"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="str">"The package will be **installed** on this type of machine / system"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="str">"BUILD"</span><span class="op">:</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="str">"compiled on"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="str">"The compilation of this package will be performed **on** this kind of machine / system"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="str">"TARGET"</span><span class="op">:</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="str">"cross-compiler output"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="str">"When building a cross-compiler, it will produce output for this kind of machine/system"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"><span class="nam">_DOCUMENTED_DPKG_ARCH_VARS</span> <span class="op">=</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="str">"ARCH"</span><span class="op">:</span> <span class="str">"Debian's name for the architecture"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="str">"ARCH_ABI"</span><span class="op">:</span> <span class="str">"Debian's name for the architecture ABI"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="str">"ARCH_BITS"</span><span class="op">:</span> <span class="str">"Number of bits in the pointer size"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="str">"ARCH_CPU"</span><span class="op">:</span> <span class="str">"Debian's name for the CPU type"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="str">"ARCH_ENDIAN"</span><span class="op">:</span> <span class="str">"Endianness of the architecture (little/big)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="str">"ARCH_LIBC"</span><span class="op">:</span> <span class="str">"Debian's name for the libc implementation"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="str">"ARCH_OS"</span><span class="op">:</span> <span class="str">"Debian name for the OS/kernel"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="str">"GNU_CPU"</span><span class="op">:</span> <span class="str">"GNU's name for the CPU"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="str">"GNU_SYSTEM"</span><span class="op">:</span> <span class="str">"GNU's name for the system"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="str">"GNU_TYPE"</span><span class="op">:</span> <span class="str">"GNU system type (GNU_CPU and GNU_SYSTEM combined)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="str">"MULTIARCH"</span><span class="op">:</span> <span class="str">"Multi-arch tuple"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"><span class="key">def</span> <span class="nam">_manifest_format_doc</span><span class="op">(</span><span class="nam">anchor</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="key">return</span> <span class="str">f"{DEBPUTY_DOC_ROOT_DIR}/MANIFEST-FORMAT.md#{anchor}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"><span class="op">@</span><span class="nam">functools</span><span class="op">.</span><span class="nam">lru_cache</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"><span class="key">def</span> <span class="nam">load_libcap</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">bool</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">bool</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="nam">cap_library_path</span> <span class="op">=</span> <span class="nam">ctypes</span><span class="op">.</span><span class="nam">util</span><span class="op">.</span><span class="nam">find_library</span><span class="op">(</span><span class="str">"cap.so"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="nam">has_libcap</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="nam">libcap</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="key">if</span> <span class="nam">cap_library_path</span><span class="op">:</span> </span><span class="r"><span class="annotate short">165 ↛ 172</span><span class="annotate long">line 165 didn't jump to line 172, because the condition on line 165 was never false</span></span></p> - <p class="run"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="nam">libcap</span> <span class="op">=</span> <span class="nam">ctypes</span><span class="op">.</span><span class="nam">cdll</span><span class="op">.</span><span class="nam">LoadLibrary</span><span class="op">(</span><span class="nam">cap_library_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="nam">has_libcap</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="key">except</span> <span class="nam">OSError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="key">if</span> <span class="nam">libcap</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">172 ↛ 173</span><span class="annotate long">line 172 didn't jump to line 173, because the condition on line 172 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">warned</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="key">def</span> <span class="nam">_is_valid_cap</span><span class="op">(</span><span class="nam">cap</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="key">nonlocal</span> <span class="nam">warned</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">warned</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="str">"Could not load libcap.so; will not validate capabilities. Use `apt install libcap2` to provide"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="str">" checking of capabilities."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="nam">warned</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="com"># cap_t cap_from_text(const char *path_p)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="nam">libcap</span><span class="op">.</span><span class="nam">cap_from_text</span><span class="op">.</span><span class="nam">argtypes</span> <span class="op">=</span> <span class="op">[</span><span class="nam">ctypes</span><span class="op">.</span><span class="nam">c_char_p</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="nam">libcap</span><span class="op">.</span><span class="nam">cap_from_text</span><span class="op">.</span><span class="nam">restype</span> <span class="op">=</span> <span class="nam">ctypes</span><span class="op">.</span><span class="nam">c_char_p</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="nam">libcap</span><span class="op">.</span><span class="nam">cap_free</span><span class="op">.</span><span class="nam">argtypes</span> <span class="op">=</span> <span class="op">[</span><span class="nam">ctypes</span><span class="op">.</span><span class="nam">c_void_p</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="nam">libcap</span><span class="op">.</span><span class="nam">cap_free</span><span class="op">.</span><span class="nam">restype</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="key">def</span> <span class="nam">_is_valid_cap</span><span class="op">(</span><span class="nam">cap</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="nam">cap_t</span> <span class="op">=</span> <span class="nam">libcap</span><span class="op">.</span><span class="nam">cap_from_text</span><span class="op">(</span><span class="nam">cap</span><span class="op">.</span><span class="nam">encode</span><span class="op">(</span><span class="str">"utf-8"</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="nam">ok</span> <span class="op">=</span> <span class="nam">cap_t</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="nam">libcap</span><span class="op">.</span><span class="nam">cap_free</span><span class="op">(</span><span class="nam">cap_t</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="key">return</span> <span class="nam">ok</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="key">return</span> <span class="nam">has_libcap</span><span class="op">,</span> <span class="nam">cap_library_path</span><span class="op">,</span> <span class="nam">_is_valid_cap</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"><span class="key">def</span> <span class="nam">check_cap_checker</span><span class="op">(</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="key">None</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="nam">_</span><span class="op">,</span> <span class="nam">libcap_path</span><span class="op">,</span> <span class="nam">is_valid_cap</span> <span class="op">=</span> <span class="nam">load_libcap</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="nam">seen_cap</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="key">def</span> <span class="nam">_check_cap</span><span class="op">(</span><span class="nam">cap</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="key">if</span> <span class="nam">cap</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">seen_cap</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">is_valid_cap</span><span class="op">(</span><span class="nam">cap</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="nam">seen_cap</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">cap</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="nam">cap_path</span> <span class="op">=</span> <span class="str">f" ({libcap_path})"</span> <span class="key">if</span> <span class="nam">libcap_path</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">else</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="str">f'The capabilities "{cap}" provided in {definition_source} were not understood by'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="str">f" libcap.so{cap_path}. Please verify you provided the correct capabilities."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="str">f" Note: This warning can be a false-positive if you are targeting a newer libcap.so"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="str">f" than the one installed on this system."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="key">return</span> <span class="nam">_check_cap</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"><span class="key">def</span> <span class="nam">load_source_variables</span><span class="op">(</span><span class="nam">variable_context</span><span class="op">:</span> <span class="nam">VariableContext</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="nam">changelog</span> <span class="op">=</span> <span class="nam">variable_context</span><span class="op">.</span><span class="nam">debian_dir</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="str">"changelog"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="key">if</span> <span class="nam">changelog</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="key">raise</span> <span class="nam">DebputyManifestVariableRequiresDebianDirError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="str">"The changelog was not present"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="key">with</span> <span class="nam">changelog</span><span class="op">.</span><span class="nam">open</span><span class="op">(</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="nam">dch</span> <span class="op">=</span> <span class="nam">Changelog</span><span class="op">(</span><span class="nam">fd</span><span class="op">,</span> <span class="nam">max_blocks</span><span class="op">=</span><span class="num">2</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="key">except</span> <span class="nam">FileNotFoundError</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="key">raise</span> <span class="nam">DebputyManifestVariableRequiresDebianDirError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="str">"The changelog was not present"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="op">)</span> <span class="key">from</span> <span class="nam">e</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="nam">first_entry</span> <span class="op">=</span> <span class="nam">dch</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="nam">first_non_binnmu_entry</span> <span class="op">=</span> <span class="nam">dch</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="key">if</span> <span class="nam">first_non_binnmu_entry</span><span class="op">.</span><span class="nam">other_pairs</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"binary-only"</span><span class="op">,</span> <span class="str">"no"</span><span class="op">)</span> <span class="op">==</span> <span class="str">"yes"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="nam">first_non_binnmu_entry</span> <span class="op">=</span> <span class="nam">dch</span><span class="op">[</span><span class="num">1</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="key">assert</span> <span class="nam">first_non_binnmu_entry</span><span class="op">.</span><span class="nam">other_pairs</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"binary-only"</span><span class="op">,</span> <span class="str">"no"</span><span class="op">)</span> <span class="op">==</span> <span class="str">"no"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="nam">source_version</span> <span class="op">=</span> <span class="nam">first_entry</span><span class="op">.</span><span class="nam">version</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="nam">epoch</span> <span class="op">=</span> <span class="nam">source_version</span><span class="op">.</span><span class="nam">epoch</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="nam">upstream_version</span> <span class="op">=</span> <span class="nam">source_version</span><span class="op">.</span><span class="nam">upstream_version</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="nam">debian_revision</span> <span class="op">=</span> <span class="nam">source_version</span><span class="op">.</span><span class="nam">debian_revision</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="nam">epoch_upstream</span> <span class="op">=</span> <span class="nam">upstream_version</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="nam">upstream_debian_revision</span> <span class="op">=</span> <span class="nam">upstream_version</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="key">if</span> <span class="nam">epoch</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">epoch</span> <span class="op">!=</span> <span class="str">""</span><span class="op">:</span> </span><span class="r"><span class="annotate short">245 ↛ 247</span><span class="annotate long">line 245 didn't jump to line 247, because the condition on line 245 was never false</span></span></p> - <p class="run"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="nam">epoch_upstream</span> <span class="op">=</span> <span class="str">f"{epoch}:{upstream_version}"</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="key">if</span> <span class="nam">debian_revision</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">debian_revision</span> <span class="op">!=</span> <span class="str">""</span><span class="op">:</span> </span><span class="r"><span class="annotate short">247 ↛ 250</span><span class="annotate long">line 247 didn't jump to line 250, because the condition on line 247 was never false</span></span></p> - <p class="run"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="nam">upstream_debian_revision</span> <span class="op">=</span> <span class="str">f"{upstream_version}-{debian_revision}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="nam">package</span> <span class="op">=</span> <span class="nam">first_entry</span><span class="op">.</span><span class="nam">package</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="key">if</span> <span class="nam">package</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">251 ↛ 252</span><span class="annotate long">line 251 didn't jump to line 252, because the condition on line 251 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span><span class="str">"Cannot determine the source package name from debian/changelog."</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="nam">date</span> <span class="op">=</span> <span class="nam">first_entry</span><span class="op">.</span><span class="nam">date</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="key">if</span> <span class="nam">date</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">255 ↛ 259</span><span class="annotate long">line 255 didn't jump to line 259, because the condition on line 255 was never false</span></span></p> - <p class="run"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="nam">local_time</span> <span class="op">=</span> <span class="nam">datetime</span><span class="op">.</span><span class="nam">strptime</span><span class="op">(</span><span class="nam">date</span><span class="op">,</span> <span class="str">"%a, %d %b %Y %H:%M:%S %z"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="nam">source_date_epoch</span> <span class="op">=</span> <span class="nam">str</span><span class="op">(</span><span class="nam">int</span><span class="op">(</span><span class="nam">local_time</span><span class="op">.</span><span class="nam">timestamp</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="str">"The latest changelog entry does not have a (parsable) date, using current time"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="str">" for SOURCE_DATE_EPOCH"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="nam">source_date_epoch</span> <span class="op">=</span> <span class="nam">str</span><span class="op">(</span><span class="nam">int</span><span class="op">(</span><span class="nam">time</span><span class="op">.</span><span class="nam">time</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="key">if</span> <span class="nam">first_non_binnmu_entry</span> <span class="key">is</span> <span class="key">not</span> <span class="nam">first_entry</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="nam">non_binnmu_date</span> <span class="op">=</span> <span class="nam">first_non_binnmu_entry</span><span class="op">.</span><span class="nam">date</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="key">if</span> <span class="nam">non_binnmu_date</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">267 ↛ 271</span><span class="annotate long">line 267 didn't jump to line 271, because the condition on line 267 was never false</span></span></p> - <p class="run"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="nam">local_time</span> <span class="op">=</span> <span class="nam">datetime</span><span class="op">.</span><span class="nam">strptime</span><span class="op">(</span><span class="nam">non_binnmu_date</span><span class="op">,</span> <span class="str">"%a, %d %b %Y %H:%M:%S %z"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="nam">snd_source_date_epoch</span> <span class="op">=</span> <span class="nam">str</span><span class="op">(</span><span class="nam">int</span><span class="op">(</span><span class="nam">local_time</span><span class="op">.</span><span class="nam">timestamp</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="str">"The latest (non-binNMU) changelog entry does not have a (parsable) date, using current time"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="str">" for SOURCE_DATE_EPOCH (for strip-nondeterminism)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="nam">snd_source_date_epoch</span> <span class="op">=</span> <span class="nam">source_date_epoch</span> <span class="op">=</span> <span class="nam">str</span><span class="op">(</span><span class="nam">int</span><span class="op">(</span><span class="nam">time</span><span class="op">.</span><span class="nam">time</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="nam">snd_source_date_epoch</span> <span class="op">=</span> <span class="nam">source_date_epoch</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="key">return</span> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="str">"DEB_SOURCE"</span><span class="op">:</span> <span class="nam">package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="str">"DEB_VERSION"</span><span class="op">:</span> <span class="nam">source_version</span><span class="op">.</span><span class="nam">full_version</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="str">"DEB_VERSION_EPOCH_UPSTREAM"</span><span class="op">:</span> <span class="nam">epoch_upstream</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="str">"DEB_VERSION_UPSTREAM_REVISION"</span><span class="op">:</span> <span class="nam">upstream_debian_revision</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="str">"DEB_VERSION_UPSTREAM"</span><span class="op">:</span> <span class="nam">upstream_version</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="str">"SOURCE_DATE_EPOCH"</span><span class="op">:</span> <span class="nam">source_date_epoch</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="str">"_DEBPUTY_INTERNAL_NON_BINNMU_SOURCE"</span><span class="op">:</span> <span class="nam">str</span><span class="op">(</span><span class="nam">first_non_binnmu_entry</span><span class="op">.</span><span class="nam">version</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="str">"_DEBPUTY_SND_SOURCE_DATE_EPOCH"</span><span class="op">:</span> <span class="nam">snd_source_date_epoch</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"><span class="key">def</span> <span class="nam">initialize_via_private_api</span><span class="op">(</span><span class="nam">public_api</span><span class="op">:</span> <span class="nam">DebputyPluginInitializer</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="nam">api</span> <span class="op">=</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"DebputyPluginInitializerProvider"</span><span class="op">,</span> <span class="nam">public_api</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">metadata_or_maintscript_detector</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> <span class="str">"dpkg-shlibdeps"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="com"># Private because detect_shlibdeps expects private API (hench this cast)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> <span class="nam">cast</span><span class="op">(</span><span class="str">"MetadataAutoDetector"</span><span class="op">,</span> <span class="nam">detect_shlibdeps</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="nam">package_type</span><span class="op">=</span><span class="op">{</span><span class="str">"deb"</span><span class="op">,</span> <span class="str">"udeb"</span><span class="op">}</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="nam">register_type_mappings</span><span class="op">(</span><span class="nam">api</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="nam">register_variables_via_private_api</span><span class="op">(</span><span class="nam">api</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="nam">document_builtin_variables</span><span class="op">(</span><span class="nam">api</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="nam">register_automatic_discard_rules</span><span class="op">(</span><span class="nam">api</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="nam">register_special_ppfs</span><span class="op">(</span><span class="nam">api</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> <span class="nam">register_install_rules</span><span class="op">(</span><span class="nam">api</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="nam">register_transformation_rules</span><span class="op">(</span><span class="nam">api</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> <span class="nam">register_manifest_condition_rules</span><span class="op">(</span><span class="nam">api</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="nam">register_dpkg_conffile_rules</span><span class="op">(</span><span class="nam">api</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="nam">register_processing_steps</span><span class="op">(</span><span class="nam">api</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="nam">register_service_managers</span><span class="op">(</span><span class="nam">api</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="nam">register_manifest_root_rules</span><span class="op">(</span><span class="nam">api</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="nam">register_binary_package_rules</span><span class="op">(</span><span class="nam">api</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"><span class="key">def</span> <span class="nam">register_type_mappings</span><span class="op">(</span><span class="nam">api</span><span class="op">:</span> <span class="nam">DebputyPluginInitializerProvider</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">register_mapped_type</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="nam">TypeMapping</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> <span class="nam">FileSystemMatchRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="nam">FileSystemMatchRule</span><span class="op">.</span><span class="nam">parse_path_match</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="nam">reference_documentation</span><span class="op">=</span><span class="nam">type_mapping_reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"><span class="str"> A generic file system path match with globs.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"><span class="str"> Manifest variable substitution will be applied and glob expansion will be performed.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"><span class="str"> The match will be read as one of the following cases:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"><span class="str"> - Exact path match if there is no globs characters like `usr/bin/debputy`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"><span class="str"> - A basename glob like `*.txt` or `**/foo`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"><span class="str"> - A generic path glob otherwise like `usr/lib/*.so*`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"><span class="str"> Except for basename globs, all matches are always relative to the root directory of</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"><span class="str"> the match, which is typically the package root directory or a search directory.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"><span class="str"> For basename globs, any path matching that basename beneath the package root directory</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"><span class="str"> or relevant search directories will match.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"><span class="str"> Please keep in mind that:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"><span class="str"> * glob patterns often have to be quoted as YAML interpret the glob metacharacter as</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"><span class="str"> an anchor reference.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"><span class="str"> * Directories can be matched via this type. Whether the rule using this type</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"><span class="str"> recurse into the directory depends on the usage and not this type. Related, if</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"><span class="str"> value for this rule ends with a literal "/", then the definition can *only* match</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"><span class="str"> directories (similar to the shell).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"><span class="str"> * path matches involving glob expansion are often subject to different rules than</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"><span class="str"> path matches without them. As an example, automatic discard rules does not apply</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"><span class="str"> to exact path matches, but they will filter out glob matches.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"><span class="str"> """</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"> <span class="nam">examples</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"> <span class="nam">type_mapping_example</span><span class="op">(</span><span class="str">"usr/bin/debputy"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"> <span class="nam">type_mapping_example</span><span class="op">(</span><span class="str">"*.txt"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"> <span class="nam">type_mapping_example</span><span class="op">(</span><span class="str">"**/foo"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"> <span class="nam">type_mapping_example</span><span class="op">(</span><span class="str">"usr/lib/*.so*"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"> <span class="nam">type_mapping_example</span><span class="op">(</span><span class="str">"usr/share/foo/data-*/"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">register_mapped_type</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"> <span class="nam">TypeMapping</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"> <span class="nam">FileSystemExactMatchRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"> <span class="nam">FileSystemExactMatchRule</span><span class="op">.</span><span class="nam">parse_path_match</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"> <span class="nam">reference_documentation</span><span class="op">=</span><span class="nam">type_mapping_reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"><span class="str"> A file system match that does **not** expand globs.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"><span class="str"> Manifest variable substitution will be applied. However, globs will not be expanded.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"><span class="str"> Any glob metacharacters will be interpreted as a literal part of path.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"><span class="str"> Note that a directory can be matched via this type. Whether the rule using this type</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"><span class="str"> recurse into the directory depends on the usage and is not defined by this type.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"><span class="str"> Related, if value for this rule ends with a literal "/", then the definition can</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"><span class="str"> *only* match directories (similar to the shell).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"><span class="str"> """</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t385" href="#t385">385</a></span><span class="t"> <span class="nam">examples</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t386" href="#t386">386</a></span><span class="t"> <span class="nam">type_mapping_example</span><span class="op">(</span><span class="str">"usr/bin/dpkg"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t387" href="#t387">387</a></span><span class="t"> <span class="nam">type_mapping_example</span><span class="op">(</span><span class="str">"usr/share/foo/"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t388" href="#t388">388</a></span><span class="t"> <span class="nam">type_mapping_example</span><span class="op">(</span><span class="str">"usr/share/foo/data.txt"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t389" href="#t389">389</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t390" href="#t390">390</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t391" href="#t391">391</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t392" href="#t392">392</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t393" href="#t393">393</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">register_mapped_type</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t394" href="#t394">394</a></span><span class="t"> <span class="nam">TypeMapping</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t395" href="#t395">395</a></span><span class="t"> <span class="nam">FileSystemExactNonDirMatchRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t396" href="#t396">396</a></span><span class="t"> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t397" href="#t397">397</a></span><span class="t"> <span class="nam">FileSystemExactNonDirMatchRule</span><span class="op">.</span><span class="nam">parse_path_match</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t398" href="#t398">398</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t399" href="#t399">399</a></span><span class="t"> <span class="nam">reference_documentation</span><span class="op">=</span><span class="nam">type_mapping_reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t400" href="#t400">400</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t401" href="#t401">401</a></span><span class="t"> <span class="str">f"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t402" href="#t402">402</a></span><span class="t"><span class="str"> A file system match that does **not** expand globs and must not match a directory.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t403" href="#t403">403</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t404" href="#t404">404</a></span><span class="t"><span class="str"> Manifest variable substitution will be applied. However, globs will not be expanded.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t405" href="#t405">405</a></span><span class="t"><span class="str"> Any glob metacharacters will be interpreted as a literal part of path.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t406" href="#t406">406</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t407" href="#t407">407</a></span><span class="t"><span class="str"> This is like {FileSystemExactMatchRule.__name__} except that the match will fail if the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t408" href="#t408">408</a></span><span class="t"><span class="str"> provided path matches a directory. Since a directory cannot be matched, it is an error</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t409" href="#t409">409</a></span><span class="t"><span class="str"> for any input to end with a "/" as only directories can be matched if the path ends</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t410" href="#t410">410</a></span><span class="t"><span class="str"> with a "/".</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t411" href="#t411">411</a></span><span class="t"><span class="str"> """</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t412" href="#t412">412</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t413" href="#t413">413</a></span><span class="t"> <span class="nam">examples</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t414" href="#t414">414</a></span><span class="t"> <span class="nam">type_mapping_example</span><span class="op">(</span><span class="str">"usr/bin/dh_debputy"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t415" href="#t415">415</a></span><span class="t"> <span class="nam">type_mapping_example</span><span class="op">(</span><span class="str">"usr/share/foo/data.txt"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t416" href="#t416">416</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t417" href="#t417">417</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t418" href="#t418">418</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t419" href="#t419">419</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t420" href="#t420">420</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">register_mapped_type</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t421" href="#t421">421</a></span><span class="t"> <span class="nam">TypeMapping</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t422" href="#t422">422</a></span><span class="t"> <span class="nam">SymlinkTarget</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t423" href="#t423">423</a></span><span class="t"> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t424" href="#t424">424</a></span><span class="t"> <span class="key">lambda</span> <span class="nam">v</span><span class="op">,</span> <span class="nam">ap</span><span class="op">,</span> <span class="nam">pc</span><span class="op">:</span> <span class="nam">SymlinkTarget</span><span class="op">.</span><span class="nam">parse_symlink_target</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t425" href="#t425">425</a></span><span class="t"> <span class="nam">v</span><span class="op">,</span> <span class="nam">ap</span><span class="op">,</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">pc</span><span class="op">)</span><span class="op">.</span><span class="nam">substitution</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t426" href="#t426">426</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t427" href="#t427">427</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t428" href="#t428">428</a></span><span class="t"> <span class="nam">reference_documentation</span><span class="op">=</span><span class="nam">type_mapping_reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t429" href="#t429">429</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t430" href="#t430">430</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t431" href="#t431">431</a></span><span class="t"><span class="str"> A symlink target.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t432" href="#t432">432</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t433" href="#t433">433</a></span><span class="t"><span class="str"> Manifest variable substitution will be applied. This is distinct from an exact file</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t434" href="#t434">434</a></span><span class="t"><span class="str"> system match in that a symlink target is not relative to the package root by default</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t435" href="#t435">435</a></span><span class="t"><span class="str"> (explicitly prefix for "/" for absolute path targets)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t436" href="#t436">436</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t437" href="#t437">437</a></span><span class="t"><span class="str"> Note that `debputy` will policy normalize symlinks when assembling the deb, so</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t438" href="#t438">438</a></span><span class="t"><span class="str"> use of relative or absolute symlinks comes down to preference.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t439" href="#t439">439</a></span><span class="t"><span class="str"> """</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t440" href="#t440">440</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t441" href="#t441">441</a></span><span class="t"> <span class="nam">examples</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t442" href="#t442">442</a></span><span class="t"> <span class="nam">type_mapping_example</span><span class="op">(</span><span class="str">"../foo"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t443" href="#t443">443</a></span><span class="t"> <span class="nam">type_mapping_example</span><span class="op">(</span><span class="str">"/usr/share/doc/bar"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t444" href="#t444">444</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t445" href="#t445">445</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t446" href="#t446">446</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t447" href="#t447">447</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t448" href="#t448">448</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">register_mapped_type</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t449" href="#t449">449</a></span><span class="t"> <span class="nam">TypeMapping</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t450" href="#t450">450</a></span><span class="t"> <span class="nam">StaticFileSystemOwner</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t451" href="#t451">451</a></span><span class="t"> <span class="nam">Union</span><span class="op">[</span><span class="nam">int</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t452" href="#t452">452</a></span><span class="t"> <span class="key">lambda</span> <span class="nam">v</span><span class="op">,</span> <span class="nam">ap</span><span class="op">,</span> <span class="nam">_</span><span class="op">:</span> <span class="nam">StaticFileSystemOwner</span><span class="op">.</span><span class="nam">from_manifest_value</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">ap</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t453" href="#t453">453</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t454" href="#t454">454</a></span><span class="t"> <span class="nam">reference_documentation</span><span class="op">=</span><span class="nam">type_mapping_reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t455" href="#t455">455</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t456" href="#t456">456</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t457" href="#t457">457</a></span><span class="t"><span class="str"> File system owner reference that is part of the passwd base data (such as "root").</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t458" href="#t458">458</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t459" href="#t459">459</a></span><span class="t"><span class="str"> The group can be provided in either of the following three forms:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t460" href="#t460">460</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t461" href="#t461">461</a></span><span class="t"><span class="str"> * A name (recommended), such as "root"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t462" href="#t462">462</a></span><span class="t"><span class="str"> * The UID in the form of an integer (that is, no quoting), such as 0 (for "root")</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t463" href="#t463">463</a></span><span class="t"><span class="str"> * The name and the UID separated by colon such as "root:0" (for "root").</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t464" href="#t464">464</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t465" href="#t465">465</a></span><span class="t"><span class="str"> Note in the last case, the `debputy` will validate that the name and the UID match.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t466" href="#t466">466</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t467" href="#t467">467</a></span><span class="t"><span class="str"> Some owners (such as "nobody") are deliberately disallowed.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t468" href="#t468">468</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t469" href="#t469">469</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t470" href="#t470">470</a></span><span class="t"> <span class="nam">examples</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t471" href="#t471">471</a></span><span class="t"> <span class="nam">type_mapping_example</span><span class="op">(</span><span class="str">"root"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t472" href="#t472">472</a></span><span class="t"> <span class="nam">type_mapping_example</span><span class="op">(</span><span class="num">0</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t473" href="#t473">473</a></span><span class="t"> <span class="nam">type_mapping_example</span><span class="op">(</span><span class="str">"root:0"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t474" href="#t474">474</a></span><span class="t"> <span class="nam">type_mapping_example</span><span class="op">(</span><span class="str">"bin"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t475" href="#t475">475</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t476" href="#t476">476</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t477" href="#t477">477</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t478" href="#t478">478</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">register_mapped_type</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t479" href="#t479">479</a></span><span class="t"> <span class="nam">TypeMapping</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t480" href="#t480">480</a></span><span class="t"> <span class="nam">StaticFileSystemGroup</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t481" href="#t481">481</a></span><span class="t"> <span class="nam">Union</span><span class="op">[</span><span class="nam">int</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t482" href="#t482">482</a></span><span class="t"> <span class="key">lambda</span> <span class="nam">v</span><span class="op">,</span> <span class="nam">ap</span><span class="op">,</span> <span class="nam">_</span><span class="op">:</span> <span class="nam">StaticFileSystemGroup</span><span class="op">.</span><span class="nam">from_manifest_value</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">ap</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t483" href="#t483">483</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t484" href="#t484">484</a></span><span class="t"> <span class="nam">reference_documentation</span><span class="op">=</span><span class="nam">type_mapping_reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t485" href="#t485">485</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t486" href="#t486">486</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t487" href="#t487">487</a></span><span class="t"><span class="str"> File system group reference that is part of the passwd base data (such as "root").</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t488" href="#t488">488</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t489" href="#t489">489</a></span><span class="t"><span class="str"> The group can be provided in either of the following three forms:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t490" href="#t490">490</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t491" href="#t491">491</a></span><span class="t"><span class="str"> * A name (recommended), such as "root"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t492" href="#t492">492</a></span><span class="t"><span class="str"> * The GID in the form of an integer (that is, no quoting), such as 0 (for "root")</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t493" href="#t493">493</a></span><span class="t"><span class="str"> * The name and the GID separated by colon such as "root:0" (for "root").</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t494" href="#t494">494</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t495" href="#t495">495</a></span><span class="t"><span class="str"> Note in the last case, the `debputy` will validate that the name and the GID match.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t496" href="#t496">496</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t497" href="#t497">497</a></span><span class="t"><span class="str"> Some owners (such as "nobody") are deliberately disallowed.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t498" href="#t498">498</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t499" href="#t499">499</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t500" href="#t500">500</a></span><span class="t"> <span class="nam">examples</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t501" href="#t501">501</a></span><span class="t"> <span class="nam">type_mapping_example</span><span class="op">(</span><span class="str">"root"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t502" href="#t502">502</a></span><span class="t"> <span class="nam">type_mapping_example</span><span class="op">(</span><span class="num">0</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t503" href="#t503">503</a></span><span class="t"> <span class="nam">type_mapping_example</span><span class="op">(</span><span class="str">"root:0"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t504" href="#t504">504</a></span><span class="t"> <span class="nam">type_mapping_example</span><span class="op">(</span><span class="str">"tty"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t505" href="#t505">505</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t506" href="#t506">506</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t507" href="#t507">507</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t508" href="#t508">508</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t509" href="#t509">509</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">register_mapped_type</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t510" href="#t510">510</a></span><span class="t"> <span class="nam">TypeMapping</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t511" href="#t511">511</a></span><span class="t"> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t512" href="#t512">512</a></span><span class="t"> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t513" href="#t513">513</a></span><span class="t"> <span class="nam">type_mapper_str2package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t514" href="#t514">514</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t515" href="#t515">515</a></span><span class="t"> <span class="nam">reference_documentation</span><span class="op">=</span><span class="nam">type_mapping_reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t516" href="#t516">516</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="str">"Name of a package in debian/control"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t517" href="#t517">517</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t518" href="#t518">518</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t519" href="#t519">519</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t520" href="#t520">520</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">register_mapped_type</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t521" href="#t521">521</a></span><span class="t"> <span class="nam">TypeMapping</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t522" href="#t522">522</a></span><span class="t"> <span class="nam">FileSystemMode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t523" href="#t523">523</a></span><span class="t"> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t524" href="#t524">524</a></span><span class="t"> <span class="key">lambda</span> <span class="nam">v</span><span class="op">,</span> <span class="nam">ap</span><span class="op">,</span> <span class="nam">_</span><span class="op">:</span> <span class="nam">FileSystemMode</span><span class="op">.</span><span class="nam">parse_filesystem_mode</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">ap</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t525" href="#t525">525</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t526" href="#t526">526</a></span><span class="t"> <span class="nam">reference_documentation</span><span class="op">=</span><span class="nam">type_mapping_reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t527" href="#t527">527</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="str">"Either an octal mode or symbolic mode"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t528" href="#t528">528</a></span><span class="t"> <span class="nam">examples</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t529" href="#t529">529</a></span><span class="t"> <span class="nam">type_mapping_example</span><span class="op">(</span><span class="str">"a+x"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t530" href="#t530">530</a></span><span class="t"> <span class="nam">type_mapping_example</span><span class="op">(</span><span class="str">"u=rwX,go=rX"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t531" href="#t531">531</a></span><span class="t"> <span class="nam">type_mapping_example</span><span class="op">(</span><span class="str">"0755"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t532" href="#t532">532</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t533" href="#t533">533</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t534" href="#t534">534</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t535" href="#t535">535</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">register_mapped_type</span><span class="op">(</span> </span><span class="r"><span class="annotate short">535 ↛ exit</span><span class="annotate long">line 535 didn't jump to the function exit</span></span></p> - <p class="pln"><span class="n"><a id="t536" href="#t536">536</a></span><span class="t"> <span class="nam">TypeMapping</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t537" href="#t537">537</a></span><span class="t"> <span class="nam">OctalMode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t538" href="#t538">538</a></span><span class="t"> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t539" href="#t539">539</a></span><span class="t"> <span class="key">lambda</span> <span class="nam">v</span><span class="op">,</span> <span class="nam">ap</span><span class="op">,</span> <span class="nam">_</span><span class="op">:</span> <span class="nam">OctalMode</span><span class="op">.</span><span class="nam">parse_filesystem_mode</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">ap</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t540" href="#t540">540</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t541" href="#t541">541</a></span><span class="t"> <span class="nam">reference_documentation</span><span class="op">=</span><span class="nam">type_mapping_reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t542" href="#t542">542</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="str">"An octal mode. Must always be a string."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t543" href="#t543">543</a></span><span class="t"> <span class="nam">examples</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t544" href="#t544">544</a></span><span class="t"> <span class="nam">type_mapping_example</span><span class="op">(</span><span class="str">"0644"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t545" href="#t545">545</a></span><span class="t"> <span class="nam">type_mapping_example</span><span class="op">(</span><span class="str">"0755"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t546" href="#t546">546</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t547" href="#t547">547</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t548" href="#t548">548</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t549" href="#t549">549</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t550" href="#t550">550</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t551" href="#t551">551</a></span><span class="t"><span class="key">def</span> <span class="nam">register_service_managers</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t552" href="#t552">552</a></span><span class="t"> <span class="nam">api</span><span class="op">:</span> <span class="nam">DebputyPluginInitializerProvider</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t553" href="#t553">553</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t554" href="#t554">554</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">service_provider</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t555" href="#t555">555</a></span><span class="t"> <span class="str">"systemd"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t556" href="#t556">556</a></span><span class="t"> <span class="nam">detect_systemd_service_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t557" href="#t557">557</a></span><span class="t"> <span class="nam">generate_snippets_for_systemd_units</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t558" href="#t558">558</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t559" href="#t559">559</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">service_provider</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t560" href="#t560">560</a></span><span class="t"> <span class="str">"sysvinit"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t561" href="#t561">561</a></span><span class="t"> <span class="nam">detect_sysv_init_service_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t562" href="#t562">562</a></span><span class="t"> <span class="nam">generate_snippets_for_init_scripts</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t563" href="#t563">563</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t564" href="#t564">564</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t565" href="#t565">565</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t566" href="#t566">566</a></span><span class="t"><span class="key">def</span> <span class="nam">register_automatic_discard_rules</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t567" href="#t567">567</a></span><span class="t"> <span class="nam">api</span><span class="op">:</span> <span class="nam">DebputyPluginInitializerProvider</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t568" href="#t568">568</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t569" href="#t569">569</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">automatic_discard_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t570" href="#t570">570</a></span><span class="t"> <span class="str">"python-cache-files"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t571" href="#t571">571</a></span><span class="t"> <span class="nam">_debputy_discard_pyc_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t572" href="#t572">572</a></span><span class="t"> <span class="nam">rule_reference_documentation</span><span class="op">=</span><span class="str">"Discards any *.pyc, *.pyo files and any __pycache__ directories"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t573" href="#t573">573</a></span><span class="t"> <span class="nam">examples</span><span class="op">=</span><span class="nam">automatic_discard_rule_example</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t574" href="#t574">574</a></span><span class="t"> <span class="op">(</span><span class="str">".../foo.py"</span><span class="op">,</span> <span class="key">False</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t575" href="#t575">575</a></span><span class="t"> <span class="str">".../__pycache__/"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t576" href="#t576">576</a></span><span class="t"> <span class="str">".../__pycache__/..."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t577" href="#t577">577</a></span><span class="t"> <span class="str">".../foo.pyc"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t578" href="#t578">578</a></span><span class="t"> <span class="str">".../foo.pyo"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t579" href="#t579">579</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t580" href="#t580">580</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t581" href="#t581">581</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">automatic_discard_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t582" href="#t582">582</a></span><span class="t"> <span class="str">"la-files"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t583" href="#t583">583</a></span><span class="t"> <span class="nam">_debputy_prune_la_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t584" href="#t584">584</a></span><span class="t"> <span class="nam">rule_reference_documentation</span><span class="op">=</span><span class="str">"Discards any file with the extension .la beneath the directory /usr/lib"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t585" href="#t585">585</a></span><span class="t"> <span class="nam">examples</span><span class="op">=</span><span class="nam">automatic_discard_rule_example</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t586" href="#t586">586</a></span><span class="t"> <span class="str">"usr/lib/libfoo.la"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t587" href="#t587">587</a></span><span class="t"> <span class="op">(</span><span class="str">"usr/lib/libfoo.so.1.0.0"</span><span class="op">,</span> <span class="key">False</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t588" href="#t588">588</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t589" href="#t589">589</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t590" href="#t590">590</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">automatic_discard_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t591" href="#t591">591</a></span><span class="t"> <span class="str">"backup-files"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t592" href="#t592">592</a></span><span class="t"> <span class="nam">_debputy_prune_backup_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t593" href="#t593">593</a></span><span class="t"> <span class="nam">rule_reference_documentation</span><span class="op">=</span><span class="str">"Discards common back up files such as foo~, foo.bak or foo.orig"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t594" href="#t594">594</a></span><span class="t"> <span class="nam">examples</span><span class="op">=</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t595" href="#t595">595</a></span><span class="t"> <span class="nam">automatic_discard_rule_example</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t596" href="#t596">596</a></span><span class="t"> <span class="str">".../foo~"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t597" href="#t597">597</a></span><span class="t"> <span class="str">".../foo.orig"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t598" href="#t598">598</a></span><span class="t"> <span class="str">".../foo.rej"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t599" href="#t599">599</a></span><span class="t"> <span class="str">".../DEADJOE"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t600" href="#t600">600</a></span><span class="t"> <span class="str">".../.foo.sw."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t601" href="#t601">601</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t602" href="#t602">602</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t603" href="#t603">603</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t604" href="#t604">604</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">automatic_discard_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t605" href="#t605">605</a></span><span class="t"> <span class="str">"version-control-paths"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t606" href="#t606">606</a></span><span class="t"> <span class="nam">_debputy_prune_vcs_paths</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t607" href="#t607">607</a></span><span class="t"> <span class="nam">rule_reference_documentation</span><span class="op">=</span><span class="str">"Discards common version control paths such as .git, .gitignore, CVS, etc."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t608" href="#t608">608</a></span><span class="t"> <span class="nam">examples</span><span class="op">=</span><span class="nam">automatic_discard_rule_example</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t609" href="#t609">609</a></span><span class="t"> <span class="op">(</span><span class="str">"tools/foo"</span><span class="op">,</span> <span class="key">False</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t610" href="#t610">610</a></span><span class="t"> <span class="str">".../CVS/"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t611" href="#t611">611</a></span><span class="t"> <span class="str">".../CVS/..."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t612" href="#t612">612</a></span><span class="t"> <span class="str">".../.gitignore"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t613" href="#t613">613</a></span><span class="t"> <span class="str">".../.gitattributes"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t614" href="#t614">614</a></span><span class="t"> <span class="str">".../.git/"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t615" href="#t615">615</a></span><span class="t"> <span class="str">".../.git/..."</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t616" href="#t616">616</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t617" href="#t617">617</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t618" href="#t618">618</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">automatic_discard_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t619" href="#t619">619</a></span><span class="t"> <span class="str">"gnu-info-dir-file"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t620" href="#t620">620</a></span><span class="t"> <span class="nam">_debputy_prune_info_dir_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t621" href="#t621">621</a></span><span class="t"> <span class="nam">rule_reference_documentation</span><span class="op">=</span><span class="str">"Discards the /usr/share/info/dir file (causes package file conflicts)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t622" href="#t622">622</a></span><span class="t"> <span class="nam">examples</span><span class="op">=</span><span class="nam">automatic_discard_rule_example</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t623" href="#t623">623</a></span><span class="t"> <span class="str">"usr/share/info/dir"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t624" href="#t624">624</a></span><span class="t"> <span class="op">(</span><span class="str">"usr/share/info/foo.info"</span><span class="op">,</span> <span class="key">False</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t625" href="#t625">625</a></span><span class="t"> <span class="op">(</span><span class="str">"usr/share/info/dir.info"</span><span class="op">,</span> <span class="key">False</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t626" href="#t626">626</a></span><span class="t"> <span class="op">(</span><span class="str">"usr/share/random/case/dir"</span><span class="op">,</span> <span class="key">False</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t627" href="#t627">627</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t628" href="#t628">628</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t629" href="#t629">629</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">automatic_discard_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t630" href="#t630">630</a></span><span class="t"> <span class="str">"debian-dir"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t631" href="#t631">631</a></span><span class="t"> <span class="nam">_debputy_prune_binary_debian_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t632" href="#t632">632</a></span><span class="t"> <span class="nam">rule_reference_documentation</span><span class="op">=</span><span class="str">"(Implementation detail) Discards any DEBIAN directory to avoid it from appearing"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t633" href="#t633">633</a></span><span class="t"> <span class="str">" literally in the file listing"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t634" href="#t634">634</a></span><span class="t"> <span class="nam">examples</span><span class="op">=</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t635" href="#t635">635</a></span><span class="t"> <span class="nam">automatic_discard_rule_example</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t636" href="#t636">636</a></span><span class="t"> <span class="str">"DEBIAN/"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t637" href="#t637">637</a></span><span class="t"> <span class="str">"DEBIAN/control"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t638" href="#t638">638</a></span><span class="t"> <span class="op">(</span><span class="str">"usr/bin/foo"</span><span class="op">,</span> <span class="key">False</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t639" href="#t639">639</a></span><span class="t"> <span class="op">(</span><span class="str">"usr/share/DEBIAN/foo"</span><span class="op">,</span> <span class="key">False</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t640" href="#t640">640</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t641" href="#t641">641</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t642" href="#t642">642</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t643" href="#t643">643</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">automatic_discard_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t644" href="#t644">644</a></span><span class="t"> <span class="str">"doxygen-cruft-files"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t645" href="#t645">645</a></span><span class="t"> <span class="nam">_debputy_prune_doxygen_cruft</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t646" href="#t646">646</a></span><span class="t"> <span class="nam">rule_reference_documentation</span><span class="op">=</span><span class="str">"Discards cruft files generated by doxygen"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t647" href="#t647">647</a></span><span class="t"> <span class="nam">examples</span><span class="op">=</span><span class="nam">automatic_discard_rule_example</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t648" href="#t648">648</a></span><span class="t"> <span class="op">(</span><span class="str">"usr/share/doc/foo/api/doxygen.css"</span><span class="op">,</span> <span class="key">False</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t649" href="#t649">649</a></span><span class="t"> <span class="op">(</span><span class="str">"usr/share/doc/foo/api/doxygen.svg"</span><span class="op">,</span> <span class="key">False</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t650" href="#t650">650</a></span><span class="t"> <span class="op">(</span><span class="str">"usr/share/doc/foo/api/index.html"</span><span class="op">,</span> <span class="key">False</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t651" href="#t651">651</a></span><span class="t"> <span class="str">"usr/share/doc/foo/api/.../cruft.map"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t652" href="#t652">652</a></span><span class="t"> <span class="str">"usr/share/doc/foo/api/.../cruft.md5"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t653" href="#t653">653</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t654" href="#t654">654</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t655" href="#t655">655</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t656" href="#t656">656</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t657" href="#t657">657</a></span><span class="t"><span class="key">def</span> <span class="nam">register_processing_steps</span><span class="op">(</span><span class="nam">api</span><span class="op">:</span> <span class="nam">DebputyPluginInitializerProvider</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t658" href="#t658">658</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">package_processor</span><span class="op">(</span><span class="str">"manpages"</span><span class="op">,</span> <span class="nam">process_manpages</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t659" href="#t659">659</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">package_processor</span><span class="op">(</span><span class="str">"clean-la-files"</span><span class="op">,</span> <span class="nam">clean_la_files</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t660" href="#t660">660</a></span><span class="t"> <span class="com"># strip-non-determinism makes assumptions about the PackageProcessingContext implementation</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t661" href="#t661">661</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">package_processor</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t662" href="#t662">662</a></span><span class="t"> <span class="str">"strip-nondeterminism"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t663" href="#t663">663</a></span><span class="t"> <span class="nam">cast</span><span class="op">(</span><span class="str">"Any"</span><span class="op">,</span> <span class="nam">strip_non_determinism</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t664" href="#t664">664</a></span><span class="t"> <span class="nam">depends_on_processor</span><span class="op">=</span><span class="op">[</span><span class="str">"manpages"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t665" href="#t665">665</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t666" href="#t666">666</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">package_processor</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t667" href="#t667">667</a></span><span class="t"> <span class="str">"compression"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t668" href="#t668">668</a></span><span class="t"> <span class="nam">apply_compression</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t669" href="#t669">669</a></span><span class="t"> <span class="nam">depends_on_processor</span><span class="op">=</span><span class="op">[</span><span class="str">"manpages"</span><span class="op">,</span> <span class="str">"strip-nondeterminism"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t670" href="#t670">670</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t671" href="#t671">671</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t672" href="#t672">672</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t673" href="#t673">673</a></span><span class="t"><span class="key">def</span> <span class="nam">register_variables_via_private_api</span><span class="op">(</span><span class="nam">api</span><span class="op">:</span> <span class="nam">DebputyPluginInitializerProvider</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t674" href="#t674">674</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">manifest_variable_provider</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t675" href="#t675">675</a></span><span class="t"> <span class="nam">load_source_variables</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t676" href="#t676">676</a></span><span class="t"> <span class="op">{</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t677" href="#t677">677</a></span><span class="t"> <span class="str">"DEB_SOURCE"</span><span class="op">:</span> <span class="str">"Name of the source package (`dpkg-parsechangelog -SSource`)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t678" href="#t678">678</a></span><span class="t"> <span class="str">"DEB_VERSION"</span><span class="op">:</span> <span class="str">"Version from the top most changelog entry (`dpkg-parsechangelog -SVersion`)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t679" href="#t679">679</a></span><span class="t"> <span class="str">"DEB_VERSION_EPOCH_UPSTREAM"</span><span class="op">:</span> <span class="str">"Version from the top most changelog entry *without* the Debian revision"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t680" href="#t680">680</a></span><span class="t"> <span class="str">"DEB_VERSION_UPSTREAM_REVISION"</span><span class="op">:</span> <span class="str">"Version from the top most changelog entry *without* the epoch"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t681" href="#t681">681</a></span><span class="t"> <span class="str">"DEB_VERSION_UPSTREAM"</span><span class="op">:</span> <span class="str">"Upstream version from the top most changelog entry (that is, *without* epoch and Debian revision)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t682" href="#t682">682</a></span><span class="t"> <span class="str">"SOURCE_DATE_EPOCH"</span><span class="op">:</span> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t683" href="#t683">683</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t684" href="#t684">684</a></span><span class="t"><span class="str"> Timestamp from the top most changelog entry (`dpkg-parsechangelog -STimestamp`)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t685" href="#t685">685</a></span><span class="t"><span class="str"> Please see <https://reproducible-builds.org/docs/source-date-epoch/> for the full definition of</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t686" href="#t686">686</a></span><span class="t"><span class="str"> this variable.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t687" href="#t687">687</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t688" href="#t688">688</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t689" href="#t689">689</a></span><span class="t"> <span class="str">"_DEBPUTY_INTERNAL_NON_BINNMU_SOURCE"</span><span class="op">:</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t690" href="#t690">690</a></span><span class="t"> <span class="str">"_DEBPUTY_SND_SOURCE_DATE_EPOCH"</span><span class="op">:</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t691" href="#t691">691</a></span><span class="t"> <span class="op">}</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t692" href="#t692">692</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t693" href="#t693">693</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t694" href="#t694">694</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t695" href="#t695">695</a></span><span class="t"><span class="key">def</span> <span class="nam">document_builtin_variables</span><span class="op">(</span><span class="nam">api</span><span class="op">:</span> <span class="nam">DebputyPluginInitializerProvider</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t696" href="#t696">696</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">document_builtin_variable</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t697" href="#t697">697</a></span><span class="t"> <span class="str">"PACKAGE"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t698" href="#t698">698</a></span><span class="t"> <span class="str">"Name of the binary package (only available in binary context)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t699" href="#t699">699</a></span><span class="t"> <span class="nam">is_context_specific</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t700" href="#t700">700</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t701" href="#t701">701</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t702" href="#t702">702</a></span><span class="t"> <span class="nam">arch_types</span> <span class="op">=</span> <span class="nam">_DOCUMENTED_DPKG_ARCH_TYPES</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t703" href="#t703">703</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t704" href="#t704">704</a></span><span class="t"> <span class="key">for</span> <span class="nam">arch_type</span><span class="op">,</span> <span class="op">(</span><span class="nam">arch_type_tag</span><span class="op">,</span> <span class="nam">arch_type_doc</span><span class="op">)</span> <span class="key">in</span> <span class="nam">arch_types</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t705" href="#t705">705</a></span><span class="t"> <span class="key">for</span> <span class="nam">arch_var</span><span class="op">,</span> <span class="nam">arch_var_doc</span> <span class="key">in</span> <span class="nam">_DOCUMENTED_DPKG_ARCH_VARS</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t706" href="#t706">706</a></span><span class="t"> <span class="nam">full_var</span> <span class="op">=</span> <span class="str">f"DEB_{arch_type}_{arch_var}"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t707" href="#t707">707</a></span><span class="t"> <span class="nam">documentation</span> <span class="op">=</span> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t708" href="#t708">708</a></span><span class="t"> <span class="str">f"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t709" href="#t709">709</a></span><span class="t"><span class="str"> {arch_var_doc} ({arch_type_tag})</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t710" href="#t710">710</a></span><span class="t"><span class="str"> This variable describes machine information used when the package is compiled and assembled.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t711" href="#t711">711</a></span><span class="t"><span class="str"> * Machine type: {arch_type_doc}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t712" href="#t712">712</a></span><span class="t"><span class="str"> * Value description: {arch_var_doc}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t713" href="#t713">713</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t714" href="#t714">714</a></span><span class="t"><span class="str"> The value is the output of: `dpkg-architecture -q{full_var}`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t715" href="#t715">715</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t716" href="#t716">716</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t717" href="#t717">717</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">document_builtin_variable</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t718" href="#t718">718</a></span><span class="t"> <span class="nam">full_var</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t719" href="#t719">719</a></span><span class="t"> <span class="nam">documentation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t720" href="#t720">720</a></span><span class="t"> <span class="nam">is_for_special_case</span><span class="op">=</span><span class="nam">arch_type</span> <span class="op">!=</span> <span class="str">"HOST"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t721" href="#t721">721</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t722" href="#t722">722</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t723" href="#t723">723</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t724" href="#t724">724</a></span><span class="t"><span class="key">def</span> <span class="nam">_format_docbase_filename</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t725" href="#t725">725</a></span><span class="t"> <span class="nam">path_format</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t726" href="#t726">726</a></span><span class="t"> <span class="nam">format_param</span><span class="op">:</span> <span class="nam">PPFFormatParam</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t727" href="#t727">727</a></span><span class="t"> <span class="nam">docbase_file</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t728" href="#t728">728</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t729" href="#t729">729</a></span><span class="t"> <span class="key">with</span> <span class="nam">docbase_file</span><span class="op">.</span><span class="nam">open</span><span class="op">(</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t730" href="#t730">730</a></span><span class="t"> <span class="nam">content</span> <span class="op">=</span> <span class="nam">Deb822</span><span class="op">(</span><span class="nam">fd</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t731" href="#t731">731</a></span><span class="t"> <span class="nam">proper_name</span> <span class="op">=</span> <span class="nam">content</span><span class="op">[</span><span class="str">"Document"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t732" href="#t732">732</a></span><span class="t"> <span class="key">if</span> <span class="nam">proper_name</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">732 ↛ 735</span><span class="annotate long">line 732 didn't jump to line 735, because the condition on line 732 was never false</span></span></p> - <p class="run"><span class="n"><a id="t733" href="#t733">733</a></span><span class="t"> <span class="nam">format_param</span><span class="op">[</span><span class="str">"name"</span><span class="op">]</span> <span class="op">=</span> <span class="nam">proper_name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t734" href="#t734">734</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t735" href="#t735">735</a></span><span class="t"> <span class="nam">_warn</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t736" href="#t736">736</a></span><span class="t"> <span class="str">f"The docbase file {docbase_file.fs_path} is missing the Document field"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t737" href="#t737">737</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t738" href="#t738">738</a></span><span class="t"> <span class="key">return</span> <span class="nam">path_format</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span><span class="op">**</span><span class="nam">format_param</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t739" href="#t739">739</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t740" href="#t740">740</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t741" href="#t741">741</a></span><span class="t"><span class="key">def</span> <span class="nam">register_special_ppfs</span><span class="op">(</span><span class="nam">api</span><span class="op">:</span> <span class="nam">DebputyPluginInitializerProvider</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t742" href="#t742">742</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t743" href="#t743">743</a></span><span class="t"> <span class="str">"doc-base"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t744" href="#t744">744</a></span><span class="t"> <span class="str">"/usr/share/doc-base/{owning_package}.{name}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t745" href="#t745">745</a></span><span class="t"> <span class="nam">format_callback</span><span class="op">=</span><span class="nam">_format_docbase_filename</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t746" href="#t746">746</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t747" href="#t747">747</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t748" href="#t748">748</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t749" href="#t749">749</a></span><span class="t"> <span class="str">"shlibs"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t750" href="#t750">750</a></span><span class="t"> <span class="str">"DEBIAN/shlibs"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t751" href="#t751">751</a></span><span class="t"> <span class="nam">allow_name_segment</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t752" href="#t752">752</a></span><span class="t"> <span class="nam">reservation_only</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t753" href="#t753">753</a></span><span class="t"> <span class="nam">reference_documentation</span><span class="op">=</span><span class="nam">packager_provided_file_reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t754" href="#t754">754</a></span><span class="t"> <span class="nam">format_documentation_uris</span><span class="op">=</span><span class="op">[</span><span class="str">"man:deb-shlibs(5)"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t755" href="#t755">755</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t756" href="#t756">756</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t757" href="#t757">757</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t758" href="#t758">758</a></span><span class="t"> <span class="str">"symbols"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t759" href="#t759">759</a></span><span class="t"> <span class="str">"DEBIAN/symbols"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t760" href="#t760">760</a></span><span class="t"> <span class="nam">allow_name_segment</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t761" href="#t761">761</a></span><span class="t"> <span class="nam">allow_architecture_segment</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t762" href="#t762">762</a></span><span class="t"> <span class="nam">reservation_only</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t763" href="#t763">763</a></span><span class="t"> <span class="nam">reference_documentation</span><span class="op">=</span><span class="nam">packager_provided_file_reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t764" href="#t764">764</a></span><span class="t"> <span class="nam">format_documentation_uris</span><span class="op">=</span><span class="op">[</span><span class="str">"man:deb-symbols(5)"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t765" href="#t765">765</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t766" href="#t766">766</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t767" href="#t767">767</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t768" href="#t768">768</a></span><span class="t"> <span class="str">"templates"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t769" href="#t769">769</a></span><span class="t"> <span class="str">"DEBIAN/templates"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t770" href="#t770">770</a></span><span class="t"> <span class="nam">allow_name_segment</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t771" href="#t771">771</a></span><span class="t"> <span class="nam">allow_architecture_segment</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t772" href="#t772">772</a></span><span class="t"> <span class="nam">reservation_only</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t773" href="#t773">773</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t774" href="#t774">774</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">packager_provided_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t775" href="#t775">775</a></span><span class="t"> <span class="str">"alternatives"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t776" href="#t776">776</a></span><span class="t"> <span class="str">"DEBIAN/alternatives"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t777" href="#t777">777</a></span><span class="t"> <span class="nam">allow_name_segment</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t778" href="#t778">778</a></span><span class="t"> <span class="nam">allow_architecture_segment</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t779" href="#t779">779</a></span><span class="t"> <span class="nam">reservation_only</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t780" href="#t780">780</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t781" href="#t781">781</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t782" href="#t782">782</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t783" href="#t783">783</a></span><span class="t"><span class="key">def</span> <span class="nam">register_install_rules</span><span class="op">(</span><span class="nam">api</span><span class="op">:</span> <span class="nam">DebputyPluginInitializerProvider</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t784" href="#t784">784</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">pluggable_manifest_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t785" href="#t785">785</a></span><span class="t"> <span class="nam">InstallRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t786" href="#t786">786</a></span><span class="t"> <span class="nam">MK_INSTALLATIONS_INSTALL</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t787" href="#t787">787</a></span><span class="t"> <span class="nam">ParsedInstallRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t788" href="#t788">788</a></span><span class="t"> <span class="nam">_install_rule_handler</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t789" href="#t789">789</a></span><span class="t"> <span class="nam">source_format</span><span class="op">=</span><span class="nam">_with_alt_form</span><span class="op">(</span><span class="nam">ParsedInstallRuleSourceFormat</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t790" href="#t790">790</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t791" href="#t791">791</a></span><span class="t"> <span class="nam">title</span><span class="op">=</span><span class="str">"Generic install (`install`)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t792" href="#t792">792</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t793" href="#t793">793</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t794" href="#t794">794</a></span><span class="t"><span class="str"> The generic `install` rule can be used to install arbitrary paths into packages</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t795" href="#t795">795</a></span><span class="t"><span class="str"> and is *similar* to how `dh_install` from debhelper works. It is a two "primary" uses.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t796" href="#t796">796</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t797" href="#t797">797</a></span><span class="t"><span class="str"> 1) The classic "install into directory" similar to the standard `dh_install`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t798" href="#t798">798</a></span><span class="t"><span class="str"> 2) The "install as" similar to `dh-exec`'s `foo => bar` feature.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t799" href="#t799">799</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t800" href="#t800">800</a></span><span class="t"><span class="str"> The `install` rule installs a path exactly once into each package it acts on. In</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t801" href="#t801">801</a></span><span class="t"><span class="str"> the rare case that you want to install the same source *multiple* times into the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t802" href="#t802">802</a></span><span class="t"><span class="str"> *same* packages, please have a look at `{MULTI_DEST_INSTALL}`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t803" href="#t803">803</a></span><span class="t"><span class="str"> """</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t804" href="#t804">804</a></span><span class="t"> <span class="nam">MULTI_DEST_INSTALL</span><span class="op">=</span><span class="nam">MK_INSTALLATIONS_MULTI_DEST_INSTALL</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t805" href="#t805">805</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t806" href="#t806">806</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t807" href="#t807">807</a></span><span class="t"> <span class="nam">non_mapping_description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t808" href="#t808">808</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t809" href="#t809">809</a></span><span class="t"><span class="str"> When the input is a string or a list of string, then that value is used as shorthand</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t810" href="#t810">810</a></span><span class="t"><span class="str"> for `source` or `sources` (respectively). This form can only be used when `into` is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t811" href="#t811">811</a></span><span class="t"><span class="str"> not required.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t812" href="#t812">812</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t813" href="#t813">813</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t814" href="#t814">814</a></span><span class="t"> <span class="nam">attributes</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t815" href="#t815">815</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t816" href="#t816">816</a></span><span class="t"> <span class="op">[</span><span class="str">"source"</span><span class="op">,</span> <span class="str">"sources"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t817" href="#t817">817</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t818" href="#t818">818</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t819" href="#t819">819</a></span><span class="t"><span class="str"> A path match (`source`) or a list of path matches (`sources`) defining the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t820" href="#t820">820</a></span><span class="t"><span class="str"> source path(s) to be installed. The path match(es) can use globs. Each match</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t821" href="#t821">821</a></span><span class="t"><span class="str"> is tried against default search directories.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t822" href="#t822">822</a></span><span class="t"><span class="str"> - When a symlink is matched, then the symlink (not its target) is installed</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t823" href="#t823">823</a></span><span class="t"><span class="str"> as-is. When a directory is matched, then the directory is installed along</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t824" href="#t824">824</a></span><span class="t"><span class="str"> with all the contents that have not already been installed somewhere.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t825" href="#t825">825</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t826" href="#t826">826</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t827" href="#t827">827</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t828" href="#t828">828</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t829" href="#t829">829</a></span><span class="t"> <span class="str">"dest_dir"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t830" href="#t830">830</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t831" href="#t831">831</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t832" href="#t832">832</a></span><span class="t"><span class="str"> A path defining the destination *directory*. The value *cannot* use globs, but can</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t833" href="#t833">833</a></span><span class="t"><span class="str"> use substitution. If neither `as` nor `dest-dir` is given, then `dest-dir` defaults</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t834" href="#t834">834</a></span><span class="t"><span class="str"> to the directory name of the `source`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t835" href="#t835">835</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t836" href="#t836">836</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t837" href="#t837">837</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t838" href="#t838">838</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t839" href="#t839">839</a></span><span class="t"> <span class="str">"into"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t840" href="#t840">840</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t841" href="#t841">841</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t842" href="#t842">842</a></span><span class="t"><span class="str"> Either a package name or a list of package names for which these paths should be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t843" href="#t843">843</a></span><span class="t"><span class="str"> installed. This key is conditional on whether there are multiple binary packages listed</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t844" href="#t844">844</a></span><span class="t"><span class="str"> in `debian/control`. When there is only one binary package, then that binary is the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t845" href="#t845">845</a></span><span class="t"><span class="str"> default for `into`. Otherwise, the key is required.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t846" href="#t846">846</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t847" href="#t847">847</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t848" href="#t848">848</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t849" href="#t849">849</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t850" href="#t850">850</a></span><span class="t"> <span class="str">"install_as"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t851" href="#t851">851</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t852" href="#t852">852</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t853" href="#t853">853</a></span><span class="t"><span class="str"> A path defining the path to install the source as. This is a full path. This option</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t854" href="#t854">854</a></span><span class="t"><span class="str"> is mutually exclusive with `dest-dir` and `sources` (but not `source`). When `as` is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t855" href="#t855">855</a></span><span class="t"><span class="str"> given, then `source` must match exactly one "not yet matched" path.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t856" href="#t856">856</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t857" href="#t857">857</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t858" href="#t858">858</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t859" href="#t859">859</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t860" href="#t860">860</a></span><span class="t"> <span class="str">"when"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t861" href="#t861">861</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t862" href="#t862">862</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t863" href="#t863">863</a></span><span class="t"><span class="str"> A condition as defined in [Conditional rules]({MANIFEST_FORMAT_DOC}#Conditional rules).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t864" href="#t864">864</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t865" href="#t865">865</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t866" href="#t866">866</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t867" href="#t867">867</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t868" href="#t868">868</a></span><span class="t"> <span class="nam">reference_documentation_url</span><span class="op">=</span><span class="nam">_manifest_format_doc</span><span class="op">(</span><span class="str">"generic-install-install"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t869" href="#t869">869</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t870" href="#t870">870</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t871" href="#t871">871</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">pluggable_manifest_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t872" href="#t872">872</a></span><span class="t"> <span class="nam">InstallRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t873" href="#t873">873</a></span><span class="t"> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t874" href="#t874">874</a></span><span class="t"> <span class="nam">MK_INSTALLATIONS_INSTALL_DOCS</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t875" href="#t875">875</a></span><span class="t"> <span class="str">"install-doc"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t876" href="#t876">876</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t877" href="#t877">877</a></span><span class="t"> <span class="nam">ParsedInstallRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t878" href="#t878">878</a></span><span class="t"> <span class="nam">_install_docs_rule_handler</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t879" href="#t879">879</a></span><span class="t"> <span class="nam">source_format</span><span class="op">=</span><span class="nam">_with_alt_form</span><span class="op">(</span><span class="nam">ParsedInstallDocRuleSourceFormat</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t880" href="#t880">880</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t881" href="#t881">881</a></span><span class="t"> <span class="nam">title</span><span class="op">=</span><span class="str">"Install documentation (`install-docs`)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t882" href="#t882">882</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t883" href="#t883">883</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t884" href="#t884">884</a></span><span class="t"><span class="str"> This install rule resemble that of `dh_installdocs`. It is a shorthand over the generic</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t885" href="#t885">885</a></span><span class="t"><span class="str"> `install` rule with the following key features:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t886" href="#t886">886</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t887" href="#t887">887</a></span><span class="t"><span class="str"> 1) The default `dest-dir` is to use the package's documentation directory (usually something</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t888" href="#t888">888</a></span><span class="t"><span class="str"> like `/usr/share/doc/{{PACKAGE}}`, though it respects the "main documentation package"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t889" href="#t889">889</a></span><span class="t"><span class="str"> recommendation from Debian Policy). The `dest-dir` or `as` can be set in case the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t890" href="#t890">890</a></span><span class="t"><span class="str"> documentation in question goes into another directory or with a concrete path. In this</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t891" href="#t891">891</a></span><span class="t"><span class="str"> case, it is still "better" than `install` due to the remaining benefits.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t892" href="#t892">892</a></span><span class="t"><span class="str"> 2) The rule comes with pre-defined conditional logic for skipping the rule under</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t893" href="#t893">893</a></span><span class="t"><span class="str"> `DEB_BUILD_OPTIONS=nodoc`, so you do not have to write that conditional yourself.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t894" href="#t894">894</a></span><span class="t"><span class="str"> 3) The `into` parameter can be omitted as long as there is a exactly one non-`udeb`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t895" href="#t895">895</a></span><span class="t"><span class="str"> package listed in `debian/control`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t896" href="#t896">896</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t897" href="#t897">897</a></span><span class="t"><span class="str"> With these two things in mind, it behaves just like the `install` rule.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t898" href="#t898">898</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t899" href="#t899">899</a></span><span class="t"><span class="str"> Note: It is often worth considering to use a more specialized version of the `install-docs`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t900" href="#t900">900</a></span><span class="t"><span class="str"> rule when one such is available. If you are looking to install an example or a man page,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t901" href="#t901">901</a></span><span class="t"><span class="str"> consider whether `install-examples` or `install-man` might be a better fit for your</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t902" href="#t902">902</a></span><span class="t"><span class="str"> use-case.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t903" href="#t903">903</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t904" href="#t904">904</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t905" href="#t905">905</a></span><span class="t"> <span class="nam">non_mapping_description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t906" href="#t906">906</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t907" href="#t907">907</a></span><span class="t"><span class="str"> When the input is a string or a list of string, then that value is used as shorthand</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t908" href="#t908">908</a></span><span class="t"><span class="str"> for `source` or `sources` (respectively). This form can only be used when `into` is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t909" href="#t909">909</a></span><span class="t"><span class="str"> not required.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t910" href="#t910">910</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t911" href="#t911">911</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t912" href="#t912">912</a></span><span class="t"> <span class="nam">attributes</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t913" href="#t913">913</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t914" href="#t914">914</a></span><span class="t"> <span class="op">[</span><span class="str">"source"</span><span class="op">,</span> <span class="str">"sources"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t915" href="#t915">915</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t916" href="#t916">916</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t917" href="#t917">917</a></span><span class="t"><span class="str"> A path match (`source`) or a list of path matches (`sources`) defining the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t918" href="#t918">918</a></span><span class="t"><span class="str"> source path(s) to be installed. The path match(es) can use globs. Each match</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t919" href="#t919">919</a></span><span class="t"><span class="str"> is tried against default search directories.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t920" href="#t920">920</a></span><span class="t"><span class="str"> - When a symlink is matched, then the symlink (not its target) is installed</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t921" href="#t921">921</a></span><span class="t"><span class="str"> as-is. When a directory is matched, then the directory is installed along</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t922" href="#t922">922</a></span><span class="t"><span class="str"> with all the contents that have not already been installed somewhere.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t923" href="#t923">923</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t924" href="#t924">924</a></span><span class="t"><span class="str"> - **CAVEAT**: Specifying `source: examples` where `examples` resolves to a</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t925" href="#t925">925</a></span><span class="t"><span class="str"> directory for `install-examples` will give you an `examples/examples`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t926" href="#t926">926</a></span><span class="t"><span class="str"> directory in the package, which is rarely what you want. Often, you</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t927" href="#t927">927</a></span><span class="t"><span class="str"> can solve this by using `examples/*` instead. Similar for `install-docs`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t928" href="#t928">928</a></span><span class="t"><span class="str"> and a `doc` or `docs` directory.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t929" href="#t929">929</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t930" href="#t930">930</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t931" href="#t931">931</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t932" href="#t932">932</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t933" href="#t933">933</a></span><span class="t"> <span class="str">"dest_dir"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t934" href="#t934">934</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t935" href="#t935">935</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t936" href="#t936">936</a></span><span class="t"><span class="str"> A path defining the destination *directory*. The value *cannot* use globs, but can</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t937" href="#t937">937</a></span><span class="t"><span class="str"> use substitution. If neither `as` nor `dest-dir` is given, then `dest-dir` defaults</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t938" href="#t938">938</a></span><span class="t"><span class="str"> to the relevant package documentation directory (a la `/usr/share/doc/{{PACKAGE}}`).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t939" href="#t939">939</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t940" href="#t940">940</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t941" href="#t941">941</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t942" href="#t942">942</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t943" href="#t943">943</a></span><span class="t"> <span class="str">"into"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t944" href="#t944">944</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t945" href="#t945">945</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t946" href="#t946">946</a></span><span class="t"><span class="str"> Either a package name or a list of package names for which these paths should be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t947" href="#t947">947</a></span><span class="t"><span class="str"> installed as documentation. This key is conditional on whether there are multiple</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t948" href="#t948">948</a></span><span class="t"><span class="str"> (non-`udeb`) binary packages listed in `debian/control`. When there is only one</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t949" href="#t949">949</a></span><span class="t"><span class="str"> (non-`udeb`) binary package, then that binary is the default for `into`. Otherwise,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t950" href="#t950">950</a></span><span class="t"><span class="str"> the key is required.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t951" href="#t951">951</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t952" href="#t952">952</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t953" href="#t953">953</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t954" href="#t954">954</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t955" href="#t955">955</a></span><span class="t"> <span class="str">"install_as"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t956" href="#t956">956</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t957" href="#t957">957</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t958" href="#t958">958</a></span><span class="t"><span class="str"> A path defining the path to install the source as. This is a full path. This option</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t959" href="#t959">959</a></span><span class="t"><span class="str"> is mutually exclusive with `dest-dir` and `sources` (but not `source`). When `as` is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t960" href="#t960">960</a></span><span class="t"><span class="str"> given, then `source` must match exactly one "not yet matched" path.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t961" href="#t961">961</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t962" href="#t962">962</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t963" href="#t963">963</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t964" href="#t964">964</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t965" href="#t965">965</a></span><span class="t"> <span class="str">"when"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t966" href="#t966">966</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t967" href="#t967">967</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t968" href="#t968">968</a></span><span class="t"><span class="str"> A condition as defined in [Conditional rules]({MANIFEST_FORMAT_DOC}#Conditional rules).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t969" href="#t969">969</a></span><span class="t"><span class="str"> This condition will be combined with the built-in condition provided by these rules</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t970" href="#t970">970</a></span><span class="t"><span class="str"> (rather than replacing it).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t971" href="#t971">971</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t972" href="#t972">972</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t973" href="#t973">973</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t974" href="#t974">974</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t975" href="#t975">975</a></span><span class="t"> <span class="nam">reference_documentation_url</span><span class="op">=</span><span class="nam">_manifest_format_doc</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t976" href="#t976">976</a></span><span class="t"> <span class="str">"install-documentation-install-docs"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t977" href="#t977">977</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t978" href="#t978">978</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t979" href="#t979">979</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t980" href="#t980">980</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">pluggable_manifest_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t981" href="#t981">981</a></span><span class="t"> <span class="nam">InstallRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t982" href="#t982">982</a></span><span class="t"> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t983" href="#t983">983</a></span><span class="t"> <span class="nam">MK_INSTALLATIONS_INSTALL_EXAMPLES</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t984" href="#t984">984</a></span><span class="t"> <span class="str">"install-example"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t985" href="#t985">985</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t986" href="#t986">986</a></span><span class="t"> <span class="nam">ParsedInstallExamplesRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t987" href="#t987">987</a></span><span class="t"> <span class="nam">_install_examples_rule_handler</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t988" href="#t988">988</a></span><span class="t"> <span class="nam">source_format</span><span class="op">=</span><span class="nam">_with_alt_form</span><span class="op">(</span><span class="nam">ParsedInstallExamplesRuleSourceFormat</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t989" href="#t989">989</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t990" href="#t990">990</a></span><span class="t"> <span class="nam">title</span><span class="op">=</span><span class="str">"Install examples (`install-examples`)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t991" href="#t991">991</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t992" href="#t992">992</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t993" href="#t993">993</a></span><span class="t"><span class="str"> This install rule resemble that of `dh_installexamples`. It is a shorthand over the generic `</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t994" href="#t994">994</a></span><span class="t"><span class="str"> install` rule with the following key features:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t995" href="#t995">995</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t996" href="#t996">996</a></span><span class="t"><span class="str"> 1) It pre-defines the `dest-dir` that respects the "main documentation package" recommendation from</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t997" href="#t997">997</a></span><span class="t"><span class="str"> Debian Policy. The `install-examples` will use the `examples` subdir for the package documentation</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t998" href="#t998">998</a></span><span class="t"><span class="str"> dir.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t999" href="#t999">999</a></span><span class="t"><span class="str"> 2) The rule comes with pre-defined conditional logic for skipping the rule under</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1000" href="#t1000">1000</a></span><span class="t"><span class="str"> `DEB_BUILD_OPTIONS=nodoc`, so you do not have to write that conditional yourself.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1001" href="#t1001">1001</a></span><span class="t"><span class="str"> 3) The `into` parameter can be omitted as long as there is a exactly one non-`udeb`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1002" href="#t1002">1002</a></span><span class="t"><span class="str"> package listed in `debian/control`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1003" href="#t1003">1003</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1004" href="#t1004">1004</a></span><span class="t"><span class="str"> With these two things in mind, it behaves just like the `install` rule.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1005" href="#t1005">1005</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1006" href="#t1006">1006</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1007" href="#t1007">1007</a></span><span class="t"> <span class="nam">non_mapping_description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1008" href="#t1008">1008</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1009" href="#t1009">1009</a></span><span class="t"><span class="str"> When the input is a string or a list of string, then that value is used as shorthand</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1010" href="#t1010">1010</a></span><span class="t"><span class="str"> for `source` or `sources` (respectively). This form can only be used when `into` is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1011" href="#t1011">1011</a></span><span class="t"><span class="str"> not required.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1012" href="#t1012">1012</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1013" href="#t1013">1013</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1014" href="#t1014">1014</a></span><span class="t"> <span class="nam">attributes</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1015" href="#t1015">1015</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1016" href="#t1016">1016</a></span><span class="t"> <span class="op">[</span><span class="str">"source"</span><span class="op">,</span> <span class="str">"sources"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1017" href="#t1017">1017</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1018" href="#t1018">1018</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1019" href="#t1019">1019</a></span><span class="t"><span class="str"> A path match (`source`) or a list of path matches (`sources`) defining the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1020" href="#t1020">1020</a></span><span class="t"><span class="str"> source path(s) to be installed. The path match(es) can use globs. Each match</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1021" href="#t1021">1021</a></span><span class="t"><span class="str"> is tried against default search directories.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1022" href="#t1022">1022</a></span><span class="t"><span class="str"> - When a symlink is matched, then the symlink (not its target) is installed</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1023" href="#t1023">1023</a></span><span class="t"><span class="str"> as-is. When a directory is matched, then the directory is installed along</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1024" href="#t1024">1024</a></span><span class="t"><span class="str"> with all the contents that have not already been installed somewhere.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1025" href="#t1025">1025</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1026" href="#t1026">1026</a></span><span class="t"><span class="str"> - **CAVEAT**: Specifying `source: examples` where `examples` resolves to a</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1027" href="#t1027">1027</a></span><span class="t"><span class="str"> directory for `install-examples` will give you an `examples/examples`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1028" href="#t1028">1028</a></span><span class="t"><span class="str"> directory in the package, which is rarely what you want. Often, you</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1029" href="#t1029">1029</a></span><span class="t"><span class="str"> can solve this by using `examples/*` instead. Similar for `install-docs`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1030" href="#t1030">1030</a></span><span class="t"><span class="str"> and a `doc` or `docs` directory.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1031" href="#t1031">1031</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1032" href="#t1032">1032</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1033" href="#t1033">1033</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1034" href="#t1034">1034</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1035" href="#t1035">1035</a></span><span class="t"> <span class="str">"into"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1036" href="#t1036">1036</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1037" href="#t1037">1037</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1038" href="#t1038">1038</a></span><span class="t"><span class="str"> Either a package name or a list of package names for which these paths should be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1039" href="#t1039">1039</a></span><span class="t"><span class="str"> installed as examples. This key is conditional on whether there are (non-`udeb`)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1040" href="#t1040">1040</a></span><span class="t"><span class="str"> multiple binary packages listed in `debian/control`. When there is only one</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1041" href="#t1041">1041</a></span><span class="t"><span class="str"> (non-`udeb`) binary package, then that binary is the default for `into`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1042" href="#t1042">1042</a></span><span class="t"><span class="str"> Otherwise, the key is required.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1043" href="#t1043">1043</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1044" href="#t1044">1044</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1045" href="#t1045">1045</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1046" href="#t1046">1046</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1047" href="#t1047">1047</a></span><span class="t"> <span class="str">"when"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1048" href="#t1048">1048</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1049" href="#t1049">1049</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1050" href="#t1050">1050</a></span><span class="t"><span class="str"> A condition as defined in [Conditional rules]({MANIFEST_FORMAT_DOC}#Conditional rules).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1051" href="#t1051">1051</a></span><span class="t"><span class="str"> This condition will be combined with the built-in condition provided by these rules</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1052" href="#t1052">1052</a></span><span class="t"><span class="str"> (rather than replacing it).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1053" href="#t1053">1053</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1054" href="#t1054">1054</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1055" href="#t1055">1055</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1056" href="#t1056">1056</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1057" href="#t1057">1057</a></span><span class="t"> <span class="nam">reference_documentation_url</span><span class="op">=</span><span class="nam">_manifest_format_doc</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1058" href="#t1058">1058</a></span><span class="t"> <span class="str">"install-examples-install-examples"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1059" href="#t1059">1059</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1060" href="#t1060">1060</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1061" href="#t1061">1061</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1062" href="#t1062">1062</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">pluggable_manifest_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1063" href="#t1063">1063</a></span><span class="t"> <span class="nam">InstallRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1064" href="#t1064">1064</a></span><span class="t"> <span class="nam">MK_INSTALLATIONS_INSTALL_MAN</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1065" href="#t1065">1065</a></span><span class="t"> <span class="nam">ParsedInstallManpageRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1066" href="#t1066">1066</a></span><span class="t"> <span class="nam">_install_man_rule_handler</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1067" href="#t1067">1067</a></span><span class="t"> <span class="nam">source_format</span><span class="op">=</span><span class="nam">_with_alt_form</span><span class="op">(</span><span class="nam">ParsedInstallManpageRuleSourceFormat</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1068" href="#t1068">1068</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1069" href="#t1069">1069</a></span><span class="t"> <span class="nam">title</span><span class="op">=</span><span class="str">"Install man pages (`install-man`)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1070" href="#t1070">1070</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1071" href="#t1071">1071</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1072" href="#t1072">1072</a></span><span class="t"><span class="str"> Install rule for installing man pages similar to `dh_installman`. It is a shorthand</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1073" href="#t1073">1073</a></span><span class="t"><span class="str"> over the generic `install` rule with the following key features:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1074" href="#t1074">1074</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1075" href="#t1075">1075</a></span><span class="t"><span class="str"> 1) The rule can only match files (notably, symlinks cannot be matched by this rule).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1076" href="#t1076">1076</a></span><span class="t"><span class="str"> 2) The `dest-dir` is computed per source file based on the man page's section and</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1077" href="#t1077">1077</a></span><span class="t"><span class="str"> language.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1078" href="#t1078">1078</a></span><span class="t"><span class="str"> 3) The `into` parameter can be omitted as long as there is a exactly one non-`udeb`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1079" href="#t1079">1079</a></span><span class="t"><span class="str"> package listed in `debian/control`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1080" href="#t1080">1080</a></span><span class="t"><span class="str"> 4) The rule comes with man page specific attributes such as `language` and `section`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1081" href="#t1081">1081</a></span><span class="t"><span class="str"> for when the auto-detection is insufficient.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1082" href="#t1082">1082</a></span><span class="t"><span class="str"> 5) The rule comes with pre-defined conditional logic for skipping the rule under</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1083" href="#t1083">1083</a></span><span class="t"><span class="str"> `DEB_BUILD_OPTIONS=nodoc`, so you do not have to write that conditional yourself.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1084" href="#t1084">1084</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1085" href="#t1085">1085</a></span><span class="t"><span class="str"> With these things in mind, the rule behaves similar to the `install` rule.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1086" href="#t1086">1086</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1087" href="#t1087">1087</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1088" href="#t1088">1088</a></span><span class="t"> <span class="nam">non_mapping_description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1089" href="#t1089">1089</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1090" href="#t1090">1090</a></span><span class="t"><span class="str"> When the input is a string or a list of string, then that value is used as shorthand</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1091" href="#t1091">1091</a></span><span class="t"><span class="str"> for `source` or `sources` (respectively). This form can only be used when `into` is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1092" href="#t1092">1092</a></span><span class="t"><span class="str"> not required.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1093" href="#t1093">1093</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1094" href="#t1094">1094</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1095" href="#t1095">1095</a></span><span class="t"> <span class="nam">attributes</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1096" href="#t1096">1096</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1097" href="#t1097">1097</a></span><span class="t"> <span class="op">[</span><span class="str">"source"</span><span class="op">,</span> <span class="str">"sources"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1098" href="#t1098">1098</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1099" href="#t1099">1099</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1100" href="#t1100">1100</a></span><span class="t"><span class="str"> A path match (`source`) or a list of path matches (`sources`) defining the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1101" href="#t1101">1101</a></span><span class="t"><span class="str"> source path(s) to be installed. The path match(es) can use globs. Each match</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1102" href="#t1102">1102</a></span><span class="t"><span class="str"> is tried against default search directories.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1103" href="#t1103">1103</a></span><span class="t"><span class="str"> - When a symlink is matched, then the symlink (not its target) is installed</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1104" href="#t1104">1104</a></span><span class="t"><span class="str"> as-is. When a directory is matched, then the directory is installed along</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1105" href="#t1105">1105</a></span><span class="t"><span class="str"> with all the contents that have not already been installed somewhere.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1106" href="#t1106">1106</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1107" href="#t1107">1107</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1108" href="#t1108">1108</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1109" href="#t1109">1109</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1110" href="#t1110">1110</a></span><span class="t"> <span class="str">"into"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1111" href="#t1111">1111</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1112" href="#t1112">1112</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1113" href="#t1113">1113</a></span><span class="t"><span class="str"> Either a package name or a list of package names for which these paths should be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1114" href="#t1114">1114</a></span><span class="t"><span class="str"> installed as man pages. This key is conditional on whether there are multiple (non-`udeb`)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1115" href="#t1115">1115</a></span><span class="t"><span class="str"> binary packages listed in `debian/control`. When there is only one (non-`udeb`) binary</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1116" href="#t1116">1116</a></span><span class="t"><span class="str"> package, then that binary is the default for `into`. Otherwise, the key is required.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1117" href="#t1117">1117</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1118" href="#t1118">1118</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1119" href="#t1119">1119</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1120" href="#t1120">1120</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1121" href="#t1121">1121</a></span><span class="t"> <span class="str">"section"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1122" href="#t1122">1122</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1123" href="#t1123">1123</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1124" href="#t1124">1124</a></span><span class="t"><span class="str"> If provided, it must be an integer between 1 and 9 (both inclusive), defining the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1125" href="#t1125">1125</a></span><span class="t"><span class="str"> section the man pages belong overriding any auto-detection that `debputy` would</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1126" href="#t1126">1126</a></span><span class="t"><span class="str"> have performed.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1127" href="#t1127">1127</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1128" href="#t1128">1128</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1129" href="#t1129">1129</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1130" href="#t1130">1130</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1131" href="#t1131">1131</a></span><span class="t"> <span class="str">"language"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1132" href="#t1132">1132</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1133" href="#t1133">1133</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1134" href="#t1134">1134</a></span><span class="t"><span class="str"> If provided, it must be either a 2 letter language code (such as `de`), a 5 letter</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1135" href="#t1135">1135</a></span><span class="t"><span class="str"> language + dialect code (such as `pt_BR`), or one of the special keywords `C`,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1136" href="#t1136">1136</a></span><span class="t"><span class="str"> `derive-from-path`, or `derive-from-basename`. The default is `derive-from-path`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1137" href="#t1137">1137</a></span><span class="t"><span class="str"> - When `language` is `C`, then the man pages are assumed to be "untranslated".</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1138" href="#t1138">1138</a></span><span class="t"><span class="str"> - When `language` is a language code (with or without dialect), then all man pages</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1139" href="#t1139">1139</a></span><span class="t"><span class="str"> matched will be assumed to be translated to that concrete language / dialect.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1140" href="#t1140">1140</a></span><span class="t"><span class="str"> - When `language` is `derive-from-path`, then `debputy` attempts to derive the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1141" href="#t1141">1141</a></span><span class="t"><span class="str"> language from the path (`man/<language>/man<section>`). This matches the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1142" href="#t1142">1142</a></span><span class="t"><span class="str"> default of `dh_installman`. When no language can be found for a given source,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1143" href="#t1143">1143</a></span><span class="t"><span class="str"> `debputy` behaves like language was `C`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1144" href="#t1144">1144</a></span><span class="t"><span class="str"> - When `language` is `derive-from-basename`, then `debputy` attempts to derive</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1145" href="#t1145">1145</a></span><span class="t"><span class="str"> the language from the basename (`foo.<language>.1`) similar to `dh_installman`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1146" href="#t1146">1146</a></span><span class="t"><span class="str"> previous default. When no language can be found for a given source, `debputy`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1147" href="#t1147">1147</a></span><span class="t"><span class="str"> behaves like language was `C`. Note this is prone to false positives where</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1148" href="#t1148">1148</a></span><span class="t"><span class="str"> `.pl`, `.so` or similar two-letter extensions gets mistaken for a language code</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1149" href="#t1149">1149</a></span><span class="t"><span class="str"> (`.pl` can both be "Polish" or "Perl Script", `.so` can both be "Somali" and</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1150" href="#t1150">1150</a></span><span class="t"><span class="str"> "Shared Object" documentation). In this configuration, such extensions are</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1151" href="#t1151">1151</a></span><span class="t"><span class="str"> always assumed to be a language.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1152" href="#t1152">1152</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1153" href="#t1153">1153</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1154" href="#t1154">1154</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1155" href="#t1155">1155</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1156" href="#t1156">1156</a></span><span class="t"> <span class="str">"when"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1157" href="#t1157">1157</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1158" href="#t1158">1158</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1159" href="#t1159">1159</a></span><span class="t"><span class="str"> A condition as defined in [Conditional rules]({MANIFEST_FORMAT_DOC}#Conditional rules).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1160" href="#t1160">1160</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1161" href="#t1161">1161</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1162" href="#t1162">1162</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1163" href="#t1163">1163</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1164" href="#t1164">1164</a></span><span class="t"> <span class="nam">reference_documentation_url</span><span class="op">=</span><span class="nam">_manifest_format_doc</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1165" href="#t1165">1165</a></span><span class="t"> <span class="str">"install-manpages-install-man"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1166" href="#t1166">1166</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1167" href="#t1167">1167</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1168" href="#t1168">1168</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1169" href="#t1169">1169</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">pluggable_manifest_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1170" href="#t1170">1170</a></span><span class="t"> <span class="nam">InstallRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1171" href="#t1171">1171</a></span><span class="t"> <span class="nam">MK_INSTALLATIONS_DISCARD</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1172" href="#t1172">1172</a></span><span class="t"> <span class="nam">ParsedInstallDiscardRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1173" href="#t1173">1173</a></span><span class="t"> <span class="nam">_install_discard_rule_handler</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1174" href="#t1174">1174</a></span><span class="t"> <span class="nam">source_format</span><span class="op">=</span><span class="nam">_with_alt_form</span><span class="op">(</span><span class="nam">ParsedInstallDiscardRuleSourceFormat</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1175" href="#t1175">1175</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1176" href="#t1176">1176</a></span><span class="t"> <span class="nam">title</span><span class="op">=</span><span class="str">"Discard (or exclude) upstream provided paths (`discard`)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1177" href="#t1177">1177</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1178" href="#t1178">1178</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1179" href="#t1179">1179</a></span><span class="t"><span class="str"> When installing paths from `debian/tmp` into packages, it might be useful to ignore</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1180" href="#t1180">1180</a></span><span class="t"><span class="str"> some paths that you never need installed. This can be done with the `discard` rule.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1181" href="#t1181">1181</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1182" href="#t1182">1182</a></span><span class="t"><span class="str"> Once a path is discarded, it cannot be matched by any other install rules. A path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1183" href="#t1183">1183</a></span><span class="t"><span class="str"> that is discarded, is considered handled when `debputy` checks for paths you might</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1184" href="#t1184">1184</a></span><span class="t"><span class="str"> have forgotten to install. The `discard` feature is therefore *also* replaces the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1185" href="#t1185">1185</a></span><span class="t"><span class="str"> `debian/not-installed` file used by `debhelper` and `cdbs`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1186" href="#t1186">1186</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1187" href="#t1187">1187</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1188" href="#t1188">1188</a></span><span class="t"> <span class="nam">non_mapping_description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1189" href="#t1189">1189</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1190" href="#t1190">1190</a></span><span class="t"><span class="str"> When the input is a string or a list of string, then that value is used as shorthand</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1191" href="#t1191">1191</a></span><span class="t"><span class="str"> for `path` or `paths` (respectively).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1192" href="#t1192">1192</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1193" href="#t1193">1193</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1194" href="#t1194">1194</a></span><span class="t"> <span class="nam">attributes</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1195" href="#t1195">1195</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1196" href="#t1196">1196</a></span><span class="t"> <span class="op">[</span><span class="str">"path"</span><span class="op">,</span> <span class="str">"paths"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1197" href="#t1197">1197</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1198" href="#t1198">1198</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1199" href="#t1199">1199</a></span><span class="t"><span class="str"> A path match (`path`) or a list of path matches (`paths`) defining the source</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1200" href="#t1200">1200</a></span><span class="t"><span class="str"> path(s) that should not be installed anywhere. The path match(es) can use globs.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1201" href="#t1201">1201</a></span><span class="t"><span class="str"> - When a symlink is matched, then the symlink (not its target) is discarded as-is.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1202" href="#t1202">1202</a></span><span class="t"><span class="str"> When a directory is matched, then the directory is discarded along with all the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1203" href="#t1203">1203</a></span><span class="t"><span class="str"> contents that have not already been installed somewhere.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1204" href="#t1204">1204</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1205" href="#t1205">1205</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1206" href="#t1206">1206</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1207" href="#t1207">1207</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1208" href="#t1208">1208</a></span><span class="t"> <span class="op">[</span><span class="str">"search_dir"</span><span class="op">,</span> <span class="str">"search_dirs"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1209" href="#t1209">1209</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1210" href="#t1210">1210</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1211" href="#t1211">1211</a></span><span class="t"><span class="str"> A path (`search-dir`) or a list to paths (`search-dirs`) that defines</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1212" href="#t1212">1212</a></span><span class="t"><span class="str"> which search directories apply to. This attribute is primarily useful</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1213" href="#t1213">1213</a></span><span class="t"><span class="str"> for source packages that uses "per package search dirs", and you want</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1214" href="#t1214">1214</a></span><span class="t"><span class="str"> to restrict a discard rule to a subset of the relevant search dirs.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1215" href="#t1215">1215</a></span><span class="t"><span class="str"> Note all listed search directories must be either an explicit search</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1216" href="#t1216">1216</a></span><span class="t"><span class="str"> requested by the packager or a search directory that `debputy`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1217" href="#t1217">1217</a></span><span class="t"><span class="str"> provided automatically (such as `debian/tmp`). Listing other paths</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1218" href="#t1218">1218</a></span><span class="t"><span class="str"> will make `debputy` report an error.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1219" href="#t1219">1219</a></span><span class="t"><span class="str"> - Note that the `path` or `paths` must match at least one entry in</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1220" href="#t1220">1220</a></span><span class="t"><span class="str"> any of the search directories unless *none* of the search directories</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1221" href="#t1221">1221</a></span><span class="t"><span class="str"> exist (or the condition in `required-when` evaluates to false). When</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1222" href="#t1222">1222</a></span><span class="t"><span class="str"> none of the search directories exist, the discard rule is silently</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1223" href="#t1223">1223</a></span><span class="t"><span class="str"> skipped. This special-case enables you to have discard rules only</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1224" href="#t1224">1224</a></span><span class="t"><span class="str"> applicable to certain builds that are only performed conditionally.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1225" href="#t1225">1225</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1226" href="#t1226">1226</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1227" href="#t1227">1227</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1228" href="#t1228">1228</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1229" href="#t1229">1229</a></span><span class="t"> <span class="str">"required_when"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1230" href="#t1230">1230</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1231" href="#t1231">1231</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1232" href="#t1232">1232</a></span><span class="t"><span class="str"> A condition as defined in [Conditional rules](#conditional-rules). The discard</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1233" href="#t1233">1233</a></span><span class="t"><span class="str"> rule is always applied. When the conditional is present and evaluates to false,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1234" href="#t1234">1234</a></span><span class="t"><span class="str"> the discard rule can silently match nothing.When the condition is absent, *or*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1235" href="#t1235">1235</a></span><span class="t"><span class="str"> it evaluates to true, then each pattern provided must match at least one path.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1236" href="#t1236">1236</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1237" href="#t1237">1237</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1238" href="#t1238">1238</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1239" href="#t1239">1239</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1240" href="#t1240">1240</a></span><span class="t"> <span class="nam">reference_documentation_url</span><span class="op">=</span><span class="nam">_manifest_format_doc</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1241" href="#t1241">1241</a></span><span class="t"> <span class="str">"discard-or-exclude-upstream-provided-paths-discard"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1242" href="#t1242">1242</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1243" href="#t1243">1243</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1244" href="#t1244">1244</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1245" href="#t1245">1245</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">pluggable_manifest_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1246" href="#t1246">1246</a></span><span class="t"> <span class="nam">InstallRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1247" href="#t1247">1247</a></span><span class="t"> <span class="nam">MK_INSTALLATIONS_MULTI_DEST_INSTALL</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1248" href="#t1248">1248</a></span><span class="t"> <span class="nam">ParsedMultiDestInstallRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1249" href="#t1249">1249</a></span><span class="t"> <span class="nam">_multi_dest_install_rule_handler</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1250" href="#t1250">1250</a></span><span class="t"> <span class="nam">source_format</span><span class="op">=</span><span class="nam">ParsedMultiDestInstallRuleSourceFormat</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1251" href="#t1251">1251</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1252" href="#t1252">1252</a></span><span class="t"> <span class="nam">title</span><span class="op">=</span><span class="str">f"Multi destination install (`{MK_INSTALLATIONS_MULTI_DEST_INSTALL}`)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1253" href="#t1253">1253</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1254" href="#t1254">1254</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1255" href="#t1255">1255</a></span><span class="t"><span class="str"> The `{RULE_NAME}` is a variant of the generic `install` rule that installs sources</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1256" href="#t1256">1256</a></span><span class="t"><span class="str"> into multiple destination paths. This is needed for the rare case where you want a</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1257" href="#t1257">1257</a></span><span class="t"><span class="str"> path to be installed *twice* (or more) into the *same* package. The rule is a two</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1258" href="#t1258">1258</a></span><span class="t"><span class="str"> "primary" uses.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1259" href="#t1259">1259</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1260" href="#t1260">1260</a></span><span class="t"><span class="str"> 1) The classic "install into directory" similar to the standard `dh_install`,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1261" href="#t1261">1261</a></span><span class="t"><span class="str"> except you list 2+ destination directories.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1262" href="#t1262">1262</a></span><span class="t"><span class="str"> 2) The "install as" similar to `dh-exec`'s `foo => bar` feature, except you list</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1263" href="#t1263">1263</a></span><span class="t"><span class="str"> 2+ `as` names.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1264" href="#t1264">1264</a></span><span class="t"><span class="str"> """</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1265" href="#t1265">1265</a></span><span class="t"> <span class="nam">RULE_NAME</span><span class="op">=</span><span class="nam">MK_INSTALLATIONS_MULTI_DEST_INSTALL</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1266" href="#t1266">1266</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1267" href="#t1267">1267</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1268" href="#t1268">1268</a></span><span class="t"> <span class="nam">attributes</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1269" href="#t1269">1269</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1270" href="#t1270">1270</a></span><span class="t"> <span class="op">[</span><span class="str">"source"</span><span class="op">,</span> <span class="str">"sources"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1271" href="#t1271">1271</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1272" href="#t1272">1272</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1273" href="#t1273">1273</a></span><span class="t"><span class="str"> A path match (`source`) or a list of path matches (`sources`) defining the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1274" href="#t1274">1274</a></span><span class="t"><span class="str"> source path(s) to be installed. The path match(es) can use globs. Each match</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1275" href="#t1275">1275</a></span><span class="t"><span class="str"> is tried against default search directories.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1276" href="#t1276">1276</a></span><span class="t"><span class="str"> - When a symlink is matched, then the symlink (not its target) is installed</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1277" href="#t1277">1277</a></span><span class="t"><span class="str"> as-is. When a directory is matched, then the directory is installed along</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1278" href="#t1278">1278</a></span><span class="t"><span class="str"> with all the contents that have not already been installed somewhere.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1279" href="#t1279">1279</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1280" href="#t1280">1280</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1281" href="#t1281">1281</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1282" href="#t1282">1282</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1283" href="#t1283">1283</a></span><span class="t"> <span class="str">"dest_dirs"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1284" href="#t1284">1284</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1285" href="#t1285">1285</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1286" href="#t1286">1286</a></span><span class="t"><span class="str"> A list of paths defining the destination *directories*. The value *cannot* use</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1287" href="#t1287">1287</a></span><span class="t"><span class="str"> globs, but can use substitution. It is mutually exclusive with `as` but must be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1288" href="#t1288">1288</a></span><span class="t"><span class="str"> provided if `as` is not provided. The attribute must contain at least two paths</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1289" href="#t1289">1289</a></span><span class="t"><span class="str"> (if you do not have two paths, you want `install`).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1290" href="#t1290">1290</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1291" href="#t1291">1291</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1292" href="#t1292">1292</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1293" href="#t1293">1293</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1294" href="#t1294">1294</a></span><span class="t"> <span class="str">"into"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1295" href="#t1295">1295</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1296" href="#t1296">1296</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1297" href="#t1297">1297</a></span><span class="t"><span class="str"> Either a package name or a list of package names for which these paths should be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1298" href="#t1298">1298</a></span><span class="t"><span class="str"> installed. This key is conditional on whether there are multiple binary packages listed</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1299" href="#t1299">1299</a></span><span class="t"><span class="str"> in `debian/control`. When there is only one binary package, then that binary is the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1300" href="#t1300">1300</a></span><span class="t"><span class="str"> default for `into`. Otherwise, the key is required.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1301" href="#t1301">1301</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1302" href="#t1302">1302</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1303" href="#t1303">1303</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1304" href="#t1304">1304</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1305" href="#t1305">1305</a></span><span class="t"> <span class="str">"install_as"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1306" href="#t1306">1306</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1307" href="#t1307">1307</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1308" href="#t1308">1308</a></span><span class="t"><span class="str"> A list of paths, which defines all the places the source will be installed.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1309" href="#t1309">1309</a></span><span class="t"><span class="str"> Each path must be a full path without globs (but can use substitution).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1310" href="#t1310">1310</a></span><span class="t"><span class="str"> This option is mutually exclusive with `dest-dirs` and `sources` (but not</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1311" href="#t1311">1311</a></span><span class="t"><span class="str"> `source`). When `as` is given, then `source` must match exactly one</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1312" href="#t1312">1312</a></span><span class="t"><span class="str"> "not yet matched" path. The attribute must contain at least two paths</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1313" href="#t1313">1313</a></span><span class="t"><span class="str"> (if you do not have two paths, you want `install`).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1314" href="#t1314">1314</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1315" href="#t1315">1315</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1316" href="#t1316">1316</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1317" href="#t1317">1317</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1318" href="#t1318">1318</a></span><span class="t"> <span class="str">"when"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1319" href="#t1319">1319</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1320" href="#t1320">1320</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1321" href="#t1321">1321</a></span><span class="t"><span class="str"> A condition as defined in [Conditional rules]({MANIFEST_FORMAT_DOC}#Conditional rules).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1322" href="#t1322">1322</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1323" href="#t1323">1323</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1324" href="#t1324">1324</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1325" href="#t1325">1325</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1326" href="#t1326">1326</a></span><span class="t"> <span class="nam">reference_documentation_url</span><span class="op">=</span><span class="nam">_manifest_format_doc</span><span class="op">(</span><span class="str">"generic-install-install"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1327" href="#t1327">1327</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1328" href="#t1328">1328</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1329" href="#t1329">1329</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1330" href="#t1330">1330</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1331" href="#t1331">1331</a></span><span class="t"><span class="key">def</span> <span class="nam">register_transformation_rules</span><span class="op">(</span><span class="nam">api</span><span class="op">:</span> <span class="nam">DebputyPluginInitializerProvider</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1332" href="#t1332">1332</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">pluggable_manifest_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1333" href="#t1333">1333</a></span><span class="t"> <span class="nam">TransformationRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1334" href="#t1334">1334</a></span><span class="t"> <span class="str">"move"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1335" href="#t1335">1335</a></span><span class="t"> <span class="nam">TransformationMoveRuleSpec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1336" href="#t1336">1336</a></span><span class="t"> <span class="nam">_transformation_move_handler</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1337" href="#t1337">1337</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1338" href="#t1338">1338</a></span><span class="t"> <span class="nam">title</span><span class="op">=</span><span class="str">"Move transformation rule (`move`)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1339" href="#t1339">1339</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1340" href="#t1340">1340</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1341" href="#t1341">1341</a></span><span class="t"><span class="str"> The move transformation rule is mostly only useful for single binary source packages,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1342" href="#t1342">1342</a></span><span class="t"><span class="str"> where everything from upstream's build system is installed automatically into the package.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1343" href="#t1343">1343</a></span><span class="t"><span class="str"> In those case, you might find yourself with some files that need to be renamed to match</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1344" href="#t1344">1344</a></span><span class="t"><span class="str"> Debian specific requirements.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1345" href="#t1345">1345</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1346" href="#t1346">1346</a></span><span class="t"><span class="str"> This can be done with the `move` transformation rule, which is a rough emulation of the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1347" href="#t1347">1347</a></span><span class="t"><span class="str"> `mv` command line tool.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1348" href="#t1348">1348</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1349" href="#t1349">1349</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1350" href="#t1350">1350</a></span><span class="t"> <span class="nam">attributes</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1351" href="#t1351">1351</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1352" href="#t1352">1352</a></span><span class="t"> <span class="str">"source"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1353" href="#t1353">1353</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1354" href="#t1354">1354</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1355" href="#t1355">1355</a></span><span class="t"><span class="str"> A path match defining the source path(s) to be renamed. The value can use globs</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1356" href="#t1356">1356</a></span><span class="t"><span class="str"> and substitutions.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1357" href="#t1357">1357</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1358" href="#t1358">1358</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1359" href="#t1359">1359</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1360" href="#t1360">1360</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1361" href="#t1361">1361</a></span><span class="t"> <span class="str">"target"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1362" href="#t1362">1362</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1363" href="#t1363">1363</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1364" href="#t1364">1364</a></span><span class="t"><span class="str"> A path defining the target path. The value *cannot* use globs, but can use</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1365" href="#t1365">1365</a></span><span class="t"><span class="str"> substitution. If the target ends with a literal `/` (prior to substitution),</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1366" href="#t1366">1366</a></span><span class="t"><span class="str"> the target will *always* be a directory.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1367" href="#t1367">1367</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1368" href="#t1368">1368</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1369" href="#t1369">1369</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1370" href="#t1370">1370</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1371" href="#t1371">1371</a></span><span class="t"> <span class="str">"when"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1372" href="#t1372">1372</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1373" href="#t1373">1373</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1374" href="#t1374">1374</a></span><span class="t"><span class="str"> A condition as defined in [Conditional rules]({MANIFEST_FORMAT_DOC}#Conditional rules).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1375" href="#t1375">1375</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1376" href="#t1376">1376</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1377" href="#t1377">1377</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1378" href="#t1378">1378</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1379" href="#t1379">1379</a></span><span class="t"> <span class="nam">reference_documentation_url</span><span class="op">=</span><span class="nam">_manifest_format_doc</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1380" href="#t1380">1380</a></span><span class="t"> <span class="str">"move-transformation-rule-move"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1381" href="#t1381">1381</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1382" href="#t1382">1382</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1383" href="#t1383">1383</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1384" href="#t1384">1384</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">pluggable_manifest_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1385" href="#t1385">1385</a></span><span class="t"> <span class="nam">TransformationRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1386" href="#t1386">1386</a></span><span class="t"> <span class="str">"remove"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1387" href="#t1387">1387</a></span><span class="t"> <span class="nam">TransformationRemoveRuleSpec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1388" href="#t1388">1388</a></span><span class="t"> <span class="nam">_transformation_remove_handler</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1389" href="#t1389">1389</a></span><span class="t"> <span class="nam">source_format</span><span class="op">=</span><span class="nam">_with_alt_form</span><span class="op">(</span><span class="nam">TransformationRemoveRuleInputFormat</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1390" href="#t1390">1390</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1391" href="#t1391">1391</a></span><span class="t"> <span class="nam">title</span><span class="op">=</span><span class="str">"Remove transformation rule (`remove`)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1392" href="#t1392">1392</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1393" href="#t1393">1393</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1394" href="#t1394">1394</a></span><span class="t"><span class="str"> The remove transformation rule is mostly only useful for single binary source packages,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1395" href="#t1395">1395</a></span><span class="t"><span class="str"> where everything from upstream's build system is installed automatically into the package.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1396" href="#t1396">1396</a></span><span class="t"><span class="str"> In those case, you might find yourself with some files that are _not_ relevant for the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1397" href="#t1397">1397</a></span><span class="t"><span class="str"> Debian package (but would be relevant for other distros or for non-distro local builds).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1398" href="#t1398">1398</a></span><span class="t"><span class="str"> Common examples include `INSTALL` files or `LICENSE` files (when they are just a subset</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1399" href="#t1399">1399</a></span><span class="t"><span class="str"> of `debian/copyright`).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1400" href="#t1400">1400</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1401" href="#t1401">1401</a></span><span class="t"><span class="str"> In the manifest, you can ask `debputy` to remove paths from the debian package by using</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1402" href="#t1402">1402</a></span><span class="t"><span class="str"> the `remove` transformation rule.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1403" href="#t1403">1403</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1404" href="#t1404">1404</a></span><span class="t"><span class="str"> Note that `remove` removes paths from future glob matches and transformation rules.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1405" href="#t1405">1405</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1406" href="#t1406">1406</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1407" href="#t1407">1407</a></span><span class="t"> <span class="nam">non_mapping_description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1408" href="#t1408">1408</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1409" href="#t1409">1409</a></span><span class="t"><span class="str"> When the input is a string or a list of string, then that value is used as shorthand</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1410" href="#t1410">1410</a></span><span class="t"><span class="str"> for `path` or `paths` (respectively).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1411" href="#t1411">1411</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1412" href="#t1412">1412</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1413" href="#t1413">1413</a></span><span class="t"> <span class="nam">attributes</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1414" href="#t1414">1414</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1415" href="#t1415">1415</a></span><span class="t"> <span class="op">[</span><span class="str">"path"</span><span class="op">,</span> <span class="str">"paths"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1416" href="#t1416">1416</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1417" href="#t1417">1417</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1418" href="#t1418">1418</a></span><span class="t"><span class="str"> A path match (`path`) or a list of path matches (`paths`) defining the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1419" href="#t1419">1419</a></span><span class="t"><span class="str"> path(s) inside the package that should be removed. The path match(es)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1420" href="#t1420">1420</a></span><span class="t"><span class="str"> can use globs.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1421" href="#t1421">1421</a></span><span class="t"><span class="str"> - When a symlink is matched, then the symlink (not its target) is removed</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1422" href="#t1422">1422</a></span><span class="t"><span class="str"> as-is. When a directory is matched, then the directory is removed</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1423" href="#t1423">1423</a></span><span class="t"><span class="str"> along with all the contents.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1424" href="#t1424">1424</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1425" href="#t1425">1425</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1426" href="#t1426">1426</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1427" href="#t1427">1427</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1428" href="#t1428">1428</a></span><span class="t"> <span class="str">"keep_empty_parent_dirs"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1429" href="#t1429">1429</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1430" href="#t1430">1430</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1431" href="#t1431">1431</a></span><span class="t"><span class="str"> A boolean determining whether to prune parent directories that become</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1432" href="#t1432">1432</a></span><span class="t"><span class="str"> empty as a consequence of this rule. When provided and `true`, this</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1433" href="#t1433">1433</a></span><span class="t"><span class="str"> rule will leave empty directories behind. Otherwise, if this rule</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1434" href="#t1434">1434</a></span><span class="t"><span class="str"> causes a directory to become empty that directory will be removed.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1435" href="#t1435">1435</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1436" href="#t1436">1436</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1437" href="#t1437">1437</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1438" href="#t1438">1438</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1439" href="#t1439">1439</a></span><span class="t"> <span class="str">"when"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1440" href="#t1440">1440</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1441" href="#t1441">1441</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1442" href="#t1442">1442</a></span><span class="t"><span class="str"> A condition as defined in [Conditional rules]({MANIFEST_FORMAT_DOC}#Conditional rules).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1443" href="#t1443">1443</a></span><span class="t"><span class="str"> This condition will be combined with the built-in condition provided by these rules</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1444" href="#t1444">1444</a></span><span class="t"><span class="str"> (rather than replacing it).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1445" href="#t1445">1445</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1446" href="#t1446">1446</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1447" href="#t1447">1447</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1448" href="#t1448">1448</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1449" href="#t1449">1449</a></span><span class="t"> <span class="nam">reference_documentation_url</span><span class="op">=</span><span class="nam">_manifest_format_doc</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1450" href="#t1450">1450</a></span><span class="t"> <span class="str">"remove-transformation-rule-remove"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1451" href="#t1451">1451</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1452" href="#t1452">1452</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1453" href="#t1453">1453</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1454" href="#t1454">1454</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">pluggable_manifest_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1455" href="#t1455">1455</a></span><span class="t"> <span class="nam">TransformationRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1456" href="#t1456">1456</a></span><span class="t"> <span class="str">"create-symlink"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1457" href="#t1457">1457</a></span><span class="t"> <span class="nam">CreateSymlinkRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1458" href="#t1458">1458</a></span><span class="t"> <span class="nam">_transformation_create_symlink</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1459" href="#t1459">1459</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1460" href="#t1460">1460</a></span><span class="t"> <span class="nam">title</span><span class="op">=</span><span class="str">"Create symlinks transformation rule (`create-symlink`)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1461" href="#t1461">1461</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1462" href="#t1462">1462</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1463" href="#t1463">1463</a></span><span class="t"><span class="str"> Often, the upstream build system will provide the symlinks for you. However,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1464" href="#t1464">1464</a></span><span class="t"><span class="str"> in some cases, it is useful for the packager to define distribution specific</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1465" href="#t1465">1465</a></span><span class="t"><span class="str"> symlinks. This can be done via the `create-symlink` transformation rule.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1466" href="#t1466">1466</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1467" href="#t1467">1467</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1468" href="#t1468">1468</a></span><span class="t"> <span class="nam">attributes</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1469" href="#t1469">1469</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1470" href="#t1470">1470</a></span><span class="t"> <span class="str">"path"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1471" href="#t1471">1471</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1472" href="#t1472">1472</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1473" href="#t1473">1473</a></span><span class="t"><span class="str"> The path that should be a symlink. The path may contain substitution</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1474" href="#t1474">1474</a></span><span class="t"><span class="str"> variables such as `{{DEB_HOST_MULTIARCH}}` but _cannot_ use globs.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1475" href="#t1475">1475</a></span><span class="t"><span class="str"> Parent directories are implicitly created as necessary.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1476" href="#t1476">1476</a></span><span class="t"><span class="str"> * Note that if `path` already exists, the behaviour of this</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1477" href="#t1477">1477</a></span><span class="t"><span class="str"> transformation depends on the value of `replacement-rule`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1478" href="#t1478">1478</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1479" href="#t1479">1479</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1480" href="#t1480">1480</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1481" href="#t1481">1481</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1482" href="#t1482">1482</a></span><span class="t"> <span class="str">"target"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1483" href="#t1483">1483</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1484" href="#t1484">1484</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1485" href="#t1485">1485</a></span><span class="t"><span class="str"> Where the symlink should point to. The target may contain substitution</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1486" href="#t1486">1486</a></span><span class="t"><span class="str"> variables such as `{{DEB_HOST_MULTIARCH}}` but _cannot_ use globs.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1487" href="#t1487">1487</a></span><span class="t"><span class="str"> The link target is _not_ required to exist inside the package.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1488" href="#t1488">1488</a></span><span class="t"><span class="str"> * The `debputy` tool will normalize the target according to the rules</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1489" href="#t1489">1489</a></span><span class="t"><span class="str"> of the Debian Policy. Use absolute or relative target at your own</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1490" href="#t1490">1490</a></span><span class="t"><span class="str"> preference.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1491" href="#t1491">1491</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1492" href="#t1492">1492</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1493" href="#t1493">1493</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1494" href="#t1494">1494</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1495" href="#t1495">1495</a></span><span class="t"> <span class="str">"replacement_rule"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1496" href="#t1496">1496</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1497" href="#t1497">1497</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1498" href="#t1498">1498</a></span><span class="t"><span class="str"> This attribute defines how to handle if `path` already exists. It can</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1499" href="#t1499">1499</a></span><span class="t"><span class="str"> be set to one of the following values:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1500" href="#t1500">1500</a></span><span class="t"><span class="str"> - `error-if-exists`: When `path` already exists, `debputy` will</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1501" href="#t1501">1501</a></span><span class="t"><span class="str"> stop with an error. This is similar to `ln -s` semantics.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1502" href="#t1502">1502</a></span><span class="t"><span class="str"> - `error-if-directory`: When `path` already exists, **and** it is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1503" href="#t1503">1503</a></span><span class="t"><span class="str"> a directory, `debputy` will stop with an error. Otherwise,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1504" href="#t1504">1504</a></span><span class="t"><span class="str"> remove the `path` first and then create the symlink. This is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1505" href="#t1505">1505</a></span><span class="t"><span class="str"> similar to `ln -sf` semantics.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1506" href="#t1506">1506</a></span><span class="t"><span class="str"> - `abort-on-non-empty-directory` (default): When `path` already</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1507" href="#t1507">1507</a></span><span class="t"><span class="str"> exists, then it will be removed provided it is a non-directory</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1508" href="#t1508">1508</a></span><span class="t"><span class="str"> **or** an *empty* directory and the symlink will then be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1509" href="#t1509">1509</a></span><span class="t"><span class="str"> created. If the path is a *non-empty* directory, `debputy`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1510" href="#t1510">1510</a></span><span class="t"><span class="str"> will stop with an error.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1511" href="#t1511">1511</a></span><span class="t"><span class="str"> - `discard-existing`: When `path` already exists, it will be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1512" href="#t1512">1512</a></span><span class="t"><span class="str"> removed. If the `path` is a directory, all its contents will</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1513" href="#t1513">1513</a></span><span class="t"><span class="str"> be removed recursively along with the directory. Finally,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1514" href="#t1514">1514</a></span><span class="t"><span class="str"> the symlink is created. This is similar to having an explicit</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1515" href="#t1515">1515</a></span><span class="t"><span class="str"> `remove` rule just prior to the `create-symlink` that is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1516" href="#t1516">1516</a></span><span class="t"><span class="str"> conditional on `path` existing (plus the condition defined in</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1517" href="#t1517">1517</a></span><span class="t"><span class="str"> `when` if any).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1518" href="#t1518">1518</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1519" href="#t1519">1519</a></span><span class="t"><span class="str"> Keep in mind, that `replacement-rule` only applies if `path` exists.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1520" href="#t1520">1520</a></span><span class="t"><span class="str"> If the symlink cannot be created, because a part of `path` exist and</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1521" href="#t1521">1521</a></span><span class="t"><span class="str"> is *not* a directory, then `create-symlink` will fail regardless of</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1522" href="#t1522">1522</a></span><span class="t"><span class="str"> the value in `replacement-rule`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1523" href="#t1523">1523</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1524" href="#t1524">1524</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1525" href="#t1525">1525</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1526" href="#t1526">1526</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1527" href="#t1527">1527</a></span><span class="t"> <span class="str">"when"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1528" href="#t1528">1528</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1529" href="#t1529">1529</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1530" href="#t1530">1530</a></span><span class="t"><span class="str"> A condition as defined in [Conditional rules]({MANIFEST_FORMAT_DOC}#Conditional rules).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1531" href="#t1531">1531</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1532" href="#t1532">1532</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1533" href="#t1533">1533</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1534" href="#t1534">1534</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1535" href="#t1535">1535</a></span><span class="t"> <span class="nam">reference_documentation_url</span><span class="op">=</span><span class="nam">_manifest_format_doc</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1536" href="#t1536">1536</a></span><span class="t"> <span class="str">"create-symlinks-transformation-rule-create-symlink"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1537" href="#t1537">1537</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1538" href="#t1538">1538</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1539" href="#t1539">1539</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1540" href="#t1540">1540</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">pluggable_manifest_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1541" href="#t1541">1541</a></span><span class="t"> <span class="nam">TransformationRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1542" href="#t1542">1542</a></span><span class="t"> <span class="str">"path-metadata"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1543" href="#t1543">1543</a></span><span class="t"> <span class="nam">PathManifestRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1544" href="#t1544">1544</a></span><span class="t"> <span class="nam">_transformation_path_metadata</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1545" href="#t1545">1545</a></span><span class="t"> <span class="nam">source_format</span><span class="op">=</span><span class="nam">PathManifestSourceDictFormat</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1546" href="#t1546">1546</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1547" href="#t1547">1547</a></span><span class="t"> <span class="nam">title</span><span class="op">=</span><span class="str">"Change path owner/group or mode (`path-metadata`)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1548" href="#t1548">1548</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1549" href="#t1549">1549</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1550" href="#t1550">1550</a></span><span class="t"><span class="str"> The `debputy` command normalizes the path metadata (such as ownership and mode) similar</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1551" href="#t1551">1551</a></span><span class="t"><span class="str"> to `dh_fixperms`. For most packages, the default is what you want. However, in some</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1552" href="#t1552">1552</a></span><span class="t"><span class="str"> cases, the package has a special case or two that `debputy` does not cover. In that</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1553" href="#t1553">1553</a></span><span class="t"><span class="str"> case, you can tell `debputy` to use the metadata you want by using the `path-metadata`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1554" href="#t1554">1554</a></span><span class="t"><span class="str"> transformation.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1555" href="#t1555">1555</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1556" href="#t1556">1556</a></span><span class="t"><span class="str"> Common use-cases include setuid/setgid binaries (such `usr/bin/sudo`) or/and static</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1557" href="#t1557">1557</a></span><span class="t"><span class="str"> ownership (such as /usr/bin/write).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1558" href="#t1558">1558</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1559" href="#t1559">1559</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1560" href="#t1560">1560</a></span><span class="t"> <span class="nam">attributes</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1561" href="#t1561">1561</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1562" href="#t1562">1562</a></span><span class="t"> <span class="op">[</span><span class="str">"path"</span><span class="op">,</span> <span class="str">"paths"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1563" href="#t1563">1563</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1564" href="#t1564">1564</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1565" href="#t1565">1565</a></span><span class="t"><span class="str"> A path match (`path`) or a list of path matches (`paths`) defining the path(s)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1566" href="#t1566">1566</a></span><span class="t"><span class="str"> inside the package that should be affected. The path match(es) can use globs</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1567" href="#t1567">1567</a></span><span class="t"><span class="str"> and substitution variables. Special-rules for matches:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1568" href="#t1568">1568</a></span><span class="t"><span class="str"> - Symlinks are never followed and will never be matched by this rule.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1569" href="#t1569">1569</a></span><span class="t"><span class="str"> - Directory handling depends on the `recursive` attribute.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1570" href="#t1570">1570</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1571" href="#t1571">1571</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1572" href="#t1572">1572</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1573" href="#t1573">1573</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1574" href="#t1574">1574</a></span><span class="t"> <span class="str">"owner"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1575" href="#t1575">1575</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1576" href="#t1576">1576</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1577" href="#t1577">1577</a></span><span class="t"><span class="str"> Denotes the owner of the paths matched by `path` or `paths`. When omitted,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1578" href="#t1578">1578</a></span><span class="t"><span class="str"> no change of owner is done.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1579" href="#t1579">1579</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1580" href="#t1580">1580</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1581" href="#t1581">1581</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1582" href="#t1582">1582</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1583" href="#t1583">1583</a></span><span class="t"> <span class="str">"group"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1584" href="#t1584">1584</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1585" href="#t1585">1585</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1586" href="#t1586">1586</a></span><span class="t"><span class="str"> Denotes the group of the paths matched by `path` or `paths`. When omitted,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1587" href="#t1587">1587</a></span><span class="t"><span class="str"> no change of group is done.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1588" href="#t1588">1588</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1589" href="#t1589">1589</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1590" href="#t1590">1590</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1591" href="#t1591">1591</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1592" href="#t1592">1592</a></span><span class="t"> <span class="str">"mode"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1593" href="#t1593">1593</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1594" href="#t1594">1594</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1595" href="#t1595">1595</a></span><span class="t"><span class="str"> Denotes the mode of the paths matched by `path` or `paths`. When omitted,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1596" href="#t1596">1596</a></span><span class="t"><span class="str"> no change in mode is done. Note that numeric mode must always be given as</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1597" href="#t1597">1597</a></span><span class="t"><span class="str"> a string (i.e., with quotes). Symbolic mode can be used as well. If</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1598" href="#t1598">1598</a></span><span class="t"><span class="str"> symbolic mode uses a relative definition (e.g., `o-rx`), then it is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1599" href="#t1599">1599</a></span><span class="t"><span class="str"> relative to the matched path's current mode.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1600" href="#t1600">1600</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1601" href="#t1601">1601</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1602" href="#t1602">1602</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1603" href="#t1603">1603</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1604" href="#t1604">1604</a></span><span class="t"> <span class="str">"capabilities"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1605" href="#t1605">1605</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1606" href="#t1606">1606</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1607" href="#t1607">1607</a></span><span class="t"><span class="str"> Denotes a Linux capability that should be applied to the path. When provided,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1608" href="#t1608">1608</a></span><span class="t"><span class="str"> `debputy` will cause the capability to be applied to all *files* denoted by</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1609" href="#t1609">1609</a></span><span class="t"><span class="str"> the `path`/`paths` attribute on install (via `postinst configure`) provided</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1610" href="#t1610">1610</a></span><span class="t"><span class="str"> that `setcap` is installed on the system when the `postinst configure` is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1611" href="#t1611">1611</a></span><span class="t"><span class="str"> run.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1612" href="#t1612">1612</a></span><span class="t"><span class="str"> - If any non-file paths are matched, the `capabilities` will *not* be applied</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1613" href="#t1613">1613</a></span><span class="t"><span class="str"> to those paths.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1614" href="#t1614">1614</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1615" href="#t1615">1615</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1616" href="#t1616">1616</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1617" href="#t1617">1617</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1618" href="#t1618">1618</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1619" href="#t1619">1619</a></span><span class="t"> <span class="str">"capability_mode"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1620" href="#t1620">1620</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1621" href="#t1621">1621</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1622" href="#t1622">1622</a></span><span class="t"><span class="str"> Denotes the mode to apply to the path *if* the Linux capability denoted in</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1623" href="#t1623">1623</a></span><span class="t"><span class="str"> `capabilities` was successfully applied. If omitted, it defaults to `a-s` as</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1624" href="#t1624">1624</a></span><span class="t"><span class="str"> generally capabilities are used to avoid "setuid"/"setgid" binaries. The</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1625" href="#t1625">1625</a></span><span class="t"><span class="str"> `capability-mode` is relative to the *final* path mode (the mode of the path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1626" href="#t1626">1626</a></span><span class="t"><span class="str"> in the produced `.deb`). The `capability-mode` attribute cannot be used if</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1627" href="#t1627">1627</a></span><span class="t"><span class="str"> `capabilities` is omitted.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1628" href="#t1628">1628</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1629" href="#t1629">1629</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1630" href="#t1630">1630</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1631" href="#t1631">1631</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1632" href="#t1632">1632</a></span><span class="t"> <span class="str">"recursive"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1633" href="#t1633">1633</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1634" href="#t1634">1634</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1635" href="#t1635">1635</a></span><span class="t"><span class="str"> When a directory is matched, then the metadata changes are applied to the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1636" href="#t1636">1636</a></span><span class="t"><span class="str"> directory itself. When `recursive` is `true`, then the transformation is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1637" href="#t1637">1637</a></span><span class="t"><span class="str"> *also* applied to all paths beneath the directory. The default value for</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1638" href="#t1638">1638</a></span><span class="t"><span class="str"> this attribute is `false`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1639" href="#t1639">1639</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1640" href="#t1640">1640</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1641" href="#t1641">1641</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1642" href="#t1642">1642</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1643" href="#t1643">1643</a></span><span class="t"> <span class="str">"when"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1644" href="#t1644">1644</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1645" href="#t1645">1645</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1646" href="#t1646">1646</a></span><span class="t"><span class="str"> A condition as defined in [Conditional rules]({MANIFEST_FORMAT_DOC}#Conditional rules).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1647" href="#t1647">1647</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1648" href="#t1648">1648</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1649" href="#t1649">1649</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1650" href="#t1650">1650</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1651" href="#t1651">1651</a></span><span class="t"> <span class="nam">reference_documentation_url</span><span class="op">=</span><span class="nam">_manifest_format_doc</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1652" href="#t1652">1652</a></span><span class="t"> <span class="str">"change-path-ownergroup-or-mode-path-metadata"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1653" href="#t1653">1653</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1654" href="#t1654">1654</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1655" href="#t1655">1655</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1656" href="#t1656">1656</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">pluggable_manifest_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1657" href="#t1657">1657</a></span><span class="t"> <span class="nam">TransformationRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1658" href="#t1658">1658</a></span><span class="t"> <span class="str">"create-directories"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1659" href="#t1659">1659</a></span><span class="t"> <span class="nam">EnsureDirectoryRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1660" href="#t1660">1660</a></span><span class="t"> <span class="nam">_transformation_mkdirs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1661" href="#t1661">1661</a></span><span class="t"> <span class="nam">source_format</span><span class="op">=</span><span class="nam">_with_alt_form</span><span class="op">(</span><span class="nam">EnsureDirectorySourceFormat</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1662" href="#t1662">1662</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1663" href="#t1663">1663</a></span><span class="t"> <span class="nam">title</span><span class="op">=</span><span class="str">"Create directories transformation rule (`create-directories`)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1664" href="#t1664">1664</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1665" href="#t1665">1665</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1666" href="#t1666">1666</a></span><span class="t"><span class="str"> NOTE: This transformation is only really needed if you need to create an empty</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1667" href="#t1667">1667</a></span><span class="t"><span class="str"> directory somewhere in your package as an integration point. All `debputy`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1668" href="#t1668">1668</a></span><span class="t"><span class="str"> transformations will create directories as required.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1669" href="#t1669">1669</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1670" href="#t1670">1670</a></span><span class="t"><span class="str"> In most cases, upstream build systems and `debputy` will create all the relevant</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1671" href="#t1671">1671</a></span><span class="t"><span class="str"> directories. However, in some rare cases you may want to explicitly define a path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1672" href="#t1672">1672</a></span><span class="t"><span class="str"> to be a directory. Maybe to silence a linter that is warning you about a directory</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1673" href="#t1673">1673</a></span><span class="t"><span class="str"> being empty, or maybe you need an empty directory that nothing else is creating for</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1674" href="#t1674">1674</a></span><span class="t"><span class="str"> you. This can be done via the `create-directories` transformation rule.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1675" href="#t1675">1675</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1676" href="#t1676">1676</a></span><span class="t"><span class="str"> Unless you have a specific need for the mapping form, you are recommended to use the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1677" href="#t1677">1677</a></span><span class="t"><span class="str"> shorthand form of just listing the directories you want created.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1678" href="#t1678">1678</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1679" href="#t1679">1679</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1680" href="#t1680">1680</a></span><span class="t"> <span class="nam">non_mapping_description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1681" href="#t1681">1681</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1682" href="#t1682">1682</a></span><span class="t"><span class="str"> When the input is a string or a list of string, then that value is used as shorthand</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1683" href="#t1683">1683</a></span><span class="t"><span class="str"> for `path` or `paths` (respectively).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1684" href="#t1684">1684</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1685" href="#t1685">1685</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1686" href="#t1686">1686</a></span><span class="t"> <span class="nam">attributes</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1687" href="#t1687">1687</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1688" href="#t1688">1688</a></span><span class="t"> <span class="op">[</span><span class="str">"path"</span><span class="op">,</span> <span class="str">"paths"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1689" href="#t1689">1689</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1690" href="#t1690">1690</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1691" href="#t1691">1691</a></span><span class="t"><span class="str"> A path (`path`) or a list of path (`paths`) defining the path(s) inside the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1692" href="#t1692">1692</a></span><span class="t"><span class="str"> package that should be created as directories. The path(es) _cannot_ use globs</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1693" href="#t1693">1693</a></span><span class="t"><span class="str"> but can use substitution variables. Parent directories are implicitly created</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1694" href="#t1694">1694</a></span><span class="t"><span class="str"> (with owner `root:root` and mode `0755` - only explicitly listed directories</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1695" href="#t1695">1695</a></span><span class="t"><span class="str"> are affected by the owner/mode options)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1696" href="#t1696">1696</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1697" href="#t1697">1697</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1698" href="#t1698">1698</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1699" href="#t1699">1699</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1700" href="#t1700">1700</a></span><span class="t"> <span class="str">"owner"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1701" href="#t1701">1701</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1702" href="#t1702">1702</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1703" href="#t1703">1703</a></span><span class="t"><span class="str"> Denotes the owner of the directory (but _not_ what is inside the directory).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1704" href="#t1704">1704</a></span><span class="t"><span class="str"> Default is "root".</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1705" href="#t1705">1705</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1706" href="#t1706">1706</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1707" href="#t1707">1707</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1708" href="#t1708">1708</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1709" href="#t1709">1709</a></span><span class="t"> <span class="str">"group"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1710" href="#t1710">1710</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1711" href="#t1711">1711</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1712" href="#t1712">1712</a></span><span class="t"><span class="str"> Denotes the group of the directory (but _not_ what is inside the directory).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1713" href="#t1713">1713</a></span><span class="t"><span class="str"> Default is "root".</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1714" href="#t1714">1714</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1715" href="#t1715">1715</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1716" href="#t1716">1716</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1717" href="#t1717">1717</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1718" href="#t1718">1718</a></span><span class="t"> <span class="str">"mode"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1719" href="#t1719">1719</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1720" href="#t1720">1720</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1721" href="#t1721">1721</a></span><span class="t"><span class="str"> Denotes the mode of the directory (but _not_ what is inside the directory).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1722" href="#t1722">1722</a></span><span class="t"><span class="str"> Note that numeric mode must always be given as a string (i.e., with quotes).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1723" href="#t1723">1723</a></span><span class="t"><span class="str"> Symbolic mode can be used as well. If symbolic mode uses a relative</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1724" href="#t1724">1724</a></span><span class="t"><span class="str"> definition (e.g., `o-rx`), then it is relative to the directory's current mode</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1725" href="#t1725">1725</a></span><span class="t"><span class="str"> (if it already exists) or `0755` if the directory is created by this</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1726" href="#t1726">1726</a></span><span class="t"><span class="str"> transformation. The default is "0755".</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1727" href="#t1727">1727</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1728" href="#t1728">1728</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1729" href="#t1729">1729</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1730" href="#t1730">1730</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1731" href="#t1731">1731</a></span><span class="t"> <span class="str">"when"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1732" href="#t1732">1732</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1733" href="#t1733">1733</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1734" href="#t1734">1734</a></span><span class="t"><span class="str"> A condition as defined in [Conditional rules]({MANIFEST_FORMAT_DOC}#Conditional rules).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1735" href="#t1735">1735</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1736" href="#t1736">1736</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1737" href="#t1737">1737</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1738" href="#t1738">1738</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1739" href="#t1739">1739</a></span><span class="t"> <span class="nam">reference_documentation_url</span><span class="op">=</span><span class="nam">_manifest_format_doc</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1740" href="#t1740">1740</a></span><span class="t"> <span class="str">"create-directories-transformation-rule-directories"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1741" href="#t1741">1741</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1742" href="#t1742">1742</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1743" href="#t1743">1743</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1744" href="#t1744">1744</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1745" href="#t1745">1745</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1746" href="#t1746">1746</a></span><span class="t"><span class="key">def</span> <span class="nam">register_manifest_condition_rules</span><span class="op">(</span><span class="nam">api</span><span class="op">:</span> <span class="nam">DebputyPluginInitializerProvider</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1747" href="#t1747">1747</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">provide_manifest_keyword</span><span class="op">(</span> </span><span class="r"><span class="annotate short">1747 ↛ exit</span><span class="annotate long">line 1747 didn't jump to the function exit</span></span></p> - <p class="pln"><span class="n"><a id="t1748" href="#t1748">1748</a></span><span class="t"> <span class="nam">ManifestCondition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1749" href="#t1749">1749</a></span><span class="t"> <span class="str">"cross-compiling"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1750" href="#t1750">1750</a></span><span class="t"> <span class="key">lambda</span> <span class="op">*</span><span class="nam">_</span><span class="op">:</span> <span class="nam">ManifestCondition</span><span class="op">.</span><span class="nam">is_cross_building</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1751" href="#t1751">1751</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1752" href="#t1752">1752</a></span><span class="t"> <span class="nam">title</span><span class="op">=</span><span class="str">"Cross-Compiling condition `cross-compiling`"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1753" href="#t1753">1753</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1754" href="#t1754">1754</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1755" href="#t1755">1755</a></span><span class="t"><span class="str"> The `cross-compiling` condition is used to determine if the current build is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1756" href="#t1756">1756</a></span><span class="t"><span class="str"> performing a cross build (i.e., `DEB_BUILD_GNU_TYPE` != `DEB_HOST_GNU_TYPE`).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1757" href="#t1757">1757</a></span><span class="t"><span class="str"> Often this has consequences for what is possible to do.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1758" href="#t1758">1758</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1759" href="#t1759">1759</a></span><span class="t"><span class="str"> Note if you specifically want to know:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1760" href="#t1760">1760</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1761" href="#t1761">1761</a></span><span class="t"><span class="str"> * whether build-time tests should be run, then please use the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1762" href="#t1762">1762</a></span><span class="t"><span class="str"> `run-build-time-tests` condition.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1763" href="#t1763">1763</a></span><span class="t"><span class="str"> * whether compiled binaries can be run as if it was a native binary, please</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1764" href="#t1764">1764</a></span><span class="t"><span class="str"> use the `can-execute-compiled-binaries` condition instead. That condition</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1765" href="#t1765">1765</a></span><span class="t"><span class="str"> accounts for cross-building in its evaluation.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1766" href="#t1766">1766</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1767" href="#t1767">1767</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1768" href="#t1768">1768</a></span><span class="t"> <span class="nam">reference_documentation_url</span><span class="op">=</span><span class="nam">_manifest_format_doc</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1769" href="#t1769">1769</a></span><span class="t"> <span class="str">"cross-compiling-condition-cross-compiling-string"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1770" href="#t1770">1770</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1771" href="#t1771">1771</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1772" href="#t1772">1772</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1773" href="#t1773">1773</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">provide_manifest_keyword</span><span class="op">(</span> </span><span class="r"><span class="annotate short">1773 ↛ exit</span><span class="annotate long">line 1773 didn't jump to the function exit</span></span></p> - <p class="pln"><span class="n"><a id="t1774" href="#t1774">1774</a></span><span class="t"> <span class="nam">ManifestCondition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1775" href="#t1775">1775</a></span><span class="t"> <span class="str">"can-execute-compiled-binaries"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1776" href="#t1776">1776</a></span><span class="t"> <span class="key">lambda</span> <span class="op">*</span><span class="nam">_</span><span class="op">:</span> <span class="nam">ManifestCondition</span><span class="op">.</span><span class="nam">can_execute_compiled_binaries</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1777" href="#t1777">1777</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1778" href="#t1778">1778</a></span><span class="t"> <span class="nam">title</span><span class="op">=</span><span class="str">"Can run produced binaries `can-execute-compiled-binaries`"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1779" href="#t1779">1779</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1780" href="#t1780">1780</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1781" href="#t1781">1781</a></span><span class="t"><span class="str"> The `can-execute-compiled-binaries` condition is used to assert the build</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1782" href="#t1782">1782</a></span><span class="t"><span class="str"> can assume that all compiled binaries can be run as-if they were native</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1783" href="#t1783">1783</a></span><span class="t"><span class="str"> binaries. For native builds, this condition always evaluates to `true`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1784" href="#t1784">1784</a></span><span class="t"><span class="str"> For cross builds, the condition is generally evaluates to `false`. However,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1785" href="#t1785">1785</a></span><span class="t"><span class="str"> there are special-cases where binaries can be run during cross-building.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1786" href="#t1786">1786</a></span><span class="t"><span class="str"> Accordingly, this condition is subtly different from the `cross-compiling`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1787" href="#t1787">1787</a></span><span class="t"><span class="str"> condition.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1788" href="#t1788">1788</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1789" href="#t1789">1789</a></span><span class="t"><span class="str"> Note this condition should *not* be used when you know the binary has been</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1790" href="#t1790">1790</a></span><span class="t"><span class="str"> built for the build architecture (`DEB_BUILD_ARCH`) or for determining</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1791" href="#t1791">1791</a></span><span class="t"><span class="str"> whether build-time tests should be run (for build-time tests, please use</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1792" href="#t1792">1792</a></span><span class="t"><span class="str"> the `run-build-time-tests` condition instead). Some upstream build systems</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1793" href="#t1793">1793</a></span><span class="t"><span class="str"> are advanced enough to distinguish building a final product vs. building</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1794" href="#t1794">1794</a></span><span class="t"><span class="str"> a helper tool that needs to run during build. The latter will often be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1795" href="#t1795">1795</a></span><span class="t"><span class="str"> compiled by a separate compiler (often using `$(CC_FOR_BUILD)`,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1796" href="#t1796">1796</a></span><span class="t"><span class="str"> `cc_for_build` or similar variable names in upstream build systems for</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1797" href="#t1797">1797</a></span><span class="t"><span class="str"> that compiler).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1798" href="#t1798">1798</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1799" href="#t1799">1799</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1800" href="#t1800">1800</a></span><span class="t"> <span class="nam">reference_documentation_url</span><span class="op">=</span><span class="nam">_manifest_format_doc</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1801" href="#t1801">1801</a></span><span class="t"> <span class="str">"can-run-produced-binaries-can-execute-compiled-binaries-string"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1802" href="#t1802">1802</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1803" href="#t1803">1803</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1804" href="#t1804">1804</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1805" href="#t1805">1805</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">provide_manifest_keyword</span><span class="op">(</span> </span><span class="r"><span class="annotate short">1805 ↛ exit</span><span class="annotate long">line 1805 didn't jump to the function exit</span></span></p> - <p class="pln"><span class="n"><a id="t1806" href="#t1806">1806</a></span><span class="t"> <span class="nam">ManifestCondition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1807" href="#t1807">1807</a></span><span class="t"> <span class="str">"run-build-time-tests"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1808" href="#t1808">1808</a></span><span class="t"> <span class="key">lambda</span> <span class="op">*</span><span class="nam">_</span><span class="op">:</span> <span class="nam">ManifestCondition</span><span class="op">.</span><span class="nam">run_build_time_tests</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1809" href="#t1809">1809</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1810" href="#t1810">1810</a></span><span class="t"> <span class="nam">title</span><span class="op">=</span><span class="str">"Whether build time tests should be run `run-build-time-tests`"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1811" href="#t1811">1811</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1812" href="#t1812">1812</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1813" href="#t1813">1813</a></span><span class="t"><span class="str"> The `run-build-time-tests` condition is used to determine whether (build</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1814" href="#t1814">1814</a></span><span class="t"><span class="str"> time) tests should be run for this build. This condition roughly</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1815" href="#t1815">1815</a></span><span class="t"><span class="str"> translates into whether `nocheck` is present in `DEB_BUILD_OPTIONS`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1816" href="#t1816">1816</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1817" href="#t1817">1817</a></span><span class="t"><span class="str"> In general, the manifest *should not* prevent build time tests from being</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1818" href="#t1818">1818</a></span><span class="t"><span class="str"> run during cross-builds.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1819" href="#t1819">1819</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1820" href="#t1820">1820</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1821" href="#t1821">1821</a></span><span class="t"> <span class="nam">reference_documentation_url</span><span class="op">=</span><span class="nam">_manifest_format_doc</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1822" href="#t1822">1822</a></span><span class="t"> <span class="str">"whether-build-time-tests-should-be-run-run-build-time-tests-string"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1823" href="#t1823">1823</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1824" href="#t1824">1824</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1825" href="#t1825">1825</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1826" href="#t1826">1826</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1827" href="#t1827">1827</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">pluggable_manifest_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1828" href="#t1828">1828</a></span><span class="t"> <span class="nam">ManifestCondition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1829" href="#t1829">1829</a></span><span class="t"> <span class="str">"not"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1830" href="#t1830">1830</a></span><span class="t"> <span class="nam">MCNot</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1831" href="#t1831">1831</a></span><span class="t"> <span class="nam">_mc_not</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1832" href="#t1832">1832</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1833" href="#t1833">1833</a></span><span class="t"> <span class="nam">title</span><span class="op">=</span><span class="str">"Negated condition `not` (mapping)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1834" href="#t1834">1834</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1835" href="#t1835">1835</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1836" href="#t1836">1836</a></span><span class="t"><span class="str"> It is possible to negate a condition via the `not` condition.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1837" href="#t1837">1837</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1838" href="#t1838">1838</a></span><span class="t"><span class="str"> As an example:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1839" href="#t1839">1839</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1840" href="#t1840">1840</a></span><span class="t"><span class="str"> packages:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1841" href="#t1841">1841</a></span><span class="t"><span class="str"> util-linux:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1842" href="#t1842">1842</a></span><span class="t"><span class="str"> transformations:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1843" href="#t1843">1843</a></span><span class="t"><span class="str"> - create-symlink</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1844" href="#t1844">1844</a></span><span class="t"><span class="str"> path: sbin/getty</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1845" href="#t1845">1845</a></span><span class="t"><span class="str"> target: /sbin/agetty</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1846" href="#t1846">1846</a></span><span class="t"><span class="str"> when:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1847" href="#t1847">1847</a></span><span class="t"><span class="str"> # On Hurd, the package "hurd" ships "sbin/getty".</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1848" href="#t1848">1848</a></span><span class="t"><span class="str"> # This example happens to also be alternative to `arch-marches: '!hurd-any`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1849" href="#t1849">1849</a></span><span class="t"><span class="str"> not:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1850" href="#t1850">1850</a></span><span class="t"><span class="str"> arch-matches: 'hurd-any'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1851" href="#t1851">1851</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1852" href="#t1852">1852</a></span><span class="t"><span class="str"> The `not` condition is specified as a mapping, where the key is `not` and the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1853" href="#t1853">1853</a></span><span class="t"><span class="str"> value is a nested condition.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1854" href="#t1854">1854</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1855" href="#t1855">1855</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1856" href="#t1856">1856</a></span><span class="t"> <span class="nam">attributes</span><span class="op">=</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1857" href="#t1857">1857</a></span><span class="t"> <span class="nam">documented_attr</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1858" href="#t1858">1858</a></span><span class="t"> <span class="str">"negated_condition"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1859" href="#t1859">1859</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1860" href="#t1860">1860</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1861" href="#t1861">1861</a></span><span class="t"><span class="str"> The condition to be negated.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1862" href="#t1862">1862</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1863" href="#t1863">1863</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1864" href="#t1864">1864</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1865" href="#t1865">1865</a></span><span class="t"> <span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1866" href="#t1866">1866</a></span><span class="t"> <span class="nam">reference_documentation_url</span><span class="op">=</span><span class="nam">_manifest_format_doc</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1867" href="#t1867">1867</a></span><span class="t"> <span class="str">"whether-build-time-tests-should-be-run-run-build-time-tests-string"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1868" href="#t1868">1868</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1869" href="#t1869">1869</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1870" href="#t1870">1870</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1871" href="#t1871">1871</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">pluggable_manifest_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1872" href="#t1872">1872</a></span><span class="t"> <span class="nam">ManifestCondition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1873" href="#t1873">1873</a></span><span class="t"> <span class="op">[</span><span class="str">"any-of"</span><span class="op">,</span> <span class="str">"all-of"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1874" href="#t1874">1874</a></span><span class="t"> <span class="nam">MCAnyOfAllOf</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1875" href="#t1875">1875</a></span><span class="t"> <span class="nam">_mc_any_of</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1876" href="#t1876">1876</a></span><span class="t"> <span class="nam">source_format</span><span class="op">=</span><span class="nam">List</span><span class="op">[</span><span class="nam">ManifestCondition</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1877" href="#t1877">1877</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1878" href="#t1878">1878</a></span><span class="t"> <span class="nam">title</span><span class="op">=</span><span class="str">"All or any of a list of conditions `all-of`/`any-of`"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1879" href="#t1879">1879</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1880" href="#t1880">1880</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1881" href="#t1881">1881</a></span><span class="t"><span class="str"> It is possible to aggregate conditions using the `all-of` or `any-of`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1882" href="#t1882">1882</a></span><span class="t"><span class="str"> condition. This provide `X and Y` and `X or Y` semantics (respectively).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1883" href="#t1883">1883</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1884" href="#t1884">1884</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1885" href="#t1885">1885</a></span><span class="t"> <span class="nam">reference_documentation_url</span><span class="op">=</span><span class="nam">_manifest_format_doc</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1886" href="#t1886">1886</a></span><span class="t"> <span class="str">"all-or-any-of-a-list-of-conditions-all-ofany-of-list"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1887" href="#t1887">1887</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1888" href="#t1888">1888</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1889" href="#t1889">1889</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1890" href="#t1890">1890</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">pluggable_manifest_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1891" href="#t1891">1891</a></span><span class="t"> <span class="nam">ManifestCondition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1892" href="#t1892">1892</a></span><span class="t"> <span class="str">"arch-matches"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1893" href="#t1893">1893</a></span><span class="t"> <span class="nam">MCArchMatches</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1894" href="#t1894">1894</a></span><span class="t"> <span class="nam">_mc_arch_matches</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1895" href="#t1895">1895</a></span><span class="t"> <span class="nam">source_format</span><span class="op">=</span><span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1896" href="#t1896">1896</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1897" href="#t1897">1897</a></span><span class="t"> <span class="nam">title</span><span class="op">=</span><span class="str">"Architecture match condition `arch-matches`"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1898" href="#t1898">1898</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1899" href="#t1899">1899</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1900" href="#t1900">1900</a></span><span class="t"><span class="str"> Sometimes, a rule needs to be conditional on the architecture.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1901" href="#t1901">1901</a></span><span class="t"><span class="str"> This can be done by using the `arch-matches` rule. In 99.99%</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1902" href="#t1902">1902</a></span><span class="t"><span class="str"> of the cases, `arch-matches` will be form you are looking for</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1903" href="#t1903">1903</a></span><span class="t"><span class="str"> and practically behaves like a comparison against</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1904" href="#t1904">1904</a></span><span class="t"><span class="str"> `dpkg-architecture -qDEB_HOST_ARCH`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1905" href="#t1905">1905</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1906" href="#t1906">1906</a></span><span class="t"><span class="str"> For the cross-compiling specialists or curious people: The</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1907" href="#t1907">1907</a></span><span class="t"><span class="str"> `arch-matches` rule behaves like a `package-context-arch-matches`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1908" href="#t1908">1908</a></span><span class="t"><span class="str"> in the context of a binary package and like</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1909" href="#t1909">1909</a></span><span class="t"><span class="str"> `source-context-arch-matches` otherwise. The details of those</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1910" href="#t1910">1910</a></span><span class="t"><span class="str"> are covered in their own keywords.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1911" href="#t1911">1911</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1912" href="#t1912">1912</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1913" href="#t1913">1913</a></span><span class="t"> <span class="nam">non_mapping_description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1914" href="#t1914">1914</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1915" href="#t1915">1915</a></span><span class="t"><span class="str"> The value must be a string in the form of a space separated list</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1916" href="#t1916">1916</a></span><span class="t"><span class="str"> architecture names or architecture wildcards (same syntax as the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1917" href="#t1917">1917</a></span><span class="t"><span class="str"> architecture restriction in Build-Depends in debian/control except</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1918" href="#t1918">1918</a></span><span class="t"><span class="str"> there is no enclosing `[]` brackets). The names/wildcards can</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1919" href="#t1919">1919</a></span><span class="t"><span class="str"> optionally be prefixed by `!` to negate them. However, either</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1920" href="#t1920">1920</a></span><span class="t"><span class="str"> *all* names / wildcards must have negation or *none* of them may</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1921" href="#t1921">1921</a></span><span class="t"><span class="str"> have it.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1922" href="#t1922">1922</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1923" href="#t1923">1923</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1924" href="#t1924">1924</a></span><span class="t"> <span class="nam">reference_documentation_url</span><span class="op">=</span><span class="nam">_manifest_format_doc</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1925" href="#t1925">1925</a></span><span class="t"> <span class="str">"architecture-match-condition-arch-matches-mapping"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1926" href="#t1926">1926</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1927" href="#t1927">1927</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1928" href="#t1928">1928</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1929" href="#t1929">1929</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1930" href="#t1930">1930</a></span><span class="t"> <span class="nam">context_arch_doc</span> <span class="op">=</span> <span class="nam">reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1931" href="#t1931">1931</a></span><span class="t"> <span class="nam">title</span><span class="op">=</span><span class="str">"Explicit source or binary package context architecture match condition"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1932" href="#t1932">1932</a></span><span class="t"> <span class="str">" `source-context-arch-matches`, `package-context-arch-matches` (mapping)"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1933" href="#t1933">1933</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1934" href="#t1934">1934</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1935" href="#t1935">1935</a></span><span class="t"><span class="str"> **These are special-case conditions**. Unless you know that you have a very special-case,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1936" href="#t1936">1936</a></span><span class="t"><span class="str"> you should probably use `arch-matches` instead. These conditions are aimed at people with</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1937" href="#t1937">1937</a></span><span class="t"><span class="str"> corner-case special architecture needs. It also assumes the reader is familiar with the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1938" href="#t1938">1938</a></span><span class="t"><span class="str"> `arch-matches` condition.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1939" href="#t1939">1939</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1940" href="#t1940">1940</a></span><span class="t"><span class="str"> To understand these rules, here is a quick primer on `debputy`'s concept of "source context"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1941" href="#t1941">1941</a></span><span class="t"><span class="str"> vs "(binary) package context" architecture. For a native build, these two contexts are the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1942" href="#t1942">1942</a></span><span class="t"><span class="str"> same except that in the package context an `Architecture: all` package always resolve to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1943" href="#t1943">1943</a></span><span class="t"><span class="str"> `all` rather than `DEB_HOST_ARCH`. As a consequence, `debputy` forbids `arch-matches` and</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1944" href="#t1944">1944</a></span><span class="t"><span class="str"> `package-context-arch-matches` in the context of an `Architecture: all` package as a warning</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1945" href="#t1945">1945</a></span><span class="t"><span class="str"> to the packager that condition does not make sense.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1946" href="#t1946">1946</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1947" href="#t1947">1947</a></span><span class="t"><span class="str"> In the very rare case that you need an architecture condition for an `Architecture: all` package,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1948" href="#t1948">1948</a></span><span class="t"><span class="str"> you can use `source-context-arch-matches`. However, this means your `Architecture: all` package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1949" href="#t1949">1949</a></span><span class="t"><span class="str"> is not reproducible between different build hosts (which has known to be relevant for some</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1950" href="#t1950">1950</a></span><span class="t"><span class="str"> very special cases).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1951" href="#t1951">1951</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1952" href="#t1952">1952</a></span><span class="t"><span class="str"> Additionally, for the 0.0001% case you are building a cross-compiling compiler (that is,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1953" href="#t1953">1953</a></span><span class="t"><span class="str"> `DEB_HOST_ARCH != DEB_TARGET_ARCH` and you are working with `gcc` or similar) `debputy` can be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1954" href="#t1954">1954</a></span><span class="t"><span class="str"> instructed (opt-in) to use `DEB_TARGET_ARCH` rather than `DEB_HOST_ARCH` for certain packages when</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1955" href="#t1955">1955</a></span><span class="t"><span class="str"> evaluating an architecture condition in context of a binary package. This can be useful if the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1956" href="#t1956">1956</a></span><span class="t"><span class="str"> compiler produces supporting libraries that need to be built for the `DEB_TARGET_ARCH` rather than</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1957" href="#t1957">1957</a></span><span class="t"><span class="str"> the `DEB_HOST_ARCH`. This is where `arch-matches` or `package-context-arch-matches` can differ</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1958" href="#t1958">1958</a></span><span class="t"><span class="str"> subtly from `source-context-arch-matches` in how they evaluate the condition. This opt-in currently</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1959" href="#t1959">1959</a></span><span class="t"><span class="str"> relies on setting `X-DH-Build-For-Type: target` for each of the relevant packages in</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1960" href="#t1960">1960</a></span><span class="t"><span class="str"> `debian/control`. However, unless you are a cross-compiling specialist, you will probably never</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1961" href="#t1961">1961</a></span><span class="t"><span class="str"> need to care about nor use any of this.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1962" href="#t1962">1962</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1963" href="#t1963">1963</a></span><span class="t"><span class="str"> Accordingly, the possible conditions are:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1964" href="#t1964">1964</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1965" href="#t1965">1965</a></span><span class="t"><span class="str"> * `arch-matches`: This is the form recommended to laymen and as the default use-case. This</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1966" href="#t1966">1966</a></span><span class="t"><span class="str"> conditional acts `package-context-arch-matches` if the condition is used in the context</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1967" href="#t1967">1967</a></span><span class="t"><span class="str"> of a binary package. Otherwise, it acts as `source-context-arch-matches`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1968" href="#t1968">1968</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1969" href="#t1969">1969</a></span><span class="t"><span class="str"> * `source-context-arch-matches`: With this conditional, the provided architecture constraint is compared</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1970" href="#t1970">1970</a></span><span class="t"><span class="str"> against the build time provided host architecture (`dpkg-architecture -qDEB_HOST_ARCH`). This can</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1971" href="#t1971">1971</a></span><span class="t"><span class="str"> be useful when an `Architecture: all` package needs an architecture condition for some reason.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1972" href="#t1972">1972</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1973" href="#t1973">1973</a></span><span class="t"><span class="str"> * `package-context-arch-matches`: With this conditional, the provided architecture constraint is compared</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1974" href="#t1974">1974</a></span><span class="t"><span class="str"> against the package's resolved architecture. This condition can only be used in the context of a binary</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1975" href="#t1975">1975</a></span><span class="t"><span class="str"> package (usually, under `packages.<name>.`). If the package is an `Architecture: all` package, the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1976" href="#t1976">1976</a></span><span class="t"><span class="str"> condition will fail with an error as the condition always have the same outcome. For all other</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1977" href="#t1977">1977</a></span><span class="t"><span class="str"> packages, the package's resolved architecture is the same as the build time provided host architecture</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1978" href="#t1978">1978</a></span><span class="t"><span class="str"> (`dpkg-architecture -qDEB_HOST_ARCH`).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1979" href="#t1979">1979</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1980" href="#t1980">1980</a></span><span class="t"><span class="str"> - However, as noted above there is a special case for when compiling a cross-compiling compiler, where</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1981" href="#t1981">1981</a></span><span class="t"><span class="str"> this behaves subtly different from `source-context-arch-matches`.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1982" href="#t1982">1982</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1983" href="#t1983">1983</a></span><span class="t"><span class="str"> All conditions are used the same way as `arch-matches`. Simply replace `arch-matches` with the other</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1984" href="#t1984">1984</a></span><span class="t"><span class="str"> condition. See the `arch-matches` description for an example.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1985" href="#t1985">1985</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1986" href="#t1986">1986</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1987" href="#t1987">1987</a></span><span class="t"> <span class="nam">non_mapping_description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1988" href="#t1988">1988</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1989" href="#t1989">1989</a></span><span class="t"><span class="str"> The value must be a string in the form of a space separated list</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1990" href="#t1990">1990</a></span><span class="t"><span class="str"> architecture names or architecture wildcards (same syntax as the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1991" href="#t1991">1991</a></span><span class="t"><span class="str"> architecture restriction in Build-Depends in debian/control except</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1992" href="#t1992">1992</a></span><span class="t"><span class="str"> there is no enclosing `[]` brackets). The names/wildcards can</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1993" href="#t1993">1993</a></span><span class="t"><span class="str"> optionally be prefixed by `!` to negate them. However, either</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1994" href="#t1994">1994</a></span><span class="t"><span class="str"> *all* names / wildcards must have negation or *none* of them may</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1995" href="#t1995">1995</a></span><span class="t"><span class="str"> have it.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1996" href="#t1996">1996</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1997" href="#t1997">1997</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1998" href="#t1998">1998</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1999" href="#t1999">1999</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2000" href="#t2000">2000</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">pluggable_manifest_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2001" href="#t2001">2001</a></span><span class="t"> <span class="nam">ManifestCondition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2002" href="#t2002">2002</a></span><span class="t"> <span class="str">"source-context-arch-matches"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2003" href="#t2003">2003</a></span><span class="t"> <span class="nam">MCArchMatches</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2004" href="#t2004">2004</a></span><span class="t"> <span class="nam">_mc_source_context_arch_matches</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2005" href="#t2005">2005</a></span><span class="t"> <span class="nam">source_format</span><span class="op">=</span><span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2006" href="#t2006">2006</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">context_arch_doc</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2007" href="#t2007">2007</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2008" href="#t2008">2008</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">pluggable_manifest_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2009" href="#t2009">2009</a></span><span class="t"> <span class="nam">ManifestCondition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2010" href="#t2010">2010</a></span><span class="t"> <span class="str">"package-context-arch-matches"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2011" href="#t2011">2011</a></span><span class="t"> <span class="nam">MCArchMatches</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2012" href="#t2012">2012</a></span><span class="t"> <span class="nam">_mc_arch_matches</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2013" href="#t2013">2013</a></span><span class="t"> <span class="nam">source_format</span><span class="op">=</span><span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2014" href="#t2014">2014</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">context_arch_doc</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2015" href="#t2015">2015</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2016" href="#t2016">2016</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">pluggable_manifest_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2017" href="#t2017">2017</a></span><span class="t"> <span class="nam">ManifestCondition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2018" href="#t2018">2018</a></span><span class="t"> <span class="str">"build-profiles-matches"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2019" href="#t2019">2019</a></span><span class="t"> <span class="nam">MCBuildProfileMatches</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2020" href="#t2020">2020</a></span><span class="t"> <span class="nam">_mc_build_profile_matches</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2021" href="#t2021">2021</a></span><span class="t"> <span class="nam">source_format</span><span class="op">=</span><span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2022" href="#t2022">2022</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="nam">reference_documentation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2023" href="#t2023">2023</a></span><span class="t"> <span class="nam">title</span><span class="op">=</span><span class="str">"Active build profile match condition `build-profiles-matches`"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2024" href="#t2024">2024</a></span><span class="t"> <span class="nam">description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2025" href="#t2025">2025</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2026" href="#t2026">2026</a></span><span class="t"><span class="str"> The `build-profiles-matches` condition is used to assert whether the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2027" href="#t2027">2027</a></span><span class="t"><span class="str"> active build profiles (`DEB_BUILD_PROFILES` / `dpkg-buildpackage -P`)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2028" href="#t2028">2028</a></span><span class="t"><span class="str"> matches a given build profile restriction.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2029" href="#t2029">2029</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2030" href="#t2030">2030</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2031" href="#t2031">2031</a></span><span class="t"> <span class="nam">non_mapping_description</span><span class="op">=</span><span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2032" href="#t2032">2032</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2033" href="#t2033">2033</a></span><span class="t"><span class="str"> The value is a string using the same syntax as the `Build-Profiles`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2034" href="#t2034">2034</a></span><span class="t"><span class="str"> field from `debian/control` (i.e., a space separated list of</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2035" href="#t2035">2035</a></span><span class="t"><span class="str"> `<[!]profile ...>` groups).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2036" href="#t2036">2036</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2037" href="#t2037">2037</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2038" href="#t2038">2038</a></span><span class="t"> <span class="nam">reference_documentation_url</span><span class="op">=</span><span class="nam">_manifest_format_doc</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2039" href="#t2039">2039</a></span><span class="t"> <span class="str">"active-build-profile-match-condition-build-profiles-matches-mapping"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2040" href="#t2040">2040</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2041" href="#t2041">2041</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2042" href="#t2042">2042</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2043" href="#t2043">2043</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2044" href="#t2044">2044</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2045" href="#t2045">2045</a></span><span class="t"><span class="key">def</span> <span class="nam">register_dpkg_conffile_rules</span><span class="op">(</span><span class="nam">api</span><span class="op">:</span> <span class="nam">DebputyPluginInitializerProvider</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2046" href="#t2046">2046</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">pluggable_manifest_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2047" href="#t2047">2047</a></span><span class="t"> <span class="nam">DpkgMaintscriptHelperCommand</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2048" href="#t2048">2048</a></span><span class="t"> <span class="str">"remove"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2049" href="#t2049">2049</a></span><span class="t"> <span class="nam">DpkgRemoveConffileRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2050" href="#t2050">2050</a></span><span class="t"> <span class="nam">_dpkg_conffile_remove</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2051" href="#t2051">2051</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> <span class="com"># TODO: write and add</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2052" href="#t2052">2052</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2053" href="#t2053">2053</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2054" href="#t2054">2054</a></span><span class="t"> <span class="nam">api</span><span class="op">.</span><span class="nam">pluggable_manifest_rule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2055" href="#t2055">2055</a></span><span class="t"> <span class="nam">DpkgMaintscriptHelperCommand</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2056" href="#t2056">2056</a></span><span class="t"> <span class="str">"rename"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2057" href="#t2057">2057</a></span><span class="t"> <span class="nam">DpkgRenameConffileRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2058" href="#t2058">2058</a></span><span class="t"> <span class="nam">_dpkg_conffile_rename</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2059" href="#t2059">2059</a></span><span class="t"> <span class="nam">inline_reference_documentation</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> <span class="com"># TODO: write and add</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2060" href="#t2060">2060</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2061" href="#t2061">2061</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2062" href="#t2062">2062</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2063" href="#t2063">2063</a></span><span class="t"><span class="key">class</span> <span class="nam">_ModeOwnerBase</span><span class="op">(</span><span class="nam">DebputyParsedContentStandardConditional</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2064" href="#t2064">2064</a></span><span class="t"> <span class="nam">mode</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">FileSystemMode</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2065" href="#t2065">2065</a></span><span class="t"> <span class="nam">owner</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">StaticFileSystemOwner</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2066" href="#t2066">2066</a></span><span class="t"> <span class="nam">group</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">StaticFileSystemGroup</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2067" href="#t2067">2067</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2068" href="#t2068">2068</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2069" href="#t2069">2069</a></span><span class="t"><span class="key">class</span> <span class="nam">PathManifestSourceDictFormat</span><span class="op">(</span><span class="nam">_ModeOwnerBase</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2070" href="#t2070">2070</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2071" href="#t2071">2071</a></span><span class="t"> <span class="nam">Annotated</span><span class="op">[</span><span class="nam">FileSystemMatchRule</span><span class="op">,</span> <span class="nam">DebputyParseHint</span><span class="op">.</span><span class="nam">target_attribute</span><span class="op">(</span><span class="str">"paths"</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2072" href="#t2072">2072</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2073" href="#t2073">2073</a></span><span class="t"> <span class="nam">paths</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">FileSystemMatchRule</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2074" href="#t2074">2074</a></span><span class="t"> <span class="nam">recursive</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2075" href="#t2075">2075</a></span><span class="t"> <span class="nam">capabilities</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2076" href="#t2076">2076</a></span><span class="t"> <span class="nam">capability_mode</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">FileSystemMode</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2077" href="#t2077">2077</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2078" href="#t2078">2078</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2079" href="#t2079">2079</a></span><span class="t"><span class="key">class</span> <span class="nam">PathManifestRule</span><span class="op">(</span><span class="nam">_ModeOwnerBase</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2080" href="#t2080">2080</a></span><span class="t"> <span class="nam">paths</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">FileSystemMatchRule</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2081" href="#t2081">2081</a></span><span class="t"> <span class="nam">recursive</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2082" href="#t2082">2082</a></span><span class="t"> <span class="nam">capabilities</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2083" href="#t2083">2083</a></span><span class="t"> <span class="nam">capability_mode</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">FileSystemMode</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2084" href="#t2084">2084</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2085" href="#t2085">2085</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2086" href="#t2086">2086</a></span><span class="t"><span class="key">class</span> <span class="nam">EnsureDirectorySourceFormat</span><span class="op">(</span><span class="nam">_ModeOwnerBase</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2087" href="#t2087">2087</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2088" href="#t2088">2088</a></span><span class="t"> <span class="nam">Annotated</span><span class="op">[</span><span class="nam">FileSystemExactMatchRule</span><span class="op">,</span> <span class="nam">DebputyParseHint</span><span class="op">.</span><span class="nam">target_attribute</span><span class="op">(</span><span class="str">"paths"</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2089" href="#t2089">2089</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2090" href="#t2090">2090</a></span><span class="t"> <span class="nam">paths</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">FileSystemExactMatchRule</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2091" href="#t2091">2091</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2092" href="#t2092">2092</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2093" href="#t2093">2093</a></span><span class="t"><span class="key">class</span> <span class="nam">EnsureDirectoryRule</span><span class="op">(</span><span class="nam">_ModeOwnerBase</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2094" href="#t2094">2094</a></span><span class="t"> <span class="nam">paths</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">FileSystemExactMatchRule</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2095" href="#t2095">2095</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2096" href="#t2096">2096</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2097" href="#t2097">2097</a></span><span class="t"><span class="key">class</span> <span class="nam">CreateSymlinkRule</span><span class="op">(</span><span class="nam">DebputyParsedContentStandardConditional</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2098" href="#t2098">2098</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">FileSystemExactMatchRule</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2099" href="#t2099">2099</a></span><span class="t"> <span class="nam">target</span><span class="op">:</span> <span class="nam">Annotated</span><span class="op">[</span><span class="nam">SymlinkTarget</span><span class="op">,</span> <span class="nam">DebputyParseHint</span><span class="op">.</span><span class="nam">not_path_error_hint</span><span class="op">(</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2100" href="#t2100">2100</a></span><span class="t"> <span class="nam">replacement_rule</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">CreateSymlinkReplacementRule</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2101" href="#t2101">2101</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2102" href="#t2102">2102</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2103" href="#t2103">2103</a></span><span class="t"><span class="key">class</span> <span class="nam">TransformationMoveRuleSpec</span><span class="op">(</span><span class="nam">DebputyParsedContentStandardConditional</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2104" href="#t2104">2104</a></span><span class="t"> <span class="nam">source</span><span class="op">:</span> <span class="nam">FileSystemMatchRule</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2105" href="#t2105">2105</a></span><span class="t"> <span class="nam">target</span><span class="op">:</span> <span class="nam">FileSystemExactMatchRule</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2106" href="#t2106">2106</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2107" href="#t2107">2107</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2108" href="#t2108">2108</a></span><span class="t"><span class="key">class</span> <span class="nam">TransformationRemoveRuleSpec</span><span class="op">(</span><span class="nam">DebputyParsedContentStandardConditional</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2109" href="#t2109">2109</a></span><span class="t"> <span class="nam">paths</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">FileSystemMatchRule</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2110" href="#t2110">2110</a></span><span class="t"> <span class="nam">keep_empty_parent_dirs</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2111" href="#t2111">2111</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2112" href="#t2112">2112</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2113" href="#t2113">2113</a></span><span class="t"><span class="key">class</span> <span class="nam">TransformationRemoveRuleInputFormat</span><span class="op">(</span><span class="nam">DebputyParsedContentStandardConditional</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2114" href="#t2114">2114</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2115" href="#t2115">2115</a></span><span class="t"> <span class="nam">Annotated</span><span class="op">[</span><span class="nam">FileSystemMatchRule</span><span class="op">,</span> <span class="nam">DebputyParseHint</span><span class="op">.</span><span class="nam">target_attribute</span><span class="op">(</span><span class="str">"paths"</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2116" href="#t2116">2116</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2117" href="#t2117">2117</a></span><span class="t"> <span class="nam">paths</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">FileSystemMatchRule</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2118" href="#t2118">2118</a></span><span class="t"> <span class="nam">keep_empty_parent_dirs</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">bool</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2119" href="#t2119">2119</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2120" href="#t2120">2120</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2121" href="#t2121">2121</a></span><span class="t"><span class="key">class</span> <span class="nam">ParsedInstallRuleSourceFormat</span><span class="op">(</span><span class="nam">DebputyParsedContentStandardConditional</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2122" href="#t2122">2122</a></span><span class="t"> <span class="nam">sources</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">FileSystemMatchRule</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2123" href="#t2123">2123</a></span><span class="t"> <span class="nam">source</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2124" href="#t2124">2124</a></span><span class="t"> <span class="nam">Annotated</span><span class="op">[</span><span class="nam">FileSystemMatchRule</span><span class="op">,</span> <span class="nam">DebputyParseHint</span><span class="op">.</span><span class="nam">target_attribute</span><span class="op">(</span><span class="str">"sources"</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2125" href="#t2125">2125</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2126" href="#t2126">2126</a></span><span class="t"> <span class="nam">into</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2127" href="#t2127">2127</a></span><span class="t"> <span class="nam">Annotated</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2128" href="#t2128">2128</a></span><span class="t"> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2129" href="#t2129">2129</a></span><span class="t"> <span class="nam">DebputyParseHint</span><span class="op">.</span><span class="nam">required_when_multi_binary</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2130" href="#t2130">2130</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2131" href="#t2131">2131</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2132" href="#t2132">2132</a></span><span class="t"> <span class="nam">dest_dir</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2133" href="#t2133">2133</a></span><span class="t"> <span class="nam">Annotated</span><span class="op">[</span><span class="nam">FileSystemExactMatchRule</span><span class="op">,</span> <span class="nam">DebputyParseHint</span><span class="op">.</span><span class="nam">not_path_error_hint</span><span class="op">(</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2134" href="#t2134">2134</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2135" href="#t2135">2135</a></span><span class="t"> <span class="nam">install_as</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2136" href="#t2136">2136</a></span><span class="t"> <span class="nam">Annotated</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2137" href="#t2137">2137</a></span><span class="t"> <span class="nam">FileSystemExactMatchRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2138" href="#t2138">2138</a></span><span class="t"> <span class="nam">DebputyParseHint</span><span class="op">.</span><span class="nam">conflicts_with_source_attributes</span><span class="op">(</span><span class="str">"sources"</span><span class="op">,</span> <span class="str">"dest_dir"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2139" href="#t2139">2139</a></span><span class="t"> <span class="nam">DebputyParseHint</span><span class="op">.</span><span class="nam">manifest_attribute</span><span class="op">(</span><span class="str">"as"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2140" href="#t2140">2140</a></span><span class="t"> <span class="nam">DebputyParseHint</span><span class="op">.</span><span class="nam">not_path_error_hint</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2141" href="#t2141">2141</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2142" href="#t2142">2142</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2143" href="#t2143">2143</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2144" href="#t2144">2144</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2145" href="#t2145">2145</a></span><span class="t"><span class="key">class</span> <span class="nam">ParsedInstallDocRuleSourceFormat</span><span class="op">(</span><span class="nam">DebputyParsedContentStandardConditional</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2146" href="#t2146">2146</a></span><span class="t"> <span class="nam">sources</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">FileSystemMatchRule</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2147" href="#t2147">2147</a></span><span class="t"> <span class="nam">source</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2148" href="#t2148">2148</a></span><span class="t"> <span class="nam">Annotated</span><span class="op">[</span><span class="nam">FileSystemMatchRule</span><span class="op">,</span> <span class="nam">DebputyParseHint</span><span class="op">.</span><span class="nam">target_attribute</span><span class="op">(</span><span class="str">"sources"</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2149" href="#t2149">2149</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2150" href="#t2150">2150</a></span><span class="t"> <span class="nam">into</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2151" href="#t2151">2151</a></span><span class="t"> <span class="nam">Annotated</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2152" href="#t2152">2152</a></span><span class="t"> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2153" href="#t2153">2153</a></span><span class="t"> <span class="nam">DebputyParseHint</span><span class="op">.</span><span class="nam">required_when_multi_binary</span><span class="op">(</span><span class="nam">package_type</span><span class="op">=</span><span class="str">"deb"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2154" href="#t2154">2154</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2155" href="#t2155">2155</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2156" href="#t2156">2156</a></span><span class="t"> <span class="nam">dest_dir</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2157" href="#t2157">2157</a></span><span class="t"> <span class="nam">Annotated</span><span class="op">[</span><span class="nam">FileSystemExactMatchRule</span><span class="op">,</span> <span class="nam">DebputyParseHint</span><span class="op">.</span><span class="nam">not_path_error_hint</span><span class="op">(</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2158" href="#t2158">2158</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2159" href="#t2159">2159</a></span><span class="t"> <span class="nam">install_as</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2160" href="#t2160">2160</a></span><span class="t"> <span class="nam">Annotated</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2161" href="#t2161">2161</a></span><span class="t"> <span class="nam">FileSystemExactMatchRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2162" href="#t2162">2162</a></span><span class="t"> <span class="nam">DebputyParseHint</span><span class="op">.</span><span class="nam">conflicts_with_source_attributes</span><span class="op">(</span><span class="str">"sources"</span><span class="op">,</span> <span class="str">"dest_dir"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2163" href="#t2163">2163</a></span><span class="t"> <span class="nam">DebputyParseHint</span><span class="op">.</span><span class="nam">manifest_attribute</span><span class="op">(</span><span class="str">"as"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2164" href="#t2164">2164</a></span><span class="t"> <span class="nam">DebputyParseHint</span><span class="op">.</span><span class="nam">not_path_error_hint</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2165" href="#t2165">2165</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2166" href="#t2166">2166</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2167" href="#t2167">2167</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2168" href="#t2168">2168</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2169" href="#t2169">2169</a></span><span class="t"><span class="key">class</span> <span class="nam">ParsedInstallRule</span><span class="op">(</span><span class="nam">DebputyParsedContentStandardConditional</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2170" href="#t2170">2170</a></span><span class="t"> <span class="nam">sources</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">FileSystemMatchRule</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2171" href="#t2171">2171</a></span><span class="t"> <span class="nam">into</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2172" href="#t2172">2172</a></span><span class="t"> <span class="nam">dest_dir</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">FileSystemExactMatchRule</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2173" href="#t2173">2173</a></span><span class="t"> <span class="nam">install_as</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">FileSystemExactMatchRule</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2174" href="#t2174">2174</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2175" href="#t2175">2175</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2176" href="#t2176">2176</a></span><span class="t"><span class="key">class</span> <span class="nam">ParsedMultiDestInstallRuleSourceFormat</span><span class="op">(</span><span class="nam">DebputyParsedContentStandardConditional</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2177" href="#t2177">2177</a></span><span class="t"> <span class="nam">sources</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">FileSystemMatchRule</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2178" href="#t2178">2178</a></span><span class="t"> <span class="nam">source</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2179" href="#t2179">2179</a></span><span class="t"> <span class="nam">Annotated</span><span class="op">[</span><span class="nam">FileSystemMatchRule</span><span class="op">,</span> <span class="nam">DebputyParseHint</span><span class="op">.</span><span class="nam">target_attribute</span><span class="op">(</span><span class="str">"sources"</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2180" href="#t2180">2180</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2181" href="#t2181">2181</a></span><span class="t"> <span class="nam">into</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2182" href="#t2182">2182</a></span><span class="t"> <span class="nam">Annotated</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2183" href="#t2183">2183</a></span><span class="t"> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2184" href="#t2184">2184</a></span><span class="t"> <span class="nam">DebputyParseHint</span><span class="op">.</span><span class="nam">required_when_multi_binary</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2185" href="#t2185">2185</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2186" href="#t2186">2186</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2187" href="#t2187">2187</a></span><span class="t"> <span class="nam">dest_dirs</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2188" href="#t2188">2188</a></span><span class="t"> <span class="nam">Annotated</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2189" href="#t2189">2189</a></span><span class="t"> <span class="nam">List</span><span class="op">[</span><span class="nam">FileSystemExactMatchRule</span><span class="op">]</span><span class="op">,</span> <span class="nam">DebputyParseHint</span><span class="op">.</span><span class="nam">not_path_error_hint</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2190" href="#t2190">2190</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2191" href="#t2191">2191</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2192" href="#t2192">2192</a></span><span class="t"> <span class="nam">install_as</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2193" href="#t2193">2193</a></span><span class="t"> <span class="nam">Annotated</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2194" href="#t2194">2194</a></span><span class="t"> <span class="nam">List</span><span class="op">[</span><span class="nam">FileSystemExactMatchRule</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2195" href="#t2195">2195</a></span><span class="t"> <span class="nam">DebputyParseHint</span><span class="op">.</span><span class="nam">conflicts_with_source_attributes</span><span class="op">(</span><span class="str">"sources"</span><span class="op">,</span> <span class="str">"dest_dirs"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2196" href="#t2196">2196</a></span><span class="t"> <span class="nam">DebputyParseHint</span><span class="op">.</span><span class="nam">not_path_error_hint</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2197" href="#t2197">2197</a></span><span class="t"> <span class="nam">DebputyParseHint</span><span class="op">.</span><span class="nam">manifest_attribute</span><span class="op">(</span><span class="str">"as"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2198" href="#t2198">2198</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2199" href="#t2199">2199</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2200" href="#t2200">2200</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2201" href="#t2201">2201</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2202" href="#t2202">2202</a></span><span class="t"><span class="key">class</span> <span class="nam">ParsedMultiDestInstallRule</span><span class="op">(</span><span class="nam">DebputyParsedContentStandardConditional</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2203" href="#t2203">2203</a></span><span class="t"> <span class="nam">sources</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">FileSystemMatchRule</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2204" href="#t2204">2204</a></span><span class="t"> <span class="nam">into</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2205" href="#t2205">2205</a></span><span class="t"> <span class="nam">dest_dirs</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">FileSystemExactMatchRule</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2206" href="#t2206">2206</a></span><span class="t"> <span class="nam">install_as</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">FileSystemExactMatchRule</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2207" href="#t2207">2207</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2208" href="#t2208">2208</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2209" href="#t2209">2209</a></span><span class="t"><span class="key">class</span> <span class="nam">ParsedInstallExamplesRule</span><span class="op">(</span><span class="nam">DebputyParsedContentStandardConditional</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2210" href="#t2210">2210</a></span><span class="t"> <span class="nam">sources</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">FileSystemMatchRule</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2211" href="#t2211">2211</a></span><span class="t"> <span class="nam">into</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2212" href="#t2212">2212</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2213" href="#t2213">2213</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2214" href="#t2214">2214</a></span><span class="t"><span class="key">class</span> <span class="nam">ParsedInstallExamplesRuleSourceFormat</span><span class="op">(</span><span class="nam">DebputyParsedContentStandardConditional</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2215" href="#t2215">2215</a></span><span class="t"> <span class="nam">sources</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">FileSystemMatchRule</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2216" href="#t2216">2216</a></span><span class="t"> <span class="nam">source</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2217" href="#t2217">2217</a></span><span class="t"> <span class="nam">Annotated</span><span class="op">[</span><span class="nam">FileSystemMatchRule</span><span class="op">,</span> <span class="nam">DebputyParseHint</span><span class="op">.</span><span class="nam">target_attribute</span><span class="op">(</span><span class="str">"sources"</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2218" href="#t2218">2218</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2219" href="#t2219">2219</a></span><span class="t"> <span class="nam">into</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2220" href="#t2220">2220</a></span><span class="t"> <span class="nam">Annotated</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2221" href="#t2221">2221</a></span><span class="t"> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2222" href="#t2222">2222</a></span><span class="t"> <span class="nam">DebputyParseHint</span><span class="op">.</span><span class="nam">required_when_multi_binary</span><span class="op">(</span><span class="nam">package_type</span><span class="op">=</span><span class="str">"deb"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2223" href="#t2223">2223</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2224" href="#t2224">2224</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2225" href="#t2225">2225</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2226" href="#t2226">2226</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2227" href="#t2227">2227</a></span><span class="t"><span class="key">class</span> <span class="nam">ParsedInstallManpageRule</span><span class="op">(</span><span class="nam">DebputyParsedContentStandardConditional</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2228" href="#t2228">2228</a></span><span class="t"> <span class="nam">sources</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">FileSystemMatchRule</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2229" href="#t2229">2229</a></span><span class="t"> <span class="nam">language</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2230" href="#t2230">2230</a></span><span class="t"> <span class="nam">section</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2231" href="#t2231">2231</a></span><span class="t"> <span class="nam">into</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">BinaryPackage</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2232" href="#t2232">2232</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2233" href="#t2233">2233</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2234" href="#t2234">2234</a></span><span class="t"><span class="key">class</span> <span class="nam">ParsedInstallManpageRuleSourceFormat</span><span class="op">(</span><span class="nam">DebputyParsedContentStandardConditional</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2235" href="#t2235">2235</a></span><span class="t"> <span class="nam">sources</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">FileSystemMatchRule</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2236" href="#t2236">2236</a></span><span class="t"> <span class="nam">source</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2237" href="#t2237">2237</a></span><span class="t"> <span class="nam">Annotated</span><span class="op">[</span><span class="nam">FileSystemMatchRule</span><span class="op">,</span> <span class="nam">DebputyParseHint</span><span class="op">.</span><span class="nam">target_attribute</span><span class="op">(</span><span class="str">"sources"</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2238" href="#t2238">2238</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2239" href="#t2239">2239</a></span><span class="t"> <span class="nam">language</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2240" href="#t2240">2240</a></span><span class="t"> <span class="nam">section</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">int</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2241" href="#t2241">2241</a></span><span class="t"> <span class="nam">into</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2242" href="#t2242">2242</a></span><span class="t"> <span class="nam">Annotated</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2243" href="#t2243">2243</a></span><span class="t"> <span class="nam">Union</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2244" href="#t2244">2244</a></span><span class="t"> <span class="nam">DebputyParseHint</span><span class="op">.</span><span class="nam">required_when_multi_binary</span><span class="op">(</span><span class="nam">package_type</span><span class="op">=</span><span class="str">"deb"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2245" href="#t2245">2245</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2246" href="#t2246">2246</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2247" href="#t2247">2247</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2248" href="#t2248">2248</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2249" href="#t2249">2249</a></span><span class="t"><span class="key">class</span> <span class="nam">ParsedInstallDiscardRuleSourceFormat</span><span class="op">(</span><span class="nam">DebputyParsedContent</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2250" href="#t2250">2250</a></span><span class="t"> <span class="nam">paths</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">FileSystemMatchRule</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2251" href="#t2251">2251</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2252" href="#t2252">2252</a></span><span class="t"> <span class="nam">Annotated</span><span class="op">[</span><span class="nam">FileSystemMatchRule</span><span class="op">,</span> <span class="nam">DebputyParseHint</span><span class="op">.</span><span class="nam">target_attribute</span><span class="op">(</span><span class="str">"paths"</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2253" href="#t2253">2253</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2254" href="#t2254">2254</a></span><span class="t"> <span class="nam">search_dir</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2255" href="#t2255">2255</a></span><span class="t"> <span class="nam">Annotated</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2256" href="#t2256">2256</a></span><span class="t"> <span class="nam">FileSystemExactMatchRule</span><span class="op">,</span> <span class="nam">DebputyParseHint</span><span class="op">.</span><span class="nam">target_attribute</span><span class="op">(</span><span class="str">"search_dirs"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2257" href="#t2257">2257</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2258" href="#t2258">2258</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2259" href="#t2259">2259</a></span><span class="t"> <span class="nam">search_dirs</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">FileSystemExactMatchRule</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2260" href="#t2260">2260</a></span><span class="t"> <span class="nam">required_when</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">ManifestCondition</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2261" href="#t2261">2261</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2262" href="#t2262">2262</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2263" href="#t2263">2263</a></span><span class="t"><span class="key">class</span> <span class="nam">ParsedInstallDiscardRule</span><span class="op">(</span><span class="nam">DebputyParsedContent</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2264" href="#t2264">2264</a></span><span class="t"> <span class="nam">paths</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">FileSystemMatchRule</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2265" href="#t2265">2265</a></span><span class="t"> <span class="nam">search_dirs</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">FileSystemExactMatchRule</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2266" href="#t2266">2266</a></span><span class="t"> <span class="nam">required_when</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">ManifestCondition</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2267" href="#t2267">2267</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2268" href="#t2268">2268</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2269" href="#t2269">2269</a></span><span class="t"><span class="key">class</span> <span class="nam">DpkgConffileManagementRuleBase</span><span class="op">(</span><span class="nam">DebputyParsedContent</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2270" href="#t2270">2270</a></span><span class="t"> <span class="nam">prior_to_version</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2271" href="#t2271">2271</a></span><span class="t"> <span class="nam">owning_package</span><span class="op">:</span> <span class="nam">NotRequired</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2272" href="#t2272">2272</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2273" href="#t2273">2273</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2274" href="#t2274">2274</a></span><span class="t"><span class="key">class</span> <span class="nam">DpkgRenameConffileRule</span><span class="op">(</span><span class="nam">DpkgConffileManagementRuleBase</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2275" href="#t2275">2275</a></span><span class="t"> <span class="nam">source</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2276" href="#t2276">2276</a></span><span class="t"> <span class="nam">target</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2277" href="#t2277">2277</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2278" href="#t2278">2278</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2279" href="#t2279">2279</a></span><span class="t"><span class="key">class</span> <span class="nam">DpkgRemoveConffileRule</span><span class="op">(</span><span class="nam">DpkgConffileManagementRuleBase</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2280" href="#t2280">2280</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2281" href="#t2281">2281</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2282" href="#t2282">2282</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2283" href="#t2283">2283</a></span><span class="t"><span class="key">class</span> <span class="nam">MCAnyOfAllOf</span><span class="op">(</span><span class="nam">DebputyParsedContent</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2284" href="#t2284">2284</a></span><span class="t"> <span class="nam">conditions</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">ManifestCondition</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2285" href="#t2285">2285</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2286" href="#t2286">2286</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2287" href="#t2287">2287</a></span><span class="t"><span class="key">class</span> <span class="nam">MCNot</span><span class="op">(</span><span class="nam">DebputyParsedContent</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2288" href="#t2288">2288</a></span><span class="t"> <span class="nam">negated_condition</span><span class="op">:</span> <span class="nam">Annotated</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2289" href="#t2289">2289</a></span><span class="t"> <span class="nam">ManifestCondition</span><span class="op">,</span> <span class="nam">DebputyParseHint</span><span class="op">.</span><span class="nam">manifest_attribute</span><span class="op">(</span><span class="str">"not"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2290" href="#t2290">2290</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2291" href="#t2291">2291</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2292" href="#t2292">2292</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2293" href="#t2293">2293</a></span><span class="t"><span class="key">class</span> <span class="nam">MCArchMatches</span><span class="op">(</span><span class="nam">DebputyParsedContent</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2294" href="#t2294">2294</a></span><span class="t"> <span class="nam">arch_matches</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2295" href="#t2295">2295</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2296" href="#t2296">2296</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2297" href="#t2297">2297</a></span><span class="t"><span class="key">class</span> <span class="nam">MCBuildProfileMatches</span><span class="op">(</span><span class="nam">DebputyParsedContent</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2298" href="#t2298">2298</a></span><span class="t"> <span class="nam">build_profile_matches</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2299" href="#t2299">2299</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2300" href="#t2300">2300</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2301" href="#t2301">2301</a></span><span class="t"><span class="key">def</span> <span class="nam">_parse_filename</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2302" href="#t2302">2302</a></span><span class="t"> <span class="nam">filename</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2303" href="#t2303">2303</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2304" href="#t2304">2304</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2305" href="#t2305">2305</a></span><span class="t"> <span class="nam">allow_directories</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2306" href="#t2306">2306</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2307" href="#t2307">2307</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2308" href="#t2308">2308</a></span><span class="t"> <span class="nam">normalized_path</span> <span class="op">=</span> <span class="nam">_normalize_path</span><span class="op">(</span><span class="nam">filename</span><span class="op">,</span> <span class="nam">with_prefix</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2309" href="#t2309">2309</a></span><span class="t"> <span class="key">except</span> <span class="nam">ValueError</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2310" href="#t2310">2310</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2311" href="#t2311">2311</a></span><span class="t"> <span class="str">f'Error parsing the path "{filename}" defined in {attribute_path.path}: {e.args[0]}'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2312" href="#t2312">2312</a></span><span class="t"> <span class="op">)</span> <span class="key">from</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2313" href="#t2313">2313</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">allow_directories</span> <span class="key">and</span> <span class="nam">filename</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2313 ↛ 2314</span><span class="annotate long">line 2313 didn't jump to line 2314, because the condition on line 2313 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t2314" href="#t2314">2314</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2315" href="#t2315">2315</a></span><span class="t"> <span class="str">f'The path "{filename}" in {attribute_path.path} ends with "/" implying it is a directory,'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2316" href="#t2316">2316</a></span><span class="t"> <span class="str">f" but this feature can only be used for files"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2317" href="#t2317">2317</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2318" href="#t2318">2318</a></span><span class="t"> <span class="key">if</span> <span class="nam">normalized_path</span> <span class="op">==</span> <span class="str">"."</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2318 ↛ 2319</span><span class="annotate long">line 2318 didn't jump to line 2319, because the condition on line 2318 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t2319" href="#t2319">2319</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2320" href="#t2320">2320</a></span><span class="t"> <span class="str">f'The path "{filename}" in {attribute_path.path} looks like the root directory,'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2321" href="#t2321">2321</a></span><span class="t"> <span class="str">f" but this feature does not allow the root directory here."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2322" href="#t2322">2322</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2323" href="#t2323">2323</a></span><span class="t"> <span class="key">return</span> <span class="nam">normalized_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2324" href="#t2324">2324</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2325" href="#t2325">2325</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2326" href="#t2326">2326</a></span><span class="t"><span class="key">def</span> <span class="nam">_with_alt_form</span><span class="op">(</span><span class="nam">t</span><span class="op">:</span> <span class="nam">Type</span><span class="op">[</span><span class="nam">TypedDict</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2327" href="#t2327">2327</a></span><span class="t"> <span class="key">return</span> <span class="nam">Union</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2328" href="#t2328">2328</a></span><span class="t"> <span class="nam">t</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2329" href="#t2329">2329</a></span><span class="t"> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2330" href="#t2330">2330</a></span><span class="t"> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2331" href="#t2331">2331</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2332" href="#t2332">2332</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2333" href="#t2333">2333</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2334" href="#t2334">2334</a></span><span class="t"><span class="key">def</span> <span class="nam">_dpkg_conffile_rename</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2335" href="#t2335">2335</a></span><span class="t"> <span class="nam">_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2336" href="#t2336">2336</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">:</span> <span class="nam">DpkgRenameConffileRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2337" href="#t2337">2337</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2338" href="#t2338">2338</a></span><span class="t"> <span class="nam">_context</span><span class="op">:</span> <span class="nam">ParserContextData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2339" href="#t2339">2339</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">DpkgMaintscriptHelperCommand</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2340" href="#t2340">2340</a></span><span class="t"> <span class="nam">source_file</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">[</span><span class="str">"source"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2341" href="#t2341">2341</a></span><span class="t"> <span class="nam">target_file</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">[</span><span class="str">"target"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2342" href="#t2342">2342</a></span><span class="t"> <span class="nam">normalized_source</span> <span class="op">=</span> <span class="nam">_parse_filename</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2343" href="#t2343">2343</a></span><span class="t"> <span class="nam">source_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2344" href="#t2344">2344</a></span><span class="t"> <span class="nam">path</span><span class="op">[</span><span class="str">"source"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2345" href="#t2345">2345</a></span><span class="t"> <span class="nam">allow_directories</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2346" href="#t2346">2346</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2347" href="#t2347">2347</a></span><span class="t"> <span class="nam">path</span><span class="op">.</span><span class="nam">path_hint</span> <span class="op">=</span> <span class="nam">source_file</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2348" href="#t2348">2348</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2349" href="#t2349">2349</a></span><span class="t"> <span class="nam">normalized_target</span> <span class="op">=</span> <span class="nam">_parse_filename</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2350" href="#t2350">2350</a></span><span class="t"> <span class="nam">target_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2351" href="#t2351">2351</a></span><span class="t"> <span class="nam">path</span><span class="op">[</span><span class="str">"target"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2352" href="#t2352">2352</a></span><span class="t"> <span class="nam">allow_directories</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2353" href="#t2353">2353</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2354" href="#t2354">2354</a></span><span class="t"> <span class="nam">normalized_source</span> <span class="op">=</span> <span class="str">"/"</span> <span class="op">+</span> <span class="nam">normalized_source</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2355" href="#t2355">2355</a></span><span class="t"> <span class="nam">normalized_target</span> <span class="op">=</span> <span class="str">"/"</span> <span class="op">+</span> <span class="nam">normalized_target</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2356" href="#t2356">2356</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2357" href="#t2357">2357</a></span><span class="t"> <span class="key">if</span> <span class="nam">normalized_source</span> <span class="op">==</span> <span class="nam">normalized_target</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2357 ↛ 2358</span><span class="annotate long">line 2357 didn't jump to line 2358, because the condition on line 2357 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t2358" href="#t2358">2358</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2359" href="#t2359">2359</a></span><span class="t"> <span class="str">f"Invalid rename defined in {path.path}: The source and target path are the same!"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2360" href="#t2360">2360</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2361" href="#t2361">2361</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2362" href="#t2362">2362</a></span><span class="t"> <span class="nam">version</span><span class="op">,</span> <span class="nam">owning_package</span> <span class="op">=</span> <span class="nam">_parse_conffile_prior_version_and_owning_package</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2363" href="#t2363">2363</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">,</span> <span class="nam">path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2364" href="#t2364">2364</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2365" href="#t2365">2365</a></span><span class="t"> <span class="key">return</span> <span class="nam">DpkgMaintscriptHelperCommand</span><span class="op">.</span><span class="nam">mv_conffile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2366" href="#t2366">2366</a></span><span class="t"> <span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2367" href="#t2367">2367</a></span><span class="t"> <span class="nam">normalized_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2368" href="#t2368">2368</a></span><span class="t"> <span class="nam">normalized_target</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2369" href="#t2369">2369</a></span><span class="t"> <span class="nam">version</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2370" href="#t2370">2370</a></span><span class="t"> <span class="nam">owning_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2371" href="#t2371">2371</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2372" href="#t2372">2372</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2373" href="#t2373">2373</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2374" href="#t2374">2374</a></span><span class="t"><span class="key">def</span> <span class="nam">_dpkg_conffile_remove</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2375" href="#t2375">2375</a></span><span class="t"> <span class="nam">_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2376" href="#t2376">2376</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">:</span> <span class="nam">DpkgRemoveConffileRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2377" href="#t2377">2377</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2378" href="#t2378">2378</a></span><span class="t"> <span class="nam">_context</span><span class="op">:</span> <span class="nam">ParserContextData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2379" href="#t2379">2379</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">DpkgMaintscriptHelperCommand</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2380" href="#t2380">2380</a></span><span class="t"> <span class="nam">source_file</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">[</span><span class="str">"path"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2381" href="#t2381">2381</a></span><span class="t"> <span class="nam">normalized_source</span> <span class="op">=</span> <span class="nam">_parse_filename</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2382" href="#t2382">2382</a></span><span class="t"> <span class="nam">source_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2383" href="#t2383">2383</a></span><span class="t"> <span class="nam">path</span><span class="op">[</span><span class="str">"path"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2384" href="#t2384">2384</a></span><span class="t"> <span class="nam">allow_directories</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2385" href="#t2385">2385</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2386" href="#t2386">2386</a></span><span class="t"> <span class="nam">path</span><span class="op">.</span><span class="nam">path_hint</span> <span class="op">=</span> <span class="nam">source_file</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2387" href="#t2387">2387</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2388" href="#t2388">2388</a></span><span class="t"> <span class="nam">normalized_source</span> <span class="op">=</span> <span class="str">"/"</span> <span class="op">+</span> <span class="nam">normalized_source</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2389" href="#t2389">2389</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2390" href="#t2390">2390</a></span><span class="t"> <span class="nam">version</span><span class="op">,</span> <span class="nam">owning_package</span> <span class="op">=</span> <span class="nam">_parse_conffile_prior_version_and_owning_package</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2391" href="#t2391">2391</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">,</span> <span class="nam">path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2392" href="#t2392">2392</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2393" href="#t2393">2393</a></span><span class="t"> <span class="key">return</span> <span class="nam">DpkgMaintscriptHelperCommand</span><span class="op">.</span><span class="nam">rm_conffile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2394" href="#t2394">2394</a></span><span class="t"> <span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2395" href="#t2395">2395</a></span><span class="t"> <span class="nam">normalized_source</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2396" href="#t2396">2396</a></span><span class="t"> <span class="nam">version</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2397" href="#t2397">2397</a></span><span class="t"> <span class="nam">owning_package</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2398" href="#t2398">2398</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2399" href="#t2399">2399</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2400" href="#t2400">2400</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2401" href="#t2401">2401</a></span><span class="t"><span class="key">def</span> <span class="nam">_parse_conffile_prior_version_and_owning_package</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2402" href="#t2402">2402</a></span><span class="t"> <span class="nam">d</span><span class="op">:</span> <span class="nam">DpkgConffileManagementRuleBase</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2403" href="#t2403">2403</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2404" href="#t2404">2404</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2405" href="#t2405">2405</a></span><span class="t"> <span class="nam">prior_version</span> <span class="op">=</span> <span class="nam">d</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"prior_to_version"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2406" href="#t2406">2406</a></span><span class="t"> <span class="nam">owning_package</span> <span class="op">=</span> <span class="nam">d</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"owning_package"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2407" href="#t2407">2407</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2408" href="#t2408">2408</a></span><span class="t"> <span class="key">if</span> <span class="nam">prior_version</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">PKGVERSION_REGEX</span><span class="op">.</span><span class="nam">match</span><span class="op">(</span><span class="nam">prior_version</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2408 ↛ 2409</span><span class="annotate long">line 2408 didn't jump to line 2409, because the condition on line 2408 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t2409" href="#t2409">2409</a></span><span class="t"> <span class="nam">p</span> <span class="op">=</span> <span class="nam">attribute_path</span><span class="op">[</span><span class="str">"prior_to_version"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2410" href="#t2410">2410</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2411" href="#t2411">2411</a></span><span class="t"> <span class="str">f"The {MK_CONFFILE_MANAGEMENT_X_PRIOR_TO_VERSION} parameter in {p.path} must be a"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2412" href="#t2412">2412</a></span><span class="t"> <span class="str">r" valid package version (i.e., match (?:\d+:)?\d[0-9A-Za-z.+:~]*(?:-[0-9A-Za-z.+:~]+)*)."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2413" href="#t2413">2413</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2414" href="#t2414">2414</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2415" href="#t2415">2415</a></span><span class="t"> <span class="key">if</span> <span class="nam">owning_package</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">PKGNAME_REGEX</span><span class="op">.</span><span class="nam">match</span><span class="op">(</span><span class="nam">owning_package</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2415 ↛ 2416</span><span class="annotate long">line 2415 didn't jump to line 2416, because the condition on line 2415 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t2416" href="#t2416">2416</a></span><span class="t"> <span class="nam">p</span> <span class="op">=</span> <span class="nam">attribute_path</span><span class="op">[</span><span class="str">"owning_package"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2417" href="#t2417">2417</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2418" href="#t2418">2418</a></span><span class="t"> <span class="str">f"The {MK_CONFFILE_MANAGEMENT_X_OWNING_PACKAGE} parameter in {p.path} must be a valid"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2419" href="#t2419">2419</a></span><span class="t"> <span class="str">f" package name (i.e., match {PKGNAME_REGEX.pattern})."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2420" href="#t2420">2420</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2421" href="#t2421">2421</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2422" href="#t2422">2422</a></span><span class="t"> <span class="key">return</span> <span class="nam">prior_version</span><span class="op">,</span> <span class="nam">owning_package</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2423" href="#t2423">2423</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2424" href="#t2424">2424</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2425" href="#t2425">2425</a></span><span class="t"><span class="key">def</span> <span class="nam">_install_rule_handler</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2426" href="#t2426">2426</a></span><span class="t"> <span class="nam">_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2427" href="#t2427">2427</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">:</span> <span class="nam">ParsedInstallRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2428" href="#t2428">2428</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2429" href="#t2429">2429</a></span><span class="t"> <span class="nam">context</span><span class="op">:</span> <span class="nam">ParserContextData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2430" href="#t2430">2430</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">InstallRule</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2431" href="#t2431">2431</a></span><span class="t"> <span class="nam">sources</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">[</span><span class="str">"sources"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2432" href="#t2432">2432</a></span><span class="t"> <span class="nam">install_as</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"install_as"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2433" href="#t2433">2433</a></span><span class="t"> <span class="nam">into</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"into"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2434" href="#t2434">2434</a></span><span class="t"> <span class="nam">dest_dir</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"dest_dir"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2435" href="#t2435">2435</a></span><span class="t"> <span class="nam">condition</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"when"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2436" href="#t2436">2436</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">into</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2437" href="#t2437">2437</a></span><span class="t"> <span class="nam">into</span> <span class="op">=</span> <span class="op">[</span><span class="nam">context</span><span class="op">.</span><span class="nam">single_binary_package</span><span class="op">(</span><span class="nam">path</span><span class="op">,</span> <span class="nam">package_attribute</span><span class="op">=</span><span class="str">"into"</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2438" href="#t2438">2438</a></span><span class="t"> <span class="nam">into</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span><span class="nam">into</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2439" href="#t2439">2439</a></span><span class="t"> <span class="key">if</span> <span class="nam">install_as</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2440" href="#t2440">2440</a></span><span class="t"> <span class="key">assert</span> <span class="nam">len</span><span class="op">(</span><span class="nam">sources</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2441" href="#t2441">2441</a></span><span class="t"> <span class="key">assert</span> <span class="nam">dest_dir</span> <span class="key">is</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2442" href="#t2442">2442</a></span><span class="t"> <span class="key">return</span> <span class="nam">InstallRule</span><span class="op">.</span><span class="nam">install_as</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2443" href="#t2443">2443</a></span><span class="t"> <span class="nam">sources</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2444" href="#t2444">2444</a></span><span class="t"> <span class="nam">install_as</span><span class="op">.</span><span class="nam">match_rule</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2445" href="#t2445">2445</a></span><span class="t"> <span class="nam">into</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2446" href="#t2446">2446</a></span><span class="t"> <span class="nam">path</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2447" href="#t2447">2447</a></span><span class="t"> <span class="nam">condition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2448" href="#t2448">2448</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2449" href="#t2449">2449</a></span><span class="t"> <span class="key">return</span> <span class="nam">InstallRule</span><span class="op">.</span><span class="nam">install_dest</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2450" href="#t2450">2450</a></span><span class="t"> <span class="nam">sources</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2451" href="#t2451">2451</a></span><span class="t"> <span class="nam">dest_dir</span><span class="op">.</span><span class="nam">match_rule</span><span class="op">.</span><span class="nam">path</span> <span class="key">if</span> <span class="nam">dest_dir</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">else</span> <span class="key">None</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2452" href="#t2452">2452</a></span><span class="t"> <span class="nam">into</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2453" href="#t2453">2453</a></span><span class="t"> <span class="nam">path</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2454" href="#t2454">2454</a></span><span class="t"> <span class="nam">condition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2455" href="#t2455">2455</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2456" href="#t2456">2456</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2457" href="#t2457">2457</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2458" href="#t2458">2458</a></span><span class="t"><span class="key">def</span> <span class="nam">_multi_dest_install_rule_handler</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2459" href="#t2459">2459</a></span><span class="t"> <span class="nam">_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2460" href="#t2460">2460</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">:</span> <span class="nam">ParsedMultiDestInstallRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2461" href="#t2461">2461</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2462" href="#t2462">2462</a></span><span class="t"> <span class="nam">context</span><span class="op">:</span> <span class="nam">ParserContextData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2463" href="#t2463">2463</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">InstallRule</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2464" href="#t2464">2464</a></span><span class="t"> <span class="nam">sources</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">[</span><span class="str">"sources"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2465" href="#t2465">2465</a></span><span class="t"> <span class="nam">install_as</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"install_as"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2466" href="#t2466">2466</a></span><span class="t"> <span class="nam">into</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"into"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2467" href="#t2467">2467</a></span><span class="t"> <span class="nam">dest_dirs</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"dest_dirs"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2468" href="#t2468">2468</a></span><span class="t"> <span class="nam">condition</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"when"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2469" href="#t2469">2469</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">into</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2469 ↛ 2471</span><span class="annotate long">line 2469 didn't jump to line 2471, because the condition on line 2469 was never false</span></span></p> - <p class="run"><span class="n"><a id="t2470" href="#t2470">2470</a></span><span class="t"> <span class="nam">into</span> <span class="op">=</span> <span class="op">[</span><span class="nam">context</span><span class="op">.</span><span class="nam">single_binary_package</span><span class="op">(</span><span class="nam">path</span><span class="op">,</span> <span class="nam">package_attribute</span><span class="op">=</span><span class="str">"into"</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2471" href="#t2471">2471</a></span><span class="t"> <span class="nam">into</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span><span class="nam">into</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2472" href="#t2472">2472</a></span><span class="t"> <span class="key">if</span> <span class="nam">install_as</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2473" href="#t2473">2473</a></span><span class="t"> <span class="key">assert</span> <span class="nam">len</span><span class="op">(</span><span class="nam">sources</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2474" href="#t2474">2474</a></span><span class="t"> <span class="key">assert</span> <span class="nam">dest_dirs</span> <span class="key">is</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2475" href="#t2475">2475</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">install_as</span><span class="op">)</span> <span class="op"><</span> <span class="num">2</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2475 ↛ 2476</span><span class="annotate long">line 2475 didn't jump to line 2476, because the condition on line 2475 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t2476" href="#t2476">2476</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2477" href="#t2477">2477</a></span><span class="t"> <span class="str">f"The {path['install_as'].path} attribute must contain at least two paths."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2478" href="#t2478">2478</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2479" href="#t2479">2479</a></span><span class="t"> <span class="key">return</span> <span class="nam">InstallRule</span><span class="op">.</span><span class="nam">install_multi_as</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2480" href="#t2480">2480</a></span><span class="t"> <span class="nam">sources</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2481" href="#t2481">2481</a></span><span class="t"> <span class="op">[</span><span class="nam">p</span><span class="op">.</span><span class="nam">match_rule</span><span class="op">.</span><span class="nam">path</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">install_as</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2482" href="#t2482">2482</a></span><span class="t"> <span class="nam">into</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2483" href="#t2483">2483</a></span><span class="t"> <span class="nam">path</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2484" href="#t2484">2484</a></span><span class="t"> <span class="nam">condition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2485" href="#t2485">2485</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2486" href="#t2486">2486</a></span><span class="t"> <span class="key">if</span> <span class="nam">dest_dirs</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2486 ↛ 2487</span><span class="annotate long">line 2486 didn't jump to line 2487, because the condition on line 2486 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t2487" href="#t2487">2487</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2488" href="#t2488">2488</a></span><span class="t"> <span class="str">f"Either the `as` or the `dest-dirs` key must be provided at {path.path}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2489" href="#t2489">2489</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2490" href="#t2490">2490</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">dest_dirs</span><span class="op">)</span> <span class="op"><</span> <span class="num">2</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2490 ↛ 2491</span><span class="annotate long">line 2490 didn't jump to line 2491, because the condition on line 2490 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t2491" href="#t2491">2491</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2492" href="#t2492">2492</a></span><span class="t"> <span class="str">f"The {path['dest_dirs'].path} attribute must contain at least two paths."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2493" href="#t2493">2493</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2494" href="#t2494">2494</a></span><span class="t"> <span class="key">return</span> <span class="nam">InstallRule</span><span class="op">.</span><span class="nam">install_multi_dest</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2495" href="#t2495">2495</a></span><span class="t"> <span class="nam">sources</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2496" href="#t2496">2496</a></span><span class="t"> <span class="op">[</span><span class="nam">dd</span><span class="op">.</span><span class="nam">match_rule</span><span class="op">.</span><span class="nam">path</span> <span class="key">for</span> <span class="nam">dd</span> <span class="key">in</span> <span class="nam">dest_dirs</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2497" href="#t2497">2497</a></span><span class="t"> <span class="nam">into</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2498" href="#t2498">2498</a></span><span class="t"> <span class="nam">path</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2499" href="#t2499">2499</a></span><span class="t"> <span class="nam">condition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2500" href="#t2500">2500</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2501" href="#t2501">2501</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2502" href="#t2502">2502</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2503" href="#t2503">2503</a></span><span class="t"><span class="key">def</span> <span class="nam">_install_docs_rule_handler</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2504" href="#t2504">2504</a></span><span class="t"> <span class="nam">_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2505" href="#t2505">2505</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">:</span> <span class="nam">ParsedInstallRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2506" href="#t2506">2506</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2507" href="#t2507">2507</a></span><span class="t"> <span class="nam">context</span><span class="op">:</span> <span class="nam">ParserContextData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2508" href="#t2508">2508</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">InstallRule</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2509" href="#t2509">2509</a></span><span class="t"> <span class="nam">sources</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">[</span><span class="str">"sources"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2510" href="#t2510">2510</a></span><span class="t"> <span class="nam">install_as</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"install_as"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2511" href="#t2511">2511</a></span><span class="t"> <span class="nam">into</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"into"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2512" href="#t2512">2512</a></span><span class="t"> <span class="nam">dest_dir</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"dest_dir"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2513" href="#t2513">2513</a></span><span class="t"> <span class="nam">condition</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"when"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2514" href="#t2514">2514</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">into</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2514 ↛ 2520</span><span class="annotate long">line 2514 didn't jump to line 2520, because the condition on line 2514 was never false</span></span></p> - <p class="run"><span class="n"><a id="t2515" href="#t2515">2515</a></span><span class="t"> <span class="nam">into</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2516" href="#t2516">2516</a></span><span class="t"> <span class="nam">context</span><span class="op">.</span><span class="nam">single_binary_package</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2517" href="#t2517">2517</a></span><span class="t"> <span class="nam">path</span><span class="op">,</span> <span class="nam">package_type</span><span class="op">=</span><span class="str">"deb"</span><span class="op">,</span> <span class="nam">package_attribute</span><span class="op">=</span><span class="str">"into"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2518" href="#t2518">2518</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2519" href="#t2519">2519</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2520" href="#t2520">2520</a></span><span class="t"> <span class="nam">into</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span><span class="nam">into</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2521" href="#t2521">2521</a></span><span class="t"> <span class="key">if</span> <span class="nam">install_as</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2521 ↛ 2522</span><span class="annotate long">line 2521 didn't jump to line 2522, because the condition on line 2521 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t2522" href="#t2522">2522</a></span><span class="t"> <span class="key">assert</span> <span class="nam">len</span><span class="op">(</span><span class="nam">sources</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2523" href="#t2523">2523</a></span><span class="t"> <span class="key">assert</span> <span class="nam">dest_dir</span> <span class="key">is</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2524" href="#t2524">2524</a></span><span class="t"> <span class="key">return</span> <span class="nam">InstallRule</span><span class="op">.</span><span class="nam">install_doc_as</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2525" href="#t2525">2525</a></span><span class="t"> <span class="nam">sources</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2526" href="#t2526">2526</a></span><span class="t"> <span class="nam">install_as</span><span class="op">.</span><span class="nam">match_rule</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2527" href="#t2527">2527</a></span><span class="t"> <span class="nam">into</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2528" href="#t2528">2528</a></span><span class="t"> <span class="nam">path</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2529" href="#t2529">2529</a></span><span class="t"> <span class="nam">condition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2530" href="#t2530">2530</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2531" href="#t2531">2531</a></span><span class="t"> <span class="key">return</span> <span class="nam">InstallRule</span><span class="op">.</span><span class="nam">install_doc</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2532" href="#t2532">2532</a></span><span class="t"> <span class="nam">sources</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2533" href="#t2533">2533</a></span><span class="t"> <span class="nam">dest_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2534" href="#t2534">2534</a></span><span class="t"> <span class="nam">into</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2535" href="#t2535">2535</a></span><span class="t"> <span class="nam">path</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2536" href="#t2536">2536</a></span><span class="t"> <span class="nam">condition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2537" href="#t2537">2537</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2538" href="#t2538">2538</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2539" href="#t2539">2539</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2540" href="#t2540">2540</a></span><span class="t"><span class="key">def</span> <span class="nam">_install_examples_rule_handler</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2541" href="#t2541">2541</a></span><span class="t"> <span class="nam">_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2542" href="#t2542">2542</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">:</span> <span class="nam">ParsedInstallExamplesRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2543" href="#t2543">2543</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2544" href="#t2544">2544</a></span><span class="t"> <span class="nam">context</span><span class="op">:</span> <span class="nam">ParserContextData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2545" href="#t2545">2545</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">InstallRule</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2546" href="#t2546">2546</a></span><span class="t"> <span class="nam">sources</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">[</span><span class="str">"sources"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2547" href="#t2547">2547</a></span><span class="t"> <span class="nam">into</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"into"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2548" href="#t2548">2548</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">into</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2548 ↛ 2554</span><span class="annotate long">line 2548 didn't jump to line 2554, because the condition on line 2548 was never false</span></span></p> - <p class="run"><span class="n"><a id="t2549" href="#t2549">2549</a></span><span class="t"> <span class="nam">into</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2550" href="#t2550">2550</a></span><span class="t"> <span class="nam">context</span><span class="op">.</span><span class="nam">single_binary_package</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2551" href="#t2551">2551</a></span><span class="t"> <span class="nam">path</span><span class="op">,</span> <span class="nam">package_type</span><span class="op">=</span><span class="str">"deb"</span><span class="op">,</span> <span class="nam">package_attribute</span><span class="op">=</span><span class="str">"into"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2552" href="#t2552">2552</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2553" href="#t2553">2553</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2554" href="#t2554">2554</a></span><span class="t"> <span class="nam">condition</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"when"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2555" href="#t2555">2555</a></span><span class="t"> <span class="nam">into</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span><span class="nam">into</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2556" href="#t2556">2556</a></span><span class="t"> <span class="key">return</span> <span class="nam">InstallRule</span><span class="op">.</span><span class="nam">install_examples</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2557" href="#t2557">2557</a></span><span class="t"> <span class="nam">sources</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2558" href="#t2558">2558</a></span><span class="t"> <span class="nam">into</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2559" href="#t2559">2559</a></span><span class="t"> <span class="nam">path</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2560" href="#t2560">2560</a></span><span class="t"> <span class="nam">condition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2561" href="#t2561">2561</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2562" href="#t2562">2562</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2563" href="#t2563">2563</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2564" href="#t2564">2564</a></span><span class="t"><span class="key">def</span> <span class="nam">_install_man_rule_handler</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2565" href="#t2565">2565</a></span><span class="t"> <span class="nam">_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2566" href="#t2566">2566</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">:</span> <span class="nam">ParsedInstallManpageRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2567" href="#t2567">2567</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2568" href="#t2568">2568</a></span><span class="t"> <span class="nam">context</span><span class="op">:</span> <span class="nam">ParserContextData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2569" href="#t2569">2569</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">InstallRule</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2570" href="#t2570">2570</a></span><span class="t"> <span class="nam">sources</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">[</span><span class="str">"sources"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2571" href="#t2571">2571</a></span><span class="t"> <span class="nam">language</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"language"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2572" href="#t2572">2572</a></span><span class="t"> <span class="nam">section</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"section"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2573" href="#t2573">2573</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2574" href="#t2574">2574</a></span><span class="t"> <span class="key">if</span> <span class="nam">language</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2575" href="#t2575">2575</a></span><span class="t"> <span class="nam">is_lang_ok</span> <span class="op">=</span> <span class="nam">language</span> <span class="key">in</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2576" href="#t2576">2576</a></span><span class="t"> <span class="str">"C"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2577" href="#t2577">2577</a></span><span class="t"> <span class="str">"derive-from-basename"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2578" href="#t2578">2578</a></span><span class="t"> <span class="str">"derive-from-path"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2579" href="#t2579">2579</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2580" href="#t2580">2580</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2581" href="#t2581">2581</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">is_lang_ok</span> <span class="key">and</span> <span class="nam">len</span><span class="op">(</span><span class="nam">language</span><span class="op">)</span> <span class="op">==</span> <span class="num">2</span> <span class="key">and</span> <span class="nam">language</span><span class="op">.</span><span class="nam">islower</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2581 ↛ 2582</span><span class="annotate long">line 2581 didn't jump to line 2582, because the condition on line 2581 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t2582" href="#t2582">2582</a></span><span class="t"> <span class="nam">is_lang_ok</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2583" href="#t2583">2583</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2584" href="#t2584">2584</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"><span class="annotate short">2584 ↛ 2591</span><span class="annotate long">line 2584 didn't jump to line 2591</span></span></p> - <p class="pln"><span class="n"><a id="t2585" href="#t2585">2585</a></span><span class="t"> <span class="key">not</span> <span class="nam">is_lang_ok</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2586" href="#t2586">2586</a></span><span class="t"> <span class="key">and</span> <span class="nam">len</span><span class="op">(</span><span class="nam">language</span><span class="op">)</span> <span class="op">==</span> <span class="num">5</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2587" href="#t2587">2587</a></span><span class="t"> <span class="key">and</span> <span class="nam">language</span><span class="op">[</span><span class="num">2</span><span class="op">]</span> <span class="op">==</span> <span class="str">"_"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2588" href="#t2588">2588</a></span><span class="t"> <span class="key">and</span> <span class="nam">language</span><span class="op">[</span><span class="op">:</span><span class="num">2</span><span class="op">]</span><span class="op">.</span><span class="nam">islower</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2589" href="#t2589">2589</a></span><span class="t"> <span class="key">and</span> <span class="nam">language</span><span class="op">[</span><span class="num">3</span><span class="op">:</span><span class="op">]</span><span class="op">.</span><span class="nam">isupper</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2590" href="#t2590">2590</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2591" href="#t2591">2591</a></span><span class="t"> <span class="nam">is_lang_ok</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2592" href="#t2592">2592</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2593" href="#t2593">2593</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">is_lang_ok</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2593 ↛ 2594</span><span class="annotate long">line 2593 didn't jump to line 2594, because the condition on line 2593 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t2594" href="#t2594">2594</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2595" href="#t2595">2595</a></span><span class="t"> <span class="str">f'The language attribute must in a 2-letter language code ("de"), a 5-letter language + dialect'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2596" href="#t2596">2596</a></span><span class="t"> <span class="str">f' code ("pt_BR"), "derive-from-basename", "derive-from-path", or omitted. The problematic'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2597" href="#t2597">2597</a></span><span class="t"> <span class="str">f' definition is {attribute_path["language"]}'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2598" href="#t2598">2598</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2599" href="#t2599">2599</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2600" href="#t2600">2600</a></span><span class="t"> <span class="key">if</span> <span class="nam">section</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="op">(</span><span class="nam">section</span> <span class="op"><</span> <span class="num">1</span> <span class="key">or</span> <span class="nam">section</span> <span class="op">></span> <span class="num">10</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2600 ↛ 2601</span><span class="annotate long">line 2600 didn't jump to line 2601, because the condition on line 2600 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t2601" href="#t2601">2601</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2602" href="#t2602">2602</a></span><span class="t"> <span class="str">f"The section attribute must in the range [1-9] or omitted. The problematic definition is"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2603" href="#t2603">2603</a></span><span class="t"> <span class="str">f' {attribute_path["section"]}'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2604" href="#t2604">2604</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2605" href="#t2605">2605</a></span><span class="t"> <span class="key">if</span> <span class="nam">section</span> <span class="key">is</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">any</span><span class="op">(</span><span class="nam">s</span><span class="op">.</span><span class="nam">raw_match_rule</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">".gz"</span><span class="op">)</span> <span class="key">for</span> <span class="nam">s</span> <span class="key">in</span> <span class="nam">sources</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2605 ↛ 2606</span><span class="annotate long">line 2605 didn't jump to line 2606, because the condition on line 2605 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t2606" href="#t2606">2606</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2607" href="#t2607">2607</a></span><span class="t"> <span class="str">"Sorry, compressed man pages are not supported without an explicit `section` definition at the moment."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2608" href="#t2608">2608</a></span><span class="t"> <span class="str">" This limitation may be removed in the future. Problematic definition from"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2609" href="#t2609">2609</a></span><span class="t"> <span class="str">f' {attribute_path["sources"]}'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2610" href="#t2610">2610</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2611" href="#t2611">2611</a></span><span class="t"> <span class="key">if</span> <span class="nam">any</span><span class="op">(</span><span class="nam">s</span><span class="op">.</span><span class="nam">raw_match_rule</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span> <span class="key">for</span> <span class="nam">s</span> <span class="key">in</span> <span class="nam">sources</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2611 ↛ 2612</span><span class="annotate long">line 2611 didn't jump to line 2612, because the condition on line 2611 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t2612" href="#t2612">2612</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2613" href="#t2613">2613</a></span><span class="t"> <span class="str">'The install-man rule can only match non-directories. Therefore, none of the sources can end with "/".'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2614" href="#t2614">2614</a></span><span class="t"> <span class="str">" as that implies the source is for a directory. Problematic definition from"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2615" href="#t2615">2615</a></span><span class="t"> <span class="str">f' {attribute_path["sources"]}'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2616" href="#t2616">2616</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2617" href="#t2617">2617</a></span><span class="t"> <span class="nam">into</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"into"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2618" href="#t2618">2618</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">into</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2618 ↛ 2624</span><span class="annotate long">line 2618 didn't jump to line 2624, because the condition on line 2618 was never false</span></span></p> - <p class="run"><span class="n"><a id="t2619" href="#t2619">2619</a></span><span class="t"> <span class="nam">into</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2620" href="#t2620">2620</a></span><span class="t"> <span class="nam">context</span><span class="op">.</span><span class="nam">single_binary_package</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2621" href="#t2621">2621</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">,</span> <span class="nam">package_type</span><span class="op">=</span><span class="str">"deb"</span><span class="op">,</span> <span class="nam">package_attribute</span><span class="op">=</span><span class="str">"into"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2622" href="#t2622">2622</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2623" href="#t2623">2623</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2624" href="#t2624">2624</a></span><span class="t"> <span class="nam">condition</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"when"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2625" href="#t2625">2625</a></span><span class="t"> <span class="nam">into</span> <span class="op">=</span> <span class="nam">frozenset</span><span class="op">(</span><span class="nam">into</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2626" href="#t2626">2626</a></span><span class="t"> <span class="key">return</span> <span class="nam">InstallRule</span><span class="op">.</span><span class="nam">install_man</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2627" href="#t2627">2627</a></span><span class="t"> <span class="nam">sources</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2628" href="#t2628">2628</a></span><span class="t"> <span class="nam">into</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2629" href="#t2629">2629</a></span><span class="t"> <span class="nam">section</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2630" href="#t2630">2630</a></span><span class="t"> <span class="nam">language</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2631" href="#t2631">2631</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2632" href="#t2632">2632</a></span><span class="t"> <span class="nam">condition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2633" href="#t2633">2633</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2634" href="#t2634">2634</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2635" href="#t2635">2635</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2636" href="#t2636">2636</a></span><span class="t"><span class="key">def</span> <span class="nam">_install_discard_rule_handler</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2637" href="#t2637">2637</a></span><span class="t"> <span class="nam">_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2638" href="#t2638">2638</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">:</span> <span class="nam">ParsedInstallDiscardRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2639" href="#t2639">2639</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2640" href="#t2640">2640</a></span><span class="t"> <span class="nam">_context</span><span class="op">:</span> <span class="nam">ParserContextData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2641" href="#t2641">2641</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">InstallRule</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2642" href="#t2642">2642</a></span><span class="t"> <span class="nam">limit_to</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"search_dirs"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2643" href="#t2643">2643</a></span><span class="t"> <span class="key">if</span> <span class="nam">limit_to</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">limit_to</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2643 ↛ 2644</span><span class="annotate long">line 2643 didn't jump to line 2644, because the condition on line 2643 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t2644" href="#t2644">2644</a></span><span class="t"> <span class="nam">p</span> <span class="op">=</span> <span class="nam">path</span><span class="op">[</span><span class="str">"search_dirs"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2645" href="#t2645">2645</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span><span class="str">f"The {p.path} attribute must not be empty."</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2646" href="#t2646">2646</a></span><span class="t"> <span class="nam">condition</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"required_when"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2647" href="#t2647">2647</a></span><span class="t"> <span class="key">return</span> <span class="nam">InstallRule</span><span class="op">.</span><span class="nam">discard_paths</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2648" href="#t2648">2648</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">[</span><span class="str">"paths"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2649" href="#t2649">2649</a></span><span class="t"> <span class="nam">path</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2650" href="#t2650">2650</a></span><span class="t"> <span class="nam">condition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2651" href="#t2651">2651</a></span><span class="t"> <span class="nam">limit_to</span><span class="op">=</span><span class="nam">limit_to</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2652" href="#t2652">2652</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2653" href="#t2653">2653</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2654" href="#t2654">2654</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2655" href="#t2655">2655</a></span><span class="t"><span class="key">def</span> <span class="nam">_transformation_move_handler</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2656" href="#t2656">2656</a></span><span class="t"> <span class="nam">_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2657" href="#t2657">2657</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">:</span> <span class="nam">TransformationMoveRuleSpec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2658" href="#t2658">2658</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2659" href="#t2659">2659</a></span><span class="t"> <span class="nam">_context</span><span class="op">:</span> <span class="nam">ParserContextData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2660" href="#t2660">2660</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">TransformationRule</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2661" href="#t2661">2661</a></span><span class="t"> <span class="nam">source_match</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">[</span><span class="str">"source"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2662" href="#t2662">2662</a></span><span class="t"> <span class="nam">target_path</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">[</span><span class="str">"target"</span><span class="op">]</span><span class="op">.</span><span class="nam">match_rule</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2663" href="#t2663">2663</a></span><span class="t"> <span class="nam">condition</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"when"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2664" href="#t2664">2664</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2665" href="#t2665">2665</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"><span class="annotate short">2665 ↛ 2669</span><span class="annotate long">line 2665 didn't jump to line 2669</span></span></p> - <p class="pln"><span class="n"><a id="t2666" href="#t2666">2666</a></span><span class="t"> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">source_match</span><span class="op">,</span> <span class="nam">ExactFileSystemPath</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2667" href="#t2667">2667</a></span><span class="t"> <span class="key">and</span> <span class="nam">source_match</span><span class="op">.</span><span class="nam">path</span> <span class="op">==</span> <span class="nam">target_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2668" href="#t2668">2668</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2669" href="#t2669">2669</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2670" href="#t2670">2670</a></span><span class="t"> <span class="str">f"The transformation rule {path.path} requests a move of {source_match} to"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2671" href="#t2671">2671</a></span><span class="t"> <span class="str">f" {target_path}, which is the same path"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2672" href="#t2672">2672</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2673" href="#t2673">2673</a></span><span class="t"> <span class="key">return</span> <span class="nam">MoveTransformationRule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2674" href="#t2674">2674</a></span><span class="t"> <span class="nam">source_match</span><span class="op">.</span><span class="nam">match_rule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2675" href="#t2675">2675</a></span><span class="t"> <span class="nam">target_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2676" href="#t2676">2676</a></span><span class="t"> <span class="nam">target_path</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"/"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2677" href="#t2677">2677</a></span><span class="t"> <span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2678" href="#t2678">2678</a></span><span class="t"> <span class="nam">condition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2679" href="#t2679">2679</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2680" href="#t2680">2680</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2681" href="#t2681">2681</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2682" href="#t2682">2682</a></span><span class="t"><span class="key">def</span> <span class="nam">_transformation_remove_handler</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2683" href="#t2683">2683</a></span><span class="t"> <span class="nam">_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2684" href="#t2684">2684</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">:</span> <span class="nam">TransformationRemoveRuleSpec</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2685" href="#t2685">2685</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2686" href="#t2686">2686</a></span><span class="t"> <span class="nam">_context</span><span class="op">:</span> <span class="nam">ParserContextData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2687" href="#t2687">2687</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">TransformationRule</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2688" href="#t2688">2688</a></span><span class="t"> <span class="nam">paths</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">[</span><span class="str">"paths"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2689" href="#t2689">2689</a></span><span class="t"> <span class="nam">keep_empty_parent_dirs</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"keep_empty_parent_dirs"</span><span class="op">,</span> <span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2690" href="#t2690">2690</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2691" href="#t2691">2691</a></span><span class="t"> <span class="key">return</span> <span class="nam">RemoveTransformationRule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2692" href="#t2692">2692</a></span><span class="t"> <span class="op">[</span><span class="nam">m</span><span class="op">.</span><span class="nam">match_rule</span> <span class="key">for</span> <span class="nam">m</span> <span class="key">in</span> <span class="nam">paths</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2693" href="#t2693">2693</a></span><span class="t"> <span class="nam">keep_empty_parent_dirs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2694" href="#t2694">2694</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2695" href="#t2695">2695</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2696" href="#t2696">2696</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2697" href="#t2697">2697</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2698" href="#t2698">2698</a></span><span class="t"><span class="key">def</span> <span class="nam">_transformation_create_symlink</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2699" href="#t2699">2699</a></span><span class="t"> <span class="nam">_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2700" href="#t2700">2700</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">:</span> <span class="nam">CreateSymlinkRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2701" href="#t2701">2701</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2702" href="#t2702">2702</a></span><span class="t"> <span class="nam">_context</span><span class="op">:</span> <span class="nam">ParserContextData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2703" href="#t2703">2703</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">TransformationRule</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2704" href="#t2704">2704</a></span><span class="t"> <span class="nam">link_dest</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">[</span><span class="str">"path"</span><span class="op">]</span><span class="op">.</span><span class="nam">match_rule</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2705" href="#t2705">2705</a></span><span class="t"> <span class="nam">replacement_rule</span><span class="op">:</span> <span class="nam">CreateSymlinkReplacementRule</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2706" href="#t2706">2706</a></span><span class="t"> <span class="str">"replacement_rule"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2707" href="#t2707">2707</a></span><span class="t"> <span class="str">"abort-on-non-empty-directory"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2708" href="#t2708">2708</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2709" href="#t2709">2709</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2710" href="#t2710">2710</a></span><span class="t"> <span class="nam">link_target</span> <span class="op">=</span> <span class="nam">debian_policy_normalize_symlink_target</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2711" href="#t2711">2711</a></span><span class="t"> <span class="nam">link_dest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2712" href="#t2712">2712</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">[</span><span class="str">"target"</span><span class="op">]</span><span class="op">.</span><span class="nam">symlink_target</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2713" href="#t2713">2713</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t2714" href="#t2714">2714</a></span><span class="t"> <span class="key">except</span> <span class="nam">ValueError</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> <span class="com"># pragma: no cover</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t2715" href="#t2715">2715</a></span><span class="t"> <span class="key">raise</span> <span class="nam">AssertionError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2716" href="#t2716">2716</a></span><span class="t"> <span class="str">"Debian Policy normalization should not raise ValueError here"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2717" href="#t2717">2717</a></span><span class="t"> <span class="op">)</span> <span class="key">from</span> <span class="nam">e</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2718" href="#t2718">2718</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2719" href="#t2719">2719</a></span><span class="t"> <span class="nam">condition</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"when"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2720" href="#t2720">2720</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2721" href="#t2721">2721</a></span><span class="t"> <span class="key">return</span> <span class="nam">CreateSymlinkPathTransformationRule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2722" href="#t2722">2722</a></span><span class="t"> <span class="nam">link_target</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2723" href="#t2723">2723</a></span><span class="t"> <span class="nam">link_dest</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2724" href="#t2724">2724</a></span><span class="t"> <span class="nam">replacement_rule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2725" href="#t2725">2725</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2726" href="#t2726">2726</a></span><span class="t"> <span class="nam">condition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2727" href="#t2727">2727</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2728" href="#t2728">2728</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2729" href="#t2729">2729</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2730" href="#t2730">2730</a></span><span class="t"><span class="key">def</span> <span class="nam">_transformation_path_metadata</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2731" href="#t2731">2731</a></span><span class="t"> <span class="nam">_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2732" href="#t2732">2732</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">:</span> <span class="nam">PathManifestRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2733" href="#t2733">2733</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2734" href="#t2734">2734</a></span><span class="t"> <span class="nam">_context</span><span class="op">:</span> <span class="nam">ParserContextData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2735" href="#t2735">2735</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">TransformationRule</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2736" href="#t2736">2736</a></span><span class="t"> <span class="nam">match_rules</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">[</span><span class="str">"paths"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2737" href="#t2737">2737</a></span><span class="t"> <span class="nam">owner</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"owner"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2738" href="#t2738">2738</a></span><span class="t"> <span class="nam">group</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"group"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2739" href="#t2739">2739</a></span><span class="t"> <span class="nam">mode</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"mode"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2740" href="#t2740">2740</a></span><span class="t"> <span class="nam">recursive</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"recursive"</span><span class="op">,</span> <span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2741" href="#t2741">2741</a></span><span class="t"> <span class="nam">capabilities</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"capabilities"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2742" href="#t2742">2742</a></span><span class="t"> <span class="nam">capability_mode</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"capability_mode"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2743" href="#t2743">2743</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2744" href="#t2744">2744</a></span><span class="t"> <span class="key">if</span> <span class="nam">capabilities</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2744 ↛ 2745</span><span class="annotate long">line 2744 didn't jump to line 2745, because the condition on line 2744 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t2745" href="#t2745">2745</a></span><span class="t"> <span class="key">if</span> <span class="nam">capability_mode</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2746" href="#t2746">2746</a></span><span class="t"> <span class="nam">capability_mode</span> <span class="op">=</span> <span class="nam">SymbolicMode</span><span class="op">.</span><span class="nam">parse_filesystem_mode</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2747" href="#t2747">2747</a></span><span class="t"> <span class="str">"a-s"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2748" href="#t2748">2748</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">[</span><span class="str">"capability-mode"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2749" href="#t2749">2749</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2750" href="#t2750">2750</a></span><span class="t"> <span class="nam">validate_cap</span> <span class="op">=</span> <span class="nam">check_cap_checker</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2751" href="#t2751">2751</a></span><span class="t"> <span class="nam">validate_cap</span><span class="op">(</span><span class="nam">capabilities</span><span class="op">,</span> <span class="nam">attribute_path</span><span class="op">[</span><span class="str">"capabilities"</span><span class="op">]</span><span class="op">.</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2752" href="#t2752">2752</a></span><span class="t"> <span class="key">elif</span> <span class="nam">capability_mode</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">capabilities</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2752 ↛ 2753</span><span class="annotate long">line 2752 didn't jump to line 2753, because the condition on line 2752 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t2753" href="#t2753">2753</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2754" href="#t2754">2754</a></span><span class="t"> <span class="str">"The attribute capability-mode cannot be provided without capabilities"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2755" href="#t2755">2755</a></span><span class="t"> <span class="str">f" in {attribute_path.path}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2756" href="#t2756">2756</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2757" href="#t2757">2757</a></span><span class="t"> <span class="key">if</span> <span class="nam">owner</span> <span class="key">is</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">group</span> <span class="key">is</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">mode</span> <span class="key">is</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">capabilities</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2757 ↛ 2758</span><span class="annotate long">line 2757 didn't jump to line 2758, because the condition on line 2757 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t2758" href="#t2758">2758</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2759" href="#t2759">2759</a></span><span class="t"> <span class="str">"At least one of owner, group, mode, or capabilities must be provided"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2760" href="#t2760">2760</a></span><span class="t"> <span class="str">f" in {attribute_path.path}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2761" href="#t2761">2761</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2762" href="#t2762">2762</a></span><span class="t"> <span class="nam">condition</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"when"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2763" href="#t2763">2763</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2764" href="#t2764">2764</a></span><span class="t"> <span class="key">return</span> <span class="nam">PathMetadataTransformationRule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2765" href="#t2765">2765</a></span><span class="t"> <span class="op">[</span><span class="nam">m</span><span class="op">.</span><span class="nam">match_rule</span> <span class="key">for</span> <span class="nam">m</span> <span class="key">in</span> <span class="nam">match_rules</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2766" href="#t2766">2766</a></span><span class="t"> <span class="nam">owner</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2767" href="#t2767">2767</a></span><span class="t"> <span class="nam">group</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2768" href="#t2768">2768</a></span><span class="t"> <span class="nam">mode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2769" href="#t2769">2769</a></span><span class="t"> <span class="nam">recursive</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2770" href="#t2770">2770</a></span><span class="t"> <span class="nam">capabilities</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2771" href="#t2771">2771</a></span><span class="t"> <span class="nam">capability_mode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2772" href="#t2772">2772</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2773" href="#t2773">2773</a></span><span class="t"> <span class="nam">condition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2774" href="#t2774">2774</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2775" href="#t2775">2775</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2776" href="#t2776">2776</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2777" href="#t2777">2777</a></span><span class="t"><span class="key">def</span> <span class="nam">_transformation_mkdirs</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2778" href="#t2778">2778</a></span><span class="t"> <span class="nam">_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2779" href="#t2779">2779</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">:</span> <span class="nam">EnsureDirectoryRule</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2780" href="#t2780">2780</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2781" href="#t2781">2781</a></span><span class="t"> <span class="nam">_context</span><span class="op">:</span> <span class="nam">ParserContextData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2782" href="#t2782">2782</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">TransformationRule</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2783" href="#t2783">2783</a></span><span class="t"> <span class="nam">provided_paths</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">[</span><span class="str">"paths"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2784" href="#t2784">2784</a></span><span class="t"> <span class="nam">owner</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"owner"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2785" href="#t2785">2785</a></span><span class="t"> <span class="nam">group</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"group"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2786" href="#t2786">2786</a></span><span class="t"> <span class="nam">mode</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"mode"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2787" href="#t2787">2787</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2788" href="#t2788">2788</a></span><span class="t"> <span class="nam">condition</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="str">"when"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2789" href="#t2789">2789</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2790" href="#t2790">2790</a></span><span class="t"> <span class="key">return</span> <span class="nam">CreateDirectoryTransformationRule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2791" href="#t2791">2791</a></span><span class="t"> <span class="op">[</span><span class="nam">p</span><span class="op">.</span><span class="nam">match_rule</span><span class="op">.</span><span class="nam">path</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">provided_paths</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2792" href="#t2792">2792</a></span><span class="t"> <span class="nam">owner</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2793" href="#t2793">2793</a></span><span class="t"> <span class="nam">group</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2794" href="#t2794">2794</a></span><span class="t"> <span class="nam">mode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2795" href="#t2795">2795</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2796" href="#t2796">2796</a></span><span class="t"> <span class="nam">condition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2797" href="#t2797">2797</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2798" href="#t2798">2798</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2799" href="#t2799">2799</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2800" href="#t2800">2800</a></span><span class="t"><span class="key">def</span> <span class="nam">_at_least_two</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2801" href="#t2801">2801</a></span><span class="t"> <span class="nam">content</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">Any</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2802" href="#t2802">2802</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2803" href="#t2803">2803</a></span><span class="t"> <span class="nam">attribute_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2804" href="#t2804">2804</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2805" href="#t2805">2805</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">content</span><span class="op">)</span> <span class="op"><</span> <span class="num">2</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2805 ↛ 2806</span><span class="annotate long">line 2805 didn't jump to line 2806, because the condition on line 2805 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t2806" href="#t2806">2806</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2807" href="#t2807">2807</a></span><span class="t"> <span class="str">f"Must have at least two conditions in {attribute_path[attribute_name].path}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2808" href="#t2808">2808</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2809" href="#t2809">2809</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2810" href="#t2810">2810</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2811" href="#t2811">2811</a></span><span class="t"><span class="key">def</span> <span class="nam">_mc_any_of</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2812" href="#t2812">2812</a></span><span class="t"> <span class="nam">name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2813" href="#t2813">2813</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">:</span> <span class="nam">MCAnyOfAllOf</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2814" href="#t2814">2814</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2815" href="#t2815">2815</a></span><span class="t"> <span class="nam">_context</span><span class="op">:</span> <span class="nam">ParserContextData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2816" href="#t2816">2816</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">ManifestCondition</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2817" href="#t2817">2817</a></span><span class="t"> <span class="nam">conditions</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">[</span><span class="str">"conditions"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2818" href="#t2818">2818</a></span><span class="t"> <span class="nam">_at_least_two</span><span class="op">(</span><span class="nam">conditions</span><span class="op">,</span> <span class="nam">attribute_path</span><span class="op">,</span> <span class="str">"conditions"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2819" href="#t2819">2819</a></span><span class="t"> <span class="key">if</span> <span class="nam">name</span> <span class="op">==</span> <span class="str">"any-of"</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2819 ↛ 2820</span><span class="annotate long">line 2819 didn't jump to line 2820, because the condition on line 2819 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t2820" href="#t2820">2820</a></span><span class="t"> <span class="key">return</span> <span class="nam">ManifestCondition</span><span class="op">.</span><span class="nam">any_of</span><span class="op">(</span><span class="nam">conditions</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2821" href="#t2821">2821</a></span><span class="t"> <span class="key">assert</span> <span class="nam">name</span> <span class="op">==</span> <span class="str">"all-of"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2822" href="#t2822">2822</a></span><span class="t"> <span class="key">return</span> <span class="nam">ManifestCondition</span><span class="op">.</span><span class="nam">all_of</span><span class="op">(</span><span class="nam">conditions</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2823" href="#t2823">2823</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2824" href="#t2824">2824</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2825" href="#t2825">2825</a></span><span class="t"><span class="key">def</span> <span class="nam">_mc_not</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2826" href="#t2826">2826</a></span><span class="t"> <span class="nam">_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2827" href="#t2827">2827</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">:</span> <span class="nam">MCNot</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2828" href="#t2828">2828</a></span><span class="t"> <span class="nam">_attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2829" href="#t2829">2829</a></span><span class="t"> <span class="nam">_context</span><span class="op">:</span> <span class="nam">ParserContextData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2830" href="#t2830">2830</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">ManifestCondition</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2831" href="#t2831">2831</a></span><span class="t"> <span class="nam">condition</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">[</span><span class="str">"negated_condition"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2832" href="#t2832">2832</a></span><span class="t"> <span class="key">return</span> <span class="nam">condition</span><span class="op">.</span><span class="nam">negated</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2833" href="#t2833">2833</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2834" href="#t2834">2834</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2835" href="#t2835">2835</a></span><span class="t"><span class="key">def</span> <span class="nam">_extract_arch_matches</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2836" href="#t2836">2836</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">:</span> <span class="nam">MCArchMatches</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2837" href="#t2837">2837</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2838" href="#t2838">2838</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2839" href="#t2839">2839</a></span><span class="t"> <span class="nam">arch_matches_as_str</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">[</span><span class="str">"arch_matches"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2840" href="#t2840">2840</a></span><span class="t"> <span class="com"># Can we check arch list for typos? If we do, it must be tight in how close matches it does.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2841" href="#t2841">2841</a></span><span class="t"> <span class="com"># Consider "arm" vs. "armel" (edit distance 2, but both are valid). Likewise, names often</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2842" href="#t2842">2842</a></span><span class="t"> <span class="com"># include a bit indicator "foo", "foo32", "foo64" - all of these have an edit distance of 2</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2843" href="#t2843">2843</a></span><span class="t"> <span class="com"># of each other.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2844" href="#t2844">2844</a></span><span class="t"> <span class="nam">arch_matches_as_list</span> <span class="op">=</span> <span class="nam">arch_matches_as_str</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2845" href="#t2845">2845</a></span><span class="t"> <span class="nam">attr_path</span> <span class="op">=</span> <span class="nam">attribute_path</span><span class="op">[</span><span class="str">"arch_matches"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2846" href="#t2846">2846</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">arch_matches_as_list</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2846 ↛ 2847</span><span class="annotate long">line 2846 didn't jump to line 2847, because the condition on line 2846 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t2847" href="#t2847">2847</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2848" href="#t2848">2848</a></span><span class="t"> <span class="str">f"The condition at {attr_path.path} must not be empty"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2849" href="#t2849">2849</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2850" href="#t2850">2850</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2851" href="#t2851">2851</a></span><span class="t"> <span class="key">if</span> <span class="nam">arch_matches_as_list</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"["</span><span class="op">)</span> <span class="key">or</span> <span class="nam">arch_matches_as_list</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span> </span><span class="r"><span class="annotate short">2851 ↛ 2854</span><span class="annotate long">line 2851 didn't jump to line 2854, because the condition on line 2851 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t2852" href="#t2852">2852</a></span><span class="t"> <span class="str">"]"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2853" href="#t2853">2853</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2854" href="#t2854">2854</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2855" href="#t2855">2855</a></span><span class="t"> <span class="str">f"The architecture match at {attr_path.path} must be defined without enclosing it with "</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2856" href="#t2856">2856</a></span><span class="t"> <span class="str">'"[" or/and "]" brackets'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2857" href="#t2857">2857</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2858" href="#t2858">2858</a></span><span class="t"> <span class="key">return</span> <span class="nam">arch_matches_as_list</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2859" href="#t2859">2859</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2860" href="#t2860">2860</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2861" href="#t2861">2861</a></span><span class="t"><span class="key">def</span> <span class="nam">_mc_source_context_arch_matches</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2862" href="#t2862">2862</a></span><span class="t"> <span class="nam">_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2863" href="#t2863">2863</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">:</span> <span class="nam">MCArchMatches</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2864" href="#t2864">2864</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2865" href="#t2865">2865</a></span><span class="t"> <span class="nam">_context</span><span class="op">:</span> <span class="nam">ParserContextData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2866" href="#t2866">2866</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">ManifestCondition</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2867" href="#t2867">2867</a></span><span class="t"> <span class="nam">arch_matches</span> <span class="op">=</span> <span class="nam">_extract_arch_matches</span><span class="op">(</span><span class="nam">parsed_data</span><span class="op">,</span> <span class="nam">attribute_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2868" href="#t2868">2868</a></span><span class="t"> <span class="key">return</span> <span class="nam">SourceContextArchMatchManifestCondition</span><span class="op">(</span><span class="nam">arch_matches</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2869" href="#t2869">2869</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2870" href="#t2870">2870</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2871" href="#t2871">2871</a></span><span class="t"><span class="key">def</span> <span class="nam">_mc_package_context_arch_matches</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2872" href="#t2872">2872</a></span><span class="t"> <span class="nam">name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2873" href="#t2873">2873</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">:</span> <span class="nam">MCArchMatches</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2874" href="#t2874">2874</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2875" href="#t2875">2875</a></span><span class="t"> <span class="nam">context</span><span class="op">:</span> <span class="nam">ParserContextData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2876" href="#t2876">2876</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">ManifestCondition</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2877" href="#t2877">2877</a></span><span class="t"> <span class="nam">arch_matches</span> <span class="op">=</span> <span class="nam">_extract_arch_matches</span><span class="op">(</span><span class="nam">parsed_data</span><span class="op">,</span> <span class="nam">attribute_path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2878" href="#t2878">2878</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2879" href="#t2879">2879</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">context</span><span class="op">.</span><span class="nam">is_in_binary_package_state</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2880" href="#t2880">2880</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2881" href="#t2881">2881</a></span><span class="t"> <span class="str">f'The condition "{name}" at {attribute_path.path} can only be used in the context of a binary package.'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2882" href="#t2882">2882</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2883" href="#t2883">2883</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2884" href="#t2884">2884</a></span><span class="t"> <span class="nam">package_state</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">current_binary_package_state</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2885" href="#t2885">2885</a></span><span class="t"> <span class="key">if</span> <span class="nam">package_state</span><span class="op">.</span><span class="nam">binary_package</span><span class="op">.</span><span class="nam">is_arch_all</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2886" href="#t2886">2886</a></span><span class="t"> <span class="nam">result</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">dpkg_arch_query_table</span><span class="op">.</span><span class="nam">architecture_is_concerned</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2887" href="#t2887">2887</a></span><span class="t"> <span class="str">"all"</span><span class="op">,</span> <span class="nam">arch_matches</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2888" href="#t2888">2888</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2889" href="#t2889">2889</a></span><span class="t"> <span class="nam">attr_path</span> <span class="op">=</span> <span class="nam">attribute_path</span><span class="op">[</span><span class="str">"arch_matches"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2890" href="#t2890">2890</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2891" href="#t2891">2891</a></span><span class="t"> <span class="str">f"The package architecture restriction at {attr_path.path} is applied to the"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2892" href="#t2892">2892</a></span><span class="t"> <span class="str">f' "Architecture: all" package {package_state.binary_package.name}, which does not make sense'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2893" href="#t2893">2893</a></span><span class="t"> <span class="str">f" as the condition will always resolves to `{str(result).lower()}`."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2894" href="#t2894">2894</a></span><span class="t"> <span class="str">f" If you **really** need an architecture specific constraint for this rule, consider using"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2895" href="#t2895">2895</a></span><span class="t"> <span class="str">f' "source-context-arch-matches" instead. However, this is a very rare use-case!'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2896" href="#t2896">2896</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2897" href="#t2897">2897</a></span><span class="t"> <span class="key">return</span> <span class="nam">BinaryPackageContextArchMatchManifestCondition</span><span class="op">(</span><span class="nam">arch_matches</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2898" href="#t2898">2898</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2899" href="#t2899">2899</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2900" href="#t2900">2900</a></span><span class="t"><span class="key">def</span> <span class="nam">_mc_arch_matches</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2901" href="#t2901">2901</a></span><span class="t"> <span class="nam">name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2902" href="#t2902">2902</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">:</span> <span class="nam">MCArchMatches</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2903" href="#t2903">2903</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2904" href="#t2904">2904</a></span><span class="t"> <span class="nam">context</span><span class="op">:</span> <span class="nam">ParserContextData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2905" href="#t2905">2905</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">ManifestCondition</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2906" href="#t2906">2906</a></span><span class="t"> <span class="key">if</span> <span class="nam">context</span><span class="op">.</span><span class="nam">is_in_binary_package_state</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2906 ↛ 2907</span><span class="annotate long">line 2906 didn't jump to line 2907, because the condition on line 2906 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t2907" href="#t2907">2907</a></span><span class="t"> <span class="key">return</span> <span class="nam">_mc_package_context_arch_matches</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2908" href="#t2908">2908</a></span><span class="t"> <span class="nam">name</span><span class="op">,</span> <span class="nam">parsed_data</span><span class="op">,</span> <span class="nam">attribute_path</span><span class="op">,</span> <span class="nam">context</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2909" href="#t2909">2909</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2910" href="#t2910">2910</a></span><span class="t"> <span class="key">return</span> <span class="nam">_mc_source_context_arch_matches</span><span class="op">(</span><span class="nam">name</span><span class="op">,</span> <span class="nam">parsed_data</span><span class="op">,</span> <span class="nam">attribute_path</span><span class="op">,</span> <span class="nam">context</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2911" href="#t2911">2911</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2912" href="#t2912">2912</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2913" href="#t2913">2913</a></span><span class="t"><span class="key">def</span> <span class="nam">_mc_build_profile_matches</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2914" href="#t2914">2914</a></span><span class="t"> <span class="nam">_name</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2915" href="#t2915">2915</a></span><span class="t"> <span class="nam">parsed_data</span><span class="op">:</span> <span class="nam">MCBuildProfileMatches</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2916" href="#t2916">2916</a></span><span class="t"> <span class="nam">attribute_path</span><span class="op">:</span> <span class="nam">AttributePath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2917" href="#t2917">2917</a></span><span class="t"> <span class="nam">_context</span><span class="op">:</span> <span class="nam">ParserContextData</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2918" href="#t2918">2918</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">ManifestCondition</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2919" href="#t2919">2919</a></span><span class="t"> <span class="nam">build_profile_spec</span> <span class="op">=</span> <span class="nam">parsed_data</span><span class="op">[</span><span class="str">"build_profile_matches"</span><span class="op">]</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2920" href="#t2920">2920</a></span><span class="t"> <span class="nam">attr_path</span> <span class="op">=</span> <span class="nam">attribute_path</span><span class="op">[</span><span class="str">"build_profile_matches"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2921" href="#t2921">2921</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">build_profile_spec</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2921 ↛ 2922</span><span class="annotate long">line 2921 didn't jump to line 2922, because the condition on line 2921 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t2922" href="#t2922">2922</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2923" href="#t2923">2923</a></span><span class="t"> <span class="str">f"The condition at {attr_path.path} must not be empty"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2924" href="#t2924">2924</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2925" href="#t2925">2925</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2926" href="#t2926">2926</a></span><span class="t"> <span class="nam">active_profiles_match</span><span class="op">(</span><span class="nam">build_profile_spec</span><span class="op">,</span> <span class="nam">frozenset</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2927" href="#t2927">2927</a></span><span class="t"> <span class="key">except</span> <span class="nam">ValueError</span> <span class="key">as</span> <span class="nam">e</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2928" href="#t2928">2928</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ManifestParseException</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2929" href="#t2929">2929</a></span><span class="t"> <span class="str">f"Could not parse the build specification at {attr_path.path}: {e.args[0]}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2930" href="#t2930">2930</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2931" href="#t2931">2931</a></span><span class="t"> <span class="key">return</span> <span class="nam">BuildProfileMatch</span><span class="op">(</span><span class="nam">build_profile_spec</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_d5d6843b45eec01e_paths_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_d5d6843b45eec01e_service_management_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_d5d6843b45eec01e_service_management_py.html b/coverage-report/d_d5d6843b45eec01e_service_management_py.html deleted file mode 100644 index 7281c92..0000000 --- a/coverage-report/d_d5d6843b45eec01e_service_management_py.html +++ /dev/null @@ -1,549 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/plugin/debputy/service_management.py: 82%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/plugin/debputy/service_management.py</b>: - <span class="pc_cov">82%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">163 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">143<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">20<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">2<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">17<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_d5d6843b45eec01e_private_api_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_d5d6843b45eec01e_shlib_metadata_detectors_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">collections</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">dataclasses</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">import</span> <span class="nam">textwrap</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Dict</span><span class="op">,</span> <span class="nam">List</span><span class="op">,</span> <span class="nam">Literal</span><span class="op">,</span> <span class="nam">Iterable</span><span class="op">,</span> <span class="nam">Sequence</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">packages</span> <span class="key">import</span> <span class="nam">BinaryPackage</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">spec</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">ServiceRegistry</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">BinaryCtrlAccessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">ServiceDefinition</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">_error</span><span class="op">,</span> <span class="nam">assume_not_none</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"><span class="nam">DPKG_ROOT</span> <span class="op">=</span> <span class="str">'"${DPKG_ROOT}"'</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"><span class="nam">EMPTY_DPKG_ROOT_CONDITION</span> <span class="op">=</span> <span class="str">'[ -z "${DPKG_ROOT}" ]'</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"><span class="nam">SERVICE_MANAGER_IS_SYSTEMD_CONDITION</span> <span class="op">=</span> <span class="str">"[ -d /run/systemd/system ]"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"><span class="key">class</span> <span class="nam">SystemdServiceContext</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">had_install_section</span><span class="op">:</span> <span class="nam">bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"><span class="key">class</span> <span class="nam">SystemdUnit</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="nam">names</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="nam">type_of_service</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="nam">service_scope</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="nam">enable_by_default</span><span class="op">:</span> <span class="nam">bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="nam">start_by_default</span><span class="op">:</span> <span class="nam">bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="nam">had_install_section</span><span class="op">:</span> <span class="nam">bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"><span class="key">def</span> <span class="nam">detect_systemd_service_files</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="nam">service_registry</span><span class="op">:</span> <span class="nam">ServiceRegistry</span><span class="op">[</span><span class="nam">SystemdServiceContext</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="nam">context</span><span class="op">:</span> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">pkg</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">binary_package</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="nam">systemd_units</span> <span class="op">=</span> <span class="nam">_find_and_analyze_systemd_service_files</span><span class="op">(</span><span class="nam">pkg</span><span class="op">,</span> <span class="nam">fs_root</span><span class="op">,</span> <span class="str">"system"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="key">for</span> <span class="nam">unit</span> <span class="key">in</span> <span class="nam">systemd_units</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="nam">service_registry</span><span class="op">.</span><span class="nam">register_service</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="nam">unit</span><span class="op">.</span><span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="nam">unit</span><span class="op">.</span><span class="nam">names</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="nam">type_of_service</span><span class="op">=</span><span class="nam">unit</span><span class="op">.</span><span class="nam">type_of_service</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="nam">service_scope</span><span class="op">=</span><span class="nam">unit</span><span class="op">.</span><span class="nam">service_scope</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="nam">enable_by_default</span><span class="op">=</span><span class="nam">unit</span><span class="op">.</span><span class="nam">enable_by_default</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="nam">start_by_default</span><span class="op">=</span><span class="nam">unit</span><span class="op">.</span><span class="nam">start_by_default</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="nam">default_upgrade_rule</span><span class="op">=</span><span class="str">"restart"</span> <span class="key">if</span> <span class="nam">unit</span><span class="op">.</span><span class="nam">start_by_default</span> <span class="key">else</span> <span class="str">"do-nothing"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="nam">service_context</span><span class="op">=</span><span class="nam">SystemdServiceContext</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="nam">unit</span><span class="op">.</span><span class="nam">had_install_section</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"><span class="key">def</span> <span class="nam">generate_snippets_for_systemd_units</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="nam">services</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">ServiceDefinition</span><span class="op">[</span><span class="nam">SystemdServiceContext</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">:</span> <span class="nam">BinaryCtrlAccessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="nam">_context</span><span class="op">:</span> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="nam">stop_before_upgrade</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="nam">stop_then_start_scripts</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="nam">on_purge</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="nam">start_on_install</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="nam">action_on_upgrade</span> <span class="op">=</span> <span class="nam">collections</span><span class="op">.</span><span class="nam">defaultdict</span><span class="op">(</span><span class="nam">list</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="key">assert</span> <span class="nam">services</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="key">for</span> <span class="nam">service_def</span> <span class="key">in</span> <span class="nam">services</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="key">if</span> <span class="nam">service_def</span><span class="op">.</span><span class="nam">auto_enable_on_install</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="nam">template</span> <span class="op">=</span> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"><span class="str"> if deb-systemd-helper debian-installed {UNITFILE}; then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"><span class="str"> # The following line should be removed in trixie or trixie+1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"><span class="str"> deb-systemd-helper unmask {UNITFILE} >/dev/null || true</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"><span class="str"> if deb-systemd-helper --quiet was-enabled {UNITFILE}; then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"><span class="str"> # Create new symlinks, if any.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"><span class="str"> deb-systemd-helper enable {UNITFILE} >/dev/null || true</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"><span class="str"> fi</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"><span class="str"> fi</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"><span class="str"> # Update the statefile to add new symlinks (if any), which need to be cleaned</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"><span class="str"> # up on purge. Also remove old symlinks.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"><span class="str"> deb-systemd-helper update-state {UNITFILE} >/dev/null || true</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="nam">template</span> <span class="op">=</span> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"><span class="str"> # The following line should be removed in trixie or trixie+1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"><span class="str"> deb-systemd-helper unmask {UNITFILE} >/dev/null || true</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"><span class="str"> # was-enabled defaults to true, so new installations run enable.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"><span class="str"> if deb-systemd-helper --quiet was-enabled {UNITFILE}; then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"><span class="str"> # Enables the unit on first installation, creates new</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"><span class="str"> # symlinks on upgrades if the unit file has changed.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"><span class="str"> deb-systemd-helper enable {UNITFILE} >/dev/null || true</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"><span class="str"> else</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"><span class="str"> # Update the statefile to add new symlinks (if any), which need to be</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"><span class="str"> # cleaned up on purge. Also remove old symlinks.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"><span class="str"> deb-systemd-helper update-state {UNITFILE} >/dev/null || true</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"><span class="str"> fi</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="nam">service_name</span> <span class="op">=</span> <span class="nam">service_def</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="key">if</span> <span class="nam">assume_not_none</span><span class="op">(</span><span class="nam">service_def</span><span class="op">.</span><span class="nam">service_context</span><span class="op">)</span><span class="op">.</span><span class="nam">had_install_section</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">on_configure</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="nam">template</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="nam">UNITFILE</span><span class="op">=</span><span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">escape_shell_words</span><span class="op">(</span><span class="nam">service_name</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="nam">on_purge</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">service_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="key">elif</span> <span class="nam">service_def</span><span class="op">.</span><span class="nam">auto_enable_on_install</span><span class="op">:</span> </span><span class="r"><span class="annotate short">114 ↛ 115</span><span class="annotate long">line 114 didn't jump to line 115, because the condition on line 114 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="str">f'The service "{service_name}" cannot be enabled under "systemd" as'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="str">f' it has no "[Install]" section. Please correct {service_def.definition_source}'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="str">f' so that it does not enable the service or does not apply to "systemd"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="key">if</span> <span class="nam">service_def</span><span class="op">.</span><span class="nam">auto_start_on_install</span><span class="op">:</span> </span><span class="r"><span class="annotate short">121 ↛ 123</span><span class="annotate long">line 121 didn't jump to line 123, because the condition on line 121 was never false</span></span></p> - <p class="run"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="nam">start_on_install</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">service_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="key">if</span> <span class="nam">service_def</span><span class="op">.</span><span class="nam">on_upgrade</span> <span class="op">==</span> <span class="str">"stop-then-start"</span><span class="op">:</span> </span><span class="r"><span class="annotate short">123 ↛ 124</span><span class="annotate long">line 123 didn't jump to line 124, because the condition on line 123 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="nam">stop_then_start_scripts</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">service_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="key">elif</span> <span class="nam">service_def</span><span class="op">.</span><span class="nam">on_upgrade</span> <span class="key">in</span> <span class="op">(</span><span class="str">"restart"</span><span class="op">,</span> <span class="str">"reload"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">125 ↛ 128</span><span class="annotate long">line 125 didn't jump to line 128, because the condition on line 125 was never false</span></span></p> - <p class="run"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="nam">action</span><span class="op">:</span> <span class="nam">str</span> <span class="op">=</span> <span class="nam">service_def</span><span class="op">.</span><span class="nam">on_upgrade</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="nam">action_on_upgrade</span><span class="op">[</span><span class="nam">action</span><span class="op">]</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">service_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="key">elif</span> <span class="nam">service_def</span><span class="op">.</span><span class="nam">on_upgrade</span> <span class="op">!=</span> <span class="str">"do-nothing"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="key">raise</span> <span class="nam">AssertionError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="str">f"Missing support for on_upgrade rule: {service_def.on_upgrade}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="key">if</span> <span class="nam">start_on_install</span> <span class="key">or</span> <span class="nam">action_on_upgrade</span><span class="op">:</span> </span><span class="r"><span class="annotate short">133 ↛ 170</span><span class="annotate long">line 133 didn't jump to line 170, because the condition on line 133 was never false</span></span></p> - <p class="run"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="nam">lines</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="str">"if {EMPTY_DPKG_ROOT_CONDITION} && {SERVICE_MANAGER_IS_SYSTEMD_CONDITION}; then"</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="nam">EMPTY_DPKG_ROOT_CONDITION</span><span class="op">=</span><span class="nam">EMPTY_DPKG_ROOT_CONDITION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="nam">SERVICE_MANAGER_IS_SYSTEMD_CONDITION</span><span class="op">=</span><span class="nam">SERVICE_MANAGER_IS_SYSTEMD_CONDITION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="str">" systemctl --system daemon-reload >/dev/null || true"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="key">if</span> <span class="nam">stop_then_start_scripts</span><span class="op">:</span> </span><span class="r"><span class="annotate short">141 ↛ 142</span><span class="annotate long">line 141 didn't jump to line 142, because the condition on line 141 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="nam">unit_files</span> <span class="op">=</span> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">escape_shell_words</span><span class="op">(</span><span class="op">*</span><span class="nam">stop_then_start_scripts</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="nam">lines</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="str">" deb-systemd-invoke start {UNITFILES} >/dev/null || true"</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="nam">UNITFILES</span><span class="op">=</span><span class="nam">unit_files</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="key">if</span> <span class="nam">start_on_install</span><span class="op">:</span> </span><span class="r"><span class="annotate short">148 ↛ 156</span><span class="annotate long">line 148 didn't jump to line 156, because the condition on line 148 was never false</span></span></p> - <p class="run"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="nam">lines</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">' if [ -z "$2" ]; then'</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="nam">lines</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="str">" deb-systemd-invoke start {UNITFILES} >/dev/null || true"</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="nam">UNITFILES</span><span class="op">=</span><span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">escape_shell_words</span><span class="op">(</span><span class="op">*</span><span class="nam">start_on_install</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="nam">lines</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">" fi"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="key">if</span> <span class="nam">action_on_upgrade</span><span class="op">:</span> </span><span class="r"><span class="annotate short">156 ↛ 166</span><span class="annotate long">line 156 didn't jump to line 166, because the condition on line 156 was never false</span></span></p> - <p class="run"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="nam">lines</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">' if [ -n "$2" ]; then'</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="key">for</span> <span class="nam">action</span><span class="op">,</span> <span class="nam">units</span> <span class="key">in</span> <span class="nam">action_on_upgrade</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="nam">lines</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="str">" deb-systemd-invoke {ACTION} {UNITFILES} >/dev/null || true"</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="nam">ACTION</span><span class="op">=</span><span class="nam">action</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="nam">UNITFILES</span><span class="op">=</span><span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">escape_shell_words</span><span class="op">(</span><span class="op">*</span><span class="nam">units</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="nam">lines</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">" fi"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="nam">lines</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">"fi"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="nam">combined</span> <span class="op">=</span> <span class="str">""</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">x</span> <span class="key">if</span> <span class="nam">x</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span> <span class="key">else</span> <span class="str">f"{x}\n"</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">lines</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">on_configure</span><span class="op">(</span><span class="nam">combined</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="key">if</span> <span class="nam">stop_then_start_scripts</span><span class="op">:</span> </span><span class="r"><span class="annotate short">170 ↛ 171</span><span class="annotate long">line 170 didn't jump to line 171, because the condition on line 170 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">unconditionally_in_script</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="str">"preinst"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"><span class="str"> if {EMPTY_DPKG_ROOT_CONDITION} && [ "$1" = upgrade ] && {SERVICE_MANAGER_IS_SYSTEMD_CONDITION} ; then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"><span class="str"> deb-systemd-invoke stop {UNIT_FILES} >/dev/null || true</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"><span class="str"> fi</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"><span class="str"> """</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="nam">EMPTY_DPKG_ROOT_CONDITION</span><span class="op">=</span><span class="nam">EMPTY_DPKG_ROOT_CONDITION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="nam">SERVICE_MANAGER_IS_SYSTEMD_CONDITION</span><span class="op">=</span><span class="nam">SERVICE_MANAGER_IS_SYSTEMD_CONDITION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="nam">UNIT_FILES</span><span class="op">=</span><span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">escape_shell_words</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="op">*</span><span class="nam">stop_then_start_scripts</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="key">if</span> <span class="nam">stop_before_upgrade</span><span class="op">:</span> </span><span class="r"><span class="annotate short">188 ↛ 189</span><span class="annotate long">line 188 didn't jump to line 189, because the condition on line 188 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">on_before_removal</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"><span class="str"> if {EMPTY_DPKG_ROOT_CONDITION} && {SERVICE_MANAGER_IS_SYSTEMD_CONDITION} ; then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"><span class="str"> deb-systemd-invoke stop {UNIT_FILES} >/dev/null || true</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"><span class="str"> fi</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"><span class="str"> """</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="nam">EMPTY_DPKG_ROOT_CONDITION</span><span class="op">=</span><span class="nam">EMPTY_DPKG_ROOT_CONDITION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="nam">SERVICE_MANAGER_IS_SYSTEMD_CONDITION</span><span class="op">=</span><span class="nam">SERVICE_MANAGER_IS_SYSTEMD_CONDITION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="nam">UNIT_FILES</span><span class="op">=</span><span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">escape_shell_words</span><span class="op">(</span><span class="op">*</span><span class="nam">stop_before_upgrade</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="key">if</span> <span class="nam">on_purge</span><span class="op">:</span> </span><span class="r"><span class="annotate short">200 ↛ 210</span><span class="annotate long">line 200 didn't jump to line 210, because the condition on line 200 was never false</span></span></p> - <p class="run"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">on_purge</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"><span class="str"> if [ -x "/usr/bin/deb-systemd-helper" ]; then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"><span class="str"> deb-systemd-helper purge {UNITFILES} >/dev/null || true</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"><span class="str"> fi</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"><span class="str"> """</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="nam">UNITFILES</span><span class="op">=</span><span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">escape_shell_words</span><span class="op">(</span><span class="op">*</span><span class="nam">stop_before_upgrade</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">on_removed</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"><span class="str"> if {SERVICE_MANAGER_IS_SYSTEMD_CONDITION} ; then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"><span class="str"> systemctl --system daemon-reload >/dev/null || true</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"><span class="str"> fi</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"><span class="str"> """</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="nam">SERVICE_MANAGER_IS_SYSTEMD_CONDITION</span><span class="op">=</span><span class="nam">SERVICE_MANAGER_IS_SYSTEMD_CONDITION</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"><span class="key">def</span> <span class="nam">_remove_quote</span><span class="op">(</span><span class="nam">v</span><span class="op">:</span> <span class="nam">str</span><span class="op">)</span> <span class="op">-></span> <span class="nam">str</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="key">if</span> <span class="nam">v</span> <span class="key">and</span> <span class="nam">v</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="op">==</span> <span class="nam">v</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span> <span class="key">and</span> <span class="nam">v</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="key">in</span> <span class="op">(</span><span class="str">'"'</span><span class="op">,</span> <span class="str">"'"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">224 ↛ 226</span><span class="annotate long">line 224 didn't jump to line 226, because the condition on line 224 was never false</span></span></p> - <p class="run"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="key">return</span> <span class="nam">v</span><span class="op">[</span><span class="num">1</span><span class="op">:</span><span class="op">-</span><span class="num">1</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="key">return</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"><span class="key">def</span> <span class="nam">_find_and_analyze_systemd_service_files</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="nam">pkg</span><span class="op">:</span> <span class="nam">BinaryPackage</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="nam">systemd_service_dir</span><span class="op">:</span> <span class="nam">Literal</span><span class="op">[</span><span class="str">"system"</span><span class="op">,</span> <span class="str">"user"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">SystemdUnit</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="nam">service_dirs</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="str">f"./usr/lib/systemd/{systemd_service_dir}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="str">f"./lib/systemd/{systemd_service_dir}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="nam">had_install_sections</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="nam">aliases</span><span class="op">:</span> <span class="nam">Dict</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="nam">collections</span><span class="op">.</span><span class="nam">defaultdict</span><span class="op">(</span><span class="nam">list</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="nam">seen</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="nam">all_files</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="nam">expected_units</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="nam">expected_units_required_by</span> <span class="op">=</span> <span class="nam">collections</span><span class="op">.</span><span class="nam">defaultdict</span><span class="op">(</span><span class="nam">list</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="key">for</span> <span class="nam">d</span> <span class="key">in</span> <span class="nam">service_dirs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="nam">system_dir</span> <span class="op">=</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="nam">d</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">system_dir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="key">for</span> <span class="nam">child</span> <span class="key">in</span> <span class="nam">system_dir</span><span class="op">.</span><span class="nam">iterdir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="key">if</span> <span class="nam">child</span><span class="op">.</span><span class="nam">is_symlink</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="nam">dest</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">basename</span><span class="op">(</span><span class="nam">child</span><span class="op">.</span><span class="nam">readlink</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="nam">aliases</span><span class="op">[</span><span class="nam">dest</span><span class="op">]</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">child</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="key">elif</span> <span class="nam">child</span><span class="op">.</span><span class="nam">is_file</span> <span class="key">and</span> <span class="nam">child</span><span class="op">.</span><span class="nam">name</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">seen</span><span class="op">:</span> </span><span class="r"><span class="annotate short">253 ↛ 249</span><span class="annotate long">line 253 didn't jump to line 249, because the condition on line 253 was never false</span></span></p> - <p class="run"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="nam">seen</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">child</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="nam">all_files</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">child</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="key">if</span> <span class="str">"@"</span> <span class="key">in</span> <span class="nam">child</span><span class="op">.</span><span class="nam">name</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="com"># dh_installsystemd does not check the contents of templated services,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="com"># and we match that.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="key">with</span> <span class="nam">child</span><span class="op">.</span><span class="nam">open</span><span class="op">(</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="key">for</span> <span class="nam">line</span> <span class="key">in</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="nam">line</span> <span class="op">=</span> <span class="nam">line</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="nam">line_lc</span> <span class="op">=</span> <span class="nam">line</span><span class="op">.</span><span class="nam">lower</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="key">if</span> <span class="nam">line_lc</span> <span class="op">==</span> <span class="str">"[install]"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="nam">had_install_sections</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">child</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="key">elif</span> <span class="nam">line_lc</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"alias="</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">266 ↛ 272</span><span class="annotate long">line 266 didn't jump to line 272, because the condition on line 266 was never false</span></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="com"># This code assumes service names cannot contain spaces (as in</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="com"># if you copy-paste it for another field it might not work)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="nam">aliases</span><span class="op">[</span><span class="nam">child</span><span class="op">.</span><span class="nam">name</span><span class="op">]</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="nam">_remove_quote</span><span class="op">(</span><span class="nam">x</span><span class="op">)</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">line</span><span class="op">[</span><span class="num">6</span><span class="op">:</span><span class="op">]</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="key">elif</span> <span class="nam">line_lc</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"also="</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="com"># This code assumes service names cannot contain spaces (as in</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="com"># if you copy-paste it for another field it might not work)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="key">for</span> <span class="nam">unit</span> <span class="key">in</span> <span class="op">(</span><span class="nam">_remove_quote</span><span class="op">(</span><span class="nam">x</span><span class="op">)</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">line</span><span class="op">[</span><span class="num">5</span><span class="op">:</span><span class="op">]</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="nam">expected_units_required_by</span><span class="op">[</span><span class="nam">unit</span><span class="op">]</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">child</span><span class="op">.</span><span class="nam">absolute</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="nam">expected_units</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">unit</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="key">for</span> <span class="nam">path</span> <span class="key">in</span> <span class="nam">all_files</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="key">if</span> <span class="str">"@"</span> <span class="key">in</span> <span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="com"># Match dh_installsystemd, which skips templated services</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="nam">names</span> <span class="op">=</span> <span class="nam">aliases</span><span class="op">[</span><span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="nam">_</span><span class="op">,</span> <span class="nam">type_of_service</span> <span class="op">=</span> <span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">rsplit</span><span class="op">(</span><span class="str">"."</span><span class="op">,</span> <span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="nam">expected_units</span><span class="op">.</span><span class="nam">difference_update</span><span class="op">(</span><span class="nam">names</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="nam">expected_units</span><span class="op">.</span><span class="nam">discard</span><span class="op">(</span><span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="nam">names</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">x</span><span class="op">[</span><span class="op">:</span><span class="op">-</span><span class="num">8</span><span class="op">]</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">list</span><span class="op">(</span><span class="nam">names</span><span class="op">)</span> <span class="key">if</span> <span class="nam">x</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">".service"</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="nam">names</span><span class="op">.</span><span class="nam">insert</span><span class="op">(</span><span class="num">0</span><span class="op">,</span> <span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">".service"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="nam">names</span><span class="op">.</span><span class="nam">insert</span><span class="op">(</span><span class="num">1</span><span class="op">,</span> <span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">[</span><span class="op">:</span><span class="op">-</span><span class="num">8</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="key">yield</span> <span class="nam">SystemdUnit</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> <span class="nam">names</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="nam">type_of_service</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> <span class="nam">systemd_service_dir</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="com"># Bug (?) compat with dh_installsystemd. All units are started, but only</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> <span class="com"># enable those with an `[Install]` section.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="com"># Possibly related bug #1055599</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="nam">enable_by_default</span><span class="op">=</span><span class="nam">path</span><span class="op">.</span><span class="nam">name</span> <span class="key">in</span> <span class="nam">had_install_sections</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="nam">start_by_default</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="nam">had_install_section</span><span class="op">=</span><span class="nam">path</span><span class="op">.</span><span class="nam">name</span> <span class="key">in</span> <span class="nam">had_install_sections</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="key">if</span> <span class="nam">expected_units</span><span class="op">:</span> </span><span class="r"><span class="annotate short">303 ↛ 304</span><span class="annotate long">line 303 didn't jump to line 304, because the condition on line 303 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> <span class="key">for</span> <span class="nam">unit_name</span> <span class="key">in</span> <span class="nam">expected_units</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="nam">required_by</span> <span class="op">=</span> <span class="nam">expected_units_required_by</span><span class="op">[</span><span class="nam">unit_name</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> <span class="nam">required_names</span> <span class="op">=</span> <span class="str">", "</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">required_by</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="str">f"The unit {unit_name} was required by {required_names} (via Also=...)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> <span class="str">f" but was not present in the package {pkg.name}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"><span class="key">def</span> <span class="nam">generate_snippets_for_init_scripts</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="nam">services</span><span class="op">:</span> <span class="nam">Sequence</span><span class="op">[</span><span class="nam">ServiceDefinition</span><span class="op">[</span><span class="key">None</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">:</span> <span class="nam">BinaryCtrlAccessor</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="nam">_context</span><span class="op">:</span> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="key">for</span> <span class="nam">service_def</span> <span class="key">in</span> <span class="nam">services</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="nam">script_name</span> <span class="op">=</span> <span class="nam">service_def</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">name</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="nam">script_installed_path</span> <span class="op">=</span> <span class="nam">service_def</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">absolute</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="nam">update_rcd_params</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> <span class="str">"defaults"</span> <span class="key">if</span> <span class="nam">service_def</span><span class="op">.</span><span class="nam">auto_enable_on_install</span> <span class="key">else</span> <span class="str">"defaults-disabled"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">unconditionally_in_script</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> <span class="str">"preinst"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"><span class="str"> if [ "$1" = "install" ] && [ -n "$2" ] && [ -x {DPKG_ROOT}{SCRIPT_PATH} ] ; then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"><span class="str"> chmod +x {DPKG_ROOT}{SCRIPT_PATH} >/dev/null || true</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"><span class="str"> fi</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"><span class="str"> """</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> <span class="nam">DPKG_ROOT</span><span class="op">=</span><span class="nam">DPKG_ROOT</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> <span class="nam">SCRIPT_PATH</span><span class="op">=</span><span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">escape_shell_words</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> <span class="nam">script_installed_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"> <span class="nam">lines</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"> <span class="str">"if {EMPTY_DPKG_ROOT_CONDITION} && [ -x {SCRIPT_PATH} ]; then"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> <span class="str">" update-rc.d {SCRIPT_NAME} {UPDATE_RCD_PARAMS} >/dev/null || exit 1"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"><span class="annotate short">347 ↛ 359</span><span class="annotate long">line 347 didn't jump to line 359</span></span></p> - <p class="pln"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"> <span class="nam">service_def</span><span class="op">.</span><span class="nam">auto_start_on_install</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"> <span class="key">and</span> <span class="nam">service_def</span><span class="op">.</span><span class="nam">on_upgrade</span> <span class="op">!=</span> <span class="str">"stop-then-start"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"> <span class="nam">lines</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">' if [ -z "$2" ]; then'</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"> <span class="nam">lines</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"> <span class="str">" invoke-rc.d --skip-systemd-native {SCRIPT_NAME} start >/dev/null || exit 1"</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"> <span class="nam">SCRIPT_NAME</span><span class="op">=</span><span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">escape_shell_words</span><span class="op">(</span><span class="nam">script_name</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"> <span class="nam">lines</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">" fi"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"> <span class="key">if</span> <span class="nam">service_def</span><span class="op">.</span><span class="nam">on_upgrade</span> <span class="key">in</span> <span class="op">(</span><span class="str">"restart"</span><span class="op">,</span> <span class="str">"reload"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">359 ↛ 368</span><span class="annotate long">line 359 didn't jump to line 368, because the condition on line 359 was never false</span></span></p> - <p class="run"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"> <span class="nam">lines</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">' if [ -n "$2" ]; then'</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"> <span class="nam">lines</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"> <span class="str">" invoke-rc.d --skip-systemd-native {SCRIPT_NAME} {ACTION} >/dev/null || exit 1"</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"> <span class="nam">SCRIPT_NAME</span><span class="op">=</span><span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">escape_shell_words</span><span class="op">(</span><span class="nam">script_name</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"> <span class="nam">ACTION</span><span class="op">=</span><span class="nam">service_def</span><span class="op">.</span><span class="nam">on_upgrade</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"> <span class="nam">lines</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">" fi"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"> <span class="key">elif</span> <span class="nam">service_def</span><span class="op">.</span><span class="nam">on_upgrade</span> <span class="op">==</span> <span class="str">"stop-then-start"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"> <span class="nam">lines</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"> <span class="str">" invoke-rc.d --skip-systemd-native {SCRIPT_NAME} start >/dev/null || exit 1"</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"> <span class="nam">SCRIPT_NAME</span><span class="op">=</span><span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">escape_shell_words</span><span class="op">(</span><span class="nam">script_name</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">unconditionally_in_script</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"> <span class="str">"preinst"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"><span class="str"> if {EMPTY_DPKG_ROOT_CONDITION} && [ "$1" = "upgrade" ] && [ -x {SCRIPT_PATH} ]; then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"><span class="str"> invoke-rc.d --skip-systemd-native {SCRIPT_NAME} stop > /dev/null || true</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"><span class="str"> fi</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"><span class="str"> """</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"> <span class="nam">EMPTY_DPKG_ROOT_CONDITION</span><span class="op">=</span><span class="nam">EMPTY_DPKG_ROOT_CONDITION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"> <span class="nam">SCRIPT_PATH</span><span class="op">=</span><span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">escape_shell_words</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"> <span class="nam">script_installed_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t385" href="#t385">385</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t386" href="#t386">386</a></span><span class="t"> <span class="nam">SCRIPT_NAME</span><span class="op">=</span><span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">escape_shell_words</span><span class="op">(</span><span class="nam">script_name</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t387" href="#t387">387</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t388" href="#t388">388</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t389" href="#t389">389</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t390" href="#t390">390</a></span><span class="t"> <span class="key">elif</span> <span class="nam">service_def</span><span class="op">.</span><span class="nam">on_upgrade</span> <span class="op">!=</span> <span class="str">"do-nothing"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t391" href="#t391">391</a></span><span class="t"> <span class="key">raise</span> <span class="nam">AssertionError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t392" href="#t392">392</a></span><span class="t"> <span class="str">f"Missing support for on_upgrade rule: {service_def.on_upgrade}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t393" href="#t393">393</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t394" href="#t394">394</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t395" href="#t395">395</a></span><span class="t"> <span class="nam">lines</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="str">"fi"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t396" href="#t396">396</a></span><span class="t"> <span class="nam">combined</span> <span class="op">=</span> <span class="str">""</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">x</span> <span class="key">if</span> <span class="nam">x</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span> <span class="key">else</span> <span class="str">f"{x}\n"</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">lines</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t397" href="#t397">397</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">on_configure</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t398" href="#t398">398</a></span><span class="t"> <span class="nam">combined</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t399" href="#t399">399</a></span><span class="t"> <span class="nam">EMPTY_DPKG_ROOT_CONDITION</span><span class="op">=</span><span class="nam">EMPTY_DPKG_ROOT_CONDITION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t400" href="#t400">400</a></span><span class="t"> <span class="nam">DPKG_ROOT</span><span class="op">=</span><span class="nam">DPKG_ROOT</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t401" href="#t401">401</a></span><span class="t"> <span class="nam">UPDATE_RCD_PARAMS</span><span class="op">=</span><span class="nam">update_rcd_params</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t402" href="#t402">402</a></span><span class="t"> <span class="nam">SCRIPT_PATH</span><span class="op">=</span><span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">escape_shell_words</span><span class="op">(</span><span class="nam">script_installed_path</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t403" href="#t403">403</a></span><span class="t"> <span class="nam">SCRIPT_NAME</span><span class="op">=</span><span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">escape_shell_words</span><span class="op">(</span><span class="nam">script_name</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t404" href="#t404">404</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t405" href="#t405">405</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t406" href="#t406">406</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t407" href="#t407">407</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">on_removed</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t408" href="#t408">408</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t409" href="#t409">409</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t410" href="#t410">410</a></span><span class="t"><span class="str"> if [ -x {DPKG_ROOT}{SCRIPT_PATH} ]; then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t411" href="#t411">411</a></span><span class="t"><span class="str"> chmod -x {DPKG_ROOT}{SCRIPT_PATH} > /dev/null || true</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t412" href="#t412">412</a></span><span class="t"><span class="str"> fi</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t413" href="#t413">413</a></span><span class="t"><span class="str"> """</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t414" href="#t414">414</a></span><span class="t"> <span class="nam">DPKG_ROOT</span><span class="op">=</span><span class="nam">DPKG_ROOT</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t415" href="#t415">415</a></span><span class="t"> <span class="nam">SCRIPT_PATH</span><span class="op">=</span><span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">escape_shell_words</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t416" href="#t416">416</a></span><span class="t"> <span class="nam">script_installed_path</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t417" href="#t417">417</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t418" href="#t418">418</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t419" href="#t419">419</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t420" href="#t420">420</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t421" href="#t421">421</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">on_purge</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t422" href="#t422">422</a></span><span class="t"> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t423" href="#t423">423</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t424" href="#t424">424</a></span><span class="t"><span class="str"> if {EMPTY_DPKG_ROOT_CONDITION} ; then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t425" href="#t425">425</a></span><span class="t"><span class="str"> update-rc.d {SCRIPT_NAME} remove >/dev/null</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t426" href="#t426">426</a></span><span class="t"><span class="str"> fi</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t427" href="#t427">427</a></span><span class="t"><span class="str"> """</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t428" href="#t428">428</a></span><span class="t"> <span class="nam">SCRIPT_NAME</span><span class="op">=</span><span class="nam">ctrl</span><span class="op">.</span><span class="nam">maintscript</span><span class="op">.</span><span class="nam">escape_shell_words</span><span class="op">(</span><span class="nam">script_name</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t429" href="#t429">429</a></span><span class="t"> <span class="nam">EMPTY_DPKG_ROOT_CONDITION</span><span class="op">=</span><span class="nam">EMPTY_DPKG_ROOT_CONDITION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t430" href="#t430">430</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t431" href="#t431">431</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t432" href="#t432">432</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t433" href="#t433">433</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t434" href="#t434">434</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t435" href="#t435">435</a></span><span class="t"><span class="key">def</span> <span class="nam">detect_sysv_init_service_files</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t436" href="#t436">436</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t437" href="#t437">437</a></span><span class="t"> <span class="nam">service_registry</span><span class="op">:</span> <span class="nam">ServiceRegistry</span><span class="op">[</span><span class="key">None</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t438" href="#t438">438</a></span><span class="t"> <span class="nam">_context</span><span class="op">:</span> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t439" href="#t439">439</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t440" href="#t440">440</a></span><span class="t"> <span class="nam">etc_init</span> <span class="op">=</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">lookup</span><span class="op">(</span><span class="str">"/etc/init.d"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t441" href="#t441">441</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">etc_init</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t442" href="#t442">442</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t443" href="#t443">443</a></span><span class="t"> <span class="key">for</span> <span class="nam">path</span> <span class="key">in</span> <span class="nam">etc_init</span><span class="op">.</span><span class="nam">iterdir</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t444" href="#t444">444</a></span><span class="t"> <span class="key">if</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_dir</span> <span class="key">or</span> <span class="key">not</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_executable</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t445" href="#t445">445</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t446" href="#t446">446</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t447" href="#t447">447</a></span><span class="t"> <span class="nam">service_registry</span><span class="op">.</span><span class="nam">register_service</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t448" href="#t448">448</a></span><span class="t"> <span class="nam">path</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t449" href="#t449">449</a></span><span class="t"> <span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t450" href="#t450">450</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_d5d6843b45eec01e_private_api_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_d5d6843b45eec01e_shlib_metadata_detectors_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_d5d6843b45eec01e_shlib_metadata_detectors_py.html b/coverage-report/d_d5d6843b45eec01e_shlib_metadata_detectors_py.html deleted file mode 100644 index eaefd35..0000000 --- a/coverage-report/d_d5d6843b45eec01e_shlib_metadata_detectors_py.html +++ /dev/null @@ -1,146 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/plugin/debputy/shlib_metadata_detectors.py: 100%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/plugin/debputy/shlib_metadata_detectors.py</b>: - <span class="pc_cov">100%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">17 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">17<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">0<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_d5d6843b45eec01e_service_management_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_d5d6843b45eec01e_strip_non_determinism_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">List</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span> <span class="key">import</span> <span class="nam">elf_util</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">elf_util</span> <span class="key">import</span> <span class="nam">ELF_LINKING_TYPE_DYNAMIC</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">impl</span> <span class="key">import</span> <span class="nam">BinaryCtrlAccessorProvider</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"><span class="nam">SKIPPED_DEBUG_DIRS</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="str">"lib"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="str">"lib64"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="str">"usr"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="str">"bin"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="str">"sbin"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="str">"opt"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="str">"dev"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="str">"emul"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="str">".build-id"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"><span class="nam">SKIP_DIRS</span> <span class="op">=</span> <span class="op">{</span><span class="str">f"./usr/lib/debug/{subdir}"</span> <span class="key">for</span> <span class="nam">subdir</span> <span class="key">in</span> <span class="nam">SKIPPED_DEBUG_DIRS</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"><span class="key">def</span> <span class="nam">_walk_filter</span><span class="op">(</span><span class="nam">fs_path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> <span class="nam">children</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="key">if</span> <span class="nam">fs_path</span><span class="op">.</span><span class="nam">path</span> <span class="key">in</span> <span class="nam">SKIP_DIRS</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="nam">children</span><span class="op">.</span><span class="nam">clear</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"><span class="key">def</span> <span class="nam">detect_shlibdeps</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">:</span> <span class="nam">BinaryCtrlAccessorProvider</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="nam">_context</span><span class="op">:</span> <span class="nam">PackageProcessingContext</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="nam">elf_files_to_process</span> <span class="op">=</span> <span class="nam">elf_util</span><span class="op">.</span><span class="nam">find_all_elf_files</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="nam">walk_filter</span><span class="op">=</span><span class="nam">_walk_filter</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="nam">with_linking_type</span><span class="op">=</span><span class="nam">ELF_LINKING_TYPE_DYNAMIC</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">elf_files_to_process</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="nam">ctrl</span><span class="op">.</span><span class="nam">dpkg_shlibdeps</span><span class="op">(</span><span class="nam">elf_files_to_process</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_d5d6843b45eec01e_service_management_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_d5d6843b45eec01e_strip_non_determinism_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_d5d6843b45eec01e_strip_non_determinism_py.html b/coverage-report/d_d5d6843b45eec01e_strip_non_determinism_py.html deleted file mode 100644 index e934d39..0000000 --- a/coverage-report/d_d5d6843b45eec01e_strip_non_determinism_py.html +++ /dev/null @@ -1,363 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/plugin/debputy/strip_non_determinism.py: 68%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/plugin/debputy/strip_non_determinism.py</b>: - <span class="pc_cov">68%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">109 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">78<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">31<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">1<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">9<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_d5d6843b45eec01e_shlib_metadata_detectors_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_d5d6843b45eec01e_types_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">dataclasses</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">re</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">import</span> <span class="nam">subprocess</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">from</span> <span class="nam">contextlib</span> <span class="key">import</span> <span class="nam">ExitStack</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">from</span> <span class="nam">enum</span> <span class="key">import</span> <span class="nam">IntEnum</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Iterator</span><span class="op">,</span> <span class="nam">Optional</span><span class="op">,</span> <span class="nam">List</span><span class="op">,</span> <span class="nam">Callable</span><span class="op">,</span> <span class="nam">Any</span><span class="op">,</span> <span class="nam">Tuple</span><span class="op">,</span> <span class="nam">Union</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span> <span class="key">import</span> <span class="nam">VirtualPath</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">plugin</span><span class="op">.</span><span class="nam">api</span><span class="op">.</span><span class="nam">impl_types</span> <span class="key">import</span> <span class="nam">PackageProcessingContextProvider</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">util</span> <span class="key">import</span> <span class="nam">xargs</span><span class="op">,</span> <span class="nam">_info</span><span class="op">,</span> <span class="nam">escape_shell</span><span class="op">,</span> <span class="nam">_error</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"><span class="key">class</span> <span class="nam">DetectionVerdict</span><span class="op">(</span><span class="nam">IntEnum</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">NOT_RELEVANT</span> <span class="op">=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">NEEDS_FILE_OUTPUT</span> <span class="op">=</span> <span class="num">2</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">PROCESS</span> <span class="op">=</span> <span class="num">3</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"><span class="key">def</span> <span class="nam">_file_starts_with</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">sequences</span><span class="op">:</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">bytes</span><span class="op">,</span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">bytes</span><span class="op">,</span> <span class="op">...</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span><span class="op">,</span> <span class="nam">bool</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">sequences</span><span class="op">,</span> <span class="nam">bytes</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">longest_sequence</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">sequences</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="nam">sequences</span> <span class="op">=</span> <span class="op">(</span><span class="nam">sequences</span><span class="op">,</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="nam">longest_sequence</span> <span class="op">=</span> <span class="nam">max</span><span class="op">(</span><span class="nam">len</span><span class="op">(</span><span class="nam">s</span><span class="op">)</span> <span class="key">for</span> <span class="nam">s</span> <span class="key">in</span> <span class="nam">sequences</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="key">def</span> <span class="nam">_checker</span><span class="op">(</span><span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="key">with</span> <span class="nam">path</span><span class="op">.</span><span class="nam">open</span><span class="op">(</span><span class="nam">byte_io</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">buffering</span><span class="op">=</span><span class="num">4096</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="nam">buffer</span> <span class="op">=</span> <span class="nam">fd</span><span class="op">.</span><span class="nam">read</span><span class="op">(</span><span class="nam">longest_sequence</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="key">return</span> <span class="nam">buffer</span> <span class="key">in</span> <span class="nam">sequences</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="key">return</span> <span class="nam">_checker</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="key">def</span> <span class="nam">_is_javadoc_file</span><span class="op">(</span><span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="key">with</span> <span class="nam">path</span><span class="op">.</span><span class="nam">open</span><span class="op">(</span><span class="nam">buffering</span><span class="op">=</span><span class="num">4096</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">c</span> <span class="op">=</span> <span class="nam">fd</span><span class="op">.</span><span class="nam">read</span><span class="op">(</span><span class="num">1024</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="key">return</span> <span class="str">"<!-- Generated by javadoc"</span> <span class="key">in</span> <span class="nam">c</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"><span class="key">class</span> <span class="nam">SndDetectionRule</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="key">def</span> <span class="nam">initial_verdict</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">)</span> <span class="op">-></span> <span class="nam">DetectionVerdict</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="key">def</span> <span class="nam">file_output_verdict</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="nam">file_analysis</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TypeError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="str">"Should not have been called or the rule forgot to implement this method"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"><span class="key">class</span> <span class="nam">ExtensionPlusFileOutputRule</span><span class="op">(</span><span class="nam">SndDetectionRule</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="nam">extensions</span><span class="op">:</span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="op">...</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="nam">file_pattern</span><span class="op">:</span> <span class="nam">Optional</span><span class="op">[</span><span class="nam">re</span><span class="op">.</span><span class="nam">Pattern</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">]</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="key">def</span> <span class="nam">initial_verdict</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">)</span> <span class="op">-></span> <span class="nam">DetectionVerdict</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="nam">_</span><span class="op">,</span> <span class="nam">ext</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">splitext</span><span class="op">(</span><span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="key">if</span> <span class="nam">ext</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">extensions</span><span class="op">:</span> </span><span class="r"><span class="annotate short">64 ↛ 66</span><span class="annotate long">line 64 didn't jump to line 66, because the condition on line 64 was never false</span></span></p> - <p class="run"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="key">return</span> <span class="nam">DetectionVerdict</span><span class="op">.</span><span class="nam">NOT_RELEVANT</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">file_pattern</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="key">return</span> <span class="nam">DetectionVerdict</span><span class="op">.</span><span class="nam">PROCESS</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="key">return</span> <span class="nam">DetectionVerdict</span><span class="op">.</span><span class="nam">NEEDS_FILE_OUTPUT</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="key">def</span> <span class="nam">file_output_verdict</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="nam">file_analysis</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="nam">file_pattern</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">file_pattern</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="key">assert</span> <span class="nam">file_pattern</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="nam">m</span> <span class="op">=</span> <span class="nam">file_pattern</span><span class="op">.</span><span class="nam">search</span><span class="op">(</span><span class="nam">file_analysis</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="key">return</span> <span class="nam">m</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"><span class="key">class</span> <span class="nam">ExtensionPlusContentCheck</span><span class="op">(</span><span class="nam">SndDetectionRule</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="nam">extensions</span><span class="op">:</span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="op">...</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="nam">content_check</span><span class="op">:</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span><span class="op">,</span> <span class="nam">bool</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="key">def</span> <span class="nam">initial_verdict</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">)</span> <span class="op">-></span> <span class="nam">DetectionVerdict</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="nam">_</span><span class="op">,</span> <span class="nam">ext</span> <span class="op">=</span> <span class="nam">os</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">splitext</span><span class="op">(</span><span class="nam">path</span><span class="op">.</span><span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="key">if</span> <span class="nam">ext</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">extensions</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="key">return</span> <span class="nam">DetectionVerdict</span><span class="op">.</span><span class="nam">NOT_RELEVANT</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="nam">content_verdict</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">content_check</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="key">if</span> <span class="nam">content_verdict</span><span class="op">:</span> </span><span class="r"><span class="annotate short">91 ↛ 92</span><span class="annotate long">line 91 didn't jump to line 92, because the condition on line 91 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="key">return</span> <span class="nam">DetectionVerdict</span><span class="op">.</span><span class="nam">PROCESS</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="key">return</span> <span class="nam">DetectionVerdict</span><span class="op">.</span><span class="nam">NOT_RELEVANT</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"><span class="key">class</span> <span class="nam">PyzipFileCheck</span><span class="op">(</span><span class="nam">SndDetectionRule</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="key">def</span> <span class="nam">_is_pyzip_file</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">)</span> <span class="op">-></span> <span class="nam">bool</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="key">with</span> <span class="nam">path</span><span class="op">.</span><span class="nam">open</span><span class="op">(</span><span class="nam">byte_io</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">buffering</span><span class="op">=</span><span class="num">4096</span><span class="op">)</span> <span class="key">as</span> <span class="nam">fd</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="nam">c</span> <span class="op">=</span> <span class="nam">fd</span><span class="op">.</span><span class="nam">read</span><span class="op">(</span><span class="num">32</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">c</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">b"#!"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">100 ↛ 103</span><span class="annotate long">line 100 didn't jump to line 103, because the condition on line 100 was never false</span></span></p> - <p class="run"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="key">return</span> <span class="str">b"\nPK\x03\x04"</span> <span class="key">in</span> <span class="nam">c</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="key">def</span> <span class="nam">initial_verdict</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">path</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">)</span> <span class="op">-></span> <span class="nam">DetectionVerdict</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_is_pyzip_file</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">106 ↛ 107</span><span class="annotate long">line 106 didn't jump to line 107, because the condition on line 106 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="key">return</span> <span class="nam">DetectionVerdict</span><span class="op">.</span><span class="nam">PROCESS</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="key">return</span> <span class="nam">DetectionVerdict</span><span class="op">.</span><span class="nam">NOT_RELEVANT</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"><span class="com"># These detection rules should be aligned with `get_normalizer_for_file` in File::StripNondeterminism.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"><span class="com"># Note if we send a file too much, it is just bad for performance. If we send a file to little, we</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"><span class="com"># risk non-determinism in the final output.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"><span class="nam">SND_DETECTION_RULES</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">SndDetectionRule</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="nam">ExtensionPlusContentCheck</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="nam">extensions</span><span class="op">=</span><span class="op">(</span><span class="str">".a"</span><span class="op">,</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="nam">content_check</span><span class="op">=</span><span class="nam">_file_starts_with</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="str">b"!<arch>\n"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="str">b"!<thin>\n"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="nam">ExtensionPlusContentCheck</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="nam">extensions</span><span class="op">=</span><span class="op">(</span><span class="str">".png"</span><span class="op">,</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="nam">content_check</span><span class="op">=</span><span class="nam">_file_starts_with</span><span class="op">(</span><span class="str">b"\x89PNG\x0D\x0A\x1A\x0A"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="nam">ExtensionPlusContentCheck</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="nam">extensions</span><span class="op">=</span><span class="op">(</span><span class="str">".gz"</span><span class="op">,</span> <span class="str">".dz"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="nam">content_check</span><span class="op">=</span><span class="nam">_file_starts_with</span><span class="op">(</span><span class="str">b"\x1F\x8B"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="nam">ExtensionPlusContentCheck</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="nam">extensions</span><span class="op">=</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="com"># .zip related</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="str">".zip"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="str">".pk3"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="str">".epub"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="str">".whl"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="str">".xpi"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="str">".htb"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="str">".zhfst"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="str">".par"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="str">".codadef"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="com"># .jar related</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="str">".jar"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="str">".war"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="str">".hpi"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="str">".apk"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="str">".sym"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="nam">content_check</span><span class="op">=</span><span class="nam">_file_starts_with</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="str">b"PK\x03\x04\x1F"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="str">b"PK\x05\x06"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="str">b"PK\x07\x08"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="nam">ExtensionPlusContentCheck</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="nam">extensions</span><span class="op">=</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="str">".mo"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="str">".gmo"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="nam">content_check</span><span class="op">=</span><span class="nam">_file_starts_with</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="str">b"\x95\x04\x12\xde"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="str">b"\xde\x12\x04\x95"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="nam">ExtensionPlusContentCheck</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="nam">extensions</span><span class="op">=</span><span class="op">(</span><span class="str">".uimage"</span><span class="op">,</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">content_check</span><span class="op">=</span><span class="nam">_file_starts_with</span><span class="op">(</span><span class="str">b"\x27\x05\x19\x56"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="nam">ExtensionPlusContentCheck</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="nam">extensions</span><span class="op">=</span><span class="op">(</span><span class="str">".bflt"</span><span class="op">,</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="nam">content_check</span><span class="op">=</span><span class="nam">_file_starts_with</span><span class="op">(</span><span class="str">b"\x62\x46\x4C\x54"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="nam">ExtensionPlusContentCheck</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="nam">extensions</span><span class="op">=</span><span class="op">(</span><span class="str">".jmod"</span><span class="op">,</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="nam">content_check</span><span class="op">=</span><span class="nam">_file_starts_with</span><span class="op">(</span><span class="str">b"JM"</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="nam">ExtensionPlusContentCheck</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="nam">extensions</span><span class="op">=</span><span class="op">(</span><span class="str">".html"</span><span class="op">,</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="nam">content_check</span><span class="op">=</span><span class="nam">_is_javadoc_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="nam">PyzipFileCheck</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="nam">ExtensionPlusFileOutputRule</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="nam">extensions</span><span class="op">=</span><span class="op">(</span><span class="str">".cpio"</span><span class="op">,</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="com"># XXX: Add file output check (requires the file output support)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"><span class="key">def</span> <span class="nam">_detect_paths_with_possible_non_determinism</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="nam">needs_file_output</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="key">for</span> <span class="nam">path</span> <span class="key">in</span> <span class="nam">fs_root</span><span class="op">.</span><span class="nam">all_paths</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">path</span><span class="op">.</span><span class="nam">is_file</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="nam">verdict</span> <span class="op">=</span> <span class="nam">DetectionVerdict</span><span class="op">.</span><span class="nam">NOT_RELEVANT</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="nam">needs_file_output_rules</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="key">for</span> <span class="nam">rule</span> <span class="key">in</span> <span class="nam">SND_DETECTION_RULES</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="nam">v</span> <span class="op">=</span> <span class="nam">rule</span><span class="op">.</span><span class="nam">initial_verdict</span><span class="op">(</span><span class="nam">path</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="key">if</span> <span class="nam">v</span> <span class="op">></span> <span class="nam">verdict</span><span class="op">:</span> </span><span class="r"><span class="annotate short">206 ↛ 207</span><span class="annotate long">line 206 didn't jump to line 207, because the condition on line 206 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="nam">verdict</span> <span class="op">=</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="key">if</span> <span class="nam">verdict</span> <span class="op">==</span> <span class="nam">DetectionVerdict</span><span class="op">.</span><span class="nam">PROCESS</span><span class="op">:</span> </span><span class="r"><span class="annotate short">208 ↛ 209</span><span class="annotate long">line 208 didn't jump to line 209, because the condition on line 208 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="key">yield</span> <span class="nam">path</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="key">elif</span> <span class="nam">verdict</span> <span class="op">==</span> <span class="nam">DetectionVerdict</span><span class="op">.</span><span class="nam">NEEDS_FILE_OUTPUT</span><span class="op">:</span> </span><span class="r"><span class="annotate short">211 ↛ 212</span><span class="annotate long">line 211 didn't jump to line 212, because the condition on line 211 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="nam">needs_file_output_rules</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">rule</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="key">if</span> <span class="nam">verdict</span> <span class="op">==</span> <span class="nam">DetectionVerdict</span><span class="op">.</span><span class="nam">NEEDS_FILE_OUTPUT</span><span class="op">:</span> </span><span class="r"><span class="annotate short">214 ↛ 215</span><span class="annotate long">line 214 didn't jump to line 215, because the condition on line 214 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="nam">needs_file_output</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="op">(</span><span class="nam">path</span><span class="op">,</span> <span class="nam">needs_file_output_rules</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="key">assert</span> <span class="key">not</span> <span class="nam">needs_file_output</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="com"># FIXME: Implement file check</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"><span class="key">def</span> <span class="nam">_apply_strip_non_determinism</span><span class="op">(</span><span class="nam">timestamp</span><span class="op">:</span> <span class="nam">str</span><span class="op">,</span> <span class="nam">paths</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">VirtualPath</span><span class="op">]</span><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="nam">static_cmd</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="str">"strip-nondeterminism"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="str">f"--timestamp={timestamp}"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="str">"-v"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="str">"--normalizers=+all"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="key">with</span> <span class="nam">ExitStack</span><span class="op">(</span><span class="op">)</span> <span class="key">as</span> <span class="nam">manager</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="nam">affected_files</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="nam">manager</span><span class="op">.</span><span class="nam">enter_context</span><span class="op">(</span><span class="nam">p</span><span class="op">.</span><span class="nam">replace_fs_path_content</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">paths</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="key">for</span> <span class="nam">cmd</span> <span class="key">in</span> <span class="nam">xargs</span><span class="op">(</span><span class="nam">static_cmd</span><span class="op">,</span> <span class="nam">affected_files</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="str">f"Removing (possible) unnecessary non-deterministic content via: {escape_shell(*cmd)}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">check_call</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="nam">cmd</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="nam">stdin</span><span class="op">=</span><span class="nam">subprocess</span><span class="op">.</span><span class="nam">DEVNULL</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="nam">restore_signals</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="key">except</span> <span class="nam">subprocess</span><span class="op">.</span><span class="nam">CalledProcessError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="nam">_error</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="str">"Attempting to remove unnecessary non-deterministic content failed. Please review"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="str">" the error from strip-nondeterminism above understand what went wrong."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"><span class="key">def</span> <span class="nam">strip_non_determinism</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="nam">fs_root</span><span class="op">:</span> <span class="nam">VirtualPath</span><span class="op">,</span> <span class="nam">_</span><span class="op">:</span> <span class="nam">Any</span><span class="op">,</span> <span class="nam">context</span><span class="op">:</span> <span class="nam">PackageProcessingContextProvider</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"><span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="nam">paths</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">_detect_paths_with_possible_non_determinism</span><span class="op">(</span><span class="nam">fs_root</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">paths</span><span class="op">:</span> </span><span class="r"><span class="annotate short">254 ↛ 258</span><span class="annotate long">line 254 didn't jump to line 258, because the condition on line 254 was never false</span></span></p> - <p class="run"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="nam">_info</span><span class="op">(</span><span class="str">"Detected no paths to be processed by strip-nondeterminism"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="nam">substitution</span> <span class="op">=</span> <span class="nam">context</span><span class="op">.</span><span class="nam">_manifest</span><span class="op">.</span><span class="nam">substitution</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="nam">source_date_epoch</span> <span class="op">=</span> <span class="nam">substitution</span><span class="op">.</span><span class="nam">substitute</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="str">"{{_DEBPUTY_SND_SOURCE_DATE_EPOCH}}"</span><span class="op">,</span> <span class="str">"Internal; strip-nondeterminism"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="nam">_apply_strip_non_determinism</span><span class="op">(</span><span class="nam">source_date_epoch</span><span class="op">,</span> <span class="nam">paths</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_d5d6843b45eec01e_shlib_metadata_detectors_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_d5d6843b45eec01e_types_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_d5d6843b45eec01e_types_py.html b/coverage-report/d_d5d6843b45eec01e_types_py.html deleted file mode 100644 index c4198b9..0000000 --- a/coverage-report/d_d5d6843b45eec01e_types_py.html +++ /dev/null @@ -1,109 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/plugin/debputy/types.py: 100%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/plugin/debputy/types.py</b>: - <span class="pc_cov">100%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">7 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">7<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">0<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_d5d6843b45eec01e_strip_non_determinism_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_substitution_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">dataclasses</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">manifest_parser</span><span class="op">.</span><span class="nam">base_types</span> <span class="key">import</span> <span class="nam">FileSystemMode</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">slots</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">class</span> <span class="nam">DebputyCapability</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">capabilities</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">capability_mode</span><span class="op">:</span> <span class="nam">FileSystemMode</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">definition_source</span><span class="op">:</span> <span class="nam">str</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_d5d6843b45eec01e_strip_non_determinism_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_substitution_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_e9c451f4ae334f76___init___py.html b/coverage-report/d_e9c451f4ae334f76___init___py.html deleted file mode 100644 index 8183ffa..0000000 --- a/coverage-report/d_e9c451f4ae334f76___init___py.html +++ /dev/null @@ -1,290 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/lsp/vendoring/_deb822_repro/__init__.py: 100%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/lsp/vendoring/_deb822_repro/__init__.py</b>: - <span class="pc_cov">100%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">3 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">3<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">0<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">1<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_50e3cc0df0cc5f51___init___py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_e9c451f4ae334f76__util_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="pln"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="com"># The "from X import Y as Y" looks weird, but we are stuck in a fight</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="com"># between mypy and pylint in the CI.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="com"># mypy --strict insists on either of following for re-exporting</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="com"># 1) Do a "from debian._deb822_repro.X import *"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="com"># 2) Do a "from .X import Y"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="com"># 3) Do a "from debian._deb822_repro.X import Y as Z"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="com"># pylint on the CI fails on relative imports (it assumes "lib" is a</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"><span class="com"># part of the python package name in relative imports). This rules</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"><span class="com"># out 2) from the mypy list. The use of 1) would cause overlapping</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="com"># imports (and also it felt prudent to import only what was exported).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"><span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"><span class="com"># This left 3) as the only option for now, which pylint then complains</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"><span class="com"># about (not unreasonably in general). Unfortunately, we can disable</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"><span class="com"># that warning in this work around. But once 2) becomes an option</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"><span class="com"># without pylint tripping over itself on the CI, then it considerably</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"><span class="com"># better than this approach.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"><span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"><span class="str">""" Round-trip safe dictionary-like interfaces to RFC822-like files</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"><span class="str">This module is a round-trip safe API for working with RFC822-like Debian data</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"><span class="str">formats. It is primarily aimed files managed by humans, like debian/control.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"><span class="str">While it is be able to process any Deb822 file, you might find the debian.deb822</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"><span class="str">module better suited for larger files such as the `Packages` and `Sources`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"><span class="str">from the Debian archive due to reasons explained below.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"><span class="str">Being round-trip safe means that this module will faithfully preserve the original</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"><span class="str">formatting including whitespace and comments from the input where not modified.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"><span class="str">A concrete example::</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"><span class="str"> >>> from debian._deb822_repro import parse_deb822_file</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"><span class="str"> >>> example_deb822_paragraph = '''</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"><span class="str"> ... Package: foo</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"><span class="str"> ... # Field comment (because it becomes just before a field)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="str"> ... Section: main/devel</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"><span class="str"> ... Depends: libfoo,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"><span class="str"> ... # Inline comment (associated with the next line)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"><span class="str"> ... libbar,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"><span class="str"> ... '''</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"><span class="str"> >>> deb822_file = parse_deb822_file(example_deb822_paragraph.splitlines())</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"><span class="str"> >>> paragraph = next(iter(deb822_file))</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"><span class="str"> >>> paragraph['Section'] = 'devel'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"><span class="str"> >>> output = deb822_file.dump()</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"><span class="str"> >>> output == example_deb822_paragraph.replace('Section: main/devel', 'Section: devel')</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"><span class="str"> True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"><span class="str">This makes it particularly good for automated changes/corrections to files (partly)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"><span class="str">maintained by humans.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"><span class="str">Compared to debian.deb822</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"><span class="str">-------------------------</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"><span class="str">The round-trip safe API is primarily useful when your program is editing files</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"><span class="str">and the file in question is (likely) to be hand-edited or formatted directly by</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"><span class="str">human maintainers. This includes files like debian/control and the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"><span class="str">debian/copyright using the "DEP-5" format.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"><span class="str">The round-trip safe API also supports parsing and working with invalid files.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"><span class="str">This enables programs to work on the file in cases where the file was a left</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"><span class="str">with an error in an attempt to correct it (or ignore it).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"><span class="str">On the flip side, the debian.deb822 module generally uses less memory than the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"><span class="str">round trip safe API. In some cases, it will also have faster data structures</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"><span class="str">because its internal data structures are simpler. Accordingly, when you are doing</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"><span class="str">read-only work or/and working with large files a la the Packages or Sources</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"><span class="str">files from the Debian archive, then the round-trip safe API either provides no</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"><span class="str">advantages or its trade-offs might show up in performance statistics.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"><span class="str">The memory and runtime performance difference should generally be constant for</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"><span class="str">valid files but not necessarily a small one. For invalid files, some operations</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"><span class="str">can degrade in runtime performance in particular cases (memory performance for</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"><span class="str">invalid files are comparable to that of valid files).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"><span class="str">Converting from debian.deb822</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"><span class="str">=============================</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"><span class="str">The following is a short example for how to migrate from debian.deb822 to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"><span class="str">the round-trip safe API. Given the following source text::</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"><span class="str"> >>> dctrl_input = b'''</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"><span class="str"> ... Source: foo</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"><span class="str"> ... Build-Depends: debhelper-compat (= 13)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"><span class="str"> ...</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"><span class="str"> ... Package: bar</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"><span class="str"> ... Architecture: any</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"><span class="str"> ... Depends: ${misc:Depends},</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"><span class="str"> ... ${shlibs:Depends},</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"><span class="str"> ... Description: provides some exciting feature</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"><span class="str"> ... yada yada yada</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"><span class="str"> ... .</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"><span class="str"> ... more deskription with a misspelling</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"><span class="str"> ... '''.lstrip() # To remove the leading newline</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"><span class="str"> >>> # A few definitions to emulate file I/O (would be different in the program)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"><span class="str"> >>> import contextlib, os</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"><span class="str"> >>> @contextlib.contextmanager</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"><span class="str"> ... def open_input():</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"><span class="str"> ... # Works with and without keepends=True.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"><span class="str"> ... # Keep the ends here to truly emulate an open file.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"><span class="str"> ... yield dctrl_input.splitlines(keepends=True)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"><span class="str"> >>> def open_output():</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"><span class="str"> ... return open(os.devnull, 'wb')</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"><span class="str">With debian.deb822, your code might look like this::</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"><span class="str"> >>> from debian.deb822 import Deb822</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"><span class="str"> >>> with open_input() as in_fd, open_output() as out_fd:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"><span class="str"> ... for paragraph in Deb822.iter_paragraphs(in_fd):</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"><span class="str"> ... if 'Description' not in paragraph:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"><span class="str"> ... continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"><span class="str"> ... description = paragraph['Description']</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"><span class="str"> ... # Fix typo</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"><span class="str"> ... paragraph['Description'] = description.replace('deskription', 'description')</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"><span class="str"> ... paragraph.dump(out_fd)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"><span class="str">With the round-trip safe API, the rewrite would look like this::</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"><span class="str"> >>> from debian._deb822_repro import parse_deb822_file</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"><span class="str"> >>> with open_input() as in_fd, open_output() as out_fd:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"><span class="str"> ... parsed_file = parse_deb822_file(in_fd)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"><span class="str"> ... for paragraph in parsed_file:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"><span class="str"> ... if 'Description' not in paragraph:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"><span class="str"> ... continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"><span class="str"> ... description = paragraph['Description']</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"><span class="str"> ... # Fix typo</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"><span class="str"> ... paragraph['Description'] = description.replace('deskription', 'description')</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"><span class="str"> ... parsed_file.dump(out_fd)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"><span class="str">Key changes are:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"><span class="str"> 1. Imports are different.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"><span class="str"> 2. Deb822.iter_paragraphs is replaced by parse_deb822_file and a reference to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"><span class="str"> its return value is kept for later.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"><span class="str"> 3. Instead of dumping paragraphs one by one, the return value from</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"><span class="str"> parse_deb822_file is dumped at the end.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"><span class="str"> - The round-trip safe api does support "per-paragraph" but formatting</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"><span class="str"> and comments between paragraphs would be lost in the output. This may</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"><span class="str"> be an acceptable tradeoff or desired for some cases.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"><span class="str">Note that the round trip safe API does not accept all the same parameters as the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"><span class="str">debian.deb822 module does. Often this is because the feature is not relevant for</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"><span class="str">the round-trip safe API (e.g., python-apt cannot be used as it discard comments)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"><span class="str">or is obsolete in the debian.deb822 module and therefore omitted.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"><span class="str">For list based fields, you may want to have a look at the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"><span class="str">Deb822ParagraphElement.as_interpreted_dict_view method.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"><span class="str">Stability of this API</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"><span class="str">---------------------</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"><span class="str">The API is subject to change based on feedback from early adopters and beta</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"><span class="str">testers. That said, the code for valid files is unlikely to change in</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"><span class="str">a backwards incompatible way.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"><span class="str">Things that might change in an incompatible way include:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"><span class="str"> * Whether invalid files are accepted (parsed without errors) by default.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"><span class="str"> (currently they are)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"><span class="str"> * How invalid files are parsed. As an example, currently a syntax error acts</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"><span class="str"> as a paragraph separator. Whether it should is open to debate.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"><span class="str">"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"><span class="com"># pylint: disable=useless-import-alias</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">parsing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="nam">parse_deb822_file</span> <span class="key">as</span> <span class="nam">parse_deb822_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="nam">LIST_SPACE_SEPARATED_INTERPRETATION</span> <span class="key">as</span> <span class="nam">LIST_SPACE_SEPARATED_INTERPRETATION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="nam">LIST_COMMA_SEPARATED_INTERPRETATION</span> <span class="key">as</span> <span class="nam">LIST_COMMA_SEPARATED_INTERPRETATION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="nam">Interpretation</span> <span class="key">as</span> <span class="nam">Interpretation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="com"># Primarily for documentation purposes / help()</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="nam">Deb822FileElement</span> <span class="key">as</span> <span class="nam">Deb822FileElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">Deb822NoDuplicateFieldsParagraphElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="nam">Deb822ParagraphElement</span> <span class="key">as</span> <span class="nam">Deb822ParagraphElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">types</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="nam">AmbiguousDeb822FieldKeyError</span> <span class="key">as</span> <span class="nam">AmbiguousDeb822FieldKeyError</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="nam">SyntaxOrParseError</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"><span class="nam">__all__</span> <span class="op">=</span> <span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="str">"parse_deb822_file"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="str">"AmbiguousDeb822FieldKeyError"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="str">"LIST_SPACE_SEPARATED_INTERPRETATION"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="str">"LIST_COMMA_SEPARATED_INTERPRETATION"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="str">"Interpretation"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="str">"Deb822FileElement"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="str">"Deb822NoDuplicateFieldsParagraphElement"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="str">"Deb822ParagraphElement"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> <span class="str">"SyntaxOrParseError"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"><span class="op">]</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_50e3cc0df0cc5f51___init___py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_e9c451f4ae334f76__util_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_e9c451f4ae334f76__util_py.html b/coverage-report/d_e9c451f4ae334f76__util_py.html deleted file mode 100644 index c0a0706..0000000 --- a/coverage-report/d_e9c451f4ae334f76__util_py.html +++ /dev/null @@ -1,390 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/lsp/vendoring/_deb822_repro/_util.py: 57%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/lsp/vendoring/_deb822_repro/_util.py</b>: - <span class="pc_cov">57%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">154 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">92<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">62<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">3<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">5<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_e9c451f4ae334f76___init___py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_e9c451f4ae334f76_formatter_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">collections</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">collections</span><span class="op">.</span><span class="nam">abc</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">logging</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">import</span> <span class="nam">sys</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">import</span> <span class="nam">textwrap</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">from</span> <span class="nam">abc</span> <span class="key">import</span> <span class="nam">ABC</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">Iterable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">Callable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">TYPE_CHECKING</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">Iterator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="nam">Type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">cast</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">List</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">Generic</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="key">from</span> <span class="nam">debian</span><span class="op">.</span><span class="nam">_util</span> <span class="key">import</span> <span class="nam">T</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="key">from</span> <span class="op">.</span><span class="nam">types</span> <span class="key">import</span> <span class="nam">TE</span><span class="op">,</span> <span class="nam">R</span><span class="op">,</span> <span class="nam">TokenOrElement</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">_combine_parts_ret_type</span> <span class="op">=</span> <span class="nam">Callable</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="op">[</span><span class="nam">Iterable</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">TokenOrElement</span><span class="op">,</span> <span class="nam">TE</span><span class="op">]</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="nam">TokenOrElement</span><span class="op">,</span> <span class="nam">R</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"><span class="key">except</span> <span class="nam">ImportError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="com"># pylint: disable=unnecessary-lambda-assignment</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="nam">TYPE_CHECKING</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="nam">cast</span> <span class="op">=</span> <span class="key">lambda</span> <span class="nam">t</span><span class="op">,</span> <span class="nam">v</span><span class="op">:</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"><span class="key">if</span> <span class="nam">TYPE_CHECKING</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="key">from</span> <span class="op">.</span><span class="nam">parsing</span> <span class="key">import</span> <span class="nam">Deb822Element</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="key">from</span> <span class="op">.</span><span class="nam">tokens</span> <span class="key">import</span> <span class="nam">Deb822Token</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"><span class="key">def</span> <span class="nam">print_ast</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">ast_tree</span><span class="op">,</span> <span class="com"># type: Union[Iterable[TokenOrElement], 'Deb822Element']</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="nam">end_marker_after</span><span class="op">=</span><span class="num">5</span><span class="op">,</span> <span class="com"># type: Optional[int]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">output_function</span><span class="op">=</span><span class="key">None</span> <span class="com"># type: Optional[Callable[[str], None]]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="com"># type: (...) -> None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="str">"""Debugging aid, which can dump a Deb822Element or a list of tokens/elements</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"><span class="str"> :param ast_tree: Either a Deb822Element or an iterable Deb822Token/Deb822Element entries</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"><span class="str"> (both types may be mixed in the same iterable, which enable it to dump the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"><span class="str"> ast tree at different stages of parse_deb822_file method)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"><span class="str"> :param end_marker_after: The dump will add "end of element" markers if a</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"><span class="str"> given element spans at least this many tokens/elements. Can be disabled</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"><span class="str"> with by passing None as value. Use 0 for unconditionally marking all</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"><span class="str"> elements (note that tokens never get an "end of element" marker as they</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"><span class="str"> are not an elements).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"><span class="str"> :param output_function: Callable that receives a single str argument and is responsible</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"><span class="str"> for "displaying" that line. The callable may be invoked multiple times (one per line</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"><span class="str"> of output). Defaults to logging.info if omitted.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="com"># Avoid circular dependency</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="com"># pylint: disable=import-outside-toplevel</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="key">from</span> <span class="nam">debian</span><span class="op">.</span><span class="nam">_deb822_repro</span><span class="op">.</span><span class="nam">parsing</span> <span class="key">import</span> <span class="nam">Deb822Element</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="nam">prefix</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">ast_tree</span><span class="op">,</span> <span class="nam">Deb822Element</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="nam">ast_tree</span> <span class="op">=</span> <span class="op">[</span><span class="nam">ast_tree</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="nam">stack</span> <span class="op">=</span> <span class="op">[</span><span class="op">(</span><span class="num">0</span><span class="op">,</span> <span class="str">""</span><span class="op">,</span> <span class="nam">iter</span><span class="op">(</span><span class="nam">ast_tree</span><span class="op">)</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="nam">current_no</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="key">if</span> <span class="nam">output_function</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="nam">output_function</span> <span class="op">=</span> <span class="nam">logging</span><span class="op">.</span><span class="nam">info</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="key">while</span> <span class="nam">stack</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="nam">start_no</span><span class="op">,</span> <span class="nam">name</span><span class="op">,</span> <span class="nam">current_iter</span> <span class="op">=</span> <span class="nam">stack</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="key">for</span> <span class="nam">current</span> <span class="key">in</span> <span class="nam">current_iter</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="nam">current_no</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="key">if</span> <span class="nam">prefix</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="nam">prefix</span> <span class="op">=</span> <span class="str">" "</span> <span class="op">*</span> <span class="nam">len</span><span class="op">(</span><span class="nam">stack</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">current</span><span class="op">,</span> <span class="nam">Deb822Element</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="nam">stack</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="op">(</span><span class="nam">current_no</span><span class="op">,</span> <span class="nam">current</span><span class="op">.</span><span class="nam">__class__</span><span class="op">.</span><span class="nam">__name__</span><span class="op">,</span> <span class="nam">iter</span><span class="op">(</span><span class="nam">current</span><span class="op">.</span><span class="nam">iter_parts</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="nam">output_function</span><span class="op">(</span><span class="nam">prefix</span> <span class="op">+</span> <span class="nam">current</span><span class="op">.</span><span class="nam">__class__</span><span class="op">.</span><span class="nam">__name__</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="nam">prefix</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="nam">output_function</span><span class="op">(</span><span class="nam">prefix</span> <span class="op">+</span> <span class="nam">str</span><span class="op">(</span><span class="nam">current</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="com"># current_iter is depleted</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="nam">stack</span><span class="op">.</span><span class="nam">pop</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="nam">prefix</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="nam">end_marker_after</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="key">and</span> <span class="nam">start_no</span> <span class="op">+</span> <span class="nam">end_marker_after</span> <span class="op"><=</span> <span class="nam">current_no</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="key">and</span> <span class="nam">name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"> <span class="key">if</span> <span class="nam">prefix</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="nam">prefix</span> <span class="op">=</span> <span class="str">" "</span> <span class="op">*</span> <span class="nam">len</span><span class="op">(</span><span class="nam">stack</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="nam">output_function</span><span class="op">(</span><span class="nam">prefix</span> <span class="op">+</span> <span class="str">"# <-- END OF "</span> <span class="op">+</span> <span class="nam">name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"><span class="key">def</span> <span class="nam">combine_into_replacement</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="nam">source_class</span><span class="op">,</span> <span class="com"># type: Type[TE]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> <span class="nam">replacement_class</span><span class="op">,</span> <span class="com"># type: Type[R]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="nam">constructor</span><span class="op">=</span><span class="key">None</span> <span class="com"># type: Optional[Callable[[List[TE]], R]]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="com"># type: (...) -> _combine_parts_ret_type[TE, R]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="str">"""Combines runs of one type into another type</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"><span class="str"> This is primarily useful for transforming tokens (e.g, Comment tokens) into</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"><span class="str"> the relevant element (such as the Comment element).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="key">if</span> <span class="nam">constructor</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="nam">_constructor</span> <span class="op">=</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"Callable[[List[TE]], R]"</span><span class="op">,</span> <span class="nam">replacement_class</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> <span class="com"># Force mypy to see that constructor is no longer optional</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="nam">_constructor</span> <span class="op">=</span> <span class="nam">constructor</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="key">def</span> <span class="nam">_impl</span><span class="op">(</span><span class="nam">token_stream</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="com"># type: (Iterable[Union[TokenOrElement, TE]]) -> Iterable[Union[TokenOrElement, R]]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="nam">tokens</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="key">for</span> <span class="nam">token</span> <span class="key">in</span> <span class="nam">token_stream</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">token</span><span class="op">,</span> <span class="nam">source_class</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="nam">tokens</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">token</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="key">if</span> <span class="nam">tokens</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="key">yield</span> <span class="nam">_constructor</span><span class="op">(</span><span class="nam">list</span><span class="op">(</span><span class="nam">tokens</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="nam">tokens</span><span class="op">.</span><span class="nam">clear</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="key">yield</span> <span class="nam">token</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="key">if</span> <span class="nam">tokens</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="key">yield</span> <span class="nam">_constructor</span><span class="op">(</span><span class="nam">tokens</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="key">return</span> <span class="nam">_impl</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"><span class="key">if</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">version_info</span> <span class="op">>=</span> <span class="op">(</span><span class="num">3</span><span class="op">,</span> <span class="num">9</span><span class="op">)</span> <span class="key">or</span> <span class="nam">TYPE_CHECKING</span><span class="op">:</span> </span><span class="r"><span class="annotate short">136 ↛ 141</span><span class="annotate long">line 136 didn't jump to line 141, because the condition on line 136 was never false</span></span></p> - <p class="run"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="nam">_bufferingIterator_Base</span> <span class="op">=</span> <span class="nam">collections</span><span class="op">.</span><span class="nam">abc</span><span class="op">.</span><span class="nam">Iterator</span><span class="op">[</span><span class="nam">T</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"><span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="com"># Python 3.5 - 3.8 compat - we are not allowed to subscript the abc.Iterator</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="com"># - use this little hack to work around it</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="key">class</span> <span class="nam">_bufferingIterator_Base</span><span class="op">(</span><span class="nam">collections</span><span class="op">.</span><span class="nam">abc</span><span class="op">.</span><span class="nam">Iterator</span><span class="op">,</span> <span class="nam">Generic</span><span class="op">[</span><span class="nam">T</span><span class="op">]</span><span class="op">,</span> <span class="nam">ABC</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"><span class="key">class</span> <span class="nam">BufferingIterator</span><span class="op">(</span><span class="nam">_bufferingIterator_Base</span><span class="op">[</span><span class="nam">T</span><span class="op">]</span><span class="op">,</span> <span class="nam">Generic</span><span class="op">[</span><span class="nam">T</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">stream</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="com"># type: (Iterable[T]) -> None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_stream</span> <span class="op">=</span> <span class="nam">iter</span><span class="op">(</span><span class="nam">stream</span><span class="op">)</span> <span class="com"># type: Iterator[T]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_buffer</span> <span class="op">=</span> <span class="nam">collections</span><span class="op">.</span><span class="nam">deque</span><span class="op">(</span><span class="op">)</span> <span class="com"># type: collections.deque[T]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_expired</span> <span class="op">=</span> <span class="key">False</span> <span class="com"># type: bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="key">def</span> <span class="nam">__next__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="com"># type: () -> T</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_buffer</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_buffer</span><span class="op">.</span><span class="nam">popleft</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_expired</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="key">raise</span> <span class="nam">StopIteration</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="key">return</span> <span class="nam">next</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_stream</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="key">def</span> <span class="nam">takewhile</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">predicate</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="com"># type: (Callable[[T], bool]) -> Iterable[T]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="str">"""Variant of itertools.takewhile except it does not discard the first non-matching token"""</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="nam">buffer</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_buffer</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="key">while</span> <span class="nam">buffer</span> <span class="key">or</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_fill_buffer</span><span class="op">(</span><span class="num">5</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">165 ↛ exit</span><span class="annotate long">line 165 didn't return from function 'takewhile', because the condition on line 165 was never false</span></span></p> - <p class="run"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="nam">v</span> <span class="op">=</span> <span class="nam">buffer</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="key">if</span> <span class="nam">predicate</span><span class="op">(</span><span class="nam">v</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="nam">buffer</span><span class="op">.</span><span class="nam">popleft</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="key">yield</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="key">def</span> <span class="nam">consume_many</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">count</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="com"># type: (int) -> List[T]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_fill_buffer</span><span class="op">(</span><span class="nam">count</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="nam">buffer</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_buffer</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">buffer</span><span class="op">)</span> <span class="op">==</span> <span class="nam">count</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="nam">ret</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">buffer</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="nam">buffer</span><span class="op">.</span><span class="nam">clear</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="nam">ret</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="key">while</span> <span class="nam">buffer</span> <span class="key">and</span> <span class="nam">count</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="nam">ret</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">buffer</span><span class="op">.</span><span class="nam">popleft</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="nam">count</span> <span class="op">-=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="key">return</span> <span class="nam">ret</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="key">def</span> <span class="nam">peek_buffer</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="com"># type: () -> List[T]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="key">return</span> <span class="nam">list</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_buffer</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="key">def</span> <span class="nam">peek_find</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="nam">predicate</span><span class="op">,</span> <span class="com"># type: Callable[[T], bool]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="nam">limit</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> <span class="com"># type: Optional[int]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="com"># type: (...) -> Optional[int]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="nam">buffer</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_buffer</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="nam">i</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="key">while</span> <span class="nam">limit</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">i</span> <span class="op"><</span> <span class="nam">limit</span><span class="op">:</span> </span><span class="r"><span class="annotate short">199 ↛ 208</span><span class="annotate long">line 199 didn't jump to line 208, because the condition on line 199 was never false</span></span></p> - <p class="run"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="key">if</span> <span class="nam">i</span> <span class="op">>=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">buffer</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_fill_buffer</span><span class="op">(</span><span class="nam">i</span> <span class="op">+</span> <span class="num">5</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="key">if</span> <span class="nam">i</span> <span class="op">>=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">buffer</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="nam">v</span> <span class="op">=</span> <span class="nam">buffer</span><span class="op">[</span><span class="nam">i</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="key">if</span> <span class="nam">predicate</span><span class="op">(</span><span class="nam">v</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="key">return</span> <span class="nam">i</span> <span class="op">+</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="nam">i</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="key">def</span> <span class="nam">_fill_buffer</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">number</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> <span class="com"># type: (int) -> bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_expired</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="key">while</span> <span class="nam">len</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_buffer</span><span class="op">)</span> <span class="op"><</span> <span class="nam">number</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_buffer</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">next</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_stream</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="key">except</span> <span class="nam">StopIteration</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_expired</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="key">return</span> <span class="nam">bool</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_buffer</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="key">def</span> <span class="nam">peek</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="com"># type: () -> Optional[T]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">peek_at</span><span class="op">(</span><span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="key">def</span> <span class="nam">peek_at</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">tokens_ahead</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="com"># type: (int) -> Optional[T]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_fill_buffer</span><span class="op">(</span><span class="nam">tokens_ahead</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="key">return</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_buffer</span><span class="op">[</span><span class="nam">tokens_ahead</span> <span class="op">-</span> <span class="num">1</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_buffer</span><span class="op">)</span> <span class="op">>=</span> <span class="nam">tokens_ahead</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="key">else</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="key">def</span> <span class="nam">peek_many</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">number</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="com"># type: (int) -> List[T]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_fill_buffer</span><span class="op">(</span><span class="nam">number</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="nam">buffer</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_buffer</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">buffer</span><span class="op">)</span> <span class="op">==</span> <span class="nam">number</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="nam">ret</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">buffer</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="key">elif</span> <span class="nam">number</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="nam">ret</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="key">for</span> <span class="nam">t</span> <span class="key">in</span> <span class="nam">buffer</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="nam">ret</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">t</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="nam">number</span> <span class="op">-=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">number</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="nam">ret</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="key">return</span> <span class="nam">ret</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"><span class="key">def</span> <span class="nam">len_check_iterator</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="nam">content</span><span class="op">,</span> <span class="com"># type: str</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="nam">stream</span><span class="op">,</span> <span class="com"># type: Iterable[TE]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="nam">content_len</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> <span class="com"># type: Optional[int]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="com"># type: (...) -> Iterable[TE]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="str">"""Flatten a parser's output into tokens and verify it covers the entire line/text"""</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="key">if</span> <span class="nam">content_len</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">259 ↛ 260</span><span class="annotate long">line 259 didn't jump to line 260, because the condition on line 259 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="nam">content_len</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">content</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="com"># Fail-safe to ensure none of the value parsers incorrectly parse a value.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="nam">covered</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="key">for</span> <span class="nam">token_or_element</span> <span class="key">in</span> <span class="nam">stream</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="com"># We use the AttributeError to discriminate between elements and tokens</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="com"># The cast()s are here to assist / workaround mypy not realizing that.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="nam">tokens</span> <span class="op">=</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"Deb822Element"</span><span class="op">,</span> <span class="nam">token_or_element</span><span class="op">)</span><span class="op">.</span><span class="nam">iter_tokens</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="key">except</span> <span class="nam">AttributeError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="nam">token</span> <span class="op">=</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"Deb822Token"</span><span class="op">,</span> <span class="nam">token_or_element</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="nam">covered</span> <span class="op">+=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">token</span><span class="op">.</span><span class="nam">text</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="key">for</span> <span class="nam">token</span> <span class="key">in</span> <span class="nam">tokens</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="nam">covered</span> <span class="op">+=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">token</span><span class="op">.</span><span class="nam">text</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="key">yield</span> <span class="nam">token_or_element</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="key">if</span> <span class="nam">covered</span> <span class="op">!=</span> <span class="nam">content_len</span><span class="op">:</span> </span><span class="r"><span class="annotate short">275 ↛ 276</span><span class="annotate long">line 275 didn't jump to line 276, because the condition on line 275 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="key">if</span> <span class="nam">covered</span> <span class="op"><</span> <span class="nam">content_len</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="nam">msg</span> <span class="op">=</span> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"><span class="str"> Value parser did not fully cover the entire line with tokens (</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"><span class="str"> missing range {covered}..{content_len}). Occurred when parsing "{content}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="op">)</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span><span class="nam">covered</span><span class="op">=</span><span class="nam">covered</span><span class="op">,</span> <span class="nam">content_len</span><span class="op">=</span><span class="nam">content_len</span><span class="op">,</span> <span class="nam">line</span><span class="op">=</span><span class="nam">content</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="nam">msg</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="nam">msg</span> <span class="op">=</span> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"><span class="str"> Value parser emitted tokens for more text than was present? Should have</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"><span class="str"> emitted {content_len} characters, got {covered}. Occurred when parsing</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"><span class="str"> "{content}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="op">)</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span><span class="nam">covered</span><span class="op">=</span><span class="nam">covered</span><span class="op">,</span> <span class="nam">content_len</span><span class="op">=</span><span class="nam">content_len</span><span class="op">,</span> <span class="nam">content</span><span class="op">=</span><span class="nam">content</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="nam">msg</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_e9c451f4ae334f76___init___py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_e9c451f4ae334f76_formatter_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_e9c451f4ae334f76_formatter_py.html b/coverage-report/d_e9c451f4ae334f76_formatter_py.html deleted file mode 100644 index b80d750..0000000 --- a/coverage-report/d_e9c451f4ae334f76_formatter_py.html +++ /dev/null @@ -1,577 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/lsp/vendoring/_deb822_repro/formatter.py: 80%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/lsp/vendoring/_deb822_repro/formatter.py</b>: - <span class="pc_cov">80%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">128 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">104<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">24<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">12<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_e9c451f4ae334f76__util_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_e9c451f4ae334f76_locatable_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">operator</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">_util</span> <span class="key">import</span> <span class="nam">BufferingIterator</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">tokens</span> <span class="key">import</span> <span class="nam">Deb822Token</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="com"># Consider these "opaque" enum-like values. The actual value was chosen to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="com"># make repr easier to implement, but they are subject to change.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="nam">_CONTENT_TYPE_VALUE</span> <span class="op">=</span> <span class="str">"is_value"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="nam">_CONTENT_TYPE_COMMENT</span> <span class="op">=</span> <span class="str">"is_comment"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"><span class="nam">_CONTENT_TYPE_SEPARATOR</span> <span class="op">=</span> <span class="str">"is_separator"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Iterator</span><span class="op">,</span> <span class="nam">Union</span><span class="op">,</span> <span class="nam">Literal</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="key">from</span> <span class="op">.</span><span class="nam">types</span> <span class="key">import</span> <span class="nam">TokenOrElement</span><span class="op">,</span> <span class="nam">FormatterCallback</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"><span class="key">except</span> <span class="nam">ImportError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"><span class="key">class</span> <span class="nam">FormatterContentToken</span><span class="op">(</span><span class="nam">object</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="str">"""Typed, tagged text for use with the formatting API</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"><span class="str"> The FormatterContentToken is used by the formatting API and provides the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"><span class="str"> formatter callback with context about the textual tokens it is supposed</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"><span class="str"> to format.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"_text"</span><span class="op">,</span> <span class="str">"_content_type"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">text</span><span class="op">,</span> <span class="nam">content_type</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="com"># type: (str, object) -> None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_text</span> <span class="op">=</span> <span class="nam">text</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_content_type</span> <span class="op">=</span> <span class="nam">content_type</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="key">def</span> <span class="nam">from_token_or_element</span><span class="op">(</span><span class="nam">cls</span><span class="op">,</span> <span class="nam">token_or_element</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="com"># type: (TokenOrElement) -> FormatterContentToken</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">token_or_element</span><span class="op">,</span> <span class="nam">Deb822Token</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="key">if</span> <span class="nam">token_or_element</span><span class="op">.</span><span class="nam">is_comment</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="key">return</span> <span class="nam">cls</span><span class="op">.</span><span class="nam">comment_token</span><span class="op">(</span><span class="nam">token_or_element</span><span class="op">.</span><span class="nam">text</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="key">if</span> <span class="nam">token_or_element</span><span class="op">.</span><span class="nam">is_whitespace</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"FormatterContentType cannot be whitespace"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="key">return</span> <span class="nam">cls</span><span class="op">.</span><span class="nam">value_token</span><span class="op">(</span><span class="nam">token_or_element</span><span class="op">.</span><span class="nam">text</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="com"># Elements are assumed to be content (this is specialized for the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="com"># interpretations where comments are always tokens).</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="key">return</span> <span class="nam">cls</span><span class="op">.</span><span class="nam">value_token</span><span class="op">(</span><span class="nam">token_or_element</span><span class="op">.</span><span class="nam">convert_to_text</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="key">def</span> <span class="nam">separator_token</span><span class="op">(</span><span class="nam">cls</span><span class="op">,</span> <span class="nam">text</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> <span class="com"># type: (str) -> FormatterContentToken</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"> <span class="com"># Special-case separators as a minor memory optimization</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="key">if</span> <span class="nam">text</span> <span class="op">==</span> <span class="str">" "</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="key">return</span> <span class="nam">SPACE_SEPARATOR_FT</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="key">if</span> <span class="nam">text</span> <span class="op">==</span> <span class="str">","</span><span class="op">:</span> </span><span class="r"><span class="annotate short">53 ↛ 54</span><span class="annotate long">line 53 didn't jump to line 54, because the condition on line 53 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="key">return</span> <span class="nam">COMMA_SEPARATOR_FT</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="key">return</span> <span class="nam">cls</span><span class="op">(</span><span class="nam">text</span><span class="op">,</span> <span class="nam">_CONTENT_TYPE_SEPARATOR</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="key">def</span> <span class="nam">comment_token</span><span class="op">(</span><span class="nam">cls</span><span class="op">,</span> <span class="nam">text</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="com"># type: (str) -> FormatterContentToken</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="str">"""Generates a single comment token with the provided text</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"><span class="str"> Mostly useful for creating test cases</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="key">return</span> <span class="nam">cls</span><span class="op">(</span><span class="nam">text</span><span class="op">,</span> <span class="nam">_CONTENT_TYPE_COMMENT</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="key">def</span> <span class="nam">value_token</span><span class="op">(</span><span class="nam">cls</span><span class="op">,</span> <span class="nam">text</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="com"># type: (str) -> FormatterContentToken</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="str">"""Generates a single value token with the provided text</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"><span class="str"> Mostly useful for creating test cases</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="key">return</span> <span class="nam">cls</span><span class="op">(</span><span class="nam">text</span><span class="op">,</span> <span class="nam">_CONTENT_TYPE_VALUE</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_comment</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="com"># type: () -> bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="str">"""True if this formatter token represent a comment</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"><span class="str"> This should be used for determining whether the token is a comment</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"><span class="str"> or not. It might be tempting to check whether the text in the token</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"><span class="str"> starts with a "#" but that is insufficient because a value *can*</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"><span class="str"> start with that as well. Whether it is a comment or a value is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"><span class="str"> based on the context (it is a comment if and only if the "#" was</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"><span class="str"> at the start of a line) but the formatter often do not have the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"><span class="str"> context available to assert this.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"><span class="str"> The formatter *should* preserve the order of comments and interleave</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"><span class="str"> between the value tokens in the same order as it see them. Failing</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"><span class="str"> to preserve the order of comments and values can cause confusing</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"><span class="str"> comments (such as associating the comment with a different value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"><span class="str"> than it was written for).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"><span class="str"> The formatter *may* discard comment tokens if it does not want to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"><span class="str"> preserve them. If so, they would be omitted in the output, which</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"><span class="str"> may be acceptable in some cases. This is a lot better than</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"><span class="str"> re-ordering comments.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"><span class="str"> Formatters must be aware of the following special cases for comments:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"><span class="str"> * Comments *MUST* be emitted after a newline. If the very first token</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"><span class="str"> is a comment, the formatter is expected to emit a newline before it</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"><span class="str"> as well (Fields cannot start immediately on a comment).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_content_type</span> <span class="key">is</span> <span class="nam">_CONTENT_TYPE_COMMENT</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_value</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="com"># type: () -> bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> <span class="str">"""True if this formatter token represents a semantic value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"><span class="str"> The formatter *MUST* preserve values as-in in its output. It may</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"><span class="str"> "unpack" it from the token (as in, return it as a part of a plain</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"><span class="str"> str) but the value content must not be changed nor re-ordered relative</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"><span class="str"> to other value tokens (as that could change the meaning of the field).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_content_type</span> <span class="key">is</span> <span class="nam">_CONTENT_TYPE_VALUE</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_separator</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="com"># type: () -> bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="str">"""True if this formatter token represents a separator token</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"><span class="str"> The formatter is not required to preserve the provided separators but it</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"><span class="str"> is required to properly separate values. In fact, often is a lot easier</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"><span class="str"> to discard existing separator tokens. As an example, in whitespace</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"><span class="str"> separated list of values space, tab and newline all counts as separator.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"><span class="str"> However, formatting-wise, there is a world of difference between the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"><span class="str"> a space, tab and a newline. In particularly, newlines must be followed</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"><span class="str"> by an additional space or tab (to act as a value continuation line) if</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"><span class="str"> there is a value following it (otherwise, the generated output is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"><span class="str"> invalid).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_content_type</span> <span class="key">is</span> <span class="nam">_CONTENT_TYPE_SEPARATOR</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_whitespace</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="com"># type: () -> bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="str">"""True if this formatter token represents a whitespace token"""</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_content_type</span> <span class="key">is</span> <span class="nam">_CONTENT_TYPE_SEPARATOR</span> <span class="key">and</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_text</span><span class="op">.</span><span class="nam">isspace</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="key">def</span> <span class="nam">text</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="com"># type: () -> str</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="str">"""The actual context of the token</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"><span class="str"> This field *must not* be used to determine the type of token. The</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"><span class="str"> formatter cannot reliably tell whether "#..." is a comment or a value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"><span class="str"> (it can be both). Use is_value and is_comment instead for discriminating</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"><span class="str"> token types.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"><span class="str"> For value tokens, this the concrete value to be omitted.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"><span class="str"> For comment token, this is the full comment text.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"><span class="str"> This is the same as str(token).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_text</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="key">def</span> <span class="nam">__str__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="com"># type: () -> str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_text</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="key">def</span> <span class="nam">__repr__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="com"># type: () -> str</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="key">return</span> <span class="str">"{}({!r}, {}=True)"</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">__class__</span><span class="op">.</span><span class="nam">__name__</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_text</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_content_type</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"><span class="nam">SPACE_SEPARATOR_FT</span> <span class="op">=</span> <span class="nam">FormatterContentToken</span><span class="op">(</span><span class="str">" "</span><span class="op">,</span> <span class="nam">_CONTENT_TYPE_SEPARATOR</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"><span class="nam">COMMA_SEPARATOR_FT</span> <span class="op">=</span> <span class="nam">FormatterContentToken</span><span class="op">(</span><span class="str">","</span><span class="op">,</span> <span class="nam">_CONTENT_TYPE_SEPARATOR</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"><span class="key">def</span> <span class="nam">one_value_per_line_formatter</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="nam">indentation</span><span class="op">,</span> <span class="com"># type: Union[int, Literal["FIELD_NAME_LENGTH"]]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="nam">trailing_separator</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="com"># type: bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="nam">immediate_empty_line</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> <span class="com"># type: bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="com"># type: (...) -> FormatterCallback</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="str">"""Provide a simple formatter that can handle indentation and trailing separators</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"><span class="str"> All formatters returned by this function puts exactly one value per line. This</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"><span class="str"> pattern is commonly seen in the "Depends" field and similar fields of</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"><span class="str"> debian/control files.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"><span class="str"> :param indentation: Either the literal string "FIELD_NAME_LENGTH" or a positive</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"><span class="str"> integer, which determines the indentation for fields. If it is an integer,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"><span class="str"> then a fixed indentation is used (notably the value 1 ensures the shortest</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"><span class="str"> possible indentation). Otherwise, if it is "FIELD_NAME_LENGTH", then the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"><span class="str"> indentation is set such that it aligns the values based on the field name.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"><span class="str"> :param trailing_separator: If True, then the last value will have a trailing</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"><span class="str"> separator token (e.g., ",") after it.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"><span class="str"> :param immediate_empty_line: Whether the value should always start with an</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"><span class="str"> empty line. If True, then the result becomes something like "Field:\n value".</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="key">if</span> <span class="nam">indentation</span> <span class="op">!=</span> <span class="str">"FIELD_NAME_LENGTH"</span> <span class="key">and</span> <span class="nam">indentation</span> <span class="op"><</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"><span class="annotate short">197 ↛ 198</span><span class="annotate long">line 197 didn't jump to line 198, because the condition on line 197 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">'indentation must be at least 1 (or "FIELD_NAME_LENGTH")'</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="key">def</span> <span class="nam">_formatter</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="nam">name</span><span class="op">,</span> <span class="com"># type: str</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="nam">sep_token</span><span class="op">,</span> <span class="com"># type: FormatterContentToken</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="nam">formatter_tokens</span><span class="op">,</span> <span class="com"># type: Iterator[FormatterContentToken]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="com"># type: (...) -> Iterator[Union[FormatterContentToken, str]]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="key">if</span> <span class="nam">indentation</span> <span class="op">==</span> <span class="str">"FIELD_NAME_LENGTH"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="nam">indent_len</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">name</span><span class="op">)</span> <span class="op">+</span> <span class="num">2</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="nam">indent_len</span> <span class="op">=</span> <span class="nam">indentation</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="nam">indent</span> <span class="op">=</span> <span class="str">" "</span> <span class="op">*</span> <span class="nam">indent_len</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> <span class="nam">emitted_first_line</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"> <span class="nam">tok_iter</span> <span class="op">=</span> <span class="nam">BufferingIterator</span><span class="op">(</span><span class="nam">formatter_tokens</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="nam">is_value</span> <span class="op">=</span> <span class="nam">operator</span><span class="op">.</span><span class="nam">attrgetter</span><span class="op">(</span><span class="str">"is_value"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="key">if</span> <span class="nam">immediate_empty_line</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="nam">emitted_first_line</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="key">yield</span> <span class="str">"\n"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="key">for</span> <span class="nam">t</span> <span class="key">in</span> <span class="nam">tok_iter</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="key">if</span> <span class="nam">t</span><span class="op">.</span><span class="nam">is_comment</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">emitted_first_line</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="key">yield</span> <span class="str">"\n"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="key">yield</span> <span class="nam">t</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="key">elif</span> <span class="nam">t</span><span class="op">.</span><span class="nam">is_value</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">emitted_first_line</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="key">yield</span> <span class="str">" "</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="key">yield</span> <span class="nam">indent</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="key">yield</span> <span class="nam">t</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">sep_token</span><span class="op">.</span><span class="nam">is_whitespace</span> <span class="key">and</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="nam">trailing_separator</span> <span class="key">or</span> <span class="nam">tok_iter</span><span class="op">.</span><span class="nam">peek_find</span><span class="op">(</span><span class="nam">is_value</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="key">yield</span> <span class="nam">sep_token</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="key">yield</span> <span class="str">"\n"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="com"># Skip existing separators (etc.)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="nam">emitted_first_line</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="key">return</span> <span class="nam">_formatter</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"><span class="nam">one_value_per_line_trailing_separator</span> <span class="op">=</span> <span class="nam">one_value_per_line_formatter</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="str">"FIELD_NAME_LENGTH"</span><span class="op">,</span> <span class="nam">trailing_separator</span><span class="op">=</span><span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"><span class="key">def</span> <span class="nam">format_field</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="nam">formatter</span><span class="op">,</span> <span class="com"># type: FormatterCallback</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="nam">field_name</span><span class="op">,</span> <span class="com"># type: str</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="nam">separator_token</span><span class="op">,</span> <span class="com"># type: FormatterContentToken</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="nam">token_iter</span><span class="op">,</span> <span class="com"># type: Iterator[FormatterContentToken]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="com"># type: (...) -> str</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="str">"""Format a field using a provided formatter</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"><span class="str"> This function formats a series of tokens using the provided formatter.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"><span class="str"> It can be used as a standalone formatter engine and can be used in test</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"><span class="str"> suites to validate third-party formatters (enabling them to test for</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"><span class="str"> corner cases without involving parsing logic).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"><span class="str"> The formatter receives series of FormatterContentTokens (via the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"><span class="str"> token_iter) and is expected to yield one or more str or</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"><span class="str"> FormatterContentTokens. The calling function will combine all of</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"><span class="str"> these into a single string, which will be used as the value.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"><span class="str"> The formatter is recommended to yield the provided value and comment</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"><span class="str"> tokens interleaved with text segments of whitespace and separators</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"><span class="str"> as part of its output. If it preserve comment and value tokens, the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"><span class="str"> calling function can provide some runtime checks to catch bugs</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"><span class="str"> (like the formatter turning a comment into a value because it forgot</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"><span class="str"> to ensure that the comment was emitted directly after a newline</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"><span class="str"> character).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"><span class="str"> When writing a formatter, please keep the following in mind:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"><span class="str"> * The output of the formatter is appended directly after the ":" separator.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"><span class="str"> Most formatters will want to emit either a space or a newline as the very</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"><span class="str"> first character for readability.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"><span class="str"> (compare "Depends:foo\\n" to "Depends: foo\\n")</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"><span class="str"> * The formatter must always end its output on a newline. This is a design</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"><span class="str"> choice of how the round-trip safe parser represent values that is imposed</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"><span class="str"> on the formatter.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"><span class="str"> * It is often easier to discard/ignore all separator tokens from the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"><span class="str"> the provided token sequence and instead just yield separator tokens/str</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"><span class="str"> where the formatter wants to place them.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"><span class="str"> - The formatter is strongly recommended to special-case formatting</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"><span class="str"> for whitespace separators (check for `separator_token.is_whitespace`).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"><span class="str"> This is because space, tab and newline all counts as valid separators</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"><span class="str"> and can all appear in the token sequence. If the original field uses</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"><span class="str"> a mix of these separators it is likely to completely undermine the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"><span class="str"> desired result. Not to mention the additional complexity of handling</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"><span class="str"> when a separator token happens to use the newline character which</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"><span class="str"> affects how the formatter is supposed what comes after it</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"><span class="str"> (see the rules for comments, empty lines and continuation line</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"><span class="str"> markers).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"><span class="str"> * The formatter must remember to emit a "continuation line" marker</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"><span class="str"> (typically a single space or tab) when emitting a value after</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"><span class="str"> a newline or a comment. A `yield " "` is sufficient.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"><span class="str"> - The continuation line marker may be embedded inside a str</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"><span class="str"> with other whitespace (such as the newline coming before it</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"><span class="str"> or/and whitespace used for indentation purposes following</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"><span class="str"> the marker).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"><span class="str"> * The formatter must not cause the output to contain completely</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"><span class="str"> empty/whitespace lines as these cause syntax errors. The first</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"><span class="str"> line never counts as an empty line (as it will be appended after</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"><span class="str"> the field name).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"><span class="str"> * Tokens must be discriminated via the `token.is_value` (etc.)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"><span class="str"> properties. Assuming that `token.text.startswith("#")` implies a</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"><span class="str"> comment and similar stunts are wrong. As an example, "#foo" is a</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"><span class="str"> perfectly valid value in some contexts.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"><span class="str"> * Comment tokens *always* take up exactly one complete line including</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"><span class="str"> the newline character at the end of the line. They must be emitted</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"><span class="str"> directly after a newline character or another comment token.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"><span class="str"> * Special cases that are rare but can happen:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"><span class="str"> - Fields *can* start with comments and requires a formatter provided newline.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"><span class="str"> (Example: "Depends:\\n# Comment here\\n foo")</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"><span class="str"> - Fields *can* start on a separator or have two separators in a row.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"><span class="str"> This is especially true for whitespace separated fields where every</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"><span class="str"> whitespace counts as a separator, but it can also happen with other</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"><span class="str"> separators (such as comma).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"><span class="str"> - Value tokens can contain whitespace (for non-whitespace separators).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"><span class="str"> When they do, the formatter must not attempt change nor "normalize"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"><span class="str"> the whitespace inside the value token as that might change how the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"><span class="str"> value is interpreted. (If you want to normalize such whitespace,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"><span class="str"> the formatter is at the wrong abstraction level. Instead, manipulate</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"><span class="str"> the values directly in the value interpretation layer)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"><span class="str"> This function will provide *some* runtime checks of its input and the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"><span class="str"> output from the formatter to detect some errors early and provide</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"><span class="str"> helpful diagnostics. If you use the function for testing, you are</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"><span class="str"> recommended to rely on verifying the output of the function rather than</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"><span class="str"> relying on the runtime checks (as these are subject to change).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"><span class="str"> :param formatter: A formatter (see FormatterCallback for the type).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"><span class="str"> Basic formatting is provided via one_value_per_line_trailing_separator</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"><span class="str"> (a formatter) or one_value_per_line_formatter (a formatter generator).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"><span class="str"> :param field_name: The name of the field.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"><span class="str"> :param separator_token: One of SPACE_SEPARATOR and COMMA_SEPARATOR</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"><span class="str"> :param token_iter: An iterable of tokens to be formatted.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"><span class="str"> The following example shows how to define a formatter_callback along with</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"><span class="str"> a few verifications.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"><span class="str"> >>> fmt_field_len_sep = one_value_per_line_trailing_separator</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"><span class="str"> >>> fmt_shortest = one_value_per_line_formatter(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"><span class="str"> ... 1,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"><span class="str"> ... trailing_separator=False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"><span class="str"> ... )</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"><span class="str"> >>> fmt_newline_first = one_value_per_line_formatter(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"><span class="str"> ... 1,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"><span class="str"> ... trailing_separator=False,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"><span class="str"> ... immediate_empty_line=True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"><span class="str"> ... )</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"><span class="str"> >>> # Omit separator tokens for in the token list for simplicity (the formatter does</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"><span class="str"> >>> # not use them, and it enables us to keep the example simple by reusing the list)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"><span class="str"> >>> tokens = [</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"><span class="str"> ... FormatterContentToken.value_token("foo"),</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"><span class="str"> ... FormatterContentToken.comment_token("# some comment about bar\\n"),</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"><span class="str"> ... FormatterContentToken.value_token("bar"),</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"><span class="str"> ... ]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"><span class="str"> >>> # Starting with fmt_dl_ts</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"><span class="str"> >>> print(format_field(fmt_field_len_sep, "Depends", COMMA_SEPARATOR_FT, tokens), end='')</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"><span class="str"> Depends: foo,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"><span class="str"> # some comment about bar</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"><span class="str"> bar,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"><span class="str"> >>> print(format_field(fmt_field_len_sep, "Architecture", SPACE_SEPARATOR_FT, tokens), end='')</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"><span class="str"> Architecture: foo</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"><span class="str"> # some comment about bar</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"><span class="str"> bar</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"><span class="str"> >>> # Control check for the special case where the field starts with a comment</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"><span class="str"> >>> print(format_field(fmt_field_len_sep, "Depends", COMMA_SEPARATOR_FT, tokens[1:]), end='')</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t385" href="#t385">385</a></span><span class="t"><span class="str"> Depends:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t386" href="#t386">386</a></span><span class="t"><span class="str"> # some comment about bar</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t387" href="#t387">387</a></span><span class="t"><span class="str"> bar,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t388" href="#t388">388</a></span><span class="t"><span class="str"> >>> # Also, check single line values (to ensure it ends on a newline)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t389" href="#t389">389</a></span><span class="t"><span class="str"> >>> print(format_field(fmt_field_len_sep, "Depends", COMMA_SEPARATOR_FT, tokens[2:]), end='')</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t390" href="#t390">390</a></span><span class="t"><span class="str"> Depends: bar,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t391" href="#t391">391</a></span><span class="t"><span class="str"> >>> ### Changing format to the shortest length</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t392" href="#t392">392</a></span><span class="t"><span class="str"> >>> print(format_field(fmt_shortest, "Depends", COMMA_SEPARATOR_FT, tokens), end='')</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t393" href="#t393">393</a></span><span class="t"><span class="str"> Depends: foo,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t394" href="#t394">394</a></span><span class="t"><span class="str"> # some comment about bar</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t395" href="#t395">395</a></span><span class="t"><span class="str"> bar</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t396" href="#t396">396</a></span><span class="t"><span class="str"> >>> print(format_field(fmt_shortest, "Architecture", SPACE_SEPARATOR_FT, tokens), end='')</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t397" href="#t397">397</a></span><span class="t"><span class="str"> Architecture: foo</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t398" href="#t398">398</a></span><span class="t"><span class="str"> # some comment about bar</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t399" href="#t399">399</a></span><span class="t"><span class="str"> bar</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t400" href="#t400">400</a></span><span class="t"><span class="str"> >>> # Control check for the special case where the field starts with a comment</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t401" href="#t401">401</a></span><span class="t"><span class="str"> >>> print(format_field(fmt_shortest, "Depends", COMMA_SEPARATOR_FT, tokens[1:]), end='')</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t402" href="#t402">402</a></span><span class="t"><span class="str"> Depends:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t403" href="#t403">403</a></span><span class="t"><span class="str"> # some comment about bar</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t404" href="#t404">404</a></span><span class="t"><span class="str"> bar</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t405" href="#t405">405</a></span><span class="t"><span class="str"> >>> # Also, check single line values (to ensure it ends on a newline)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t406" href="#t406">406</a></span><span class="t"><span class="str"> >>> print(format_field(fmt_shortest, "Depends", COMMA_SEPARATOR_FT, tokens[2:]), end='')</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t407" href="#t407">407</a></span><span class="t"><span class="str"> Depends: bar</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t408" href="#t408">408</a></span><span class="t"><span class="str"> >>> ### Changing format to the newline first format</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t409" href="#t409">409</a></span><span class="t"><span class="str"> >>> print(format_field(fmt_newline_first, "Depends", COMMA_SEPARATOR_FT, tokens), end='')</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t410" href="#t410">410</a></span><span class="t"><span class="str"> Depends:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t411" href="#t411">411</a></span><span class="t"><span class="str"> foo,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t412" href="#t412">412</a></span><span class="t"><span class="str"> # some comment about bar</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t413" href="#t413">413</a></span><span class="t"><span class="str"> bar</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t414" href="#t414">414</a></span><span class="t"><span class="str"> >>> print(format_field(fmt_newline_first, "Architecture", SPACE_SEPARATOR_FT, tokens), end='')</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t415" href="#t415">415</a></span><span class="t"><span class="str"> Architecture:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t416" href="#t416">416</a></span><span class="t"><span class="str"> foo</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t417" href="#t417">417</a></span><span class="t"><span class="str"> # some comment about bar</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t418" href="#t418">418</a></span><span class="t"><span class="str"> bar</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t419" href="#t419">419</a></span><span class="t"><span class="str"> >>> # Control check for the special case where the field starts with a comment</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t420" href="#t420">420</a></span><span class="t"><span class="str"> >>> print(format_field(fmt_newline_first, "Depends", COMMA_SEPARATOR_FT, tokens[1:]), end='')</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t421" href="#t421">421</a></span><span class="t"><span class="str"> Depends:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t422" href="#t422">422</a></span><span class="t"><span class="str"> # some comment about bar</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t423" href="#t423">423</a></span><span class="t"><span class="str"> bar</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t424" href="#t424">424</a></span><span class="t"><span class="str"> >>> # Also, check single line values (to ensure it ends on a newline)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t425" href="#t425">425</a></span><span class="t"><span class="str"> >>> print(format_field(fmt_newline_first, "Depends", COMMA_SEPARATOR_FT, tokens[2:]), end='')</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t426" href="#t426">426</a></span><span class="t"><span class="str"> Depends:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t427" href="#t427">427</a></span><span class="t"><span class="str"> bar</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t428" href="#t428">428</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t429" href="#t429">429</a></span><span class="t"> <span class="nam">formatted_tokens</span> <span class="op">=</span> <span class="op">[</span><span class="nam">field_name</span><span class="op">,</span> <span class="str">":"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t430" href="#t430">430</a></span><span class="t"> <span class="nam">just_after_newline</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t431" href="#t431">431</a></span><span class="t"> <span class="nam">last_was_value_token</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t432" href="#t432">432</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">token_iter</span><span class="op">,</span> <span class="nam">list</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t433" href="#t433">433</a></span><span class="t"> <span class="com"># Stop people from using this to test known "invalid" cases.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t434" href="#t434">434</a></span><span class="t"> <span class="nam">last_token</span> <span class="op">=</span> <span class="nam">token_iter</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t435" href="#t435">435</a></span><span class="t"> <span class="key">if</span> <span class="nam">last_token</span><span class="op">.</span><span class="nam">is_comment</span><span class="op">:</span> </span><span class="r"><span class="annotate short">435 ↛ 436</span><span class="annotate long">line 435 didn't jump to line 436, because the condition on line 435 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t436" href="#t436">436</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t437" href="#t437">437</a></span><span class="t"> <span class="str">"Invalid token_iter: Field values cannot end with comments"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t438" href="#t438">438</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t439" href="#t439">439</a></span><span class="t"> <span class="key">for</span> <span class="nam">token</span> <span class="key">in</span> <span class="nam">formatter</span><span class="op">(</span><span class="nam">field_name</span><span class="op">,</span> <span class="nam">separator_token</span><span class="op">,</span> <span class="nam">token_iter</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t440" href="#t440">440</a></span><span class="t"> <span class="nam">token_as_text</span> <span class="op">=</span> <span class="nam">str</span><span class="op">(</span><span class="nam">token</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t441" href="#t441">441</a></span><span class="t"> <span class="com"># If we are given formatter tokens, then use them to verify the output.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t442" href="#t442">442</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">token</span><span class="op">,</span> <span class="nam">FormatterContentToken</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t443" href="#t443">443</a></span><span class="t"> <span class="key">if</span> <span class="nam">token</span><span class="op">.</span><span class="nam">is_comment</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t444" href="#t444">444</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">just_after_newline</span><span class="op">:</span> </span><span class="r"><span class="annotate short">444 ↛ 445</span><span class="annotate long">line 444 didn't jump to line 445, because the condition on line 444 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t445" href="#t445">445</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t446" href="#t446">446</a></span><span class="t"> <span class="str">"Bad format: Comments must appear directly after a newline."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t447" href="#t447">447</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t448" href="#t448">448</a></span><span class="t"> <span class="com"># for the sake of ensuring people use proper test data.</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t449" href="#t449">449</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">token_as_text</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"#"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">449 ↛ 450</span><span class="annotate long">line 449 didn't jump to line 450, because the condition on line 449 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t450" href="#t450">450</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"Invalid Comment token: Must start with #"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t451" href="#t451">451</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">token_as_text</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">451 ↛ 452</span><span class="annotate long">line 451 didn't jump to line 452, because the condition on line 451 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t452" href="#t452">452</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"Invalid Comment token: Must end on a newline"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t453" href="#t453">453</a></span><span class="t"> <span class="key">elif</span> <span class="nam">token</span><span class="op">.</span><span class="nam">is_value</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t454" href="#t454">454</a></span><span class="t"> <span class="key">if</span> <span class="nam">token_as_text</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">.</span><span class="nam">isspace</span><span class="op">(</span><span class="op">)</span> <span class="key">or</span> <span class="nam">token_as_text</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span><span class="op">.</span><span class="nam">isspace</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">454 ↛ 455</span><span class="annotate long">line 454 didn't jump to line 455, because the condition on line 454 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t455" href="#t455">455</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t456" href="#t456">456</a></span><span class="t"> <span class="str">"Invalid Value token: It cannot start nor end on whitespace"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t457" href="#t457">457</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t458" href="#t458">458</a></span><span class="t"> <span class="key">if</span> <span class="nam">just_after_newline</span><span class="op">:</span> </span><span class="r"><span class="annotate short">458 ↛ 459</span><span class="annotate long">line 458 didn't jump to line 459, because the condition on line 458 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t459" href="#t459">459</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"Bad format: Missing continuation line marker"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t460" href="#t460">460</a></span><span class="t"> <span class="key">if</span> <span class="nam">last_was_value_token</span><span class="op">:</span> </span><span class="r"><span class="annotate short">460 ↛ 461</span><span class="annotate long">line 460 didn't jump to line 461, because the condition on line 460 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t461" href="#t461">461</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"Bad format: Formatter omitted a separator"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t462" href="#t462">462</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t463" href="#t463">463</a></span><span class="t"> <span class="nam">last_was_value_token</span> <span class="op">=</span> <span class="nam">token</span><span class="op">.</span><span class="nam">is_value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t464" href="#t464">464</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t465" href="#t465">465</a></span><span class="t"> <span class="nam">last_was_value_token</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t466" href="#t466">466</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t467" href="#t467">467</a></span><span class="t"> <span class="key">if</span> <span class="nam">just_after_newline</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t468" href="#t468">468</a></span><span class="t"> <span class="key">if</span> <span class="nam">token_as_text</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="key">in</span> <span class="op">(</span><span class="str">"\r"</span><span class="op">,</span> <span class="str">"\n"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">468 ↛ 469</span><span class="annotate long">line 468 didn't jump to line 469, because the condition on line 468 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t469" href="#t469">469</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"Bad format: Saw completely empty line."</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t470" href="#t470">470</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">token_as_text</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">.</span><span class="nam">isspace</span><span class="op">(</span><span class="op">)</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">token_as_text</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"#"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">470 ↛ 471</span><span class="annotate long">line 470 didn't jump to line 471, because the condition on line 470 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t471" href="#t471">471</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"Bad format: Saw completely empty line."</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t472" href="#t472">472</a></span><span class="t"> <span class="nam">formatted_tokens</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">token_as_text</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t473" href="#t473">473</a></span><span class="t"> <span class="nam">just_after_newline</span> <span class="op">=</span> <span class="nam">token_as_text</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t474" href="#t474">474</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t475" href="#t475">475</a></span><span class="t"> <span class="nam">formatted_text</span> <span class="op">=</span> <span class="str">""</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">formatted_tokens</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t476" href="#t476">476</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">formatted_text</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">476 ↛ 477</span><span class="annotate long">line 476 didn't jump to line 477, because the condition on line 476 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t477" href="#t477">477</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"Bad format: The field value must end on a newline"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t478" href="#t478">478</a></span><span class="t"> <span class="key">return</span> <span class="nam">formatted_text</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_e9c451f4ae334f76__util_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_e9c451f4ae334f76_locatable_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_e9c451f4ae334f76_locatable_py.html b/coverage-report/d_e9c451f4ae334f76_locatable_py.html deleted file mode 100644 index 6ce16fc..0000000 --- a/coverage-report/d_e9c451f4ae334f76_locatable_py.html +++ /dev/null @@ -1,512 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/lsp/vendoring/_deb822_repro/locatable.py: 90%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/lsp/vendoring/_deb822_repro/locatable.py</b>: - <span class="pc_cov">90%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">122 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">111<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">11<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">5<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">5<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_e9c451f4ae334f76_formatter_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_e9c451f4ae334f76_parsing_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">dataclasses</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">itertools</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">sys</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Optional</span><span class="op">,</span> <span class="nam">TYPE_CHECKING</span><span class="op">,</span> <span class="nam">Iterable</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">if</span> <span class="nam">TYPE_CHECKING</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Self</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="key">from</span> <span class="op">.</span><span class="nam">parsing</span> <span class="key">import</span> <span class="nam">Deb822Element</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="nam">_DATA_CLASS_OPTIONAL_ARGS</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"><span class="key">if</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">version_info</span> <span class="op">>=</span> <span class="op">(</span><span class="num">3</span><span class="op">,</span> <span class="num">10</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">13 ↛ 20</span><span class="annotate long">line 13 didn't jump to line 20, because the condition on line 13 was never false</span></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="com"># The `slots` feature greatly reduces the memory usage by avoiding the `__dict__`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="com"># instance. But at the end of the day, performance is "nice to have" for this</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="com"># feature and all current consumers are at Python 3.12 (except the CI tests...)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">_DATA_CLASS_OPTIONAL_ARGS</span><span class="op">[</span><span class="str">"slots"</span><span class="op">]</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="op">**</span><span class="nam">_DATA_CLASS_OPTIONAL_ARGS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"><span class="key">class</span> <span class="nam">Position</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="str">"""Describes a "cursor" position inside a file</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"><span class="str"> It consists of a line position (0-based line number) and a cursor position. This is modelled</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"><span class="str"> after the "Position" in Language Server Protocol (LSP).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="nam">line_position</span><span class="op">:</span> <span class="nam">int</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="str">"""Describes the line position as a 0-based line number</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"><span class="str"> See line_number if you want a human-readable line number</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="nam">cursor_position</span><span class="op">:</span> <span class="nam">int</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="str">"""Describes a cursor position ("between two characters") or a character offset.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"><span class="str"> When this value is 0, the position is at the start of a line. When it is 1, then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="str"> the position is between the first and the second character (etc.).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"> <span class="key">def</span> <span class="nam">line_number</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="str">"""The line number as human would count it"""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">line_position</span> <span class="op">+</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="key">def</span> <span class="nam">relative_to</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">new_base</span><span class="op">:</span> <span class="str">"Position"</span><span class="op">)</span> <span class="op">-></span> <span class="str">"Position"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="str">"""Offsets the position relative to another position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"><span class="str"> This is useful to avoid the `position_in_file()` method by caching where</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"><span class="str"> the parents position and then for its children you use `range_in_parent()`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"><span class="str"> plus `relative_to()` to rebase the range.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"><span class="str"> >>> parent: Locatable = ... # doctest: +SKIP</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"><span class="str"> >>> children: Iterable[Locatable] = ... # doctest: +SKIP</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"><span class="str"> >>> # This will expensive</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"><span class="str"> >>> parent_pos = parent.position_in_file( # doctest: +SKIP</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"><span class="str"> ... skip_leading_comments=False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"><span class="str"> ... )</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"><span class="str"> >>> for child in children: # doctest: +SKIP</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"><span class="str"> ... child_pos = child.position_in_parent()</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"><span class="str"> ... # Avoid a position_in_file() for each child</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"><span class="str"> ... child_pos_in_file = child_pos.relative_to(parent_pos)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"><span class="str"> ... ... # Use the child_pos_in_file for something</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"><span class="str"> :param new_base: The position that should have been the origin rather than</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"><span class="str"> (0, 0).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"><span class="str"> :returns: The range offset relative to the base position.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">line_position</span> <span class="op">==</span> <span class="num">0</span> <span class="key">and</span> <span class="nam">self</span><span class="op">.</span><span class="nam">cursor_position</span> <span class="op">==</span> <span class="num">0</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="key">return</span> <span class="nam">new_base</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="key">if</span> <span class="nam">new_base</span><span class="op">.</span><span class="nam">line_position</span> <span class="op">==</span> <span class="num">0</span> <span class="key">and</span> <span class="nam">new_base</span><span class="op">.</span><span class="nam">cursor_position</span> <span class="op">==</span> <span class="num">0</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">line_position</span> <span class="op">==</span> <span class="num">0</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="nam">line_number</span> <span class="op">=</span> <span class="nam">new_base</span><span class="op">.</span><span class="nam">line_position</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="nam">line_char_offset</span> <span class="op">=</span> <span class="nam">new_base</span><span class="op">.</span><span class="nam">cursor_position</span> <span class="op">+</span> <span class="nam">self</span><span class="op">.</span><span class="nam">cursor_position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="nam">line_number</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">line_position</span> <span class="op">+</span> <span class="nam">new_base</span><span class="op">.</span><span class="nam">line_position</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="nam">line_char_offset</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">cursor_position</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="key">return</span> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="nam">line_number</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="nam">line_char_offset</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"><span class="op">@</span><span class="nam">dataclasses</span><span class="op">.</span><span class="nam">dataclass</span><span class="op">(</span><span class="nam">frozen</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="op">**</span><span class="nam">_DATA_CLASS_OPTIONAL_ARGS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"><span class="key">class</span> <span class="nam">Range</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="str">"""Describes a range inside a file</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"><span class="str"> This can be useful to describe things like "from line 4, cursor position 2</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"><span class="str"> to line 7 to cursor position 10". When describing a full line including the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"><span class="str"> newline, use line N, cursor position 0 to line N+1. cursor position 0.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"><span class="str"> It is also used to denote the size of objects (in that case, the start position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"><span class="str"> is set to START_POSITION as a convention if the precise location is not</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"><span class="str"> specified).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"><span class="str"> This is modelled after the "Range" in Language Server Protocol (LSP).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> <span class="nam">start_pos</span><span class="op">:</span> <span class="nam">Position</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="nam">end_pos</span><span class="op">:</span> <span class="nam">Position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> <span class="key">def</span> <span class="nam">start_line_position</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"> <span class="str">"""Describes the start line position as a 0-based line number</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"><span class="str"> See start_line_number if you want a human-readable line number</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">start_pos</span><span class="op">.</span><span class="nam">line_position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> <span class="key">def</span> <span class="nam">start_cursor_position</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> <span class="str">"""Describes the starting cursor position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"><span class="str"> When this value is 0, the position is at the start of a line. When it is 1, then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"><span class="str"> the position is between the first and the second character (etc.).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">start_pos</span><span class="op">.</span><span class="nam">cursor_position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="key">def</span> <span class="nam">start_line_number</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="str">"""The start line number as human would count it"""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">start_pos</span><span class="op">.</span><span class="nam">line_number</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="key">def</span> <span class="nam">end_line_position</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="str">"""Describes the end line position as a 0-based line number</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"><span class="str"> See end_line_number if you want a human-readable line number</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">end_pos</span><span class="op">.</span><span class="nam">line_position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="key">def</span> <span class="nam">end_line_number</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="str">"""The end line number as human would count it"""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">end_pos</span><span class="op">.</span><span class="nam">line_number</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="key">def</span> <span class="nam">end_cursor_position</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="str">"""Describes the end cursor position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"><span class="str"> When this value is 0, the position is at the start of a line. When it is 1, then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"><span class="str"> the position is between the first and the second character (etc.).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">end_pos</span><span class="op">.</span><span class="nam">cursor_position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="key">def</span> <span class="nam">line_count</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="nam">int</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="str">"""The number of lines (newlines) spanned by this range.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"><span class="str"> Will be zero when the range fits inside one line.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">end_line_position</span> <span class="op">-</span> <span class="nam">self</span><span class="op">.</span><span class="nam">start_line_position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="key">def</span> <span class="nam">between</span><span class="op">(</span><span class="nam">cls</span><span class="op">,</span> <span class="nam">a</span><span class="op">:</span> <span class="nam">Position</span><span class="op">,</span> <span class="nam">b</span><span class="op">:</span> <span class="nam">Position</span><span class="op">)</span> <span class="op">-></span> <span class="str">"Self"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="str">"""Computes the range between two positions</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"><span class="str"> Unlike the constructor, this will always create a "positive" range.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"><span class="str"> That is, the "earliest" position will always be the start position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"><span class="str"> regardless of the order they were passed to `between`. When using</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"><span class="str"> the Range constructor, you have freedom to do "inverse" ranges</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"><span class="str"> in case that is ever useful</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="key">if</span> <span class="nam">a</span><span class="op">.</span><span class="nam">line_position</span> <span class="op">></span> <span class="nam">b</span><span class="op">.</span><span class="nam">line_position</span> <span class="key">or</span> <span class="op">(</span> </span><span class="r"><span class="annotate short">164 ↛ 168</span><span class="annotate long">line 164 didn't jump to line 168, because the condition on line 164 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="nam">a</span><span class="op">.</span><span class="nam">line_position</span> <span class="op">==</span> <span class="nam">b</span><span class="op">.</span><span class="nam">line_position</span> <span class="key">and</span> <span class="nam">a</span><span class="op">.</span><span class="nam">cursor_position</span> <span class="op">></span> <span class="nam">b</span><span class="op">.</span><span class="nam">cursor_position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> <span class="com"># Order swap, so `a` is always the earliest position</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="nam">a</span><span class="op">,</span> <span class="nam">b</span> <span class="op">=</span> <span class="nam">b</span><span class="op">,</span> <span class="nam">a</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="key">return</span> <span class="nam">cls</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="nam">a</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="nam">b</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="key">def</span> <span class="nam">relative_to</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">new_base</span><span class="op">:</span> <span class="nam">Position</span><span class="op">)</span> <span class="op">-></span> <span class="str">"Range"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="str">"""Offsets the range relative to another position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"><span class="str"> This is useful to avoid the `position_in_file()` method by caching where</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"><span class="str"> the parents position and then for its children you use `range_in_parent()`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"><span class="str"> plus `relative_to()` to rebase the range.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"><span class="str"> >>> parent: Locatable = ... # doctest: +SKIP</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"><span class="str"> >>> children: Iterable[Locatable] = ... # doctest: +SKIP</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"><span class="str"> >>> # This will expensive</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"><span class="str"> >>> parent_pos = parent.position_in_file( # doctest: +SKIP</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"><span class="str"> ... skip_leading_comments=False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"><span class="str"> ... )</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"><span class="str"> >>> for child in children: # doctest: +SKIP</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"><span class="str"> ... child_range = child.range_in_parent()</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"><span class="str"> ... # Avoid a position_in_file() for each child</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"><span class="str"> ... child_range_in_file = child_range.relative_to(parent_pos)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"><span class="str"> ... ... # Use the child_range_in_file for something</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"><span class="str"> :param new_base: The position that should have been the origin rather than</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"><span class="str"> (0, 0).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"><span class="str"> :returns: The range offset relative to the base position.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="key">if</span> <span class="nam">new_base</span> <span class="op">==</span> <span class="nam">START_POSITION</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="key">return</span> <span class="nam">Range</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">start_pos</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span><span class="nam">new_base</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">end_pos</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span><span class="nam">new_base</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="key">def</span> <span class="nam">as_size</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> <span class="op">-></span> <span class="str">"Range"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="str">"""Reduces the range to a "size"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"><span class="str"> The returned range will always have its start position to (0, 0) and</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"><span class="str"> its end position shifted accordingly if it was not already based at</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"><span class="str"> (0, 0).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"><span class="str"> The original range is not mutated and, if it is already at (0, 0), the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"><span class="str"> method will just return it as-is.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">start_pos</span> <span class="op">==</span> <span class="nam">START_POSITION</span><span class="op">:</span> </span><span class="r"><span class="annotate short">214 ↛ 216</span><span class="annotate long">line 214 didn't jump to line 216, because the condition on line 214 was never false</span></span></p> - <p class="run"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"> <span class="nam">line_count</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">line_count</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> <span class="key">if</span> <span class="nam">line_count</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="nam">new_end_cursor_position</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">end_cursor_position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="nam">delta</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">end_cursor_position</span> <span class="op">-</span> <span class="nam">self</span><span class="op">.</span><span class="nam">start_cursor_position</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="nam">new_end_cursor_position</span> <span class="op">=</span> <span class="nam">delta</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="key">return</span> <span class="nam">Range</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="nam">START_POSITION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="nam">line_count</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="nam">new_end_cursor_position</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="key">def</span> <span class="nam">from_position_and_size</span><span class="op">(</span><span class="nam">cls</span><span class="op">,</span> <span class="nam">base</span><span class="op">:</span> <span class="nam">Position</span><span class="op">,</span> <span class="nam">size</span><span class="op">:</span> <span class="str">"Range"</span><span class="op">)</span> <span class="op">-></span> <span class="str">"Self"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="str">"""Compute a range from a position and the size of another range</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"><span class="str"> This provides you with a range starting at the base position that has</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"><span class="str"> the same effective span as the size parameter.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"><span class="str"> :param base: The desired starting position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"><span class="str"> :param size: A range, which will be used as a size (that is, it will</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"><span class="str"> be reduced to a size via the `as_size()` method) for the resulting</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"><span class="str"> range</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"><span class="str"> :returns: A range at the provided base position that has the size of</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"><span class="str"> the provided range.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="nam">line_position</span> <span class="op">=</span> <span class="nam">base</span><span class="op">.</span><span class="nam">line_position</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="nam">cursor_position</span> <span class="op">=</span> <span class="nam">base</span><span class="op">.</span><span class="nam">cursor_position</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="nam">size_rebased</span> <span class="op">=</span> <span class="nam">size</span><span class="op">.</span><span class="nam">as_size</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="nam">lines</span> <span class="op">=</span> <span class="nam">size_rebased</span><span class="op">.</span><span class="nam">line_count</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="key">if</span> <span class="nam">lines</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="nam">line_position</span> <span class="op">+=</span> <span class="nam">lines</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="nam">cursor_position</span> <span class="op">=</span> <span class="nam">size_rebased</span><span class="op">.</span><span class="nam">end_cursor_position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="nam">delta</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="nam">size_rebased</span><span class="op">.</span><span class="nam">end_cursor_position</span> <span class="op">-</span> <span class="nam">size_rebased</span><span class="op">.</span><span class="nam">start_cursor_position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="nam">cursor_position</span> <span class="op">+=</span> <span class="nam">delta</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="key">return</span> <span class="nam">cls</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="nam">base</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="nam">line_position</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="nam">cursor_position</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="key">def</span> <span class="nam">from_position_and_sizes</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> <span class="nam">cls</span><span class="op">,</span> <span class="nam">base</span><span class="op">:</span> <span class="nam">Position</span><span class="op">,</span> <span class="nam">sizes</span><span class="op">:</span> <span class="nam">Iterable</span><span class="op">[</span><span class="str">"Range"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="str">"Self"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="str">"""Compute a range from a position and the size of number of ranges</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"><span class="str"> :param base: The desired starting position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"><span class="str"> :param sizes: All the ranges that combined makes up the size of the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"><span class="str"> desired position. Note that order can affect the end result. Particularly</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"><span class="str"> the end character offset gets reset every time a size spans a line.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"><span class="str"> :returns: A range at the provided base position that has the size of</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"><span class="str"> the provided range.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> <span class="nam">line_position</span> <span class="op">=</span> <span class="nam">base</span><span class="op">.</span><span class="nam">line_position</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="nam">cursor_position</span> <span class="op">=</span> <span class="nam">base</span><span class="op">.</span><span class="nam">cursor_position</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="key">for</span> <span class="nam">size</span> <span class="key">in</span> <span class="nam">sizes</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="nam">size_rebased</span> <span class="op">=</span> <span class="nam">size</span><span class="op">.</span><span class="nam">as_size</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="nam">lines</span> <span class="op">=</span> <span class="nam">size_rebased</span><span class="op">.</span><span class="nam">line_count</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="key">if</span> <span class="nam">lines</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="nam">line_position</span> <span class="op">+=</span> <span class="nam">lines</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="nam">cursor_position</span> <span class="op">=</span> <span class="nam">size_rebased</span><span class="op">.</span><span class="nam">end_cursor_position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="nam">delta</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="nam">size_rebased</span><span class="op">.</span><span class="nam">end_cursor_position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="op">-</span> <span class="nam">size_rebased</span><span class="op">.</span><span class="nam">start_cursor_position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="nam">cursor_position</span> <span class="op">+=</span> <span class="nam">delta</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="key">return</span> <span class="nam">cls</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> <span class="nam">base</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> <span class="nam">Position</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"> <span class="nam">line_position</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="nam">cursor_position</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"><span class="nam">START_POSITION</span> <span class="op">=</span> <span class="nam">Position</span><span class="op">(</span><span class="num">0</span><span class="op">,</span> <span class="num">0</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"><span class="nam">SECOND_CHAR_POS</span> <span class="op">=</span> <span class="nam">Position</span><span class="op">(</span><span class="num">0</span><span class="op">,</span> <span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"><span class="nam">SECOND_LINE_POS</span> <span class="op">=</span> <span class="nam">Position</span><span class="op">(</span><span class="num">1</span><span class="op">,</span> <span class="num">0</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"><span class="nam">ONE_CHAR_RANGE</span> <span class="op">=</span> <span class="nam">Range</span><span class="op">.</span><span class="nam">between</span><span class="op">(</span><span class="nam">START_POSITION</span><span class="op">,</span> <span class="nam">SECOND_CHAR_POS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"><span class="nam">ONE_LINE_RANGE</span> <span class="op">=</span> <span class="nam">Range</span><span class="op">.</span><span class="nam">between</span><span class="op">(</span><span class="nam">START_POSITION</span><span class="op">,</span> <span class="nam">SECOND_LINE_POS</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"><span class="key">class</span> <span class="nam">Locatable</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="key">def</span> <span class="nam">parent_element</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="com"># type: () -> Optional[Deb822Element]</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="key">def</span> <span class="nam">position_in_parent</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">skip_leading_comments</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Position</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="str">"""The start position of this token/element inside its parent</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"><span class="str"> This is operation is generally linear to the number of "parts" (elements/tokens)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"><span class="str"> inside the parent.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"><span class="str"> :param skip_leading_comments: If True, then if any leading comment that</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"><span class="str"> that can be skipped will be excluded in the position of this locatable.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"><span class="str"> This is useful if you want the position "semantic" content of a field</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"><span class="str"> without also highlighting a leading comment. Remember to align this</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"><span class="str"> parameter with the `size` call, so the range does not "overshoot"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"><span class="str"> into the next element (or falls short and only covers part of an</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"><span class="str"> element). Note that this option can only be used to filter out leading</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"><span class="str"> comments when the comments are a subset of the element. It has no</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"><span class="str"> effect on elements that are entirely made of comments.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> <span class="com"># pylint: disable=unused-argument</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> <span class="com"># Note: The base class makes no assumptions about what tokens can be skipped,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> <span class="com"># therefore, skip_leading_comments is unused here. However, I do not want the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> <span class="com"># API to differ between elements and tokens.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> <span class="nam">parent</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">parent_element</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> <span class="key">if</span> <span class="nam">parent</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">337 ↛ 338</span><span class="annotate long">line 337 didn't jump to line 338, because the condition on line 337 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> <span class="key">raise</span> <span class="nam">TypeError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"> <span class="str">"Cannot determine the position since the object is detached"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"> <span class="nam">relevant_parts</span> <span class="op">=</span> <span class="nam">itertools</span><span class="op">.</span><span class="nam">takewhile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"> <span class="key">lambda</span> <span class="nam">x</span><span class="op">:</span> <span class="nam">x</span> <span class="key">is</span> <span class="key">not</span> <span class="nam">self</span><span class="op">,</span> <span class="nam">parent</span><span class="op">.</span><span class="nam">iter_parts</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> <span class="nam">span</span> <span class="op">=</span> <span class="nam">Range</span><span class="op">.</span><span class="nam">from_position_and_sizes</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"> <span class="nam">START_POSITION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"> <span class="op">(</span><span class="nam">x</span><span class="op">.</span><span class="nam">size</span><span class="op">(</span><span class="nam">skip_leading_comments</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">relevant_parts</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"> <span class="key">return</span> <span class="nam">span</span><span class="op">.</span><span class="nam">end_pos</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"> <span class="key">def</span> <span class="nam">range_in_parent</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">skip_leading_comments</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Range</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"> <span class="str">"""The range of this token/element inside its parent</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"><span class="str"> This is operation is generally linear to the number of "parts" (elements/tokens)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"><span class="str"> inside the parent.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"><span class="str"> :param skip_leading_comments: If True, then if any leading comment that</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"><span class="str"> that can be skipped will be excluded in the position of this locatable.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"><span class="str"> This is useful if you want the position "semantic" content of a field</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"><span class="str"> without also highlighting a leading comment. Remember to align this</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"><span class="str"> parameter with the `size` call, so the range does not "overshoot"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"><span class="str"> into the next element (or falls short and only covers part of an</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"><span class="str"> element). Note that this option can only be used to filter out leading</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"><span class="str"> comments when the comments are a subset of the element. It has no</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"><span class="str"> effect on elements that are entirely made of comments.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"> <span class="nam">pos</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">position_in_parent</span><span class="op">(</span><span class="nam">skip_leading_comments</span><span class="op">=</span><span class="nam">skip_leading_comments</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"> <span class="key">return</span> <span class="nam">Range</span><span class="op">.</span><span class="nam">from_position_and_size</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"> <span class="nam">pos</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">size</span><span class="op">(</span><span class="nam">skip_leading_comments</span><span class="op">=</span><span class="nam">skip_leading_comments</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"> <span class="key">def</span> <span class="nam">position_in_file</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">skip_leading_comments</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Position</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"> <span class="str">"""The start position of this token/element in this file</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"><span class="str"> This is an *expensive* operation and in many cases have to traverse</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"><span class="str"> the entire file structure to answer the query. Consider whether</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"><span class="str"> you can maintain the parent's position and then use</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"><span class="str"> `position_in_parent()` combined with</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"><span class="str"> `child_position.relative_to(parent_position)`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"><span class="str"> :param skip_leading_comments: If True, then if any leading comment that</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"><span class="str"> that can be skipped will be excluded in the position of this locatable.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"><span class="str"> This is useful if you want the position "semantic" content of a field</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"><span class="str"> without also highlighting a leading comment. Remember to align this</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"><span class="str"> parameter with the `size` call, so the range does not "overshoot"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t385" href="#t385">385</a></span><span class="t"><span class="str"> into the next element (or falls short and only covers part of an</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t386" href="#t386">386</a></span><span class="t"><span class="str"> element). Note that this option can only be used to filter out leading</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t387" href="#t387">387</a></span><span class="t"><span class="str"> comments when the comments are a subset of the element. It has no</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t388" href="#t388">388</a></span><span class="t"><span class="str"> effect on elements that are entirely made of comments.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t389" href="#t389">389</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t390" href="#t390">390</a></span><span class="t"> <span class="nam">position</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">position_in_parent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t391" href="#t391">391</a></span><span class="t"> <span class="nam">skip_leading_comments</span><span class="op">=</span><span class="nam">skip_leading_comments</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t392" href="#t392">392</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t393" href="#t393">393</a></span><span class="t"> <span class="nam">parent</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">parent_element</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t394" href="#t394">394</a></span><span class="t"> <span class="key">if</span> <span class="nam">parent</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">394 ↛ 397</span><span class="annotate long">line 394 didn't jump to line 397, because the condition on line 394 was never false</span></span></p> - <p class="run"><span class="n"><a id="t395" href="#t395">395</a></span><span class="t"> <span class="nam">parent_position</span> <span class="op">=</span> <span class="nam">parent</span><span class="op">.</span><span class="nam">position_in_file</span><span class="op">(</span><span class="nam">skip_leading_comments</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t396" href="#t396">396</a></span><span class="t"> <span class="nam">position</span> <span class="op">=</span> <span class="nam">position</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span><span class="nam">parent_position</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t397" href="#t397">397</a></span><span class="t"> <span class="key">return</span> <span class="nam">position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t398" href="#t398">398</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t399" href="#t399">399</a></span><span class="t"> <span class="key">def</span> <span class="nam">size</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">skip_leading_comments</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Range</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t400" href="#t400">400</a></span><span class="t"> <span class="str">"""Describe the objects size as a continuous range</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t401" href="#t401">401</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t402" href="#t402">402</a></span><span class="t"><span class="str"> :param skip_leading_comments: If True, then if any leading comment that</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t403" href="#t403">403</a></span><span class="t"><span class="str"> that can be skipped will be excluded in the position of this locatable.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t404" href="#t404">404</a></span><span class="t"><span class="str"> This is useful if you want the position "semantic" content of a field</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t405" href="#t405">405</a></span><span class="t"><span class="str"> without also highlighting a leading comment. Remember to align this</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t406" href="#t406">406</a></span><span class="t"><span class="str"> parameter with the `position_in_file` or `position_in_parent` call,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t407" href="#t407">407</a></span><span class="t"><span class="str"> so the range does not "overshoot" into the next element (or falls</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t408" href="#t408">408</a></span><span class="t"><span class="str"> short and only covers part of an element). Note that this option can</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t409" href="#t409">409</a></span><span class="t"><span class="str"> only be used to filter out leading comments when the comments are a</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t410" href="#t410">410</a></span><span class="t"><span class="str"> subset of the element. It has no effect on elements that are entirely</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t411" href="#t411">411</a></span><span class="t"><span class="str"> made of comments.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t412" href="#t412">412</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t413" href="#t413">413</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_e9c451f4ae334f76_formatter_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_e9c451f4ae334f76_parsing_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_e9c451f4ae334f76_parsing_py.html b/coverage-report/d_e9c451f4ae334f76_parsing_py.html deleted file mode 100644 index 40a0c05..0000000 --- a/coverage-report/d_e9c451f4ae334f76_parsing_py.html +++ /dev/null @@ -1,3596 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/lsp/vendoring/_deb822_repro/parsing.py: 59%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/lsp/vendoring/_deb822_repro/parsing.py</b>: - <span class="pc_cov">59%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">1464 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">923<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">541<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">30<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">80<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_e9c451f4ae334f76_locatable_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_e9c451f4ae334f76_tokens_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="pln"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="com"># -*- coding: utf-8 -*- vim: fileencoding=utf-8 :</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">collections</span><span class="op">.</span><span class="nam">abc</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">import</span> <span class="nam">contextlib</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="key">import</span> <span class="nam">sys</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">import</span> <span class="nam">textwrap</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">import</span> <span class="nam">weakref</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"><span class="key">from</span> <span class="nam">abc</span> <span class="key">import</span> <span class="nam">ABC</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"><span class="key">from</span> <span class="nam">types</span> <span class="key">import</span> <span class="nam">TracebackType</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"><span class="key">from</span> <span class="nam">weakref</span> <span class="key">import</span> <span class="nam">ReferenceType</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">_util</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">combine_into_replacement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">BufferingIterator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> <span class="nam">len_check_iterator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">formatter</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="nam">FormatterContentToken</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">one_value_per_line_trailing_separator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="nam">format_field</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">locatable</span> <span class="key">import</span> <span class="nam">Locatable</span><span class="op">,</span> <span class="nam">START_POSITION</span><span class="op">,</span> <span class="nam">Position</span><span class="op">,</span> <span class="nam">Range</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">tokens</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">Deb822Token</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="nam">Deb822ValueToken</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="nam">Deb822SemanticallySignificantWhiteSpace</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> <span class="nam">Deb822SpaceSeparatorToken</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="nam">Deb822CommentToken</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> <span class="nam">Deb822WhitespaceToken</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="nam">Deb822ValueContinuationToken</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="nam">Deb822NewlineAfterValueToken</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="nam">Deb822CommaToken</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="nam">Deb822FieldNameToken</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="nam">Deb822FieldSeparatorToken</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="nam">Deb822ErrorToken</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="nam">tokenize_deb822_file</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"> <span class="nam">comma_split_tokenizer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"> <span class="nam">whitespace_split_tokenizer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">types</span> <span class="key">import</span> <span class="nam">AmbiguousDeb822FieldKeyError</span><span class="op">,</span> <span class="nam">SyntaxOrParseError</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"><span class="key">from</span> <span class="nam">debian</span><span class="op">.</span><span class="nam">_util</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">resolve_ref</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">LinkedList</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"> <span class="nam">LinkedListNode</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="nam">OrderedSet</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="nam">_strI</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"> <span class="nam">default_field_sort_key</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"><span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> <span class="nam">Iterable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"> <span class="nam">Iterator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"> <span class="nam">List</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"> <span class="nam">Union</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">Dict</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"> <span class="nam">Optional</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"> <span class="nam">Callable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"> <span class="nam">Any</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"> <span class="nam">Generic</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"> <span class="nam">Type</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="nam">Tuple</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"> <span class="nam">IO</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> <span class="nam">cast</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"> <span class="nam">overload</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"> <span class="nam">Mapping</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="nam">TYPE_CHECKING</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="nam">Sequence</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"> <span class="key">from</span> <span class="nam">debian</span><span class="op">.</span><span class="nam">_util</span> <span class="key">import</span> <span class="nam">T</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="com"># for some reason, pylint does not see that Commentish is used in typing</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> <span class="key">from</span> <span class="op">.</span><span class="nam">types</span> <span class="key">import</span> <span class="op">(</span> <span class="com"># pylint: disable=unused-import</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> <span class="nam">ST</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="nam">VE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> <span class="nam">TE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"> <span class="nam">ParagraphKey</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"> <span class="nam">TokenOrElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"> <span class="nam">Commentish</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"> <span class="nam">ParagraphKeyBase</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"> <span class="nam">FormatterCallback</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"> <span class="key">if</span> <span class="nam">TYPE_CHECKING</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="nam">StreamingValueParser</span> <span class="op">=</span> <span class="nam">Callable</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> <span class="op">[</span><span class="nam">Deb822Token</span><span class="op">,</span> <span class="nam">BufferingIterator</span><span class="op">[</span><span class="nam">Deb822Token</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> <span class="nam">VE</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"> <span class="nam">StrToValueParser</span> <span class="op">=</span> <span class="nam">Callable</span><span class="op">[</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">Iterable</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="str">"Deb822Token"</span><span class="op">,</span> <span class="nam">VE</span><span class="op">]</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"> <span class="nam">KVPNode</span> <span class="op">=</span> <span class="nam">LinkedListNode</span><span class="op">[</span><span class="str">"Deb822KeyValuePairElement"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> <span class="nam">StreamingValueParser</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"> <span class="nam">StrToValueParser</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="nam">KVPNode</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"><span class="key">except</span> <span class="nam">ImportError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">TYPE_CHECKING</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"> <span class="com"># pylint: disable=unnecessary-lambda-assignment</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"> <span class="nam">cast</span> <span class="op">=</span> <span class="key">lambda</span> <span class="nam">t</span><span class="op">,</span> <span class="nam">v</span><span class="op">:</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"> <span class="nam">overload</span> <span class="op">=</span> <span class="key">lambda</span> <span class="nam">f</span><span class="op">:</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"><span class="key">class</span> <span class="nam">ValueReference</span><span class="op">(</span><span class="nam">Generic</span><span class="op">[</span><span class="nam">TE</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> <span class="str">"""Reference to a value inside a Deb822 paragraph</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"><span class="str"> This is useful for cases where want to modify values "in-place" or maybe</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"><span class="str"> conditionally remove a value after looking at it.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"><span class="str"> ValueReferences can be invalidated by various changes or actions performed</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"><span class="str"> to the underlying provider of the value reference. As an example, sorting</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"><span class="str"> a list of values will generally invalidate all ValueReferences related to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"><span class="str"> that list.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"><span class="str"> The ValueReference will raise validity issues where it detects them but most</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"><span class="str"> of the time it will not notice. As a means to this end, the ValueReference</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"><span class="str"> will *not* keep a strong reference to the underlying value. This enables it</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"><span class="str"> to detect when the container goes out of scope. However, keep in mind that</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"><span class="str"> the timeliness of garbage collection is implementation defined (e.g., pypy</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"><span class="str"> does not use ref-counting).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="str">"_node"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="str">"_render"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> <span class="str">"_value_factory"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="str">"_removal_handler"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="str">"_mutation_notifier"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="nam">node</span><span class="op">,</span> <span class="com"># type: LinkedListNode[TE]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="nam">render</span><span class="op">,</span> <span class="com"># type: Callable[[TE], str]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="nam">value_factory</span><span class="op">,</span> <span class="com"># type: Callable[[str], TE]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="nam">removal_handler</span><span class="op">,</span> <span class="com"># type: Callable[[LinkedListNode[TokenOrElement]], None]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="nam">mutation_notifier</span><span class="op">,</span> <span class="com"># type: Optional[Callable[[], None]]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_node</span> <span class="op">=</span> <span class="nam">weakref</span><span class="op">.</span><span class="nam">ref</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="nam">node</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="op">)</span> <span class="com"># type: Optional[ReferenceType[LinkedListNode[TE]]]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_render</span> <span class="op">=</span> <span class="nam">render</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_value_factory</span> <span class="op">=</span> <span class="nam">value_factory</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_removal_handler</span> <span class="op">=</span> <span class="nam">removal_handler</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_mutation_notifier</span> <span class="op">=</span> <span class="nam">mutation_notifier</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="key">def</span> <span class="nam">_resolve_node</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="com"># type: () -> LinkedListNode[TE]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="com"># NB: We check whether the "ref" itself is None (instead of the ref resolving to None)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> <span class="com"># This enables us to tell the difference between "known removal" vs. "garbage collected"</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_node</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">148 ↛ 149</span><span class="annotate long">line 148 didn't jump to line 149, because the condition on line 148 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="key">raise</span> <span class="nam">RuntimeError</span><span class="op">(</span><span class="str">"Cannot use ValueReference after remove()"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="nam">node</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_node</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="key">if</span> <span class="nam">node</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">151 ↛ 152</span><span class="annotate long">line 151 didn't jump to line 152, because the condition on line 151 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> <span class="key">raise</span> <span class="nam">RuntimeError</span><span class="op">(</span><span class="str">"ValueReference is invalid (garbage collected)"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="key">return</span> <span class="nam">node</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="key">def</span> <span class="nam">value</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> <span class="com"># type: () -> str</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="str">"""Resolve the reference into a str"""</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_render</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_resolve_node</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">value</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="op">@</span><span class="nam">value</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> <span class="key">def</span> <span class="nam">value</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">new_value</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="com"># type: (str) -> None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="str">"""Update the reference value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"><span class="str"> Updating the value via this method will *not* invalidate the reference (or other</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"><span class="str"> references to the same container).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"><span class="str"> This can raise an exception if the new value does not follow the requirements</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"><span class="str"> for the referenced values. As an example, values in whitespace separated</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"><span class="str"> lists cannot contain spaces and would trigger an exception.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_resolve_node</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">value</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_value_factory</span><span class="op">(</span><span class="nam">new_value</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_mutation_notifier</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_mutation_notifier</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="key">def</span> <span class="nam">locatable</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="com"># type: () -> Locatable</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="str">"""Reference to a locatable that can be used to determine where this value is"""</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_resolve_node</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="key">def</span> <span class="nam">remove</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="com"># type: () -> None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="str">"""Remove the underlying value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"><span class="str"> This will invalidate the ValueReference (and any other ValueReferences pointing</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"><span class="str"> to that exact value). The validity of other ValueReferences to that container</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"><span class="str"> remains unaffected.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_removal_handler</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="nam">cast</span><span class="op">(</span><span class="str">"LinkedListNode[TokenOrElement]"</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_resolve_node</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_node</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"><span class="key">if</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">version_info</span> <span class="op">>=</span> <span class="op">(</span><span class="num">3</span><span class="op">,</span> <span class="num">9</span><span class="op">)</span> <span class="key">or</span> <span class="nam">TYPE_CHECKING</span><span class="op">:</span> </span><span class="r"><span class="annotate short">197 ↛ 204</span><span class="annotate long">line 197 didn't jump to line 204, because the condition on line 197 was never false</span></span></p> - <p class="run"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="nam">_Deb822ParsedTokenList_ContextManager</span> <span class="op">=</span> <span class="nam">contextlib</span><span class="op">.</span><span class="nam">AbstractContextManager</span><span class="op">[</span><span class="nam">T</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"><span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="com"># Python 3.5 - 3.8 compat - we are not allowed to subscript the abc.Iterator</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="com"># - use this little hack to work around it</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> <span class="com"># Note that Python 3.5 is so old that it does not have AbstractContextManager,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="com"># so we re-implement it here.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="key">class</span> <span class="nam">_Deb822ParsedTokenList_ContextManager</span><span class="op">(</span><span class="nam">Generic</span><span class="op">[</span><span class="nam">T</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="key">def</span> <span class="nam">__enter__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"> <span class="key">def</span> <span class="nam">__exit__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">exc_type</span><span class="op">,</span> <span class="nam">exc_val</span><span class="op">,</span> <span class="nam">exc_tb</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822ParsedTokenList</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"> <span class="nam">Generic</span><span class="op">[</span><span class="nam">VE</span><span class="op">,</span> <span class="nam">ST</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"> <span class="nam">_Deb822ParsedTokenList_ContextManager</span><span class="op">[</span><span class="str">"Deb822ParsedTokenList[VE, ST]"</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="nam">kvpair_element</span><span class="op">,</span> <span class="com"># type: 'Deb822KeyValuePairElement'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="nam">interpreted_value_element</span><span class="op">,</span> <span class="com"># type: Deb822InterpretationProxyElement</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="nam">vtype</span><span class="op">,</span> <span class="com"># type: Type[VE]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="nam">stype</span><span class="op">,</span> <span class="com"># type: Type[ST]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> <span class="nam">str2value_parser</span><span class="op">,</span> <span class="com"># type: StrToValueParser[VE]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> <span class="nam">default_separator_factory</span><span class="op">,</span> <span class="com"># type: Callable[[], ST]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"> <span class="nam">render</span><span class="op">,</span> <span class="com"># type: Callable[[VE], str]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> <span class="com"># type: (...) -> None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_element</span> <span class="op">=</span> <span class="nam">kvpair_element</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_proxy_element</span> <span class="op">=</span> <span class="nam">interpreted_value_element</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_list</span> <span class="op">=</span> <span class="nam">LinkedList</span><span class="op">(</span><span class="nam">interpreted_value_element</span><span class="op">.</span><span class="nam">parts</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_vtype</span> <span class="op">=</span> <span class="nam">vtype</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_stype</span> <span class="op">=</span> <span class="nam">stype</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_str2value_parser</span> <span class="op">=</span> <span class="nam">str2value_parser</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_default_separator_factory</span> <span class="op">=</span> <span class="nam">default_separator_factory</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_value_factory</span> <span class="op">=</span> <span class="nam">_parser_to_value_factory</span><span class="op">(</span><span class="nam">str2value_parser</span><span class="op">,</span> <span class="nam">vtype</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_render</span> <span class="op">=</span> <span class="nam">render</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_format_preserve_original_formatting</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_formatter</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="nam">one_value_per_line_trailing_separator</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="op">)</span> <span class="com"># type: FormatterCallback</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_changed</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">__continuation_line_char</span> <span class="op">=</span> <span class="key">None</span> <span class="com"># type: Optional[str]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> <span class="key">assert</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_list</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"> <span class="nam">last_token</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_list</span><span class="op">.</span><span class="nam">tail</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> <span class="key">if</span> <span class="nam">last_token</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">isinstance</span><span class="op">(</span> </span><span class="r"><span class="annotate short">247 ↛ exit</span><span class="annotate long">line 247 didn't return from function '__init__', because the condition on line 247 was never false</span></span></p> - <p class="pln"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="nam">last_token</span><span class="op">,</span> <span class="nam">Deb822NewlineAfterValueToken</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> <span class="com"># We always remove the last newline (if present), because then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"> <span class="com"># adding values will happen after the last value rather than on</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="com"># a new line by default.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> <span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="com"># On write, we always ensure the value ends on a newline (even</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> <span class="com"># if it did not before). This is simpler and should be a</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> <span class="com"># non-issue in practise.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_list</span><span class="op">.</span><span class="nam">pop</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> <span class="key">def</span> <span class="nam">__iter__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="com"># type: () -> Iterator[str]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_render</span><span class="op">(</span><span class="nam">v</span><span class="op">)</span> <span class="key">for</span> <span class="nam">v</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">value_parts</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="key">def</span> <span class="nam">__bool__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="com"># type: () -> bool</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="key">return</span> <span class="nam">next</span><span class="op">(</span><span class="nam">iter</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">,</span> <span class="key">None</span><span class="op">)</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> <span class="key">def</span> <span class="nam">__exit__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> <span class="nam">exc_type</span><span class="op">,</span> <span class="com"># type: Optional[Type[BaseException]]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="nam">exc_val</span><span class="op">,</span> <span class="com"># type: Optional[BaseException]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> <span class="nam">exc_tb</span><span class="op">,</span> <span class="com"># type: Optional[TracebackType]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="com"># type: (...) -> Optional[bool]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="key">if</span> <span class="nam">exc_type</span> <span class="key">is</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_changed</span><span class="op">:</span> </span><span class="r"><span class="annotate short">274 ↛ 276</span><span class="annotate long">line 274 didn't jump to line 276, because the condition on line 274 was never false</span></span></p> - <p class="run"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_update_field</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> <span class="key">return</span> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__exit__</span><span class="op">(</span><span class="nam">exc_type</span><span class="op">,</span> <span class="nam">exc_val</span><span class="op">,</span> <span class="nam">exc_tb</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> <span class="key">def</span> <span class="nam">value_parts</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="com"># type: () -> Iterator[VE]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="op">(</span><span class="nam">v</span> <span class="key">for</span> <span class="nam">v</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_list</span> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_vtype</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="key">def</span> <span class="nam">_mark_changed</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="com"># type: () -> None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_changed</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> <span class="key">def</span> <span class="nam">iter_value_references</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="com"># type: () -> Iterator[ValueReference[VE]]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="str">"""Iterate over all values in the list (as ValueReferences)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"><span class="str"> This is useful for doing inplace modification of the values or even</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"><span class="str"> streaming removal of field values. It is in general also more</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"><span class="str"> efficient when more than one value is updated or removed.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> <span class="nam">ValueReference</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="nam">cast</span><span class="op">(</span><span class="str">"LinkedListNode[VE]"</span><span class="op">,</span> <span class="nam">n</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_render</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_value_factory</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_remove_node</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_mark_changed</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> <span class="key">for</span> <span class="nam">n</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_list</span><span class="op">.</span><span class="nam">iter_nodes</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">n</span><span class="op">.</span><span class="nam">value</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_vtype</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> <span class="key">def</span> <span class="nam">append_separator</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">space_after_separator</span><span class="op">=</span><span class="key">True</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> <span class="com"># type: (bool) -> None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="nam">separator_token</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_default_separator_factory</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> <span class="key">if</span> <span class="nam">separator_token</span><span class="op">.</span><span class="nam">is_whitespace</span><span class="op">:</span> </span><span class="r"><span class="annotate short">311 ↛ 314</span><span class="annotate long">line 311 didn't jump to line 314, because the condition on line 311 was never false</span></span></p> - <p class="run"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="nam">space_after_separator</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_changed</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_append_continuation_line_token_if_necessary</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_list</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">separator_token</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> <span class="key">if</span> <span class="nam">space_after_separator</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">separator_token</span><span class="op">.</span><span class="nam">is_whitespace</span><span class="op">:</span> </span><span class="r"><span class="annotate short">318 ↛ 319</span><span class="annotate long">line 318 didn't jump to line 319, because the condition on line 318 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_list</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">Deb822WhitespaceToken</span><span class="op">(</span><span class="str">" "</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> <span class="key">def</span> <span class="nam">replace</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">orig_value</span><span class="op">,</span> <span class="nam">new_value</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="com"># type: (str, str) -> None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> <span class="str">"""Replace the first instance of a value with another</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"><span class="str"> This method will *not* affect the validity of ValueReferences.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> <span class="nam">vtype</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_vtype</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> <span class="key">for</span> <span class="nam">node</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_list</span><span class="op">.</span><span class="nam">iter_nodes</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">328 ↛ 334</span><span class="annotate long">line 328 didn't jump to line 334, because the loop on line 328 didn't complete</span></span></p> - <p class="run"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">node</span><span class="op">.</span><span class="nam">value</span><span class="op">,</span> <span class="nam">vtype</span><span class="op">)</span> <span class="key">and</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_render</span><span class="op">(</span><span class="nam">node</span><span class="op">.</span><span class="nam">value</span><span class="op">)</span> <span class="op">==</span> <span class="nam">orig_value</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> <span class="nam">node</span><span class="op">.</span><span class="nam">value</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_value_factory</span><span class="op">(</span><span class="nam">new_value</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_changed</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"list.replace(x, y): x not in list"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> <span class="key">def</span> <span class="nam">remove</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">value</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> <span class="com"># type: (str) -> None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> <span class="str">"""Remove the first instance of a value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"><span class="str"> Removal will invalidate ValueReferences to the value being removed.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"><span class="str"> ValueReferences to other values will be unaffected.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"> <span class="nam">vtype</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_vtype</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> <span class="key">for</span> <span class="nam">node</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_list</span><span class="op">.</span><span class="nam">iter_nodes</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">node</span><span class="op">.</span><span class="nam">value</span><span class="op">,</span> <span class="nam">vtype</span><span class="op">)</span> <span class="key">and</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_render</span><span class="op">(</span><span class="nam">node</span><span class="op">.</span><span class="nam">value</span><span class="op">)</span> <span class="op">==</span> <span class="nam">value</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"> <span class="nam">node_to_remove</span> <span class="op">=</span> <span class="nam">node</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"list.remove(x): x not in list"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_remove_node</span><span class="op">(</span><span class="nam">node_to_remove</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"> <span class="key">def</span> <span class="nam">_remove_node</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">node_to_remove</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"> <span class="com"># type: (LinkedListNode[TokenOrElement]) -> None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"> <span class="nam">vtype</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_vtype</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_changed</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"> <span class="com"># We naively want to remove the node and every thing to the left of it</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"> <span class="com"># until the previous value. That is the basic idea for now (ignoring</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"> <span class="com"># special-cases for now).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"> <span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"> <span class="com"># Example:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"> <span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"> <span class="com"># """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"> <span class="com"># Multiline-Keywords: bar[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"> <span class="com"># # Comment about foo</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"> <span class="com"># foo]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"> <span class="com"># baz</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"> <span class="com"># Keywords: bar[ foo] baz</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"> <span class="com"># Comma-List: bar[, foo], baz,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"> <span class="com"># Multiline-Comma-List: bar[,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"> <span class="com"># # Comment about foo</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"> <span class="com"># foo],</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"> <span class="com"># baz,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"> <span class="com"># """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"> <span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"> <span class="com"># Assuming we want to remove "foo" for the lists, the []-markers</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"> <span class="com"># show what we aim to remove. This has the nice side-effect of</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"> <span class="com"># preserving whether nor not the value has a trailing separator.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"> <span class="com"># Note that we do *not* attempt to repair missing separators but</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"> <span class="com"># it may fix duplicated separators by "accident".</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"> <span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"> <span class="com"># Now, there are two special cases to be aware of, where this approach</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"> <span class="com"># has short comings:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t385" href="#t385">385</a></span><span class="t"> <span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t386" href="#t386">386</a></span><span class="t"> <span class="com"># 1) If foo is the only value (in which case, "delete everything"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t387" href="#t387">387</a></span><span class="t"> <span class="com"># is the only option).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t388" href="#t388">388</a></span><span class="t"> <span class="com"># 2) If foo is the first value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t389" href="#t389">389</a></span><span class="t"> <span class="com"># 3) If foo is not the only value on the line and we see a comment</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t390" href="#t390">390</a></span><span class="t"> <span class="com"># inside the deletion range.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t391" href="#t391">391</a></span><span class="t"> <span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t392" href="#t392">392</a></span><span class="t"> <span class="com"># For 2) + 3), we attempt to flip and range to delete and every</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t393" href="#t393">393</a></span><span class="t"> <span class="com"># thing after it (up to but exclusion "baz") instead. This</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t394" href="#t394">394</a></span><span class="t"> <span class="com"># definitely fixes 3), but 2) has yet another corner case, namely:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t395" href="#t395">395</a></span><span class="t"> <span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t396" href="#t396">396</a></span><span class="t"> <span class="com"># """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t397" href="#t397">397</a></span><span class="t"> <span class="com"># Multiline-Comma-List: foo,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t398" href="#t398">398</a></span><span class="t"> <span class="com"># # Remark about bar</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t399" href="#t399">399</a></span><span class="t"> <span class="com"># bar,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t400" href="#t400">400</a></span><span class="t"> <span class="com"># Another-Case: foo</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t401" href="#t401">401</a></span><span class="t"> <span class="com"># # Remark, also we use leading separator</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t402" href="#t402">402</a></span><span class="t"> <span class="com"># , bar</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t403" href="#t403">403</a></span><span class="t"> <span class="com"># """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t404" href="#t404">404</a></span><span class="t"> <span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t405" href="#t405">405</a></span><span class="t"> <span class="com"># The options include:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t406" href="#t406">406</a></span><span class="t"> <span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t407" href="#t407">407</a></span><span class="t"> <span class="com"># A) Discard the comment - brain-dead simple</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t408" href="#t408">408</a></span><span class="t"> <span class="com"># B) Hoist the comment up to a field comment, but then what if the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t409" href="#t409">409</a></span><span class="t"> <span class="com"># field already has a comment?</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t410" href="#t410">410</a></span><span class="t"> <span class="com"># C) Clear the first value line leaving just the newline and</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t411" href="#t411">411</a></span><span class="t"> <span class="com"># replace the separator before "bar" (if present) with a space.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t412" href="#t412">412</a></span><span class="t"> <span class="com"># (leaving you with the value of the form "\n# ...\n bar")</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t413" href="#t413">413</a></span><span class="t"> <span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t414" href="#t414">414</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t415" href="#t415">415</a></span><span class="t"> <span class="nam">first_value_on_lhs</span> <span class="op">=</span> <span class="key">None</span> <span class="com"># type: Optional[LinkedListNode[TokenOrElement]]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t416" href="#t416">416</a></span><span class="t"> <span class="nam">first_value_on_rhs</span> <span class="op">=</span> <span class="key">None</span> <span class="com"># type: Optional[LinkedListNode[TokenOrElement]]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t417" href="#t417">417</a></span><span class="t"> <span class="nam">comment_before_previous_value</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t418" href="#t418">418</a></span><span class="t"> <span class="nam">comment_before_next_value</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t419" href="#t419">419</a></span><span class="t"> <span class="key">for</span> <span class="nam">past_node</span> <span class="key">in</span> <span class="nam">node_to_remove</span><span class="op">.</span><span class="nam">iter_previous</span><span class="op">(</span><span class="nam">skip_current</span><span class="op">=</span><span class="key">True</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t420" href="#t420">420</a></span><span class="t"> <span class="nam">past_token</span> <span class="op">=</span> <span class="nam">past_node</span><span class="op">.</span><span class="nam">value</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t421" href="#t421">421</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">past_token</span><span class="op">,</span> <span class="nam">Deb822Token</span><span class="op">)</span> <span class="key">and</span> <span class="nam">past_token</span><span class="op">.</span><span class="nam">is_comment</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t422" href="#t422">422</a></span><span class="t"> <span class="nam">comment_before_previous_value</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t423" href="#t423">423</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t424" href="#t424">424</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">past_token</span><span class="op">,</span> <span class="nam">vtype</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t425" href="#t425">425</a></span><span class="t"> <span class="nam">first_value_on_lhs</span> <span class="op">=</span> <span class="nam">past_node</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t426" href="#t426">426</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t427" href="#t427">427</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t428" href="#t428">428</a></span><span class="t"> <span class="key">for</span> <span class="nam">future_node</span> <span class="key">in</span> <span class="nam">node_to_remove</span><span class="op">.</span><span class="nam">iter_next</span><span class="op">(</span><span class="nam">skip_current</span><span class="op">=</span><span class="key">True</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t429" href="#t429">429</a></span><span class="t"> <span class="nam">future_token</span> <span class="op">=</span> <span class="nam">future_node</span><span class="op">.</span><span class="nam">value</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t430" href="#t430">430</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">future_token</span><span class="op">,</span> <span class="nam">Deb822Token</span><span class="op">)</span> <span class="key">and</span> <span class="nam">future_token</span><span class="op">.</span><span class="nam">is_comment</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t431" href="#t431">431</a></span><span class="t"> <span class="nam">comment_before_next_value</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t432" href="#t432">432</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t433" href="#t433">433</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">future_token</span><span class="op">,</span> <span class="nam">vtype</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t434" href="#t434">434</a></span><span class="t"> <span class="nam">first_value_on_rhs</span> <span class="op">=</span> <span class="nam">future_node</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t435" href="#t435">435</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t436" href="#t436">436</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t437" href="#t437">437</a></span><span class="t"> <span class="key">if</span> <span class="nam">first_value_on_rhs</span> <span class="key">is</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">first_value_on_lhs</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t438" href="#t438">438</a></span><span class="t"> <span class="com"># This was the last value, just remove everything.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t439" href="#t439">439</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_list</span><span class="op">.</span><span class="nam">clear</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t440" href="#t440">440</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t441" href="#t441">441</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t442" href="#t442">442</a></span><span class="t"> <span class="key">if</span> <span class="nam">first_value_on_lhs</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">comment_before_previous_value</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t443" href="#t443">443</a></span><span class="t"> <span class="com"># Delete left</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t444" href="#t444">444</a></span><span class="t"> <span class="nam">delete_lhs_of_node</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t445" href="#t445">445</a></span><span class="t"> <span class="key">elif</span> <span class="nam">first_value_on_rhs</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">comment_before_next_value</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t446" href="#t446">446</a></span><span class="t"> <span class="com"># Delete right</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t447" href="#t447">447</a></span><span class="t"> <span class="nam">delete_lhs_of_node</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t448" href="#t448">448</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t449" href="#t449">449</a></span><span class="t"> <span class="com"># There is a comment on either side (or no value on one and a</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t450" href="#t450">450</a></span><span class="t"> <span class="com"># comment and the other). Keep it simple, we just delete to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t451" href="#t451">451</a></span><span class="t"> <span class="com"># one side (preferring deleting to left if possible).</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t452" href="#t452">452</a></span><span class="t"> <span class="nam">delete_lhs_of_node</span> <span class="op">=</span> <span class="nam">first_value_on_lhs</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t453" href="#t453">453</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t454" href="#t454">454</a></span><span class="t"> <span class="key">if</span> <span class="nam">delete_lhs_of_node</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t455" href="#t455">455</a></span><span class="t"> <span class="nam">first_remain_lhs</span> <span class="op">=</span> <span class="nam">first_value_on_lhs</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t456" href="#t456">456</a></span><span class="t"> <span class="nam">first_remain_rhs</span> <span class="op">=</span> <span class="nam">node_to_remove</span><span class="op">.</span><span class="nam">next_node</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t457" href="#t457">457</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t458" href="#t458">458</a></span><span class="t"> <span class="nam">first_remain_lhs</span> <span class="op">=</span> <span class="nam">node_to_remove</span><span class="op">.</span><span class="nam">previous_node</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t459" href="#t459">459</a></span><span class="t"> <span class="nam">first_remain_rhs</span> <span class="op">=</span> <span class="nam">first_value_on_rhs</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t460" href="#t460">460</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t461" href="#t461">461</a></span><span class="t"> <span class="com"># Actual deletion - with some manual labour to update HEAD/TAIL of</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t462" href="#t462">462</a></span><span class="t"> <span class="com"># the list in case we do a "delete everything left/right this node".</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t463" href="#t463">463</a></span><span class="t"> <span class="key">if</span> <span class="nam">first_remain_lhs</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t464" href="#t464">464</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_list</span><span class="op">.</span><span class="nam">head_node</span> <span class="op">=</span> <span class="nam">first_remain_rhs</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t465" href="#t465">465</a></span><span class="t"> <span class="key">if</span> <span class="nam">first_remain_rhs</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t466" href="#t466">466</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_list</span><span class="op">.</span><span class="nam">tail_node</span> <span class="op">=</span> <span class="nam">first_remain_lhs</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t467" href="#t467">467</a></span><span class="t"> <span class="nam">LinkedListNode</span><span class="op">.</span><span class="nam">link_nodes</span><span class="op">(</span><span class="nam">first_remain_lhs</span><span class="op">,</span> <span class="nam">first_remain_rhs</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t468" href="#t468">468</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t469" href="#t469">469</a></span><span class="t"> <span class="key">def</span> <span class="nam">append</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">value</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t470" href="#t470">470</a></span><span class="t"> <span class="com"># type: (str) -> None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t471" href="#t471">471</a></span><span class="t"> <span class="nam">vt</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_value_factory</span><span class="op">(</span><span class="nam">value</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t472" href="#t472">472</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">append_value</span><span class="op">(</span><span class="nam">vt</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t473" href="#t473">473</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t474" href="#t474">474</a></span><span class="t"> <span class="key">def</span> <span class="nam">append_value</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">vt</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t475" href="#t475">475</a></span><span class="t"> <span class="com"># type: (VE) -> None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t476" href="#t476">476</a></span><span class="t"> <span class="nam">value_parts</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_list</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t477" href="#t477">477</a></span><span class="t"> <span class="key">if</span> <span class="nam">value_parts</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t478" href="#t478">478</a></span><span class="t"> <span class="nam">needs_separator</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t479" href="#t479">479</a></span><span class="t"> <span class="nam">stype</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_stype</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t480" href="#t480">480</a></span><span class="t"> <span class="nam">vtype</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_vtype</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t481" href="#t481">481</a></span><span class="t"> <span class="key">for</span> <span class="nam">t</span> <span class="key">in</span> <span class="nam">reversed</span><span class="op">(</span><span class="nam">value_parts</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">481 ↛ 488</span><span class="annotate long">line 481 didn't jump to line 488, because the loop on line 481 didn't complete</span></span></p> - <p class="run"><span class="n"><a id="t482" href="#t482">482</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">t</span><span class="op">,</span> <span class="nam">vtype</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t483" href="#t483">483</a></span><span class="t"> <span class="nam">needs_separator</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t484" href="#t484">484</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t485" href="#t485">485</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">t</span><span class="op">,</span> <span class="nam">stype</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t486" href="#t486">486</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t487" href="#t487">487</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t488" href="#t488">488</a></span><span class="t"> <span class="key">if</span> <span class="nam">needs_separator</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t489" href="#t489">489</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">append_separator</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t490" href="#t490">490</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t491" href="#t491">491</a></span><span class="t"> <span class="com"># Looks nicer if there is a space before the very first value</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t492" href="#t492">492</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_list</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">Deb822WhitespaceToken</span><span class="op">(</span><span class="str">" "</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t493" href="#t493">493</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_append_continuation_line_token_if_necessary</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t494" href="#t494">494</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_changed</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t495" href="#t495">495</a></span><span class="t"> <span class="nam">value_parts</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">vt</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t496" href="#t496">496</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t497" href="#t497">497</a></span><span class="t"> <span class="key">def</span> <span class="nam">_previous_is_newline</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t498" href="#t498">498</a></span><span class="t"> <span class="com"># type: () -> bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t499" href="#t499">499</a></span><span class="t"> <span class="nam">tail</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_list</span><span class="op">.</span><span class="nam">tail</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t500" href="#t500">500</a></span><span class="t"> <span class="key">return</span> <span class="nam">tail</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">tail</span><span class="op">.</span><span class="nam">convert_to_text</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t501" href="#t501">501</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t502" href="#t502">502</a></span><span class="t"> <span class="key">def</span> <span class="nam">append_newline</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t503" href="#t503">503</a></span><span class="t"> <span class="com"># type: () -> None</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t504" href="#t504">504</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_previous_is_newline</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">504 ↛ 505</span><span class="annotate long">line 504 didn't jump to line 505, because the condition on line 504 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t505" href="#t505">505</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t506" href="#t506">506</a></span><span class="t"> <span class="str">"Cannot add a newline after a token that ends on a newline"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t507" href="#t507">507</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t508" href="#t508">508</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_list</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">Deb822NewlineAfterValueToken</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t509" href="#t509">509</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t510" href="#t510">510</a></span><span class="t"> <span class="key">def</span> <span class="nam">append_comment</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">comment_text</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t511" href="#t511">511</a></span><span class="t"> <span class="com"># type: (str) -> None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t512" href="#t512">512</a></span><span class="t"> <span class="nam">tail</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_list</span><span class="op">.</span><span class="nam">tail</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t513" href="#t513">513</a></span><span class="t"> <span class="key">if</span> <span class="nam">tail</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="key">not</span> <span class="nam">tail</span><span class="op">.</span><span class="nam">convert_to_text</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t514" href="#t514">514</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">append_newline</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t515" href="#t515">515</a></span><span class="t"> <span class="nam">comment_token</span> <span class="op">=</span> <span class="nam">Deb822CommentToken</span><span class="op">(</span><span class="nam">_format_comment</span><span class="op">(</span><span class="nam">comment_text</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t516" href="#t516">516</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_list</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">comment_token</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t517" href="#t517">517</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t518" href="#t518">518</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t519" href="#t519">519</a></span><span class="t"> <span class="key">def</span> <span class="nam">_continuation_line_char</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t520" href="#t520">520</a></span><span class="t"> <span class="com"># type: () -> str</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t521" href="#t521">521</a></span><span class="t"> <span class="nam">char</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">__continuation_line_char</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t522" href="#t522">522</a></span><span class="t"> <span class="key">if</span> <span class="nam">char</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t523" href="#t523">523</a></span><span class="t"> <span class="com"># Use ' ' by default but match the existing field if possible.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t524" href="#t524">524</a></span><span class="t"> <span class="nam">char</span> <span class="op">=</span> <span class="str">" "</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t525" href="#t525">525</a></span><span class="t"> <span class="key">for</span> <span class="nam">token</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_list</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t526" href="#t526">526</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">token</span><span class="op">,</span> <span class="nam">Deb822ValueContinuationToken</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t527" href="#t527">527</a></span><span class="t"> <span class="nam">char</span> <span class="op">=</span> <span class="nam">token</span><span class="op">.</span><span class="nam">text</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t528" href="#t528">528</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t529" href="#t529">529</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">__continuation_line_char</span> <span class="op">=</span> <span class="nam">char</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t530" href="#t530">530</a></span><span class="t"> <span class="key">return</span> <span class="nam">char</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t531" href="#t531">531</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t532" href="#t532">532</a></span><span class="t"> <span class="key">def</span> <span class="nam">_append_continuation_line_token_if_necessary</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t533" href="#t533">533</a></span><span class="t"> <span class="com"># type: () -> None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t534" href="#t534">534</a></span><span class="t"> <span class="nam">tail</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_list</span><span class="op">.</span><span class="nam">tail</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t535" href="#t535">535</a></span><span class="t"> <span class="key">if</span> <span class="nam">tail</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">tail</span><span class="op">.</span><span class="nam">convert_to_text</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">535 ↛ 536</span><span class="annotate long">line 535 didn't jump to line 536, because the condition on line 535 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t536" href="#t536">536</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_list</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t537" href="#t537">537</a></span><span class="t"> <span class="nam">Deb822ValueContinuationToken</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_continuation_line_char</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t538" href="#t538">538</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t539" href="#t539">539</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t540" href="#t540">540</a></span><span class="t"> <span class="key">def</span> <span class="nam">reformat_when_finished</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t541" href="#t541">541</a></span><span class="t"> <span class="com"># type: () -> None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t542" href="#t542">542</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_enable_reformatting</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t543" href="#t543">543</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_changed</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t544" href="#t544">544</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t545" href="#t545">545</a></span><span class="t"> <span class="key">def</span> <span class="nam">_enable_reformatting</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t546" href="#t546">546</a></span><span class="t"> <span class="com"># type: () -> None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t547" href="#t547">547</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_format_preserve_original_formatting</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t548" href="#t548">548</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t549" href="#t549">549</a></span><span class="t"> <span class="key">def</span> <span class="nam">no_reformatting_when_finished</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t550" href="#t550">550</a></span><span class="t"> <span class="com"># type: () -> None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t551" href="#t551">551</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_format_preserve_original_formatting</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t552" href="#t552">552</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t553" href="#t553">553</a></span><span class="t"> <span class="key">def</span> <span class="nam">value_formatter</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t554" href="#t554">554</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t555" href="#t555">555</a></span><span class="t"> <span class="nam">formatter</span><span class="op">,</span> <span class="com"># type: FormatterCallback</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t556" href="#t556">556</a></span><span class="t"> <span class="nam">force_reformat</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> <span class="com"># type: bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t557" href="#t557">557</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t558" href="#t558">558</a></span><span class="t"> <span class="com"># type: (...) -> None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t559" href="#t559">559</a></span><span class="t"> <span class="str">"""Use a custom formatter when formatting the value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t560" href="#t560">560</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t561" href="#t561">561</a></span><span class="t"><span class="str"> :param formatter: A formatter (see debian._deb822_repro.formatter.format_field</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t562" href="#t562">562</a></span><span class="t"><span class="str"> for details)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t563" href="#t563">563</a></span><span class="t"><span class="str"> :param force_reformat: If True, always reformat the field even if there are</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t564" href="#t564">564</a></span><span class="t"><span class="str"> no (other) changes performed. By default, fields are only reformatted if</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t565" href="#t565">565</a></span><span class="t"><span class="str"> they are changed.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t566" href="#t566">566</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t567" href="#t567">567</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_formatter</span> <span class="op">=</span> <span class="nam">formatter</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t568" href="#t568">568</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_format_preserve_original_formatting</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t569" href="#t569">569</a></span><span class="t"> <span class="key">if</span> <span class="nam">force_reformat</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t570" href="#t570">570</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_changed</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t571" href="#t571">571</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t572" href="#t572">572</a></span><span class="t"> <span class="key">def</span> <span class="nam">clear</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t573" href="#t573">573</a></span><span class="t"> <span class="com"># type: () -> None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t574" href="#t574">574</a></span><span class="t"> <span class="str">"""Like list.clear() - removes all content (including comments and spaces)"""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t575" href="#t575">575</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_list</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t576" href="#t576">576</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_changed</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t577" href="#t577">577</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_list</span><span class="op">.</span><span class="nam">clear</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t578" href="#t578">578</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t579" href="#t579">579</a></span><span class="t"> <span class="key">def</span> <span class="nam">_iter_content_as_tokens</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t580" href="#t580">580</a></span><span class="t"> <span class="com"># type: () -> Iterable[Deb822Token]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t581" href="#t581">581</a></span><span class="t"> <span class="key">for</span> <span class="nam">te</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_list</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t582" href="#t582">582</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">te</span><span class="op">,</span> <span class="nam">Deb822Element</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t583" href="#t583">583</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">te</span><span class="op">.</span><span class="nam">iter_tokens</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t584" href="#t584">584</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t585" href="#t585">585</a></span><span class="t"> <span class="key">yield</span> <span class="nam">te</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t586" href="#t586">586</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t587" href="#t587">587</a></span><span class="t"> <span class="key">def</span> <span class="nam">_generate_reformatted_field_content</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t588" href="#t588">588</a></span><span class="t"> <span class="com"># type: () -> str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t589" href="#t589">589</a></span><span class="t"> <span class="nam">separator_token</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_default_separator_factory</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t590" href="#t590">590</a></span><span class="t"> <span class="nam">vtype</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_vtype</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t591" href="#t591">591</a></span><span class="t"> <span class="nam">stype</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_stype</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t592" href="#t592">592</a></span><span class="t"> <span class="nam">token_list</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_list</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t593" href="#t593">593</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t594" href="#t594">594</a></span><span class="t"> <span class="key">def</span> <span class="nam">_token_iter</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t595" href="#t595">595</a></span><span class="t"> <span class="com"># type: () -> Iterator[FormatterContentToken]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t596" href="#t596">596</a></span><span class="t"> <span class="nam">text</span> <span class="op">=</span> <span class="str">""</span> <span class="com"># type: str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t597" href="#t597">597</a></span><span class="t"> <span class="key">for</span> <span class="nam">te</span> <span class="key">in</span> <span class="nam">token_list</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t598" href="#t598">598</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">te</span><span class="op">,</span> <span class="nam">Deb822Token</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t599" href="#t599">599</a></span><span class="t"> <span class="key">if</span> <span class="nam">te</span><span class="op">.</span><span class="nam">is_comment</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t600" href="#t600">600</a></span><span class="t"> <span class="key">yield</span> <span class="nam">FormatterContentToken</span><span class="op">.</span><span class="nam">comment_token</span><span class="op">(</span><span class="nam">te</span><span class="op">.</span><span class="nam">text</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t601" href="#t601">601</a></span><span class="t"> <span class="key">elif</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">te</span><span class="op">,</span> <span class="nam">stype</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t602" href="#t602">602</a></span><span class="t"> <span class="nam">text</span> <span class="op">=</span> <span class="nam">te</span><span class="op">.</span><span class="nam">text</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t603" href="#t603">603</a></span><span class="t"> <span class="key">yield</span> <span class="nam">FormatterContentToken</span><span class="op">.</span><span class="nam">separator_token</span><span class="op">(</span><span class="nam">text</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t604" href="#t604">604</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t605" href="#t605">605</a></span><span class="t"> <span class="key">assert</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">te</span><span class="op">,</span> <span class="nam">vtype</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t606" href="#t606">606</a></span><span class="t"> <span class="nam">text</span> <span class="op">=</span> <span class="nam">te</span><span class="op">.</span><span class="nam">convert_to_text</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t607" href="#t607">607</a></span><span class="t"> <span class="key">yield</span> <span class="nam">FormatterContentToken</span><span class="op">.</span><span class="nam">value_token</span><span class="op">(</span><span class="nam">text</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t608" href="#t608">608</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t609" href="#t609">609</a></span><span class="t"> <span class="key">return</span> <span class="nam">format_field</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t610" href="#t610">610</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_formatter</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t611" href="#t611">611</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_element</span><span class="op">.</span><span class="nam">field_name</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t612" href="#t612">612</a></span><span class="t"> <span class="nam">FormatterContentToken</span><span class="op">.</span><span class="nam">separator_token</span><span class="op">(</span><span class="nam">separator_token</span><span class="op">.</span><span class="nam">text</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t613" href="#t613">613</a></span><span class="t"> <span class="nam">_token_iter</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t614" href="#t614">614</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t615" href="#t615">615</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t616" href="#t616">616</a></span><span class="t"> <span class="key">def</span> <span class="nam">_generate_field_content</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t617" href="#t617">617</a></span><span class="t"> <span class="com"># type: () -> str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t618" href="#t618">618</a></span><span class="t"> <span class="key">return</span> <span class="str">""</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">t</span><span class="op">.</span><span class="nam">text</span> <span class="key">for</span> <span class="nam">t</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_iter_content_as_tokens</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t619" href="#t619">619</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t620" href="#t620">620</a></span><span class="t"> <span class="key">def</span> <span class="nam">_update_field</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t621" href="#t621">621</a></span><span class="t"> <span class="com"># type: () -> None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t622" href="#t622">622</a></span><span class="t"> <span class="nam">kvpair_element</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_element</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t623" href="#t623">623</a></span><span class="t"> <span class="nam">field_name</span> <span class="op">=</span> <span class="nam">kvpair_element</span><span class="op">.</span><span class="nam">field_name</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t624" href="#t624">624</a></span><span class="t"> <span class="nam">token_list</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_list</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t625" href="#t625">625</a></span><span class="t"> <span class="nam">tail</span> <span class="op">=</span> <span class="nam">token_list</span><span class="op">.</span><span class="nam">tail</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t626" href="#t626">626</a></span><span class="t"> <span class="nam">had_tokens</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t627" href="#t627">627</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t628" href="#t628">628</a></span><span class="t"> <span class="key">for</span> <span class="nam">t</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_iter_content_as_tokens</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">628 ↛ 633</span><span class="annotate long">line 628 didn't jump to line 633, because the loop on line 628 didn't complete</span></span></p> - <p class="run"><span class="n"><a id="t629" href="#t629">629</a></span><span class="t"> <span class="nam">had_tokens</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t630" href="#t630">630</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">t</span><span class="op">.</span><span class="nam">is_comment</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">t</span><span class="op">.</span><span class="nam">is_whitespace</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t631" href="#t631">631</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t632" href="#t632">632</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t633" href="#t633">633</a></span><span class="t"> <span class="key">if</span> <span class="nam">had_tokens</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t634" href="#t634">634</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t635" href="#t635">635</a></span><span class="t"> <span class="str">"Field must be completely empty or have content "</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t636" href="#t636">636</a></span><span class="t"> <span class="str">"(i.e. non-whitespace and non-comments)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t637" href="#t637">637</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t638" href="#t638">638</a></span><span class="t"> <span class="key">if</span> <span class="nam">tail</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">638 ↛ 656</span><span class="annotate long">line 638 didn't jump to line 656, because the condition on line 638 was never false</span></span></p> - <p class="par run show_par"><span class="n"><a id="t639" href="#t639">639</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">tail</span><span class="op">,</span> <span class="nam">Deb822Token</span><span class="op">)</span> <span class="key">and</span> <span class="nam">tail</span><span class="op">.</span><span class="nam">is_comment</span><span class="op">:</span> </span><span class="r"><span class="annotate short">639 ↛ 640</span><span class="annotate long">line 639 didn't jump to line 640, because the condition on line 639 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t640" href="#t640">640</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"Fields must not end on a comment"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t641" href="#t641">641</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">tail</span><span class="op">.</span><span class="nam">convert_to_text</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">641 ↛ 645</span><span class="annotate long">line 641 didn't jump to line 645, because the condition on line 641 was never false</span></span></p> - <p class="pln"><span class="n"><a id="t642" href="#t642">642</a></span><span class="t"> <span class="com"># Always end on a newline</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t643" href="#t643">643</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">append_newline</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t644" href="#t644">644</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t645" href="#t645">645</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_format_preserve_original_formatting</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t646" href="#t646">646</a></span><span class="t"> <span class="nam">value_text</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_generate_field_content</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t647" href="#t647">647</a></span><span class="t"> <span class="nam">text</span> <span class="op">=</span> <span class="str">":"</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="op">(</span><span class="nam">field_name</span><span class="op">,</span> <span class="nam">value_text</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t648" href="#t648">648</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t649" href="#t649">649</a></span><span class="t"> <span class="nam">text</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_generate_reformatted_field_content</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t650" href="#t650">650</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t651" href="#t651">651</a></span><span class="t"> <span class="nam">new_content</span> <span class="op">=</span> <span class="nam">text</span><span class="op">.</span><span class="nam">splitlines</span><span class="op">(</span><span class="nam">keepends</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t652" href="#t652">652</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t653" href="#t653">653</a></span><span class="t"> <span class="com"># Special-case for the empty list which will be mapped to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t654" href="#t654">654</a></span><span class="t"> <span class="com"># an empty field. Always end on a newline (avoids errors</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t655" href="#t655">655</a></span><span class="t"> <span class="com"># if there is a field after this)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t656" href="#t656">656</a></span><span class="t"> <span class="nam">new_content</span> <span class="op">=</span> <span class="op">[</span><span class="nam">field_name</span> <span class="op">+</span> <span class="str">":\n"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t657" href="#t657">657</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t658" href="#t658">658</a></span><span class="t"> <span class="com"># As absurd as it might seem, it is easier to just use the parser to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t659" href="#t659">659</a></span><span class="t"> <span class="com"># construct the AST correctly</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t660" href="#t660">660</a></span><span class="t"> <span class="nam">deb822_file</span> <span class="op">=</span> <span class="nam">parse_deb822_file</span><span class="op">(</span><span class="nam">iter</span><span class="op">(</span><span class="nam">new_content</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t661" href="#t661">661</a></span><span class="t"> <span class="nam">error_token</span> <span class="op">=</span> <span class="nam">deb822_file</span><span class="op">.</span><span class="nam">find_first_error_element</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t662" href="#t662">662</a></span><span class="t"> <span class="key">if</span> <span class="nam">error_token</span><span class="op">:</span> </span><span class="r"><span class="annotate short">662 ↛ 664</span><span class="annotate long">line 662 didn't jump to line 664, because the condition on line 662 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t663" href="#t663">663</a></span><span class="t"> <span class="com"># _print_ast(deb822_file)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t664" href="#t664">664</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"Syntax error in new field value for "</span> <span class="op">+</span> <span class="nam">field_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t665" href="#t665">665</a></span><span class="t"> <span class="nam">paragraph</span> <span class="op">=</span> <span class="nam">next</span><span class="op">(</span><span class="nam">iter</span><span class="op">(</span><span class="nam">deb822_file</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t666" href="#t666">666</a></span><span class="t"> <span class="key">assert</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">paragraph</span><span class="op">,</span> <span class="nam">Deb822NoDuplicateFieldsParagraphElement</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t667" href="#t667">667</a></span><span class="t"> <span class="nam">new_kvpair_element</span> <span class="op">=</span> <span class="nam">paragraph</span><span class="op">.</span><span class="nam">get_kvpair_element</span><span class="op">(</span><span class="nam">field_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t668" href="#t668">668</a></span><span class="t"> <span class="key">assert</span> <span class="nam">new_kvpair_element</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t669" href="#t669">669</a></span><span class="t"> <span class="nam">kvpair_element</span><span class="op">.</span><span class="nam">value_element</span> <span class="op">=</span> <span class="nam">new_kvpair_element</span><span class="op">.</span><span class="nam">value_element</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t670" href="#t670">670</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_changed</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t671" href="#t671">671</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t672" href="#t672">672</a></span><span class="t"> <span class="key">def</span> <span class="nam">sort_elements</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t673" href="#t673">673</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t674" href="#t674">674</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t675" href="#t675">675</a></span><span class="t"> <span class="nam">key</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> <span class="com"># type: Optional[Callable[[VE], Any]]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t676" href="#t676">676</a></span><span class="t"> <span class="nam">reverse</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> <span class="com"># type: bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t677" href="#t677">677</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t678" href="#t678">678</a></span><span class="t"> <span class="com"># type: (...) -> None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t679" href="#t679">679</a></span><span class="t"> <span class="str">"""Sort the elements (abstract values) in this list.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t680" href="#t680">680</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t681" href="#t681">681</a></span><span class="t"><span class="str"> This method will sort the logical values of the list. It will</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t682" href="#t682">682</a></span><span class="t"><span class="str"> attempt to preserve comments associated with a given value where</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t683" href="#t683">683</a></span><span class="t"><span class="str"> possible. Whether space and separators are preserved depends on</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t684" href="#t684">684</a></span><span class="t"><span class="str"> the contents of the field as well as the formatting settings.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t685" href="#t685">685</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t686" href="#t686">686</a></span><span class="t"><span class="str"> Sorting (without reformatting) is likely to leave you with "awkward"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t687" href="#t687">687</a></span><span class="t"><span class="str"> whitespace. Therefore, you almost always want to apply reformatting</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t688" href="#t688">688</a></span><span class="t"><span class="str"> such as the reformat_when_finished() method.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t689" href="#t689">689</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t690" href="#t690">690</a></span><span class="t"><span class="str"> Sorting will invalidate all ValueReferences.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t691" href="#t691">691</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t692" href="#t692">692</a></span><span class="t"> <span class="nam">comment_start_node</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t693" href="#t693">693</a></span><span class="t"> <span class="nam">vtype</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_vtype</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t694" href="#t694">694</a></span><span class="t"> <span class="nam">stype</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_stype</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t695" href="#t695">695</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t696" href="#t696">696</a></span><span class="t"> <span class="key">def</span> <span class="nam">key_func</span><span class="op">(</span><span class="nam">x</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t697" href="#t697">697</a></span><span class="t"> <span class="com"># type: (Tuple[VE, List[TokenOrElement]]) -> Any</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t698" href="#t698">698</a></span><span class="t"> <span class="key">if</span> <span class="nam">key</span><span class="op">:</span> </span><span class="r"><span class="annotate short">698 ↛ 699</span><span class="annotate long">line 698 didn't jump to line 699, because the condition on line 698 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t699" href="#t699">699</a></span><span class="t"> <span class="key">return</span> <span class="nam">key</span><span class="op">(</span><span class="nam">x</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t700" href="#t700">700</a></span><span class="t"> <span class="key">return</span> <span class="nam">x</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">.</span><span class="nam">convert_to_text</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t701" href="#t701">701</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t702" href="#t702">702</a></span><span class="t"> <span class="nam">parts</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t703" href="#t703">703</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t704" href="#t704">704</a></span><span class="t"> <span class="key">for</span> <span class="nam">node</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_list</span><span class="op">.</span><span class="nam">iter_nodes</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t705" href="#t705">705</a></span><span class="t"> <span class="nam">value</span> <span class="op">=</span> <span class="nam">node</span><span class="op">.</span><span class="nam">value</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t706" href="#t706">706</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">value</span><span class="op">,</span> <span class="nam">Deb822Token</span><span class="op">)</span> <span class="key">and</span> <span class="nam">value</span><span class="op">.</span><span class="nam">is_comment</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t707" href="#t707">707</a></span><span class="t"> <span class="key">if</span> <span class="nam">comment_start_node</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">707 ↛ 709</span><span class="annotate long">line 707 didn't jump to line 709, because the condition on line 707 was never false</span></span></p> - <p class="run"><span class="n"><a id="t708" href="#t708">708</a></span><span class="t"> <span class="nam">comment_start_node</span> <span class="op">=</span> <span class="nam">node</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t709" href="#t709">709</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t710" href="#t710">710</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t711" href="#t711">711</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">value</span><span class="op">,</span> <span class="nam">vtype</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t712" href="#t712">712</a></span><span class="t"> <span class="nam">comments</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t713" href="#t713">713</a></span><span class="t"> <span class="key">if</span> <span class="nam">comment_start_node</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t714" href="#t714">714</a></span><span class="t"> <span class="key">for</span> <span class="nam">keep_node</span> <span class="key">in</span> <span class="nam">comment_start_node</span><span class="op">.</span><span class="nam">iter_next</span><span class="op">(</span><span class="nam">skip_current</span><span class="op">=</span><span class="key">False</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">714 ↛ 718</span><span class="annotate long">line 714 didn't jump to line 718, because the loop on line 714 didn't complete</span></span></p> - <p class="run"><span class="n"><a id="t715" href="#t715">715</a></span><span class="t"> <span class="key">if</span> <span class="nam">keep_node</span> <span class="key">is</span> <span class="nam">node</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t716" href="#t716">716</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t717" href="#t717">717</a></span><span class="t"> <span class="nam">comments</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">keep_node</span><span class="op">.</span><span class="nam">value</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t718" href="#t718">718</a></span><span class="t"> <span class="nam">parts</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="op">(</span><span class="nam">value</span><span class="op">,</span> <span class="nam">comments</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t719" href="#t719">719</a></span><span class="t"> <span class="nam">comment_start_node</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t720" href="#t720">720</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t721" href="#t721">721</a></span><span class="t"> <span class="nam">parts</span><span class="op">.</span><span class="nam">sort</span><span class="op">(</span><span class="nam">key</span><span class="op">=</span><span class="nam">key_func</span><span class="op">,</span> <span class="nam">reverse</span><span class="op">=</span><span class="nam">reverse</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t722" href="#t722">722</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t723" href="#t723">723</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_changed</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t724" href="#t724">724</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_list</span><span class="op">.</span><span class="nam">clear</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t725" href="#t725">725</a></span><span class="t"> <span class="nam">first_value</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t726" href="#t726">726</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t727" href="#t727">727</a></span><span class="t"> <span class="nam">separator_is_space</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_default_separator_factory</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">is_whitespace</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t728" href="#t728">728</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t729" href="#t729">729</a></span><span class="t"> <span class="key">for</span> <span class="nam">value</span><span class="op">,</span> <span class="nam">comments</span> <span class="key">in</span> <span class="nam">parts</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t730" href="#t730">730</a></span><span class="t"> <span class="key">if</span> <span class="nam">first_value</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t731" href="#t731">731</a></span><span class="t"> <span class="nam">first_value</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t732" href="#t732">732</a></span><span class="t"> <span class="key">if</span> <span class="nam">comments</span><span class="op">:</span> </span><span class="r"><span class="annotate short">732 ↛ 735</span><span class="annotate long">line 732 didn't jump to line 735, because the condition on line 732 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t733" href="#t733">733</a></span><span class="t"> <span class="com"># While unlikely, there could be a separator between the comments.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t734" href="#t734">734</a></span><span class="t"> <span class="com"># It would be in the way and we remove it.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t735" href="#t735">735</a></span><span class="t"> <span class="nam">comments</span> <span class="op">=</span> <span class="op">[</span><span class="nam">x</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">comments</span> <span class="key">if</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">x</span><span class="op">,</span> <span class="nam">stype</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t736" href="#t736">736</a></span><span class="t"> <span class="com"># Comments cannot start the field, so inject a newline to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t737" href="#t737">737</a></span><span class="t"> <span class="com"># work around that</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t738" href="#t738">738</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">append_newline</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t739" href="#t739">739</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t740" href="#t740">740</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">separator_is_space</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">any</span><span class="op">(</span> </span><span class="r"><span class="annotate short">740 ↛ exit, 740 ↛ 747</span><span class="annotate long">2 missed branches: 1) line 740 didn't run the generator expression on line 740, 2) line 740 didn't jump to line 747, because the condition on line 740 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t741" href="#t741">741</a></span><span class="t"> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">x</span><span class="op">,</span> <span class="nam">stype</span><span class="op">)</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">comments</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t742" href="#t742">742</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t743" href="#t743">743</a></span><span class="t"> <span class="com"># While unlikely, you can hide a comma between two comments and expect</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t744" href="#t744">744</a></span><span class="t"> <span class="com"># us to preserve it. However, the more common case is that the separator</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t745" href="#t745">745</a></span><span class="t"> <span class="com"># appeared before the comments and was thus omitted (leaving us to re-add</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t746" href="#t746">746</a></span><span class="t"> <span class="com"># it here).</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t747" href="#t747">747</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">append_separator</span><span class="op">(</span><span class="nam">space_after_separator</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t748" href="#t748">748</a></span><span class="t"> <span class="key">if</span> <span class="nam">comments</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t749" href="#t749">749</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">append_newline</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t750" href="#t750">750</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t751" href="#t751">751</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_list</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">Deb822WhitespaceToken</span><span class="op">(</span><span class="str">" "</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t752" href="#t752">752</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t753" href="#t753">753</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_list</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">comments</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t754" href="#t754">754</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">append_value</span><span class="op">(</span><span class="nam">value</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t755" href="#t755">755</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t756" href="#t756">756</a></span><span class="t"> <span class="key">def</span> <span class="nam">sort</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t757" href="#t757">757</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t758" href="#t758">758</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t759" href="#t759">759</a></span><span class="t"> <span class="nam">key</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> <span class="com"># type: Optional[Callable[[str], Any]]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t760" href="#t760">760</a></span><span class="t"> <span class="op">**</span><span class="nam">kwargs</span><span class="op">,</span> <span class="com"># type: Any</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t761" href="#t761">761</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t762" href="#t762">762</a></span><span class="t"> <span class="com"># type: (...) -> None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t763" href="#t763">763</a></span><span class="t"> <span class="str">"""Sort the values (rendered as str) in this list.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t764" href="#t764">764</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t765" href="#t765">765</a></span><span class="t"><span class="str"> This method will sort the logical values of the list. It will</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t766" href="#t766">766</a></span><span class="t"><span class="str"> attempt to preserve comments associated with a given value where</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t767" href="#t767">767</a></span><span class="t"><span class="str"> possible. Whether space and separators are preserved depends on</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t768" href="#t768">768</a></span><span class="t"><span class="str"> the contents of the field as well as the formatting settings.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t769" href="#t769">769</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t770" href="#t770">770</a></span><span class="t"><span class="str"> Sorting (without reformatting) is likely to leave you with "awkward"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t771" href="#t771">771</a></span><span class="t"><span class="str"> whitespace. Therefore, you almost always want to apply reformatting</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t772" href="#t772">772</a></span><span class="t"><span class="str"> such as the reformat_when_finished() method.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t773" href="#t773">773</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t774" href="#t774">774</a></span><span class="t"><span class="str"> Sorting will invalidate all ValueReferences.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t775" href="#t775">775</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t776" href="#t776">776</a></span><span class="t"> <span class="key">if</span> <span class="nam">key</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">776 ↛ 777</span><span class="annotate long">line 776 didn't jump to line 777, because the condition on line 776 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t777" href="#t777">777</a></span><span class="t"> <span class="nam">render</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_render</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t778" href="#t778">778</a></span><span class="t"> <span class="nam">kwargs</span><span class="op">[</span><span class="str">"key"</span><span class="op">]</span> <span class="op">=</span> <span class="key">lambda</span> <span class="nam">vt</span><span class="op">:</span> <span class="nam">key</span><span class="op">(</span><span class="nam">render</span><span class="op">(</span><span class="nam">vt</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t779" href="#t779">779</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">sort_elements</span><span class="op">(</span><span class="op">**</span><span class="nam">kwargs</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t780" href="#t780">780</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t781" href="#t781">781</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t782" href="#t782">782</a></span><span class="t"><span class="key">class</span> <span class="nam">Interpretation</span><span class="op">(</span><span class="nam">Generic</span><span class="op">[</span><span class="nam">T</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t783" href="#t783">783</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t784" href="#t784">784</a></span><span class="t"> <span class="key">def</span> <span class="nam">interpret</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t785" href="#t785">785</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t786" href="#t786">786</a></span><span class="t"> <span class="nam">kvpair_element</span><span class="op">,</span> <span class="com"># type: Deb822KeyValuePairElement</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t787" href="#t787">787</a></span><span class="t"> <span class="nam">discard_comments_on_read</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="com"># type: bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t788" href="#t788">788</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t789" href="#t789">789</a></span><span class="t"> <span class="com"># type: (...) -> T</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t790" href="#t790">790</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> <span class="com"># pragma: no cover</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t791" href="#t791">791</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t792" href="#t792">792</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t793" href="#t793">793</a></span><span class="t"><span class="key">class</span> <span class="nam">GenericContentBasedInterpretation</span><span class="op">(</span><span class="nam">Interpretation</span><span class="op">[</span><span class="nam">T</span><span class="op">]</span><span class="op">,</span> <span class="nam">Generic</span><span class="op">[</span><span class="nam">T</span><span class="op">,</span> <span class="nam">VE</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t794" href="#t794">794</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t795" href="#t795">795</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t796" href="#t796">796</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t797" href="#t797">797</a></span><span class="t"> <span class="nam">tokenizer</span><span class="op">,</span> <span class="com"># type: Callable[[str], Iterable['Deb822Token']]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t798" href="#t798">798</a></span><span class="t"> <span class="nam">value_parser</span><span class="op">,</span> <span class="com"># type: StreamingValueParser[VE]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t799" href="#t799">799</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t800" href="#t800">800</a></span><span class="t"> <span class="com"># type: (...) -> None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t801" href="#t801">801</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t802" href="#t802">802</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_tokenizer</span> <span class="op">=</span> <span class="nam">tokenizer</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t803" href="#t803">803</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_value_parser</span> <span class="op">=</span> <span class="nam">value_parser</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t804" href="#t804">804</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t805" href="#t805">805</a></span><span class="t"> <span class="key">def</span> <span class="nam">_high_level_interpretation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t806" href="#t806">806</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t807" href="#t807">807</a></span><span class="t"> <span class="nam">kvpair_element</span><span class="op">,</span> <span class="com"># type: Deb822KeyValuePairElement</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t808" href="#t808">808</a></span><span class="t"> <span class="nam">proxy_element</span><span class="op">,</span> <span class="com"># type: Deb822InterpretationProxyElement</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t809" href="#t809">809</a></span><span class="t"> <span class="nam">discard_comments_on_read</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="com"># type: bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t810" href="#t810">810</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t811" href="#t811">811</a></span><span class="t"> <span class="com"># type: (...) -> T</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t812" href="#t812">812</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> <span class="com"># pragma: no cover</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t813" href="#t813">813</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t814" href="#t814">814</a></span><span class="t"> <span class="key">def</span> <span class="nam">_parse_stream</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t815" href="#t815">815</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> <span class="nam">buffered_iterator</span> <span class="com"># type: BufferingIterator[Deb822Token]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t816" href="#t816">816</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t817" href="#t817">817</a></span><span class="t"> <span class="com"># type: (...) -> Iterable[Union[Deb822Token, VE]]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t818" href="#t818">818</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t819" href="#t819">819</a></span><span class="t"> <span class="nam">value_parser</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_value_parser</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t820" href="#t820">820</a></span><span class="t"> <span class="key">for</span> <span class="nam">token</span> <span class="key">in</span> <span class="nam">buffered_iterator</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t821" href="#t821">821</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">token</span><span class="op">,</span> <span class="nam">Deb822ValueToken</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t822" href="#t822">822</a></span><span class="t"> <span class="key">yield</span> <span class="nam">value_parser</span><span class="op">(</span><span class="nam">token</span><span class="op">,</span> <span class="nam">buffered_iterator</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t823" href="#t823">823</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t824" href="#t824">824</a></span><span class="t"> <span class="key">yield</span> <span class="nam">token</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t825" href="#t825">825</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t826" href="#t826">826</a></span><span class="t"> <span class="key">def</span> <span class="nam">_parse_kvpair</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t827" href="#t827">827</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> <span class="nam">kvpair</span> <span class="com"># type: Deb822KeyValuePairElement</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t828" href="#t828">828</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t829" href="#t829">829</a></span><span class="t"> <span class="com"># type: (...) -> Deb822InterpretationProxyElement</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t830" href="#t830">830</a></span><span class="t"> <span class="nam">value_element</span> <span class="op">=</span> <span class="nam">kvpair</span><span class="op">.</span><span class="nam">value_element</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t831" href="#t831">831</a></span><span class="t"> <span class="nam">content</span> <span class="op">=</span> <span class="nam">value_element</span><span class="op">.</span><span class="nam">convert_to_text</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t832" href="#t832">832</a></span><span class="t"> <span class="nam">token_list</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> <span class="com"># type: List['TokenOrElement']</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t833" href="#t833">833</a></span><span class="t"> <span class="nam">token_list</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_parse_str</span><span class="op">(</span><span class="nam">content</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t834" href="#t834">834</a></span><span class="t"> <span class="key">return</span> <span class="nam">Deb822InterpretationProxyElement</span><span class="op">(</span><span class="nam">value_element</span><span class="op">,</span> <span class="nam">token_list</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t835" href="#t835">835</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t836" href="#t836">836</a></span><span class="t"> <span class="key">def</span> <span class="nam">_parse_str</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">content</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t837" href="#t837">837</a></span><span class="t"> <span class="com"># type: (str) -> Iterable[Union[Deb822Token, VE]]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t838" href="#t838">838</a></span><span class="t"> <span class="nam">content_len</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">content</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t839" href="#t839">839</a></span><span class="t"> <span class="nam">biter</span> <span class="op">=</span> <span class="nam">BufferingIterator</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t840" href="#t840">840</a></span><span class="t"> <span class="nam">len_check_iterator</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t841" href="#t841">841</a></span><span class="t"> <span class="nam">content</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t842" href="#t842">842</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_tokenizer</span><span class="op">(</span><span class="nam">content</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t843" href="#t843">843</a></span><span class="t"> <span class="nam">content_len</span><span class="op">=</span><span class="nam">content_len</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t844" href="#t844">844</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t845" href="#t845">845</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t846" href="#t846">846</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">len_check_iterator</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t847" href="#t847">847</a></span><span class="t"> <span class="nam">content</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t848" href="#t848">848</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_parse_stream</span><span class="op">(</span><span class="nam">biter</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t849" href="#t849">849</a></span><span class="t"> <span class="nam">content_len</span><span class="op">=</span><span class="nam">content_len</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t850" href="#t850">850</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t851" href="#t851">851</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t852" href="#t852">852</a></span><span class="t"> <span class="key">def</span> <span class="nam">interpret</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t853" href="#t853">853</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t854" href="#t854">854</a></span><span class="t"> <span class="nam">kvpair_element</span><span class="op">,</span> <span class="com"># type: Deb822KeyValuePairElement</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t855" href="#t855">855</a></span><span class="t"> <span class="nam">discard_comments_on_read</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="com"># type: bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t856" href="#t856">856</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t857" href="#t857">857</a></span><span class="t"> <span class="com"># type: (...) -> T</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t858" href="#t858">858</a></span><span class="t"> <span class="nam">proxy_element</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parse_kvpair</span><span class="op">(</span><span class="nam">kvpair_element</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t859" href="#t859">859</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_high_level_interpretation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t860" href="#t860">860</a></span><span class="t"> <span class="nam">kvpair_element</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t861" href="#t861">861</a></span><span class="t"> <span class="nam">proxy_element</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t862" href="#t862">862</a></span><span class="t"> <span class="nam">discard_comments_on_read</span><span class="op">=</span><span class="nam">discard_comments_on_read</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t863" href="#t863">863</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t864" href="#t864">864</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t865" href="#t865">865</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t866" href="#t866">866</a></span><span class="t"><span class="key">def</span> <span class="nam">_parser_to_value_factory</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t867" href="#t867">867</a></span><span class="t"> <span class="nam">parser</span><span class="op">,</span> <span class="com"># type: StrToValueParser[VE]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t868" href="#t868">868</a></span><span class="t"> <span class="nam">vtype</span><span class="op">,</span> <span class="com"># type: Type[VE]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t869" href="#t869">869</a></span><span class="t"><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t870" href="#t870">870</a></span><span class="t"> <span class="com"># type: (...) -> Callable[[str], VE]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t871" href="#t871">871</a></span><span class="t"> <span class="key">def</span> <span class="nam">_value_factory</span><span class="op">(</span><span class="nam">v</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t872" href="#t872">872</a></span><span class="t"> <span class="com"># type: (str) -> VE</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t873" href="#t873">873</a></span><span class="t"> <span class="key">if</span> <span class="nam">v</span> <span class="op">==</span> <span class="str">""</span><span class="op">:</span> </span><span class="r"><span class="annotate short">873 ↛ 874</span><span class="annotate long">line 873 didn't jump to line 874, because the condition on line 873 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t874" href="#t874">874</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"The empty string is not a value"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t875" href="#t875">875</a></span><span class="t"> <span class="nam">token_iter</span> <span class="op">=</span> <span class="nam">iter</span><span class="op">(</span><span class="nam">parser</span><span class="op">(</span><span class="nam">v</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t876" href="#t876">876</a></span><span class="t"> <span class="nam">t1</span> <span class="op">=</span> <span class="nam">next</span><span class="op">(</span><span class="nam">token_iter</span><span class="op">,</span> <span class="key">None</span><span class="op">)</span> <span class="com"># type: Optional[Union[TokenOrElement]]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t877" href="#t877">877</a></span><span class="t"> <span class="nam">t2</span> <span class="op">=</span> <span class="nam">next</span><span class="op">(</span><span class="nam">token_iter</span><span class="op">,</span> <span class="key">None</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t878" href="#t878">878</a></span><span class="t"> <span class="key">assert</span> <span class="nam">t1</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">,</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t879" href="#t879">879</a></span><span class="t"> <span class="str">'Bad parser - it returned None (or no TE) for "'</span> <span class="op">+</span> <span class="nam">v</span> <span class="op">+</span> <span class="str">'"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t880" href="#t880">880</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t881" href="#t881">881</a></span><span class="t"> <span class="key">if</span> <span class="nam">t2</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">881 ↛ 882</span><span class="annotate long">line 881 didn't jump to line 882, because the condition on line 881 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t882" href="#t882">882</a></span><span class="t"> <span class="nam">msg</span> <span class="op">=</span> <span class="nam">textwrap</span><span class="op">.</span><span class="nam">dedent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t883" href="#t883">883</a></span><span class="t"> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t884" href="#t884">884</a></span><span class="t"><span class="str"> The input "{v}" should have been exactly one element, but the parser provided at</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t885" href="#t885">885</a></span><span class="t"><span class="str"> least two. This can happen with unnecessary leading/trailing whitespace</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t886" href="#t886">886</a></span><span class="t"><span class="str"> or including commas the value for a comma list.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t887" href="#t887">887</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t888" href="#t888">888</a></span><span class="t"> <span class="op">)</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span><span class="nam">v</span><span class="op">=</span><span class="nam">v</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t889" href="#t889">889</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="nam">msg</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t890" href="#t890">890</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">t1</span><span class="op">,</span> <span class="nam">vtype</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">890 ↛ 891</span><span class="annotate long">line 890 didn't jump to line 891, because the condition on line 890 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t891" href="#t891">891</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">t1</span><span class="op">,</span> <span class="nam">Deb822Token</span><span class="op">)</span> <span class="key">and</span> <span class="op">(</span><span class="nam">t1</span><span class="op">.</span><span class="nam">is_comment</span> <span class="key">or</span> <span class="nam">t1</span><span class="op">.</span><span class="nam">is_whitespace</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t892" href="#t892">892</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t893" href="#t893">893</a></span><span class="t"> <span class="str">'The input "{v}" is whitespace or a comment: Expected a value'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t894" href="#t894">894</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t895" href="#t895">895</a></span><span class="t"> <span class="nam">msg</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t896" href="#t896">896</a></span><span class="t"> <span class="str">'The input "{v}" should have produced a element of type {vtype_name}, but'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t897" href="#t897">897</a></span><span class="t"> <span class="str">" instead it produced {t1}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t898" href="#t898">898</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t899" href="#t899">899</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="nam">msg</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span><span class="nam">v</span><span class="op">=</span><span class="nam">v</span><span class="op">,</span> <span class="nam">vtype_name</span><span class="op">=</span><span class="nam">vtype</span><span class="op">.</span><span class="nam">__name__</span><span class="op">,</span> <span class="nam">t1</span><span class="op">=</span><span class="nam">t1</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t900" href="#t900">900</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t901" href="#t901">901</a></span><span class="t"> <span class="key">assert</span> <span class="nam">len</span><span class="op">(</span><span class="nam">t1</span><span class="op">.</span><span class="nam">convert_to_text</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> <span class="op">==</span> <span class="nam">len</span><span class="op">(</span><span class="nam">v</span><span class="op">)</span><span class="op">,</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t902" href="#t902">902</a></span><span class="t"> <span class="str">"Bad tokenizer - the token did not cover the input text"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t903" href="#t903">903</a></span><span class="t"> <span class="str">" exactly ({t1_len} != {v_len}"</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t904" href="#t904">904</a></span><span class="t"> <span class="nam">t1_len</span><span class="op">=</span><span class="nam">len</span><span class="op">(</span><span class="nam">t1</span><span class="op">.</span><span class="nam">convert_to_text</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">,</span> <span class="nam">v_len</span><span class="op">=</span><span class="nam">len</span><span class="op">(</span><span class="nam">v</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t905" href="#t905">905</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t906" href="#t906">906</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t907" href="#t907">907</a></span><span class="t"> <span class="key">return</span> <span class="nam">t1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t908" href="#t908">908</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t909" href="#t909">909</a></span><span class="t"> <span class="key">return</span> <span class="nam">_value_factory</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t910" href="#t910">910</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t911" href="#t911">911</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t912" href="#t912">912</a></span><span class="t"><span class="key">class</span> <span class="nam">ListInterpretation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t913" href="#t913">913</a></span><span class="t"> <span class="nam">GenericContentBasedInterpretation</span><span class="op">[</span><span class="nam">Deb822ParsedTokenList</span><span class="op">[</span><span class="nam">VE</span><span class="op">,</span> <span class="nam">ST</span><span class="op">]</span><span class="op">,</span> <span class="nam">VE</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t914" href="#t914">914</a></span><span class="t"><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t915" href="#t915">915</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t916" href="#t916">916</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t917" href="#t917">917</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t918" href="#t918">918</a></span><span class="t"> <span class="nam">tokenizer</span><span class="op">,</span> <span class="com"># type: Callable[[str], Iterable['Deb822Token']]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t919" href="#t919">919</a></span><span class="t"> <span class="nam">value_parser</span><span class="op">,</span> <span class="com"># type: StreamingValueParser[VE]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t920" href="#t920">920</a></span><span class="t"> <span class="nam">vtype</span><span class="op">,</span> <span class="com"># type: Type[VE]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t921" href="#t921">921</a></span><span class="t"> <span class="nam">stype</span><span class="op">,</span> <span class="com"># type: Type[ST]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t922" href="#t922">922</a></span><span class="t"> <span class="nam">default_separator_factory</span><span class="op">,</span> <span class="com"># type: Callable[[], ST]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t923" href="#t923">923</a></span><span class="t"> <span class="nam">render_factory</span><span class="op">,</span> <span class="com"># type: Callable[[bool], Callable[[VE], str]]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t924" href="#t924">924</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t925" href="#t925">925</a></span><span class="t"> <span class="com"># type: (...) -> None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t926" href="#t926">926</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="nam">tokenizer</span><span class="op">,</span> <span class="nam">value_parser</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t927" href="#t927">927</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_vtype</span> <span class="op">=</span> <span class="nam">vtype</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t928" href="#t928">928</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_stype</span> <span class="op">=</span> <span class="nam">stype</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t929" href="#t929">929</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_default_separator_factory</span> <span class="op">=</span> <span class="nam">default_separator_factory</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t930" href="#t930">930</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_render_factory</span> <span class="op">=</span> <span class="nam">render_factory</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t931" href="#t931">931</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t932" href="#t932">932</a></span><span class="t"> <span class="key">def</span> <span class="nam">_high_level_interpretation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t933" href="#t933">933</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t934" href="#t934">934</a></span><span class="t"> <span class="nam">kvpair_element</span><span class="op">,</span> <span class="com"># type: Deb822KeyValuePairElement</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t935" href="#t935">935</a></span><span class="t"> <span class="nam">proxy_element</span><span class="op">,</span> <span class="com"># type: Deb822InterpretationProxyElement</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t936" href="#t936">936</a></span><span class="t"> <span class="nam">discard_comments_on_read</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="com"># type: bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t937" href="#t937">937</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t938" href="#t938">938</a></span><span class="t"> <span class="com"># type: (...) -> Deb822ParsedTokenList[VE, ST]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t939" href="#t939">939</a></span><span class="t"> <span class="key">return</span> <span class="nam">Deb822ParsedTokenList</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t940" href="#t940">940</a></span><span class="t"> <span class="nam">kvpair_element</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t941" href="#t941">941</a></span><span class="t"> <span class="nam">proxy_element</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t942" href="#t942">942</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_vtype</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t943" href="#t943">943</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_stype</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t944" href="#t944">944</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_parse_str</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t945" href="#t945">945</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_default_separator_factory</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t946" href="#t946">946</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_render_factory</span><span class="op">(</span><span class="nam">discard_comments_on_read</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t947" href="#t947">947</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t948" href="#t948">948</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t949" href="#t949">949</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t950" href="#t950">950</a></span><span class="t"><span class="key">def</span> <span class="nam">_parse_whitespace_list_value</span><span class="op">(</span><span class="nam">token</span><span class="op">,</span> <span class="nam">_</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t951" href="#t951">951</a></span><span class="t"> <span class="com"># type: (Deb822Token, BufferingIterator[Deb822Token]) -> Deb822ParsedValueElement</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t952" href="#t952">952</a></span><span class="t"> <span class="key">return</span> <span class="nam">Deb822ParsedValueElement</span><span class="op">(</span><span class="op">[</span><span class="nam">token</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t953" href="#t953">953</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t954" href="#t954">954</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t955" href="#t955">955</a></span><span class="t"><span class="key">def</span> <span class="nam">_is_comma_token</span><span class="op">(</span><span class="nam">v</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t956" href="#t956">956</a></span><span class="t"> <span class="com"># type: (TokenOrElement) -> bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t957" href="#t957">957</a></span><span class="t"> <span class="com"># Consume tokens until the next comma</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t958" href="#t958">958</a></span><span class="t"> <span class="key">return</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">Deb822CommaToken</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t959" href="#t959">959</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t960" href="#t960">960</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t961" href="#t961">961</a></span><span class="t"><span class="key">def</span> <span class="nam">_parse_comma_list_value</span><span class="op">(</span><span class="nam">token</span><span class="op">,</span> <span class="nam">buffered_iterator</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t962" href="#t962">962</a></span><span class="t"> <span class="com"># type: (Deb822Token, BufferingIterator[Deb822Token]) -> Deb822ParsedValueElement</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t963" href="#t963">963</a></span><span class="t"> <span class="nam">comma_offset</span> <span class="op">=</span> <span class="nam">buffered_iterator</span><span class="op">.</span><span class="nam">peek_find</span><span class="op">(</span><span class="nam">_is_comma_token</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t964" href="#t964">964</a></span><span class="t"> <span class="nam">value_parts</span> <span class="op">=</span> <span class="op">[</span><span class="nam">token</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t965" href="#t965">965</a></span><span class="t"> <span class="key">if</span> <span class="nam">comma_offset</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t966" href="#t966">966</a></span><span class="t"> <span class="com"># The value is followed by a comma and now we know where it ends</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t967" href="#t967">967</a></span><span class="t"> <span class="nam">value_parts</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">buffered_iterator</span><span class="op">.</span><span class="nam">peek_many</span><span class="op">(</span><span class="nam">comma_offset</span> <span class="op">-</span> <span class="num">1</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t968" href="#t968">968</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t969" href="#t969">969</a></span><span class="t"> <span class="com"># The value is the last value there is. Consume all remaining tokens</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t970" href="#t970">970</a></span><span class="t"> <span class="com"># and then trim from the right.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t971" href="#t971">971</a></span><span class="t"> <span class="nam">value_parts</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">buffered_iterator</span><span class="op">.</span><span class="nam">peek_buffer</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t972" href="#t972">972</a></span><span class="t"> <span class="key">while</span> <span class="nam">value_parts</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">value_parts</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span><span class="op">,</span> <span class="nam">Deb822ValueToken</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t973" href="#t973">973</a></span><span class="t"> <span class="nam">value_parts</span><span class="op">.</span><span class="nam">pop</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t974" href="#t974">974</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t975" href="#t975">975</a></span><span class="t"> <span class="nam">buffered_iterator</span><span class="op">.</span><span class="nam">consume_many</span><span class="op">(</span><span class="nam">len</span><span class="op">(</span><span class="nam">value_parts</span><span class="op">)</span> <span class="op">-</span> <span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t976" href="#t976">976</a></span><span class="t"> <span class="key">return</span> <span class="nam">Deb822ParsedValueElement</span><span class="op">(</span><span class="nam">value_parts</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t977" href="#t977">977</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t978" href="#t978">978</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t979" href="#t979">979</a></span><span class="t"><span class="key">def</span> <span class="nam">_parse_uploaders_list_value</span><span class="op">(</span><span class="nam">token</span><span class="op">,</span> <span class="nam">buffered_iterator</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t980" href="#t980">980</a></span><span class="t"> <span class="com"># type: (Deb822Token, BufferingIterator[Deb822Token]) -> Deb822ParsedValueElement</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t981" href="#t981">981</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t982" href="#t982">982</a></span><span class="t"> <span class="com"># This is similar to _parse_comma_list_value *except* that there is an extra special</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t983" href="#t983">983</a></span><span class="t"> <span class="com"># case. Namely comma only counts as a true separator if it follows ">"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t984" href="#t984">984</a></span><span class="t"> <span class="nam">value_parts</span> <span class="op">=</span> <span class="op">[</span><span class="nam">token</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t985" href="#t985">985</a></span><span class="t"> <span class="nam">comma_offset</span> <span class="op">=</span> <span class="op">-</span><span class="num">1</span> <span class="com"># type: Optional[int]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t986" href="#t986">986</a></span><span class="t"> <span class="key">while</span> <span class="nam">comma_offset</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t987" href="#t987">987</a></span><span class="t"> <span class="nam">comma_offset</span> <span class="op">=</span> <span class="nam">buffered_iterator</span><span class="op">.</span><span class="nam">peek_find</span><span class="op">(</span><span class="nam">_is_comma_token</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t988" href="#t988">988</a></span><span class="t"> <span class="key">if</span> <span class="nam">comma_offset</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t989" href="#t989">989</a></span><span class="t"> <span class="com"># The value is followed by a comma. Verify that this is a terminating</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t990" href="#t990">990</a></span><span class="t"> <span class="com"># comma (comma may appear in the name or email)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t991" href="#t991">991</a></span><span class="t"> <span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t992" href="#t992">992</a></span><span class="t"> <span class="com"># We include value_parts[-1] to easily cope with the common case of</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t993" href="#t993">993</a></span><span class="t"> <span class="com"># "foo <a@b.com>," where we will have 0 peeked element to examine.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t994" href="#t994">994</a></span><span class="t"> <span class="nam">peeked_elements</span> <span class="op">=</span> <span class="op">[</span><span class="nam">value_parts</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t995" href="#t995">995</a></span><span class="t"> <span class="nam">peeked_elements</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">buffered_iterator</span><span class="op">.</span><span class="nam">peek_many</span><span class="op">(</span><span class="nam">comma_offset</span> <span class="op">-</span> <span class="num">1</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t996" href="#t996">996</a></span><span class="t"> <span class="nam">comma_was_separator</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t997" href="#t997">997</a></span><span class="t"> <span class="nam">i</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">peeked_elements</span><span class="op">)</span> <span class="op">-</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t998" href="#t998">998</a></span><span class="t"> <span class="key">while</span> <span class="nam">i</span> <span class="op">>=</span> <span class="num">0</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t999" href="#t999">999</a></span><span class="t"> <span class="nam">token</span> <span class="op">=</span> <span class="nam">peeked_elements</span><span class="op">[</span><span class="nam">i</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1000" href="#t1000">1000</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">token</span><span class="op">,</span> <span class="nam">Deb822ValueToken</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1001" href="#t1001">1001</a></span><span class="t"> <span class="key">if</span> <span class="nam">token</span><span class="op">.</span><span class="nam">text</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">">"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1002" href="#t1002">1002</a></span><span class="t"> <span class="com"># The comma terminates the value</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1003" href="#t1003">1003</a></span><span class="t"> <span class="nam">value_parts</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">buffered_iterator</span><span class="op">.</span><span class="nam">consume_many</span><span class="op">(</span><span class="nam">i</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1004" href="#t1004">1004</a></span><span class="t"> <span class="key">assert</span> <span class="nam">isinstance</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1005" href="#t1005">1005</a></span><span class="t"> <span class="nam">value_parts</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span><span class="op">,</span> <span class="nam">Deb822ValueToken</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1006" href="#t1006">1006</a></span><span class="t"> <span class="op">)</span> <span class="key">and</span> <span class="nam">value_parts</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span><span class="op">.</span><span class="nam">text</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">">"</span><span class="op">)</span><span class="op">,</span> <span class="str">"Got: "</span> <span class="op">+</span> <span class="nam">str</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1007" href="#t1007">1007</a></span><span class="t"> <span class="nam">value_parts</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1008" href="#t1008">1008</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1009" href="#t1009">1009</a></span><span class="t"> <span class="nam">comma_was_separator</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1010" href="#t1010">1010</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1011" href="#t1011">1011</a></span><span class="t"> <span class="nam">i</span> <span class="op">-=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1012" href="#t1012">1012</a></span><span class="t"> <span class="key">if</span> <span class="nam">comma_was_separator</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1013" href="#t1013">1013</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1014" href="#t1014">1014</a></span><span class="t"> <span class="nam">value_parts</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">buffered_iterator</span><span class="op">.</span><span class="nam">consume_many</span><span class="op">(</span><span class="nam">comma_offset</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1015" href="#t1015">1015</a></span><span class="t"> <span class="key">assert</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">value_parts</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span><span class="op">,</span> <span class="nam">Deb822CommaToken</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1016" href="#t1016">1016</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1017" href="#t1017">1017</a></span><span class="t"> <span class="com"># The value is the last value there is. Consume all remaining tokens</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1018" href="#t1018">1018</a></span><span class="t"> <span class="com"># and then trim from the right.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1019" href="#t1019">1019</a></span><span class="t"> <span class="nam">remaining_part</span> <span class="op">=</span> <span class="nam">buffered_iterator</span><span class="op">.</span><span class="nam">peek_buffer</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1020" href="#t1020">1020</a></span><span class="t"> <span class="nam">consume_elements</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">remaining_part</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1021" href="#t1021">1021</a></span><span class="t"> <span class="nam">value_parts</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">remaining_part</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1022" href="#t1022">1022</a></span><span class="t"> <span class="key">while</span> <span class="nam">value_parts</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">value_parts</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span><span class="op">,</span> <span class="nam">Deb822ValueToken</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1023" href="#t1023">1023</a></span><span class="t"> <span class="nam">value_parts</span><span class="op">.</span><span class="nam">pop</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1024" href="#t1024">1024</a></span><span class="t"> <span class="nam">consume_elements</span> <span class="op">-=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1025" href="#t1025">1025</a></span><span class="t"> <span class="nam">buffered_iterator</span><span class="op">.</span><span class="nam">consume_many</span><span class="op">(</span><span class="nam">consume_elements</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1026" href="#t1026">1026</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1027" href="#t1027">1027</a></span><span class="t"> <span class="key">return</span> <span class="nam">Deb822ParsedValueElement</span><span class="op">(</span><span class="nam">value_parts</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1028" href="#t1028">1028</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1029" href="#t1029">1029</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1030" href="#t1030">1030</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822Element</span><span class="op">(</span><span class="nam">Locatable</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1031" href="#t1031">1031</a></span><span class="t"> <span class="str">"""Composite elements (consists of 1 or more tokens)"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1032" href="#t1032">1032</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1033" href="#t1033">1033</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"_parent_element"</span><span class="op">,</span> <span class="str">"_full_size_cache"</span><span class="op">,</span> <span class="str">"__weakref__"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1034" href="#t1034">1034</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1035" href="#t1035">1035</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1036" href="#t1036">1036</a></span><span class="t"> <span class="com"># type: () -> None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1037" href="#t1037">1037</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent_element</span> <span class="op">=</span> <span class="key">None</span> <span class="com"># type: Optional[ReferenceType['Deb822Element']]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1038" href="#t1038">1038</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_full_size_cache</span> <span class="op">=</span> <span class="key">None</span> <span class="com"># type: Optional[Range]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1039" href="#t1039">1039</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1040" href="#t1040">1040</a></span><span class="t"> <span class="key">def</span> <span class="nam">iter_parts</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1041" href="#t1041">1041</a></span><span class="t"> <span class="com"># type: () -> Iterable[TokenOrElement]</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1042" href="#t1042">1042</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> <span class="com"># pragma: no cover</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1043" href="#t1043">1043</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1044" href="#t1044">1044</a></span><span class="t"> <span class="key">def</span> <span class="nam">iter_parts_of_type</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">only_element_or_token_type</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1045" href="#t1045">1045</a></span><span class="t"> <span class="com"># type: (Type[TE]) -> Iterable[TE]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1046" href="#t1046">1046</a></span><span class="t"> <span class="key">for</span> <span class="nam">part</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">iter_parts</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1047" href="#t1047">1047</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">part</span><span class="op">,</span> <span class="nam">only_element_or_token_type</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1048" href="#t1048">1048</a></span><span class="t"> <span class="key">yield</span> <span class="nam">part</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1049" href="#t1049">1049</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1050" href="#t1050">1050</a></span><span class="t"> <span class="key">def</span> <span class="nam">iter_tokens</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1051" href="#t1051">1051</a></span><span class="t"> <span class="com"># type: () -> Iterable[Deb822Token]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1052" href="#t1052">1052</a></span><span class="t"> <span class="key">for</span> <span class="nam">part</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">iter_parts</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1053" href="#t1053">1053</a></span><span class="t"> <span class="com"># Control check to catch bugs early</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1054" href="#t1054">1054</a></span><span class="t"> <span class="key">assert</span> <span class="nam">part</span><span class="op">.</span><span class="nam">_parent_element</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1055" href="#t1055">1055</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">part</span><span class="op">,</span> <span class="nam">Deb822Element</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1056" href="#t1056">1056</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">part</span><span class="op">.</span><span class="nam">iter_tokens</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1057" href="#t1057">1057</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1058" href="#t1058">1058</a></span><span class="t"> <span class="key">yield</span> <span class="nam">part</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1059" href="#t1059">1059</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1060" href="#t1060">1060</a></span><span class="t"> <span class="key">def</span> <span class="nam">iter_recurse</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1061" href="#t1061">1061</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">only_element_or_token_type</span><span class="op">=</span><span class="key">None</span> <span class="com"># type: Optional[Type[TE]]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1062" href="#t1062">1062</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1063" href="#t1063">1063</a></span><span class="t"> <span class="com"># type: (...) -> Iterable[TE]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1064" href="#t1064">1064</a></span><span class="t"> <span class="key">for</span> <span class="nam">part</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">iter_parts</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1065" href="#t1065">1065</a></span><span class="t"> <span class="key">if</span> <span class="nam">only_element_or_token_type</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">isinstance</span><span class="op">(</span> </span><span class="r"><span class="annotate short">1065 ↛ 1068</span><span class="annotate long">line 1065 didn't jump to line 1068, because the condition on line 1065 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t1066" href="#t1066">1066</a></span><span class="t"> <span class="nam">part</span><span class="op">,</span> <span class="nam">only_element_or_token_type</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1067" href="#t1067">1067</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1068" href="#t1068">1068</a></span><span class="t"> <span class="key">yield</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"TE"</span><span class="op">,</span> <span class="nam">part</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1069" href="#t1069">1069</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">part</span><span class="op">,</span> <span class="nam">Deb822Element</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1070" href="#t1070">1070</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">part</span><span class="op">.</span><span class="nam">iter_recurse</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1071" href="#t1071">1071</a></span><span class="t"> <span class="nam">only_element_or_token_type</span><span class="op">=</span><span class="nam">only_element_or_token_type</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1072" href="#t1072">1072</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1073" href="#t1073">1073</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1074" href="#t1074">1074</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1075" href="#t1075">1075</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_error</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1076" href="#t1076">1076</a></span><span class="t"> <span class="com"># type: () -> bool</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1077" href="#t1077">1077</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1078" href="#t1078">1078</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1079" href="#t1079">1079</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1080" href="#t1080">1080</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_comment</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1081" href="#t1081">1081</a></span><span class="t"> <span class="com"># type: () -> bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1082" href="#t1082">1082</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1083" href="#t1083">1083</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1084" href="#t1084">1084</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1085" href="#t1085">1085</a></span><span class="t"> <span class="key">def</span> <span class="nam">parent_element</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1086" href="#t1086">1086</a></span><span class="t"> <span class="com"># type: () -> Optional[Deb822Element]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1087" href="#t1087">1087</a></span><span class="t"> <span class="key">return</span> <span class="nam">resolve_ref</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_parent_element</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1088" href="#t1088">1088</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1089" href="#t1089">1089</a></span><span class="t"> <span class="op">@</span><span class="nam">parent_element</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1090" href="#t1090">1090</a></span><span class="t"> <span class="key">def</span> <span class="nam">parent_element</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">new_parent</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1091" href="#t1091">1091</a></span><span class="t"> <span class="com"># type: (Optional[Deb822Element]) -> None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1092" href="#t1092">1092</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent_element</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1093" href="#t1093">1093</a></span><span class="t"> <span class="nam">weakref</span><span class="op">.</span><span class="nam">ref</span><span class="op">(</span><span class="nam">new_parent</span><span class="op">)</span> <span class="key">if</span> <span class="nam">new_parent</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">else</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1094" href="#t1094">1094</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1095" href="#t1095">1095</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1096" href="#t1096">1096</a></span><span class="t"> <span class="key">def</span> <span class="nam">_init_parent_of_parts</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1097" href="#t1097">1097</a></span><span class="t"> <span class="com"># type: () -> None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1098" href="#t1098">1098</a></span><span class="t"> <span class="key">for</span> <span class="nam">part</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">iter_parts</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1099" href="#t1099">1099</a></span><span class="t"> <span class="nam">part</span><span class="op">.</span><span class="nam">parent_element</span> <span class="op">=</span> <span class="nam">self</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1100" href="#t1100">1100</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1101" href="#t1101">1101</a></span><span class="t"> <span class="com"># Deliberately not a "text" property, to signal that it is not necessary cheap.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1102" href="#t1102">1102</a></span><span class="t"> <span class="key">def</span> <span class="nam">convert_to_text</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1103" href="#t1103">1103</a></span><span class="t"> <span class="com"># type: () -> str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1104" href="#t1104">1104</a></span><span class="t"> <span class="key">return</span> <span class="str">""</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">t</span><span class="op">.</span><span class="nam">text</span> <span class="key">for</span> <span class="nam">t</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">iter_tokens</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1105" href="#t1105">1105</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1106" href="#t1106">1106</a></span><span class="t"> <span class="key">def</span> <span class="nam">clear_parent_if_parent</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">parent</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1107" href="#t1107">1107</a></span><span class="t"> <span class="com"># type: (Deb822Element) -> None</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1108" href="#t1108">1108</a></span><span class="t"> <span class="key">if</span> <span class="nam">parent</span> <span class="key">is</span> <span class="nam">self</span><span class="op">.</span><span class="nam">parent_element</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1108 ↛ exit</span><span class="annotate long">line 1108 didn't return from function 'clear_parent_if_parent', because the condition on line 1108 was never false</span></span></p> - <p class="run"><span class="n"><a id="t1109" href="#t1109">1109</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent_element</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1110" href="#t1110">1110</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1111" href="#t1111">1111</a></span><span class="t"> <span class="key">def</span> <span class="nam">size</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">skip_leading_comments</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Range</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1112" href="#t1112">1112</a></span><span class="t"> <span class="nam">size_cache</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_full_size_cache</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1113" href="#t1113">1113</a></span><span class="t"> <span class="key">if</span> <span class="nam">size_cache</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1114" href="#t1114">1114</a></span><span class="t"> <span class="nam">size_cache</span> <span class="op">=</span> <span class="nam">Range</span><span class="op">.</span><span class="nam">from_position_and_sizes</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1115" href="#t1115">1115</a></span><span class="t"> <span class="nam">START_POSITION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1116" href="#t1116">1116</a></span><span class="t"> <span class="op">(</span><span class="nam">p</span><span class="op">.</span><span class="nam">size</span><span class="op">(</span><span class="nam">skip_leading_comments</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">iter_parts</span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1117" href="#t1117">1117</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1118" href="#t1118">1118</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_full_size_cache</span> <span class="op">=</span> <span class="nam">size_cache</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1119" href="#t1119">1119</a></span><span class="t"> <span class="key">return</span> <span class="nam">size_cache</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1120" href="#t1120">1120</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1121" href="#t1121">1121</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1122" href="#t1122">1122</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822InterpretationProxyElement</span><span class="op">(</span><span class="nam">Deb822Element</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1123" href="#t1123">1123</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1124" href="#t1124">1124</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"parts"</span><span class="op">,</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1125" href="#t1125">1125</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1126" href="#t1126">1126</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1127" href="#t1127">1127</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> <span class="nam">real_element</span><span class="op">:</span> <span class="nam">Deb822Element</span><span class="op">,</span> <span class="nam">parts</span><span class="op">:</span> <span class="nam">List</span><span class="op">[</span><span class="nam">TokenOrElement</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1128" href="#t1128">1128</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1129" href="#t1129">1129</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1130" href="#t1130">1130</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">parent_element</span> <span class="op">=</span> <span class="nam">real_element</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1131" href="#t1131">1131</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">parts</span> <span class="op">=</span> <span class="nam">parts</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1132" href="#t1132">1132</a></span><span class="t"> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">parts</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1133" href="#t1133">1133</a></span><span class="t"> <span class="nam">p</span><span class="op">.</span><span class="nam">parent_element</span> <span class="op">=</span> <span class="nam">self</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1134" href="#t1134">1134</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1135" href="#t1135">1135</a></span><span class="t"> <span class="key">def</span> <span class="nam">iter_parts</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1136" href="#t1136">1136</a></span><span class="t"> <span class="com"># type: () -> Iterable[TokenOrElement]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1137" href="#t1137">1137</a></span><span class="t"> <span class="key">return</span> <span class="nam">iter</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">parts</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1138" href="#t1138">1138</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1139" href="#t1139">1139</a></span><span class="t"> <span class="key">def</span> <span class="nam">position_in_parent</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">skip_leading_comments</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Position</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1140" href="#t1140">1140</a></span><span class="t"> <span class="nam">parent</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">parent_element</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1141" href="#t1141">1141</a></span><span class="t"> <span class="key">if</span> <span class="nam">parent</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1142" href="#t1142">1142</a></span><span class="t"> <span class="key">raise</span> <span class="nam">RuntimeError</span><span class="op">(</span><span class="str">"parent was garbage collected"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1143" href="#t1143">1143</a></span><span class="t"> <span class="key">return</span> <span class="nam">parent</span><span class="op">.</span><span class="nam">position_in_parent</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1144" href="#t1144">1144</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1145" href="#t1145">1145</a></span><span class="t"> <span class="key">def</span> <span class="nam">position_in_file</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">skip_leading_comments</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Position</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1146" href="#t1146">1146</a></span><span class="t"> <span class="nam">parent</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">parent_element</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1147" href="#t1147">1147</a></span><span class="t"> <span class="key">if</span> <span class="nam">parent</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1148" href="#t1148">1148</a></span><span class="t"> <span class="key">raise</span> <span class="nam">RuntimeError</span><span class="op">(</span><span class="str">"parent was garbage collected"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1149" href="#t1149">1149</a></span><span class="t"> <span class="key">return</span> <span class="nam">parent</span><span class="op">.</span><span class="nam">position_in_file</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1150" href="#t1150">1150</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1151" href="#t1151">1151</a></span><span class="t"> <span class="key">def</span> <span class="nam">size</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">skip_leading_comments</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Range</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1152" href="#t1152">1152</a></span><span class="t"> <span class="com"># Same as parent except we never use a cache.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1153" href="#t1153">1153</a></span><span class="t"> <span class="nam">sizes</span> <span class="op">=</span> <span class="op">(</span><span class="nam">p</span><span class="op">.</span><span class="nam">size</span><span class="op">(</span><span class="nam">skip_leading_comments</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">iter_parts</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1154" href="#t1154">1154</a></span><span class="t"> <span class="key">return</span> <span class="nam">Range</span><span class="op">.</span><span class="nam">from_position_and_sizes</span><span class="op">(</span><span class="nam">START_POSITION</span><span class="op">,</span> <span class="nam">sizes</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1155" href="#t1155">1155</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1156" href="#t1156">1156</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1157" href="#t1157">1157</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822ErrorElement</span><span class="op">(</span><span class="nam">Deb822Element</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1158" href="#t1158">1158</a></span><span class="t"> <span class="str">"""Element representing elements or tokens that are out of place</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1159" href="#t1159">1159</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1160" href="#t1160">1160</a></span><span class="t"><span class="str"> Commonly, it will just be instances of Deb822ErrorToken, but it can be other</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1161" href="#t1161">1161</a></span><span class="t"><span class="str"> things. As an example if a parser discovers out of order elements/tokens,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1162" href="#t1162">1162</a></span><span class="t"><span class="str"> it can bundle them in a Deb822ErrorElement to signal that the sequence of</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1163" href="#t1163">1163</a></span><span class="t"><span class="str"> elements/tokens are invalid (even if the tokens themselves are valid).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1164" href="#t1164">1164</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1165" href="#t1165">1165</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1166" href="#t1166">1166</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"_parts"</span><span class="op">,</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1167" href="#t1167">1167</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1168" href="#t1168">1168</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">parts</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1169" href="#t1169">1169</a></span><span class="t"> <span class="com"># type: (Sequence[TokenOrElement]) -> None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1170" href="#t1170">1170</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1171" href="#t1171">1171</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_parts</span> <span class="op">=</span> <span class="nam">tuple</span><span class="op">(</span><span class="nam">parts</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1172" href="#t1172">1172</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_init_parent_of_parts</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1173" href="#t1173">1173</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1174" href="#t1174">1174</a></span><span class="t"> <span class="key">def</span> <span class="nam">iter_parts</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1175" href="#t1175">1175</a></span><span class="t"> <span class="com"># type: () -> Iterable[TokenOrElement]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1176" href="#t1176">1176</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_parts</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1177" href="#t1177">1177</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1178" href="#t1178">1178</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1179" href="#t1179">1179</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_error</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1180" href="#t1180">1180</a></span><span class="t"> <span class="com"># type: () -> bool</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1181" href="#t1181">1181</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1182" href="#t1182">1182</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1183" href="#t1183">1183</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1184" href="#t1184">1184</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822ValueLineElement</span><span class="op">(</span><span class="nam">Deb822Element</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1185" href="#t1185">1185</a></span><span class="t"> <span class="str">"""Consists of one "line" of a value"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1186" href="#t1186">1186</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1187" href="#t1187">1187</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1188" href="#t1188">1188</a></span><span class="t"> <span class="str">"_comment_element"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1189" href="#t1189">1189</a></span><span class="t"> <span class="str">"_continuation_line_token"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1190" href="#t1190">1190</a></span><span class="t"> <span class="str">"_leading_whitespace_token"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1191" href="#t1191">1191</a></span><span class="t"> <span class="str">"_value_tokens"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1192" href="#t1192">1192</a></span><span class="t"> <span class="str">"_trailing_whitespace_token"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1193" href="#t1193">1193</a></span><span class="t"> <span class="str">"_newline_token"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1194" href="#t1194">1194</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1195" href="#t1195">1195</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1196" href="#t1196">1196</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1197" href="#t1197">1197</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1198" href="#t1198">1198</a></span><span class="t"> <span class="nam">comment_element</span><span class="op">,</span> <span class="com"># type: Optional[Deb822CommentElement]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1199" href="#t1199">1199</a></span><span class="t"> <span class="nam">continuation_line_token</span><span class="op">,</span> <span class="com"># type: Optional[Deb822ValueContinuationToken]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1200" href="#t1200">1200</a></span><span class="t"> <span class="nam">leading_whitespace_token</span><span class="op">,</span> <span class="com"># type: Optional[Deb822WhitespaceToken]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1201" href="#t1201">1201</a></span><span class="t"> <span class="nam">value_parts</span><span class="op">,</span> <span class="com"># type: List[TokenOrElement]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1202" href="#t1202">1202</a></span><span class="t"> <span class="nam">trailing_whitespace_token</span><span class="op">,</span> <span class="com"># type: Optional[Deb822WhitespaceToken]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1203" href="#t1203">1203</a></span><span class="t"> <span class="com"># only optional if it is the last line of the file and the file does not</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1204" href="#t1204">1204</a></span><span class="t"> <span class="com"># end with a newline.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1205" href="#t1205">1205</a></span><span class="t"> <span class="nam">newline_token</span><span class="op">,</span> <span class="com"># type: Optional[Deb822WhitespaceToken]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1206" href="#t1206">1206</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1207" href="#t1207">1207</a></span><span class="t"> <span class="com"># type: (...) -> None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1208" href="#t1208">1208</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1209" href="#t1209">1209</a></span><span class="t"> <span class="key">if</span> <span class="nam">comment_element</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">continuation_line_token</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1209 ↛ 1210</span><span class="annotate long">line 1209 didn't jump to line 1210, because the condition on line 1209 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1210" href="#t1210">1210</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"Only continuation lines can have comments"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1211" href="#t1211">1211</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_comment_element</span> <span class="op">=</span> <span class="nam">comment_element</span> <span class="com"># type: Optional[Deb822CommentElement]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1212" href="#t1212">1212</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_continuation_line_token</span> <span class="op">=</span> <span class="nam">continuation_line_token</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1213" href="#t1213">1213</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_leading_whitespace_token</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1214" href="#t1214">1214</a></span><span class="t"> <span class="nam">leading_whitespace_token</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1215" href="#t1215">1215</a></span><span class="t"> <span class="op">)</span> <span class="com"># type: Optional[Deb822WhitespaceToken]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1216" href="#t1216">1216</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_value_tokens</span> <span class="op">=</span> <span class="nam">value_parts</span> <span class="com"># type: List[TokenOrElement]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1217" href="#t1217">1217</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_trailing_whitespace_token</span> <span class="op">=</span> <span class="nam">trailing_whitespace_token</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1218" href="#t1218">1218</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_newline_token</span> <span class="op">=</span> <span class="nam">newline_token</span> <span class="com"># type: Optional[Deb822WhitespaceToken]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1219" href="#t1219">1219</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_init_parent_of_parts</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1220" href="#t1220">1220</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1221" href="#t1221">1221</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1222" href="#t1222">1222</a></span><span class="t"> <span class="key">def</span> <span class="nam">comment_element</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1223" href="#t1223">1223</a></span><span class="t"> <span class="com"># type: () -> Optional[Deb822CommentElement]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1224" href="#t1224">1224</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_comment_element</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1225" href="#t1225">1225</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1226" href="#t1226">1226</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1227" href="#t1227">1227</a></span><span class="t"> <span class="key">def</span> <span class="nam">continuation_line_token</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1228" href="#t1228">1228</a></span><span class="t"> <span class="com"># type: () -> Optional[Deb822ValueContinuationToken]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1229" href="#t1229">1229</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_continuation_line_token</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1230" href="#t1230">1230</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1231" href="#t1231">1231</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1232" href="#t1232">1232</a></span><span class="t"> <span class="key">def</span> <span class="nam">newline_token</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1233" href="#t1233">1233</a></span><span class="t"> <span class="com"># type: () -> Optional[Deb822WhitespaceToken]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1234" href="#t1234">1234</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_newline_token</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1235" href="#t1235">1235</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1236" href="#t1236">1236</a></span><span class="t"> <span class="key">def</span> <span class="nam">add_newline_if_missing</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1237" href="#t1237">1237</a></span><span class="t"> <span class="com"># type: () -> bool</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1238" href="#t1238">1238</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_newline_token</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1239" href="#t1239">1239</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_newline_token</span> <span class="op">=</span> <span class="nam">Deb822NewlineAfterValueToken</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1240" href="#t1240">1240</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_newline_token</span><span class="op">.</span><span class="nam">parent_element</span> <span class="op">=</span> <span class="nam">self</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1241" href="#t1241">1241</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_full_size_cache</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1242" href="#t1242">1242</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1243" href="#t1243">1243</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1244" href="#t1244">1244</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1245" href="#t1245">1245</a></span><span class="t"> <span class="key">def</span> <span class="nam">_iter_content_parts</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1246" href="#t1246">1246</a></span><span class="t"> <span class="com"># type: () -> Iterable[TokenOrElement]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1247" href="#t1247">1247</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_leading_whitespace_token</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1247 ↛ 1248</span><span class="annotate long">line 1247 didn't jump to line 1248, because the condition on line 1247 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1248" href="#t1248">1248</a></span><span class="t"> <span class="key">yield</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_leading_whitespace_token</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1249" href="#t1249">1249</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_value_tokens</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1250" href="#t1250">1250</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_trailing_whitespace_token</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1251" href="#t1251">1251</a></span><span class="t"> <span class="key">yield</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_trailing_whitespace_token</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1252" href="#t1252">1252</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1253" href="#t1253">1253</a></span><span class="t"> <span class="key">def</span> <span class="nam">_iter_content_tokens</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1254" href="#t1254">1254</a></span><span class="t"> <span class="com"># type: () -> Iterable[Deb822Token]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1255" href="#t1255">1255</a></span><span class="t"> <span class="key">for</span> <span class="nam">part</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_iter_content_parts</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1256" href="#t1256">1256</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">part</span><span class="op">,</span> <span class="nam">Deb822Element</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1257" href="#t1257">1257</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">part</span><span class="op">.</span><span class="nam">iter_tokens</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1258" href="#t1258">1258</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1259" href="#t1259">1259</a></span><span class="t"> <span class="key">yield</span> <span class="nam">part</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1260" href="#t1260">1260</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1261" href="#t1261">1261</a></span><span class="t"> <span class="key">def</span> <span class="nam">convert_content_to_text</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1262" href="#t1262">1262</a></span><span class="t"> <span class="com"># type: () -> str</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1263" href="#t1263">1263</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1264" href="#t1264">1264</a></span><span class="t"> <span class="nam">len</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_value_tokens</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1265" href="#t1265">1265</a></span><span class="t"> <span class="key">and</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_leading_whitespace_token</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1266" href="#t1266">1266</a></span><span class="t"> <span class="key">and</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_trailing_whitespace_token</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1267" href="#t1267">1267</a></span><span class="t"> <span class="key">and</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_value_tokens</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">,</span> <span class="nam">Deb822Token</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1268" href="#t1268">1268</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1269" href="#t1269">1269</a></span><span class="t"> <span class="com"># By default, we get a single value spanning the entire line</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1270" href="#t1270">1270</a></span><span class="t"> <span class="com"># (minus continuation line and newline, but we are supposed to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1271" href="#t1271">1271</a></span><span class="t"> <span class="com"># exclude those)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1272" href="#t1272">1272</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_value_tokens</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">.</span><span class="nam">text</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1273" href="#t1273">1273</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1274" href="#t1274">1274</a></span><span class="t"> <span class="key">return</span> <span class="str">""</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">t</span><span class="op">.</span><span class="nam">text</span> <span class="key">for</span> <span class="nam">t</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_iter_content_tokens</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1275" href="#t1275">1275</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1276" href="#t1276">1276</a></span><span class="t"> <span class="key">def</span> <span class="nam">iter_parts</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1277" href="#t1277">1277</a></span><span class="t"> <span class="com"># type: () -> Iterable[TokenOrElement]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1278" href="#t1278">1278</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_comment_element</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1279" href="#t1279">1279</a></span><span class="t"> <span class="key">yield</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_comment_element</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1280" href="#t1280">1280</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_continuation_line_token</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1281" href="#t1281">1281</a></span><span class="t"> <span class="key">yield</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_continuation_line_token</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1282" href="#t1282">1282</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_iter_content_parts</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1283" href="#t1283">1283</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_newline_token</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1283 ↛ exit</span><span class="annotate long">line 1283 didn't return from function 'iter_parts', because the condition on line 1283 was never false</span></span></p> - <p class="run"><span class="n"><a id="t1284" href="#t1284">1284</a></span><span class="t"> <span class="key">yield</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_newline_token</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1285" href="#t1285">1285</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1286" href="#t1286">1286</a></span><span class="t"> <span class="key">def</span> <span class="nam">size</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">skip_leading_comments</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Range</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1287" href="#t1287">1287</a></span><span class="t"> <span class="key">if</span> <span class="nam">skip_leading_comments</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1287 ↛ 1288</span><span class="annotate long">line 1287 didn't jump to line 1288, because the condition on line 1287 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1288" href="#t1288">1288</a></span><span class="t"> <span class="key">return</span> <span class="nam">Range</span><span class="op">.</span><span class="nam">from_position_and_sizes</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1289" href="#t1289">1289</a></span><span class="t"> <span class="nam">START_POSITION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1290" href="#t1290">1290</a></span><span class="t"> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1291" href="#t1291">1291</a></span><span class="t"> <span class="nam">p</span><span class="op">.</span><span class="nam">size</span><span class="op">(</span><span class="nam">skip_leading_comments</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1292" href="#t1292">1292</a></span><span class="t"> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">iter_parts</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1293" href="#t1293">1293</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">p</span><span class="op">.</span><span class="nam">is_comment</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1294" href="#t1294">1294</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1295" href="#t1295">1295</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1296" href="#t1296">1296</a></span><span class="t"> <span class="key">return</span> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">size</span><span class="op">(</span><span class="nam">skip_leading_comments</span><span class="op">=</span><span class="nam">skip_leading_comments</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1297" href="#t1297">1297</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1298" href="#t1298">1298</a></span><span class="t"> <span class="key">def</span> <span class="nam">position_in_parent</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">skip_leading_comments</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Position</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1299" href="#t1299">1299</a></span><span class="t"> <span class="nam">base_pos</span> <span class="op">=</span> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">position_in_parent</span><span class="op">(</span><span class="nam">skip_leading_comments</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1300" href="#t1300">1300</a></span><span class="t"> <span class="key">if</span> <span class="nam">skip_leading_comments</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1301" href="#t1301">1301</a></span><span class="t"> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">iter_parts</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1302" href="#t1302">1302</a></span><span class="t"> <span class="key">if</span> <span class="nam">p</span><span class="op">.</span><span class="nam">is_comment</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1303" href="#t1303">1303</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1304" href="#t1304">1304</a></span><span class="t"> <span class="nam">non_comment_pos</span> <span class="op">=</span> <span class="nam">p</span><span class="op">.</span><span class="nam">position_in_parent</span><span class="op">(</span><span class="nam">skip_leading_comments</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1305" href="#t1305">1305</a></span><span class="t"> <span class="nam">base_pos</span> <span class="op">=</span> <span class="nam">non_comment_pos</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span><span class="nam">base_pos</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1306" href="#t1306">1306</a></span><span class="t"> <span class="key">return</span> <span class="nam">base_pos</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1307" href="#t1307">1307</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1308" href="#t1308">1308</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1309" href="#t1309">1309</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822ValueElement</span><span class="op">(</span><span class="nam">Deb822Element</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1310" href="#t1310">1310</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"_value_entry_elements"</span><span class="op">,</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1311" href="#t1311">1311</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1312" href="#t1312">1312</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">value_entry_elements</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1313" href="#t1313">1313</a></span><span class="t"> <span class="com"># type: (Sequence[Deb822ValueLineElement]) -> None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1314" href="#t1314">1314</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1315" href="#t1315">1315</a></span><span class="t"> <span class="com"># Split over two lines due to line length issues</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1316" href="#t1316">1316</a></span><span class="t"> <span class="nam">v</span> <span class="op">=</span> <span class="nam">tuple</span><span class="op">(</span><span class="nam">value_entry_elements</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1317" href="#t1317">1317</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_value_entry_elements</span> <span class="op">=</span> <span class="nam">v</span> <span class="com"># type: Sequence[Deb822ValueLineElement]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1318" href="#t1318">1318</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_init_parent_of_parts</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1319" href="#t1319">1319</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1320" href="#t1320">1320</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1321" href="#t1321">1321</a></span><span class="t"> <span class="key">def</span> <span class="nam">value_lines</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1322" href="#t1322">1322</a></span><span class="t"> <span class="com"># type: () -> Sequence[Deb822ValueLineElement]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1323" href="#t1323">1323</a></span><span class="t"> <span class="str">"""Read-only list of value entries"""</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1324" href="#t1324">1324</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_value_entry_elements</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1325" href="#t1325">1325</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1326" href="#t1326">1326</a></span><span class="t"> <span class="key">def</span> <span class="nam">iter_parts</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1327" href="#t1327">1327</a></span><span class="t"> <span class="com"># type: () -> Iterable[TokenOrElement]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1328" href="#t1328">1328</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_value_entry_elements</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1329" href="#t1329">1329</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1330" href="#t1330">1330</a></span><span class="t"> <span class="key">def</span> <span class="nam">add_final_newline_if_missing</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1331" href="#t1331">1331</a></span><span class="t"> <span class="com"># type: () -> bool</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1332" href="#t1332">1332</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_value_entry_elements</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1333" href="#t1333">1333</a></span><span class="t"> <span class="nam">changed</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_value_entry_elements</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span><span class="op">.</span><span class="nam">add_newline_if_missing</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1334" href="#t1334">1334</a></span><span class="t"> <span class="key">if</span> <span class="nam">changed</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1335" href="#t1335">1335</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_full_size_cache</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1336" href="#t1336">1336</a></span><span class="t"> <span class="key">return</span> <span class="nam">changed</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1337" href="#t1337">1337</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1338" href="#t1338">1338</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1339" href="#t1339">1339</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1340" href="#t1340">1340</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822ParsedValueElement</span><span class="op">(</span><span class="nam">Deb822Element</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1341" href="#t1341">1341</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1342" href="#t1342">1342</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"_text_cached"</span><span class="op">,</span> <span class="str">"_text_no_comments_cached"</span><span class="op">,</span> <span class="str">"_token_list"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1343" href="#t1343">1343</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1344" href="#t1344">1344</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">tokens</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1345" href="#t1345">1345</a></span><span class="t"> <span class="com"># type: (List[Deb822Token]) -> None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1346" href="#t1346">1346</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1347" href="#t1347">1347</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_list</span> <span class="op">=</span> <span class="nam">tokens</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1348" href="#t1348">1348</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_init_parent_of_parts</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1349" href="#t1349">1349</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">tokens</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">,</span> <span class="nam">Deb822ValueToken</span><span class="op">)</span> <span class="key">or</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span> </span><span class="r"><span class="annotate short">1349 ↛ 1352</span><span class="annotate long">line 1349 didn't jump to line 1352, because the condition on line 1349 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t1350" href="#t1350">1350</a></span><span class="t"> <span class="nam">tokens</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span><span class="op">,</span> <span class="nam">Deb822ValueToken</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1351" href="#t1351">1351</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1352" href="#t1352">1352</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1353" href="#t1353">1353</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">__class__</span><span class="op">.</span><span class="nam">__name__</span> <span class="op">+</span> <span class="str">" MUST start and end on a Deb822ValueToken"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1354" href="#t1354">1354</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1355" href="#t1355">1355</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">tokens</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1355 ↛ 1360</span><span class="annotate long">line 1355 didn't jump to line 1360, because the condition on line 1355 was never false</span></span></p> - <p class="run"><span class="n"><a id="t1356" href="#t1356">1356</a></span><span class="t"> <span class="nam">token</span> <span class="op">=</span> <span class="nam">tokens</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1357" href="#t1357">1357</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_text_cached</span> <span class="op">=</span> <span class="nam">token</span><span class="op">.</span><span class="nam">text</span> <span class="com"># type: Optional[str]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1358" href="#t1358">1358</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_text_no_comments_cached</span> <span class="op">=</span> <span class="nam">token</span><span class="op">.</span><span class="nam">text</span> <span class="com"># type: Optional[str]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1359" href="#t1359">1359</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1360" href="#t1360">1360</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_text_cached</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1361" href="#t1361">1361</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_text_no_comments_cached</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1362" href="#t1362">1362</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1363" href="#t1363">1363</a></span><span class="t"> <span class="key">def</span> <span class="nam">convert_to_text</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1364" href="#t1364">1364</a></span><span class="t"> <span class="com"># type: () -> str</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1365" href="#t1365">1365</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_text_no_comments_cached</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1365 ↛ 1366</span><span class="annotate long">line 1365 didn't jump to line 1366, because the condition on line 1365 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1366" href="#t1366">1366</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_text_no_comments_cached</span> <span class="op">=</span> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">convert_to_text</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1367" href="#t1367">1367</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_text_no_comments_cached</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1368" href="#t1368">1368</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1369" href="#t1369">1369</a></span><span class="t"> <span class="key">def</span> <span class="nam">convert_to_text_without_comments</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1370" href="#t1370">1370</a></span><span class="t"> <span class="com"># type: () -> str</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1371" href="#t1371">1371</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_text_no_comments_cached</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1371 ↛ 1372</span><span class="annotate long">line 1371 didn't jump to line 1372, because the condition on line 1371 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1372" href="#t1372">1372</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_text_no_comments_cached</span> <span class="op">=</span> <span class="str">""</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1373" href="#t1373">1373</a></span><span class="t"> <span class="nam">t</span><span class="op">.</span><span class="nam">text</span> <span class="key">for</span> <span class="nam">t</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">iter_tokens</span><span class="op">(</span><span class="op">)</span> <span class="key">if</span> <span class="key">not</span> <span class="nam">t</span><span class="op">.</span><span class="nam">is_comment</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1374" href="#t1374">1374</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1375" href="#t1375">1375</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_text_no_comments_cached</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1376" href="#t1376">1376</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1377" href="#t1377">1377</a></span><span class="t"> <span class="key">def</span> <span class="nam">iter_parts</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1378" href="#t1378">1378</a></span><span class="t"> <span class="com"># type: () -> Iterable[TokenOrElement]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1379" href="#t1379">1379</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_list</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1380" href="#t1380">1380</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1381" href="#t1381">1381</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1382" href="#t1382">1382</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822CommentElement</span><span class="op">(</span><span class="nam">Deb822Element</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1383" href="#t1383">1383</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"_comment_tokens"</span><span class="op">,</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1384" href="#t1384">1384</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1385" href="#t1385">1385</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">comment_tokens</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1386" href="#t1386">1386</a></span><span class="t"> <span class="com"># type: (Sequence[Deb822CommentToken]) -> None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1387" href="#t1387">1387</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1388" href="#t1388">1388</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_comment_tokens</span> <span class="op">=</span> <span class="nam">tuple</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1389" href="#t1389">1389</a></span><span class="t"> <span class="nam">comment_tokens</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1390" href="#t1390">1390</a></span><span class="t"> <span class="op">)</span> <span class="com"># type: Sequence[Deb822CommentToken]</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1391" href="#t1391">1391</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">comment_tokens</span><span class="op">:</span> <span class="com"># pragma: no cover</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1392" href="#t1392">1392</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"Comment elements must have at least one comment token"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1393" href="#t1393">1393</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_init_parent_of_parts</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1394" href="#t1394">1394</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1395" href="#t1395">1395</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1396" href="#t1396">1396</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_comment</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1397" href="#t1397">1397</a></span><span class="t"> <span class="com"># type: () -> bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1398" href="#t1398">1398</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1399" href="#t1399">1399</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1400" href="#t1400">1400</a></span><span class="t"> <span class="key">def</span> <span class="nam">__len__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1401" href="#t1401">1401</a></span><span class="t"> <span class="com"># type: () -> int</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1402" href="#t1402">1402</a></span><span class="t"> <span class="key">return</span> <span class="nam">len</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_comment_tokens</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1403" href="#t1403">1403</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1404" href="#t1404">1404</a></span><span class="t"> <span class="key">def</span> <span class="nam">__getitem__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">item</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1405" href="#t1405">1405</a></span><span class="t"> <span class="com"># type: (int) -> Deb822CommentToken</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1406" href="#t1406">1406</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_comment_tokens</span><span class="op">[</span><span class="nam">item</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1407" href="#t1407">1407</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1408" href="#t1408">1408</a></span><span class="t"> <span class="key">def</span> <span class="nam">iter_parts</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1409" href="#t1409">1409</a></span><span class="t"> <span class="com"># type: () -> Iterable[TokenOrElement]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1410" href="#t1410">1410</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_comment_tokens</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1411" href="#t1411">1411</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1412" href="#t1412">1412</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1413" href="#t1413">1413</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822KeyValuePairElement</span><span class="op">(</span><span class="nam">Deb822Element</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1414" href="#t1414">1414</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1415" href="#t1415">1415</a></span><span class="t"> <span class="str">"_comment_element"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1416" href="#t1416">1416</a></span><span class="t"> <span class="str">"_field_token"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1417" href="#t1417">1417</a></span><span class="t"> <span class="str">"_separator_token"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1418" href="#t1418">1418</a></span><span class="t"> <span class="str">"_value_element"</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1419" href="#t1419">1419</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1420" href="#t1420">1420</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1421" href="#t1421">1421</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1422" href="#t1422">1422</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1423" href="#t1423">1423</a></span><span class="t"> <span class="nam">comment_element</span><span class="op">,</span> <span class="com"># type: Optional[Deb822CommentElement]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1424" href="#t1424">1424</a></span><span class="t"> <span class="nam">field_token</span><span class="op">,</span> <span class="com"># type: Deb822FieldNameToken</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1425" href="#t1425">1425</a></span><span class="t"> <span class="nam">separator_token</span><span class="op">,</span> <span class="com"># type: Deb822FieldSeparatorToken</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1426" href="#t1426">1426</a></span><span class="t"> <span class="nam">value_element</span><span class="op">,</span> <span class="com"># type: Deb822ValueElement</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1427" href="#t1427">1427</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1428" href="#t1428">1428</a></span><span class="t"> <span class="com"># type: (...) -> None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1429" href="#t1429">1429</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1430" href="#t1430">1430</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_comment_element</span> <span class="op">=</span> <span class="nam">comment_element</span> <span class="com"># type: Optional[Deb822CommentElement]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1431" href="#t1431">1431</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_field_token</span> <span class="op">=</span> <span class="nam">field_token</span> <span class="com"># type: Deb822FieldNameToken</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1432" href="#t1432">1432</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_separator_token</span> <span class="op">=</span> <span class="nam">separator_token</span> <span class="com"># type: Deb822FieldSeparatorToken</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1433" href="#t1433">1433</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_value_element</span> <span class="op">=</span> <span class="nam">value_element</span> <span class="com"># type: Deb822ValueElement</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1434" href="#t1434">1434</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_init_parent_of_parts</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1435" href="#t1435">1435</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1436" href="#t1436">1436</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1437" href="#t1437">1437</a></span><span class="t"> <span class="key">def</span> <span class="nam">field_name</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1438" href="#t1438">1438</a></span><span class="t"> <span class="com"># type: () -> _strI</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1439" href="#t1439">1439</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">field_token</span><span class="op">.</span><span class="nam">text</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1440" href="#t1440">1440</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1441" href="#t1441">1441</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1442" href="#t1442">1442</a></span><span class="t"> <span class="key">def</span> <span class="nam">field_token</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1443" href="#t1443">1443</a></span><span class="t"> <span class="com"># type: () -> Deb822FieldNameToken</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1444" href="#t1444">1444</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_field_token</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1445" href="#t1445">1445</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1446" href="#t1446">1446</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1447" href="#t1447">1447</a></span><span class="t"> <span class="key">def</span> <span class="nam">value_element</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1448" href="#t1448">1448</a></span><span class="t"> <span class="com"># type: () -> Deb822ValueElement</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1449" href="#t1449">1449</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_value_element</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1450" href="#t1450">1450</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1451" href="#t1451">1451</a></span><span class="t"> <span class="op">@</span><span class="nam">value_element</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1452" href="#t1452">1452</a></span><span class="t"> <span class="key">def</span> <span class="nam">value_element</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">new_value</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1453" href="#t1453">1453</a></span><span class="t"> <span class="com"># type: (Deb822ValueElement) -> None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1454" href="#t1454">1454</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_full_size_cache</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1455" href="#t1455">1455</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_value_element</span><span class="op">.</span><span class="nam">clear_parent_if_parent</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1456" href="#t1456">1456</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_value_element</span> <span class="op">=</span> <span class="nam">new_value</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1457" href="#t1457">1457</a></span><span class="t"> <span class="nam">new_value</span><span class="op">.</span><span class="nam">parent_element</span> <span class="op">=</span> <span class="nam">self</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1458" href="#t1458">1458</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1459" href="#t1459">1459</a></span><span class="t"> <span class="key">def</span> <span class="nam">interpret_as</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1460" href="#t1460">1460</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1461" href="#t1461">1461</a></span><span class="t"> <span class="nam">interpreter</span><span class="op">,</span> <span class="com"># type: Interpretation[T]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1462" href="#t1462">1462</a></span><span class="t"> <span class="nam">discard_comments_on_read</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="com"># type: bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1463" href="#t1463">1463</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1464" href="#t1464">1464</a></span><span class="t"> <span class="com"># type: (...) -> T</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1465" href="#t1465">1465</a></span><span class="t"> <span class="key">return</span> <span class="nam">interpreter</span><span class="op">.</span><span class="nam">interpret</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1466" href="#t1466">1466</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> <span class="nam">discard_comments_on_read</span><span class="op">=</span><span class="nam">discard_comments_on_read</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1467" href="#t1467">1467</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1468" href="#t1468">1468</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1469" href="#t1469">1469</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1470" href="#t1470">1470</a></span><span class="t"> <span class="key">def</span> <span class="nam">comment_element</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1471" href="#t1471">1471</a></span><span class="t"> <span class="com"># type: () -> Optional[Deb822CommentElement]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1472" href="#t1472">1472</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_comment_element</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1473" href="#t1473">1473</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1474" href="#t1474">1474</a></span><span class="t"> <span class="op">@</span><span class="nam">comment_element</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1475" href="#t1475">1475</a></span><span class="t"> <span class="key">def</span> <span class="nam">comment_element</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">value</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1476" href="#t1476">1476</a></span><span class="t"> <span class="com"># type: (Optional[Deb822CommentElement]) -> None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1477" href="#t1477">1477</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_full_size_cache</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1478" href="#t1478">1478</a></span><span class="t"> <span class="key">if</span> <span class="nam">value</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1478 ↛ 1479</span><span class="annotate long">line 1478 didn't jump to line 1479, because the condition on line 1478 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1479" href="#t1479">1479</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">value</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span><span class="op">.</span><span class="nam">text</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1480" href="#t1480">1480</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"Field comments must end with a newline"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1481" href="#t1481">1481</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_comment_element</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1481 ↛ 1482</span><span class="annotate long">line 1481 didn't jump to line 1482, because the condition on line 1481 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1482" href="#t1482">1482</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_comment_element</span><span class="op">.</span><span class="nam">clear_parent_if_parent</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1483" href="#t1483">1483</a></span><span class="t"> <span class="key">if</span> <span class="nam">value</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1483 ↛ 1484</span><span class="annotate long">line 1483 didn't jump to line 1484, because the condition on line 1483 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1484" href="#t1484">1484</a></span><span class="t"> <span class="nam">value</span><span class="op">.</span><span class="nam">parent_element</span> <span class="op">=</span> <span class="nam">self</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1485" href="#t1485">1485</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_comment_element</span> <span class="op">=</span> <span class="nam">value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1486" href="#t1486">1486</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1487" href="#t1487">1487</a></span><span class="t"> <span class="key">def</span> <span class="nam">iter_parts</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1488" href="#t1488">1488</a></span><span class="t"> <span class="com"># type: () -> Iterable[TokenOrElement]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1489" href="#t1489">1489</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_comment_element</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1490" href="#t1490">1490</a></span><span class="t"> <span class="key">yield</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_comment_element</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1491" href="#t1491">1491</a></span><span class="t"> <span class="key">yield</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_field_token</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1492" href="#t1492">1492</a></span><span class="t"> <span class="key">yield</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_separator_token</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1493" href="#t1493">1493</a></span><span class="t"> <span class="key">yield</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_value_element</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1494" href="#t1494">1494</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1495" href="#t1495">1495</a></span><span class="t"> <span class="key">def</span> <span class="nam">position_in_parent</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1496" href="#t1496">1496</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1497" href="#t1497">1497</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1498" href="#t1498">1498</a></span><span class="t"> <span class="nam">skip_leading_comments</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1499" href="#t1499">1499</a></span><span class="t"> <span class="op">)</span> <span class="op">-></span> <span class="nam">Position</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1500" href="#t1500">1500</a></span><span class="t"> <span class="nam">position</span> <span class="op">=</span> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">position_in_parent</span><span class="op">(</span><span class="nam">skip_leading_comments</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1501" href="#t1501">1501</a></span><span class="t"> <span class="key">if</span> <span class="nam">skip_leading_comments</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1501 ↛ 1505</span><span class="annotate long">line 1501 didn't jump to line 1505, because the condition on line 1501 was never false</span></span></p> - <p class="run"><span class="n"><a id="t1502" href="#t1502">1502</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_comment_element</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1503" href="#t1503">1503</a></span><span class="t"> <span class="nam">field_pos</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_field_token</span><span class="op">.</span><span class="nam">position_in_parent</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1504" href="#t1504">1504</a></span><span class="t"> <span class="nam">position</span> <span class="op">=</span> <span class="nam">field_pos</span><span class="op">.</span><span class="nam">relative_to</span><span class="op">(</span><span class="nam">position</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1505" href="#t1505">1505</a></span><span class="t"> <span class="key">return</span> <span class="nam">position</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1506" href="#t1506">1506</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1507" href="#t1507">1507</a></span><span class="t"> <span class="key">def</span> <span class="nam">size</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">skip_leading_comments</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Range</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1508" href="#t1508">1508</a></span><span class="t"> <span class="key">if</span> <span class="nam">skip_leading_comments</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1509" href="#t1509">1509</a></span><span class="t"> <span class="key">return</span> <span class="nam">Range</span><span class="op">.</span><span class="nam">from_position_and_sizes</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1510" href="#t1510">1510</a></span><span class="t"> <span class="nam">START_POSITION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1511" href="#t1511">1511</a></span><span class="t"> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1512" href="#t1512">1512</a></span><span class="t"> <span class="nam">p</span><span class="op">.</span><span class="nam">size</span><span class="op">(</span><span class="nam">skip_leading_comments</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1513" href="#t1513">1513</a></span><span class="t"> <span class="key">for</span> <span class="nam">p</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">iter_parts</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1514" href="#t1514">1514</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">p</span><span class="op">.</span><span class="nam">is_comment</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1515" href="#t1515">1515</a></span><span class="t"> <span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1516" href="#t1516">1516</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1517" href="#t1517">1517</a></span><span class="t"> <span class="key">return</span> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">size</span><span class="op">(</span><span class="nam">skip_leading_comments</span><span class="op">=</span><span class="key">False</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1518" href="#t1518">1518</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1519" href="#t1519">1519</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1520" href="#t1520">1520</a></span><span class="t"><span class="key">def</span> <span class="nam">_format_comment</span><span class="op">(</span><span class="nam">c</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1521" href="#t1521">1521</a></span><span class="t"> <span class="com"># type: (str) -> str</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1522" href="#t1522">1522</a></span><span class="t"> <span class="key">if</span> <span class="nam">c</span> <span class="op">==</span> <span class="str">""</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1522 ↛ 1524</span><span class="annotate long">line 1522 didn't jump to line 1524, because the condition on line 1522 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t1523" href="#t1523">1523</a></span><span class="t"> <span class="com"># Special-case: Empty strings are mapped to an empty comment line</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1524" href="#t1524">1524</a></span><span class="t"> <span class="key">return</span> <span class="str">"#\n"</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1525" href="#t1525">1525</a></span><span class="t"> <span class="key">if</span> <span class="str">"\n"</span> <span class="key">in</span> <span class="nam">c</span><span class="op">[</span><span class="op">:</span><span class="op">-</span><span class="num">1</span><span class="op">]</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1525 ↛ 1526</span><span class="annotate long">line 1525 didn't jump to line 1526, because the condition on line 1525 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1526" href="#t1526">1526</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"Comment lines must not have embedded newlines"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1527" href="#t1527">1527</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">c</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1527 ↛ 1529</span><span class="annotate long">line 1527 didn't jump to line 1529, because the condition on line 1527 was never false</span></span></p> - <p class="run"><span class="n"><a id="t1528" href="#t1528">1528</a></span><span class="t"> <span class="nam">c</span> <span class="op">=</span> <span class="nam">c</span><span class="op">.</span><span class="nam">rstrip</span><span class="op">(</span><span class="op">)</span> <span class="op">+</span> <span class="str">"\n"</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1529" href="#t1529">1529</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">c</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"#"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1529 ↛ 1531</span><span class="annotate long">line 1529 didn't jump to line 1531, because the condition on line 1529 was never false</span></span></p> - <p class="run"><span class="n"><a id="t1530" href="#t1530">1530</a></span><span class="t"> <span class="nam">c</span> <span class="op">=</span> <span class="str">"# "</span> <span class="op">+</span> <span class="nam">c</span><span class="op">.</span><span class="nam">lstrip</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1531" href="#t1531">1531</a></span><span class="t"> <span class="key">return</span> <span class="nam">c</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1532" href="#t1532">1532</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1533" href="#t1533">1533</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1534" href="#t1534">1534</a></span><span class="t"><span class="key">def</span> <span class="nam">_unpack_key</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1535" href="#t1535">1535</a></span><span class="t"> <span class="nam">item</span><span class="op">,</span> <span class="com"># type: ParagraphKey</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1536" href="#t1536">1536</a></span><span class="t"> <span class="nam">raise_if_indexed</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> <span class="com"># type: bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1537" href="#t1537">1537</a></span><span class="t"><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1538" href="#t1538">1538</a></span><span class="t"> <span class="com"># type: (...) -> Tuple[_strI, Optional[int], Optional[Deb822FieldNameToken]]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1539" href="#t1539">1539</a></span><span class="t"> <span class="nam">index</span> <span class="op">=</span> <span class="key">None</span> <span class="com"># type: Optional[int]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1540" href="#t1540">1540</a></span><span class="t"> <span class="nam">name_token</span> <span class="op">=</span> <span class="key">None</span> <span class="com"># type: Optional[Deb822FieldNameToken]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1541" href="#t1541">1541</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">item</span><span class="op">,</span> <span class="nam">tuple</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1542" href="#t1542">1542</a></span><span class="t"> <span class="nam">key</span><span class="op">,</span> <span class="nam">index</span> <span class="op">=</span> <span class="nam">item</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1543" href="#t1543">1543</a></span><span class="t"> <span class="key">if</span> <span class="nam">raise_if_indexed</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1543 ↛ 1550</span><span class="annotate long">line 1543 didn't jump to line 1550, because the condition on line 1543 was never false</span></span></p> - <p class="pln"><span class="n"><a id="t1544" href="#t1544">1544</a></span><span class="t"> <span class="com"># Fudge "(key, 0)" into a "key" callers to defensively support</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1545" href="#t1545">1545</a></span><span class="t"> <span class="com"># both paragraph styles with the same key.</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1546" href="#t1546">1546</a></span><span class="t"> <span class="key">if</span> <span class="nam">index</span> <span class="op">!=</span> <span class="num">0</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1546 ↛ 1547</span><span class="annotate long">line 1546 didn't jump to line 1547, because the condition on line 1546 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1547" href="#t1547">1547</a></span><span class="t"> <span class="nam">msg</span> <span class="op">=</span> <span class="str">'Cannot resolve key "{key}" with index {index}. The key is not indexed'</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1548" href="#t1548">1548</a></span><span class="t"> <span class="key">raise</span> <span class="nam">KeyError</span><span class="op">(</span><span class="nam">msg</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span><span class="nam">key</span><span class="op">=</span><span class="nam">key</span><span class="op">,</span> <span class="nam">index</span><span class="op">=</span><span class="nam">index</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1549" href="#t1549">1549</a></span><span class="t"> <span class="nam">index</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1550" href="#t1550">1550</a></span><span class="t"> <span class="nam">key</span> <span class="op">=</span> <span class="nam">_strI</span><span class="op">(</span><span class="nam">key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1551" href="#t1551">1551</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1552" href="#t1552">1552</a></span><span class="t"> <span class="nam">index</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1553" href="#t1553">1553</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">item</span><span class="op">,</span> <span class="nam">Deb822FieldNameToken</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1553 ↛ 1554</span><span class="annotate long">line 1553 didn't jump to line 1554, because the condition on line 1553 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1554" href="#t1554">1554</a></span><span class="t"> <span class="nam">name_token</span> <span class="op">=</span> <span class="nam">item</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1555" href="#t1555">1555</a></span><span class="t"> <span class="nam">key</span> <span class="op">=</span> <span class="nam">name_token</span><span class="op">.</span><span class="nam">text</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1556" href="#t1556">1556</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1557" href="#t1557">1557</a></span><span class="t"> <span class="nam">key</span> <span class="op">=</span> <span class="nam">_strI</span><span class="op">(</span><span class="nam">item</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1558" href="#t1558">1558</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1559" href="#t1559">1559</a></span><span class="t"> <span class="key">return</span> <span class="nam">key</span><span class="op">,</span> <span class="nam">index</span><span class="op">,</span> <span class="nam">name_token</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1560" href="#t1560">1560</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1561" href="#t1561">1561</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1562" href="#t1562">1562</a></span><span class="t"><span class="key">def</span> <span class="nam">_convert_value_lines_to_lines</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1563" href="#t1563">1563</a></span><span class="t"> <span class="nam">value_lines</span><span class="op">,</span> <span class="com"># type: Iterable[Deb822ValueLineElement]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1564" href="#t1564">1564</a></span><span class="t"> <span class="nam">strip_comments</span><span class="op">,</span> <span class="com"># type: bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1565" href="#t1565">1565</a></span><span class="t"><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1566" href="#t1566">1566</a></span><span class="t"> <span class="com"># type: (...) -> Iterable[str]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1567" href="#t1567">1567</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">strip_comments</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1567 ↛ 1568</span><span class="annotate long">line 1567 didn't jump to line 1568, because the condition on line 1567 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1568" href="#t1568">1568</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="op">(</span><span class="nam">v</span><span class="op">.</span><span class="nam">convert_to_text</span><span class="op">(</span><span class="op">)</span> <span class="key">for</span> <span class="nam">v</span> <span class="key">in</span> <span class="nam">value_lines</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1569" href="#t1569">1569</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1570" href="#t1570">1570</a></span><span class="t"> <span class="key">for</span> <span class="nam">element</span> <span class="key">in</span> <span class="nam">value_lines</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1571" href="#t1571">1571</a></span><span class="t"> <span class="key">yield</span> <span class="str">""</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">x</span><span class="op">.</span><span class="nam">text</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">element</span><span class="op">.</span><span class="nam">iter_tokens</span><span class="op">(</span><span class="op">)</span> <span class="key">if</span> <span class="key">not</span> <span class="nam">x</span><span class="op">.</span><span class="nam">is_comment</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1572" href="#t1572">1572</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1573" href="#t1573">1573</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1574" href="#t1574">1574</a></span><span class="t"><span class="key">if</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">version_info</span> <span class="op">>=</span> <span class="op">(</span><span class="num">3</span><span class="op">,</span> <span class="num">9</span><span class="op">)</span> <span class="key">or</span> <span class="nam">TYPE_CHECKING</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1574 ↛ 1579</span><span class="annotate long">line 1574 didn't jump to line 1579, because the condition on line 1574 was never false</span></span></p> - <p class="run"><span class="n"><a id="t1575" href="#t1575">1575</a></span><span class="t"> <span class="nam">_ParagraphMapping_Base</span> <span class="op">=</span> <span class="nam">collections</span><span class="op">.</span><span class="nam">abc</span><span class="op">.</span><span class="nam">Mapping</span><span class="op">[</span><span class="nam">ParagraphKey</span><span class="op">,</span> <span class="nam">T</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1576" href="#t1576">1576</a></span><span class="t"><span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1577" href="#t1577">1577</a></span><span class="t"> <span class="com"># Python 3.5 - 3.8 compat - we are not allowed to subscript the abc.Iterator</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1578" href="#t1578">1578</a></span><span class="t"> <span class="com"># - use this little hack to work around it</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1579" href="#t1579">1579</a></span><span class="t"> <span class="key">class</span> <span class="nam">_ParagraphMapping_Base</span><span class="op">(</span><span class="nam">collections</span><span class="op">.</span><span class="nam">abc</span><span class="op">.</span><span class="nam">Mapping</span><span class="op">,</span> <span class="nam">Generic</span><span class="op">[</span><span class="nam">T</span><span class="op">]</span><span class="op">,</span> <span class="nam">ABC</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1580" href="#t1580">1580</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1581" href="#t1581">1581</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1582" href="#t1582">1582</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1583" href="#t1583">1583</a></span><span class="t"><span class="com"># Deb822ParagraphElement uses this Mixin (by having `_paragraph` return self).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1584" href="#t1584">1584</a></span><span class="t"><span class="com"># Therefore, the Mixin needs to call the "proper" methods on the paragraph to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1585" href="#t1585">1585</a></span><span class="t"><span class="com"># avoid doing infinite recursion.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1586" href="#t1586">1586</a></span><span class="t"><span class="key">class</span> <span class="nam">AutoResolvingMixin</span><span class="op">(</span><span class="nam">Generic</span><span class="op">[</span><span class="nam">T</span><span class="op">]</span><span class="op">,</span> <span class="nam">_ParagraphMapping_Base</span><span class="op">[</span><span class="nam">T</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1587" href="#t1587">1587</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1588" href="#t1588">1588</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1589" href="#t1589">1589</a></span><span class="t"> <span class="key">def</span> <span class="nam">_auto_resolve_ambiguous_fields</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1590" href="#t1590">1590</a></span><span class="t"> <span class="com"># type: () -> bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1591" href="#t1591">1591</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1592" href="#t1592">1592</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1593" href="#t1593">1593</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1594" href="#t1594">1594</a></span><span class="t"> <span class="key">def</span> <span class="nam">_paragraph</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1595" href="#t1595">1595</a></span><span class="t"> <span class="com"># type: () -> Deb822ParagraphElement</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1596" href="#t1596">1596</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> <span class="com"># pragma: no cover</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1597" href="#t1597">1597</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1598" href="#t1598">1598</a></span><span class="t"> <span class="key">def</span> <span class="nam">__len__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1599" href="#t1599">1599</a></span><span class="t"> <span class="com"># type: () -> int</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1600" href="#t1600">1600</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_paragraph</span><span class="op">.</span><span class="nam">kvpair_count</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1601" href="#t1601">1601</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1602" href="#t1602">1602</a></span><span class="t"> <span class="key">def</span> <span class="nam">__contains__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">item</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1603" href="#t1603">1603</a></span><span class="t"> <span class="com"># type: (object) -> bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1604" href="#t1604">1604</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_paragraph</span><span class="op">.</span><span class="nam">contains_kvpair_element</span><span class="op">(</span><span class="nam">item</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1605" href="#t1605">1605</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1606" href="#t1606">1606</a></span><span class="t"> <span class="key">def</span> <span class="nam">__iter__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1607" href="#t1607">1607</a></span><span class="t"> <span class="com"># type: () -> Iterator[ParagraphKey]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1608" href="#t1608">1608</a></span><span class="t"> <span class="key">return</span> <span class="nam">iter</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_paragraph</span><span class="op">.</span><span class="nam">iter_keys</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1609" href="#t1609">1609</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1610" href="#t1610">1610</a></span><span class="t"> <span class="key">def</span> <span class="nam">__getitem__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">item</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1611" href="#t1611">1611</a></span><span class="t"> <span class="com"># type: (ParagraphKey) -> T</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1612" href="#t1612">1612</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_auto_resolve_ambiguous_fields</span> <span class="key">and</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">item</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1613" href="#t1613">1613</a></span><span class="t"> <span class="nam">v</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_paragraph</span><span class="op">.</span><span class="nam">get_kvpair_element</span><span class="op">(</span><span class="op">(</span><span class="nam">item</span><span class="op">,</span> <span class="num">0</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1614" href="#t1614">1614</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1615" href="#t1615">1615</a></span><span class="t"> <span class="nam">v</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_paragraph</span><span class="op">.</span><span class="nam">get_kvpair_element</span><span class="op">(</span><span class="nam">item</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1616" href="#t1616">1616</a></span><span class="t"> <span class="key">assert</span> <span class="nam">v</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1617" href="#t1617">1617</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_interpret_value</span><span class="op">(</span><span class="nam">item</span><span class="op">,</span> <span class="nam">v</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1618" href="#t1618">1618</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1619" href="#t1619">1619</a></span><span class="t"> <span class="key">def</span> <span class="nam">__delitem__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">item</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1620" href="#t1620">1620</a></span><span class="t"> <span class="com"># type: (ParagraphKey) -> None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1621" href="#t1621">1621</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_paragraph</span><span class="op">.</span><span class="nam">remove_kvpair_element</span><span class="op">(</span><span class="nam">item</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1622" href="#t1622">1622</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1623" href="#t1623">1623</a></span><span class="t"> <span class="key">def</span> <span class="nam">_interpret_value</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">key</span><span class="op">,</span> <span class="nam">value</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1624" href="#t1624">1624</a></span><span class="t"> <span class="com"># type: (ParagraphKey, Deb822KeyValuePairElement) -> T</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t1625" href="#t1625">1625</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> <span class="com"># pragma: no cover</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1626" href="#t1626">1626</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1627" href="#t1627">1627</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1628" href="#t1628">1628</a></span><span class="t"><span class="com"># Deb822ParagraphElement uses this Mixin (by having `_paragraph` return self).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1629" href="#t1629">1629</a></span><span class="t"><span class="com"># Therefore, the Mixin needs to call the "proper" methods on the paragraph to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1630" href="#t1630">1630</a></span><span class="t"><span class="com"># avoid doing infinite recursion.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1631" href="#t1631">1631</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822ParagraphToStrWrapperMixin</span><span class="op">(</span><span class="nam">AutoResolvingMixin</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">ABC</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1632" href="#t1632">1632</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1633" href="#t1633">1633</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1634" href="#t1634">1634</a></span><span class="t"> <span class="key">def</span> <span class="nam">_auto_map_initial_line_whitespace</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1635" href="#t1635">1635</a></span><span class="t"> <span class="com"># type: () -> bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1636" href="#t1636">1636</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1637" href="#t1637">1637</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1638" href="#t1638">1638</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1639" href="#t1639">1639</a></span><span class="t"> <span class="key">def</span> <span class="nam">_discard_comments_on_read</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1640" href="#t1640">1640</a></span><span class="t"> <span class="com"># type: () -> bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1641" href="#t1641">1641</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1642" href="#t1642">1642</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1643" href="#t1643">1643</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1644" href="#t1644">1644</a></span><span class="t"> <span class="key">def</span> <span class="nam">_auto_map_final_newline_in_multiline_values</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1645" href="#t1645">1645</a></span><span class="t"> <span class="com"># type: () -> bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1646" href="#t1646">1646</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1647" href="#t1647">1647</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1648" href="#t1648">1648</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1649" href="#t1649">1649</a></span><span class="t"> <span class="key">def</span> <span class="nam">_preserve_field_comments_on_field_updates</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1650" href="#t1650">1650</a></span><span class="t"> <span class="com"># type: () -> bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1651" href="#t1651">1651</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1652" href="#t1652">1652</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1653" href="#t1653">1653</a></span><span class="t"> <span class="key">def</span> <span class="nam">_convert_value_to_str</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">kvpair_element</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1654" href="#t1654">1654</a></span><span class="t"> <span class="com"># type: (Deb822KeyValuePairElement) -> str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1655" href="#t1655">1655</a></span><span class="t"> <span class="nam">value_element</span> <span class="op">=</span> <span class="nam">kvpair_element</span><span class="op">.</span><span class="nam">value_element</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1656" href="#t1656">1656</a></span><span class="t"> <span class="nam">value_entries</span> <span class="op">=</span> <span class="nam">value_element</span><span class="op">.</span><span class="nam">value_lines</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1657" href="#t1657">1657</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">value_entries</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1658" href="#t1658">1658</a></span><span class="t"> <span class="com"># Special case single line entry (e.g. "Package: foo") as they never</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1659" href="#t1659">1659</a></span><span class="t"> <span class="com"># have comments and we can do some parts more efficient.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1660" href="#t1660">1660</a></span><span class="t"> <span class="nam">value_entry</span> <span class="op">=</span> <span class="nam">value_entries</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1661" href="#t1661">1661</a></span><span class="t"> <span class="nam">t</span> <span class="op">=</span> <span class="nam">value_entry</span><span class="op">.</span><span class="nam">convert_to_text</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1662" href="#t1662">1662</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_auto_map_initial_line_whitespace</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1663" href="#t1663">1663</a></span><span class="t"> <span class="nam">t</span> <span class="op">=</span> <span class="nam">t</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1664" href="#t1664">1664</a></span><span class="t"> <span class="key">return</span> <span class="nam">t</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1665" href="#t1665">1665</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1666" href="#t1666">1666</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_auto_map_initial_line_whitespace</span> <span class="key">or</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_discard_comments_on_read</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1667" href="#t1667">1667</a></span><span class="t"> <span class="nam">converter</span> <span class="op">=</span> <span class="nam">_convert_value_lines_to_lines</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1668" href="#t1668">1668</a></span><span class="t"> <span class="nam">value_entries</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1669" href="#t1669">1669</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_discard_comments_on_read</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1670" href="#t1670">1670</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1671" href="#t1671">1671</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1672" href="#t1672">1672</a></span><span class="t"> <span class="nam">auto_map_space</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_auto_map_initial_line_whitespace</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1673" href="#t1673">1673</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1674" href="#t1674">1674</a></span><span class="t"> <span class="com"># Because we know there are more than one line, we can unconditionally inject</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1675" href="#t1675">1675</a></span><span class="t"> <span class="com"># the newline after the first line</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1676" href="#t1676">1676</a></span><span class="t"> <span class="nam">as_text</span> <span class="op">=</span> <span class="str">""</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1677" href="#t1677">1677</a></span><span class="t"> <span class="nam">line</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span> <span class="op">+</span> <span class="str">"\n"</span> <span class="key">if</span> <span class="nam">auto_map_space</span> <span class="key">and</span> <span class="nam">i</span> <span class="op">==</span> <span class="num">1</span> <span class="key">else</span> <span class="nam">line</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1678" href="#t1678">1678</a></span><span class="t"> <span class="key">for</span> <span class="nam">i</span><span class="op">,</span> <span class="nam">line</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">converter</span><span class="op">,</span> <span class="nam">start</span><span class="op">=</span><span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1679" href="#t1679">1679</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1680" href="#t1680">1680</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1681" href="#t1681">1681</a></span><span class="t"> <span class="com"># No rewrite necessary.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1682" href="#t1682">1682</a></span><span class="t"> <span class="nam">as_text</span> <span class="op">=</span> <span class="nam">value_element</span><span class="op">.</span><span class="nam">convert_to_text</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1683" href="#t1683">1683</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1684" href="#t1684">1684</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_auto_map_final_newline_in_multiline_values</span> <span class="key">and</span> <span class="nam">as_text</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span> <span class="op">==</span> <span class="str">"\n"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1685" href="#t1685">1685</a></span><span class="t"> <span class="nam">as_text</span> <span class="op">=</span> <span class="nam">as_text</span><span class="op">[</span><span class="op">:</span><span class="op">-</span><span class="num">1</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1686" href="#t1686">1686</a></span><span class="t"> <span class="key">return</span> <span class="nam">as_text</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1687" href="#t1687">1687</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1688" href="#t1688">1688</a></span><span class="t"> <span class="key">def</span> <span class="nam">__setitem__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">item</span><span class="op">,</span> <span class="nam">value</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1689" href="#t1689">1689</a></span><span class="t"> <span class="com"># type: (ParagraphKey, str) -> None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1690" href="#t1690">1690</a></span><span class="t"> <span class="nam">keep_comments</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1691" href="#t1691">1691</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_preserve_field_comments_on_field_updates</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1692" href="#t1692">1692</a></span><span class="t"> <span class="op">)</span> <span class="com"># type: Optional[bool]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1693" href="#t1693">1693</a></span><span class="t"> <span class="nam">comment</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1694" href="#t1694">1694</a></span><span class="t"> <span class="key">if</span> <span class="nam">keep_comments</span> <span class="key">and</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_auto_resolve_ambiguous_fields</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1695" href="#t1695">1695</a></span><span class="t"> <span class="com"># For ambiguous fields, we have to resolve the original field as</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1696" href="#t1696">1696</a></span><span class="t"> <span class="com"># the set_field_* methods do not cope with ambiguous fields. This</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1697" href="#t1697">1697</a></span><span class="t"> <span class="com"># means we might as well clear the keep_comments flag as we have</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1698" href="#t1698">1698</a></span><span class="t"> <span class="com"># resolved the comment.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1699" href="#t1699">1699</a></span><span class="t"> <span class="nam">keep_comments</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1700" href="#t1700">1700</a></span><span class="t"> <span class="nam">key_lookup</span> <span class="op">=</span> <span class="nam">item</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1701" href="#t1701">1701</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">item</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1701 ↛ 1703</span><span class="annotate long">line 1701 didn't jump to line 1703, because the condition on line 1701 was never false</span></span></p> - <p class="run"><span class="n"><a id="t1702" href="#t1702">1702</a></span><span class="t"> <span class="nam">key_lookup</span> <span class="op">=</span> <span class="op">(</span><span class="nam">item</span><span class="op">,</span> <span class="num">0</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1703" href="#t1703">1703</a></span><span class="t"> <span class="nam">orig_kvpair</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_paragraph</span><span class="op">.</span><span class="nam">get_kvpair_element</span><span class="op">(</span><span class="nam">key_lookup</span><span class="op">,</span> <span class="nam">use_get</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1704" href="#t1704">1704</a></span><span class="t"> <span class="key">if</span> <span class="nam">orig_kvpair</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1705" href="#t1705">1705</a></span><span class="t"> <span class="nam">comment</span> <span class="op">=</span> <span class="nam">orig_kvpair</span><span class="op">.</span><span class="nam">comment_element</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1706" href="#t1706">1706</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1707" href="#t1707">1707</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_auto_map_initial_line_whitespace</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1708" href="#t1708">1708</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1709" href="#t1709">1709</a></span><span class="t"> <span class="nam">idx</span> <span class="op">=</span> <span class="nam">value</span><span class="op">.</span><span class="nam">index</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1710" href="#t1710">1710</a></span><span class="t"> <span class="key">except</span> <span class="nam">ValueError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1711" href="#t1711">1711</a></span><span class="t"> <span class="nam">idx</span> <span class="op">=</span> <span class="op">-</span><span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1712" href="#t1712">1712</a></span><span class="t"> <span class="key">if</span> <span class="nam">idx</span> <span class="op">==</span> <span class="op">-</span><span class="num">1</span> <span class="key">or</span> <span class="nam">idx</span> <span class="op">==</span> <span class="nam">len</span><span class="op">(</span><span class="nam">value</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1713" href="#t1713">1713</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_paragraph</span><span class="op">.</span><span class="nam">set_field_to_simple_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1714" href="#t1714">1714</a></span><span class="t"> <span class="nam">item</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1715" href="#t1715">1715</a></span><span class="t"> <span class="nam">value</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1716" href="#t1716">1716</a></span><span class="t"> <span class="nam">preserve_original_field_comment</span><span class="op">=</span><span class="nam">keep_comments</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1717" href="#t1717">1717</a></span><span class="t"> <span class="nam">field_comment</span><span class="op">=</span><span class="nam">comment</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1718" href="#t1718">1718</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1719" href="#t1719">1719</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1720" href="#t1720">1720</a></span><span class="t"> <span class="com"># Regenerate the first line with normalized whitespace if necessary</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1721" href="#t1721">1721</a></span><span class="t"> <span class="nam">first_line</span><span class="op">,</span> <span class="nam">rest</span> <span class="op">=</span> <span class="nam">value</span><span class="op">.</span><span class="nam">split</span><span class="op">(</span><span class="str">"\n"</span><span class="op">,</span> <span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1722" href="#t1722">1722</a></span><span class="t"> <span class="key">if</span> <span class="nam">first_line</span> <span class="key">and</span> <span class="nam">first_line</span><span class="op">[</span><span class="op">:</span><span class="num">1</span><span class="op">]</span> <span class="key">not</span> <span class="key">in</span> <span class="op">(</span><span class="str">"\t"</span><span class="op">,</span> <span class="str">" "</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1722 ↛ 1723</span><span class="annotate long">line 1722 didn't jump to line 1723, because the condition on line 1722 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1723" href="#t1723">1723</a></span><span class="t"> <span class="nam">value</span> <span class="op">=</span> <span class="str">""</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="op">(</span><span class="str">" "</span><span class="op">,</span> <span class="nam">first_line</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span><span class="op">,</span> <span class="str">"\n"</span><span class="op">,</span> <span class="nam">rest</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1724" href="#t1724">1724</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1725" href="#t1725">1725</a></span><span class="t"> <span class="nam">value</span> <span class="op">=</span> <span class="str">""</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="op">(</span><span class="nam">first_line</span><span class="op">,</span> <span class="str">"\n"</span><span class="op">,</span> <span class="nam">rest</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1726" href="#t1726">1726</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">value</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1727" href="#t1727">1727</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_auto_map_final_newline_in_multiline_values</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1727 ↛ 1732</span><span class="annotate long">line 1727 didn't jump to line 1732, because the condition on line 1727 was never false</span></span></p> - <p class="run"><span class="n"><a id="t1728" href="#t1728">1728</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1729" href="#t1729">1729</a></span><span class="t"> <span class="str">"Values must end with a newline (or be single line"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1730" href="#t1730">1730</a></span><span class="t"> <span class="str">" values and use the auto whitespace mapping feature)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1731" href="#t1731">1731</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1732" href="#t1732">1732</a></span><span class="t"> <span class="nam">value</span> <span class="op">+=</span> <span class="str">"\n"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1733" href="#t1733">1733</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_paragraph</span><span class="op">.</span><span class="nam">set_field_from_raw_string</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1734" href="#t1734">1734</a></span><span class="t"> <span class="nam">item</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1735" href="#t1735">1735</a></span><span class="t"> <span class="nam">value</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1736" href="#t1736">1736</a></span><span class="t"> <span class="nam">preserve_original_field_comment</span><span class="op">=</span><span class="nam">keep_comments</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1737" href="#t1737">1737</a></span><span class="t"> <span class="nam">field_comment</span><span class="op">=</span><span class="nam">comment</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1738" href="#t1738">1738</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1739" href="#t1739">1739</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1740" href="#t1740">1740</a></span><span class="t"> <span class="key">def</span> <span class="nam">_interpret_value</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">key</span><span class="op">,</span> <span class="nam">value</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1741" href="#t1741">1741</a></span><span class="t"> <span class="com"># type: (ParagraphKey, Deb822KeyValuePairElement) -> str</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1742" href="#t1742">1742</a></span><span class="t"> <span class="com"># mypy is a bit dense and cannot see that T == str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1743" href="#t1743">1743</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_convert_value_to_str</span><span class="op">(</span><span class="nam">value</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1744" href="#t1744">1744</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1745" href="#t1745">1745</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1746" href="#t1746">1746</a></span><span class="t"><span class="key">class</span> <span class="nam">AbstractDeb822ParagraphWrapper</span><span class="op">(</span><span class="nam">AutoResolvingMixin</span><span class="op">[</span><span class="nam">T</span><span class="op">]</span><span class="op">,</span> <span class="nam">ABC</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1747" href="#t1747">1747</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1748" href="#t1748">1748</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1749" href="#t1749">1749</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1750" href="#t1750">1750</a></span><span class="t"> <span class="nam">paragraph</span><span class="op">,</span> <span class="com"># type: Deb822ParagraphElement</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1751" href="#t1751">1751</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1752" href="#t1752">1752</a></span><span class="t"> <span class="nam">auto_resolve_ambiguous_fields</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> <span class="com"># type: bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1753" href="#t1753">1753</a></span><span class="t"> <span class="nam">discard_comments_on_read</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="com"># type: bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1754" href="#t1754">1754</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1755" href="#t1755">1755</a></span><span class="t"> <span class="com"># type: (...) -> None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1756" href="#t1756">1756</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">__paragraph</span> <span class="op">=</span> <span class="nam">paragraph</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1757" href="#t1757">1757</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">__auto_resolve_ambiguous_fields</span> <span class="op">=</span> <span class="nam">auto_resolve_ambiguous_fields</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1758" href="#t1758">1758</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">__discard_comments_on_read</span> <span class="op">=</span> <span class="nam">discard_comments_on_read</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1759" href="#t1759">1759</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1760" href="#t1760">1760</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1761" href="#t1761">1761</a></span><span class="t"> <span class="key">def</span> <span class="nam">_paragraph</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1762" href="#t1762">1762</a></span><span class="t"> <span class="com"># type: () -> Deb822ParagraphElement</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1763" href="#t1763">1763</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">__paragraph</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1764" href="#t1764">1764</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1765" href="#t1765">1765</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1766" href="#t1766">1766</a></span><span class="t"> <span class="key">def</span> <span class="nam">_discard_comments_on_read</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1767" href="#t1767">1767</a></span><span class="t"> <span class="com"># type: () -> bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1768" href="#t1768">1768</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">__discard_comments_on_read</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1769" href="#t1769">1769</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1770" href="#t1770">1770</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1771" href="#t1771">1771</a></span><span class="t"> <span class="key">def</span> <span class="nam">_auto_resolve_ambiguous_fields</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1772" href="#t1772">1772</a></span><span class="t"> <span class="com"># type: () -> bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1773" href="#t1773">1773</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">__auto_resolve_ambiguous_fields</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1774" href="#t1774">1774</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1775" href="#t1775">1775</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1776" href="#t1776">1776</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822InterpretingParagraphWrapper</span><span class="op">(</span><span class="nam">AbstractDeb822ParagraphWrapper</span><span class="op">[</span><span class="nam">T</span><span class="op">]</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1777" href="#t1777">1777</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1778" href="#t1778">1778</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1779" href="#t1779">1779</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1780" href="#t1780">1780</a></span><span class="t"> <span class="nam">paragraph</span><span class="op">,</span> <span class="com"># type: Deb822ParagraphElement</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1781" href="#t1781">1781</a></span><span class="t"> <span class="nam">interpretation</span><span class="op">,</span> <span class="com"># type: Interpretation[T]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1782" href="#t1782">1782</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1783" href="#t1783">1783</a></span><span class="t"> <span class="nam">auto_resolve_ambiguous_fields</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> <span class="com"># type: bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1784" href="#t1784">1784</a></span><span class="t"> <span class="nam">discard_comments_on_read</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="com"># type: bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1785" href="#t1785">1785</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1786" href="#t1786">1786</a></span><span class="t"> <span class="com"># type: (...) -> None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1787" href="#t1787">1787</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1788" href="#t1788">1788</a></span><span class="t"> <span class="nam">paragraph</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1789" href="#t1789">1789</a></span><span class="t"> <span class="nam">auto_resolve_ambiguous_fields</span><span class="op">=</span><span class="nam">auto_resolve_ambiguous_fields</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1790" href="#t1790">1790</a></span><span class="t"> <span class="nam">discard_comments_on_read</span><span class="op">=</span><span class="nam">discard_comments_on_read</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1791" href="#t1791">1791</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1792" href="#t1792">1792</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_interpretation</span> <span class="op">=</span> <span class="nam">interpretation</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1793" href="#t1793">1793</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1794" href="#t1794">1794</a></span><span class="t"> <span class="key">def</span> <span class="nam">_interpret_value</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">key</span><span class="op">,</span> <span class="nam">value</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1795" href="#t1795">1795</a></span><span class="t"> <span class="com"># type: (ParagraphKey, Deb822KeyValuePairElement) -> T</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1796" href="#t1796">1796</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_interpretation</span><span class="op">.</span><span class="nam">interpret</span><span class="op">(</span><span class="nam">value</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1797" href="#t1797">1797</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1798" href="#t1798">1798</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1799" href="#t1799">1799</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822DictishParagraphWrapper</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1800" href="#t1800">1800</a></span><span class="t"> <span class="nam">AbstractDeb822ParagraphWrapper</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="nam">Deb822ParagraphToStrWrapperMixin</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1801" href="#t1801">1801</a></span><span class="t"><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1802" href="#t1802">1802</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1803" href="#t1803">1803</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1804" href="#t1804">1804</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1805" href="#t1805">1805</a></span><span class="t"> <span class="nam">paragraph</span><span class="op">,</span> <span class="com"># type: Deb822ParagraphElement</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1806" href="#t1806">1806</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1807" href="#t1807">1807</a></span><span class="t"> <span class="nam">discard_comments_on_read</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="com"># type: bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1808" href="#t1808">1808</a></span><span class="t"> <span class="nam">auto_map_initial_line_whitespace</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="com"># type: bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1809" href="#t1809">1809</a></span><span class="t"> <span class="nam">auto_resolve_ambiguous_fields</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> <span class="com"># type: bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1810" href="#t1810">1810</a></span><span class="t"> <span class="nam">preserve_field_comments_on_field_updates</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="com"># type: bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1811" href="#t1811">1811</a></span><span class="t"> <span class="nam">auto_map_final_newline_in_multiline_values</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="com"># type: bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1812" href="#t1812">1812</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1813" href="#t1813">1813</a></span><span class="t"> <span class="com"># type: (...) -> None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1814" href="#t1814">1814</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1815" href="#t1815">1815</a></span><span class="t"> <span class="nam">paragraph</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1816" href="#t1816">1816</a></span><span class="t"> <span class="nam">auto_resolve_ambiguous_fields</span><span class="op">=</span><span class="nam">auto_resolve_ambiguous_fields</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1817" href="#t1817">1817</a></span><span class="t"> <span class="nam">discard_comments_on_read</span><span class="op">=</span><span class="nam">discard_comments_on_read</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1818" href="#t1818">1818</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1819" href="#t1819">1819</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">__auto_map_initial_line_whitespace</span> <span class="op">=</span> <span class="nam">auto_map_initial_line_whitespace</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1820" href="#t1820">1820</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">__preserve_field_comments_on_field_updates</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1821" href="#t1821">1821</a></span><span class="t"> <span class="nam">preserve_field_comments_on_field_updates</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1822" href="#t1822">1822</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1823" href="#t1823">1823</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">__auto_map_final_newline_in_multiline_values</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1824" href="#t1824">1824</a></span><span class="t"> <span class="nam">auto_map_final_newline_in_multiline_values</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1825" href="#t1825">1825</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1826" href="#t1826">1826</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1827" href="#t1827">1827</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1828" href="#t1828">1828</a></span><span class="t"> <span class="key">def</span> <span class="nam">_auto_map_initial_line_whitespace</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1829" href="#t1829">1829</a></span><span class="t"> <span class="com"># type: () -> bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1830" href="#t1830">1830</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">__auto_map_initial_line_whitespace</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1831" href="#t1831">1831</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1832" href="#t1832">1832</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1833" href="#t1833">1833</a></span><span class="t"> <span class="key">def</span> <span class="nam">_preserve_field_comments_on_field_updates</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1834" href="#t1834">1834</a></span><span class="t"> <span class="com"># type: () -> bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1835" href="#t1835">1835</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">__preserve_field_comments_on_field_updates</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1836" href="#t1836">1836</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1837" href="#t1837">1837</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1838" href="#t1838">1838</a></span><span class="t"> <span class="key">def</span> <span class="nam">_auto_map_final_newline_in_multiline_values</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1839" href="#t1839">1839</a></span><span class="t"> <span class="com"># type: () -> bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1840" href="#t1840">1840</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">__auto_map_final_newline_in_multiline_values</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1841" href="#t1841">1841</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1842" href="#t1842">1842</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1843" href="#t1843">1843</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822ParagraphElement</span><span class="op">(</span><span class="nam">Deb822Element</span><span class="op">,</span> <span class="nam">Deb822ParagraphToStrWrapperMixin</span><span class="op">,</span> <span class="nam">ABC</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1844" href="#t1844">1844</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1845" href="#t1845">1845</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1846" href="#t1846">1846</a></span><span class="t"> <span class="key">def</span> <span class="nam">new_empty_paragraph</span><span class="op">(</span><span class="nam">cls</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1847" href="#t1847">1847</a></span><span class="t"> <span class="com"># type: () -> Deb822ParagraphElement</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1848" href="#t1848">1848</a></span><span class="t"> <span class="key">return</span> <span class="nam">Deb822NoDuplicateFieldsParagraphElement</span><span class="op">(</span><span class="op">[</span><span class="op">]</span><span class="op">,</span> <span class="nam">OrderedSet</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1849" href="#t1849">1849</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1850" href="#t1850">1850</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1851" href="#t1851">1851</a></span><span class="t"> <span class="key">def</span> <span class="nam">from_dict</span><span class="op">(</span><span class="nam">cls</span><span class="op">,</span> <span class="nam">mapping</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1852" href="#t1852">1852</a></span><span class="t"> <span class="com"># type: (Mapping[str, str]) -> Deb822ParagraphElement</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1853" href="#t1853">1853</a></span><span class="t"> <span class="nam">paragraph</span> <span class="op">=</span> <span class="nam">cls</span><span class="op">.</span><span class="nam">new_empty_paragraph</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1854" href="#t1854">1854</a></span><span class="t"> <span class="key">for</span> <span class="nam">k</span><span class="op">,</span> <span class="nam">v</span> <span class="key">in</span> <span class="nam">mapping</span><span class="op">.</span><span class="nam">items</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1855" href="#t1855">1855</a></span><span class="t"> <span class="nam">paragraph</span><span class="op">[</span><span class="nam">k</span><span class="op">]</span> <span class="op">=</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1856" href="#t1856">1856</a></span><span class="t"> <span class="key">return</span> <span class="nam">paragraph</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1857" href="#t1857">1857</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1858" href="#t1858">1858</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1859" href="#t1859">1859</a></span><span class="t"> <span class="key">def</span> <span class="nam">from_kvpairs</span><span class="op">(</span><span class="nam">cls</span><span class="op">,</span> <span class="nam">kvpair_elements</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1860" href="#t1860">1860</a></span><span class="t"> <span class="com"># type: (List[Deb822KeyValuePairElement]) -> Deb822ParagraphElement</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1861" href="#t1861">1861</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">kvpair_elements</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1861 ↛ 1862</span><span class="annotate long">line 1861 didn't jump to line 1862, because the condition on line 1861 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t1862" href="#t1862">1862</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1863" href="#t1863">1863</a></span><span class="t"> <span class="str">"A paragraph must consist of at least one field/value pair"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1864" href="#t1864">1864</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1865" href="#t1865">1865</a></span><span class="t"> <span class="nam">kvpair_order</span> <span class="op">=</span> <span class="nam">OrderedSet</span><span class="op">(</span><span class="nam">kv</span><span class="op">.</span><span class="nam">field_name</span> <span class="key">for</span> <span class="nam">kv</span> <span class="key">in</span> <span class="nam">kvpair_elements</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t1866" href="#t1866">1866</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">kvpair_order</span><span class="op">)</span> <span class="op">==</span> <span class="nam">len</span><span class="op">(</span><span class="nam">kvpair_elements</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">1866 ↛ 1875</span><span class="annotate long">line 1866 didn't jump to line 1875, because the condition on line 1866 was never false</span></span></p> - <p class="pln"><span class="n"><a id="t1867" href="#t1867">1867</a></span><span class="t"> <span class="com"># Each field occurs at most once, which is good because that</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1868" href="#t1868">1868</a></span><span class="t"> <span class="com"># means it is a valid paragraph and we can use the optimized</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1869" href="#t1869">1869</a></span><span class="t"> <span class="com"># implementation.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1870" href="#t1870">1870</a></span><span class="t"> <span class="key">return</span> <span class="nam">Deb822NoDuplicateFieldsParagraphElement</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1871" href="#t1871">1871</a></span><span class="t"> <span class="nam">kvpair_elements</span><span class="op">,</span> <span class="nam">kvpair_order</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1872" href="#t1872">1872</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1873" href="#t1873">1873</a></span><span class="t"> <span class="com"># Fallback implementation, that can cope with the repeated field names</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1874" href="#t1874">1874</a></span><span class="t"> <span class="com"># at the cost of complexity.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1875" href="#t1875">1875</a></span><span class="t"> <span class="key">return</span> <span class="nam">Deb822DuplicateFieldsParagraphElement</span><span class="op">(</span><span class="nam">kvpair_elements</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1876" href="#t1876">1876</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1877" href="#t1877">1877</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1878" href="#t1878">1878</a></span><span class="t"> <span class="key">def</span> <span class="nam">has_duplicate_fields</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1879" href="#t1879">1879</a></span><span class="t"> <span class="com"># type: () -> bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1880" href="#t1880">1880</a></span><span class="t"> <span class="str">"""Tell whether this paragraph has duplicate fields"""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t1881" href="#t1881">1881</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1882" href="#t1882">1882</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1883" href="#t1883">1883</a></span><span class="t"> <span class="key">def</span> <span class="nam">as_interpreted_dict_view</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1884" href="#t1884">1884</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1885" href="#t1885">1885</a></span><span class="t"> <span class="nam">interpretation</span><span class="op">,</span> <span class="com"># type: Interpretation[T]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1886" href="#t1886">1886</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1887" href="#t1887">1887</a></span><span class="t"> <span class="nam">auto_resolve_ambiguous_fields</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="com"># type: bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1888" href="#t1888">1888</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1889" href="#t1889">1889</a></span><span class="t"> <span class="com"># type: (...) -> Deb822InterpretingParagraphWrapper[T]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1890" href="#t1890">1890</a></span><span class="t"> <span class="str">r"""Provide a Dict-like view of the paragraph</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1891" href="#t1891">1891</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1892" href="#t1892">1892</a></span><span class="t"><span class="str"> This method returns a dict-like object representing this paragraph and</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1893" href="#t1893">1893</a></span><span class="t"><span class="str"> is useful for accessing fields in a given interpretation. It is possible</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1894" href="#t1894">1894</a></span><span class="t"><span class="str"> to use multiple versions of this dict-like view with different interpretations</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1895" href="#t1895">1895</a></span><span class="t"><span class="str"> on the same paragraph at the same time (for different fields).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1896" href="#t1896">1896</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1897" href="#t1897">1897</a></span><span class="t"><span class="str"> >>> example_deb822_paragraph = '''</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1898" href="#t1898">1898</a></span><span class="t"><span class="str"> ... Package: foo</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1899" href="#t1899">1899</a></span><span class="t"><span class="str"> ... # Field comment (because it becomes just before a field)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1900" href="#t1900">1900</a></span><span class="t"><span class="str"> ... Architecture: amd64</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1901" href="#t1901">1901</a></span><span class="t"><span class="str"> ... # Inline comment (associated with the next line)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1902" href="#t1902">1902</a></span><span class="t"><span class="str"> ... i386</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1903" href="#t1903">1903</a></span><span class="t"><span class="str"> ... # We also support arm</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1904" href="#t1904">1904</a></span><span class="t"><span class="str"> ... arm64</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1905" href="#t1905">1905</a></span><span class="t"><span class="str"> ... armel</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1906" href="#t1906">1906</a></span><span class="t"><span class="str"> ... '''</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1907" href="#t1907">1907</a></span><span class="t"><span class="str"> >>> dfile = parse_deb822_file(example_deb822_paragraph.splitlines())</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1908" href="#t1908">1908</a></span><span class="t"><span class="str"> >>> paragraph = next(iter(dfile))</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1909" href="#t1909">1909</a></span><span class="t"><span class="str"> >>> list_view = paragraph.as_interpreted_dict_view(LIST_SPACE_SEPARATED_INTERPRETATION)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1910" href="#t1910">1910</a></span><span class="t"><span class="str"> >>> # With the defaults, you only deal with the semantic values</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1911" href="#t1911">1911</a></span><span class="t"><span class="str"> >>> # - no leading or trailing whitespace on the first part of the value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1912" href="#t1912">1912</a></span><span class="t"><span class="str"> >>> list(list_view["Package"])</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1913" href="#t1913">1913</a></span><span class="t"><span class="str"> ['foo']</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1914" href="#t1914">1914</a></span><span class="t"><span class="str"> >>> with list_view["Architecture"] as arch_list:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1915" href="#t1915">1915</a></span><span class="t"><span class="str"> ... orig_arch_list = list(arch_list)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1916" href="#t1916">1916</a></span><span class="t"><span class="str"> ... arch_list.replace('i386', 'kfreebsd-amd64')</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1917" href="#t1917">1917</a></span><span class="t"><span class="str"> >>> orig_arch_list</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1918" href="#t1918">1918</a></span><span class="t"><span class="str"> ['amd64', 'i386', 'arm64', 'armel']</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1919" href="#t1919">1919</a></span><span class="t"><span class="str"> >>> list(list_view["Architecture"])</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1920" href="#t1920">1920</a></span><span class="t"><span class="str"> ['amd64', 'kfreebsd-amd64', 'arm64', 'armel']</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1921" href="#t1921">1921</a></span><span class="t"><span class="str"> >>> print(paragraph.dump(), end='')</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1922" href="#t1922">1922</a></span><span class="t"><span class="str"> Package: foo</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1923" href="#t1923">1923</a></span><span class="t"><span class="str"> # Field comment (because it becomes just before a field)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1924" href="#t1924">1924</a></span><span class="t"><span class="str"> Architecture: amd64</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1925" href="#t1925">1925</a></span><span class="t"><span class="str"> # Inline comment (associated with the next line)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1926" href="#t1926">1926</a></span><span class="t"><span class="str"> kfreebsd-amd64</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1927" href="#t1927">1927</a></span><span class="t"><span class="str"> # We also support arm</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1928" href="#t1928">1928</a></span><span class="t"><span class="str"> arm64</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1929" href="#t1929">1929</a></span><span class="t"><span class="str"> armel</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1930" href="#t1930">1930</a></span><span class="t"><span class="str"> >>> # Format preserved and architecture replaced</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1931" href="#t1931">1931</a></span><span class="t"><span class="str"> >>> with list_view["Architecture"] as arch_list:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1932" href="#t1932">1932</a></span><span class="t"><span class="str"> ... # Prettify the result as sorting will cause awkward whitespace</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1933" href="#t1933">1933</a></span><span class="t"><span class="str"> ... arch_list.reformat_when_finished()</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1934" href="#t1934">1934</a></span><span class="t"><span class="str"> ... arch_list.sort()</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1935" href="#t1935">1935</a></span><span class="t"><span class="str"> >>> print(paragraph.dump(), end='')</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1936" href="#t1936">1936</a></span><span class="t"><span class="str"> Package: foo</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1937" href="#t1937">1937</a></span><span class="t"><span class="str"> # Field comment (because it becomes just before a field)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1938" href="#t1938">1938</a></span><span class="t"><span class="str"> Architecture: amd64</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1939" href="#t1939">1939</a></span><span class="t"><span class="str"> # We also support arm</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1940" href="#t1940">1940</a></span><span class="t"><span class="str"> arm64</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1941" href="#t1941">1941</a></span><span class="t"><span class="str"> armel</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1942" href="#t1942">1942</a></span><span class="t"><span class="str"> # Inline comment (associated with the next line)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1943" href="#t1943">1943</a></span><span class="t"><span class="str"> kfreebsd-amd64</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1944" href="#t1944">1944</a></span><span class="t"><span class="str"> >>> list(list_view["Architecture"])</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1945" href="#t1945">1945</a></span><span class="t"><span class="str"> ['amd64', 'arm64', 'armel', 'kfreebsd-amd64']</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1946" href="#t1946">1946</a></span><span class="t"><span class="str"> >>> # Format preserved and architecture values sorted</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1947" href="#t1947">1947</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1948" href="#t1948">1948</a></span><span class="t"><span class="str"> :param interpretation: Decides how the field values are interpreted. As an example,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1949" href="#t1949">1949</a></span><span class="t"><span class="str"> use LIST_SPACE_SEPARATED_INTERPRETATION for fields such as Architecture in the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1950" href="#t1950">1950</a></span><span class="t"><span class="str"> debian/control file.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1951" href="#t1951">1951</a></span><span class="t"><span class="str"> :param auto_resolve_ambiguous_fields: This parameter is only relevant for paragraphs</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1952" href="#t1952">1952</a></span><span class="t"><span class="str"> that contain the same field multiple times (these are generally invalid). If the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1953" href="#t1953">1953</a></span><span class="t"><span class="str"> caller requests an ambiguous field from an invalid paragraph via a plain field name,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1954" href="#t1954">1954</a></span><span class="t"><span class="str"> the return dict-like object will refuse to resolve the field (not knowing which</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1955" href="#t1955">1955</a></span><span class="t"><span class="str"> version to pick). This parameter (if set to True) instead changes the error into</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1956" href="#t1956">1956</a></span><span class="t"><span class="str"> assuming the caller wants the *first* variant.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1957" href="#t1957">1957</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1958" href="#t1958">1958</a></span><span class="t"> <span class="key">return</span> <span class="nam">Deb822InterpretingParagraphWrapper</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1959" href="#t1959">1959</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1960" href="#t1960">1960</a></span><span class="t"> <span class="nam">interpretation</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1961" href="#t1961">1961</a></span><span class="t"> <span class="nam">auto_resolve_ambiguous_fields</span><span class="op">=</span><span class="nam">auto_resolve_ambiguous_fields</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1962" href="#t1962">1962</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1963" href="#t1963">1963</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t1964" href="#t1964">1964</a></span><span class="t"> <span class="key">def</span> <span class="nam">configured_view</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1965" href="#t1965">1965</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1966" href="#t1966">1966</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1967" href="#t1967">1967</a></span><span class="t"> <span class="nam">discard_comments_on_read</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="com"># type: bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1968" href="#t1968">1968</a></span><span class="t"> <span class="nam">auto_map_initial_line_whitespace</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="com"># type: bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1969" href="#t1969">1969</a></span><span class="t"> <span class="nam">auto_resolve_ambiguous_fields</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="com"># type: bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1970" href="#t1970">1970</a></span><span class="t"> <span class="nam">preserve_field_comments_on_field_updates</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="com"># type: bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1971" href="#t1971">1971</a></span><span class="t"> <span class="nam">auto_map_final_newline_in_multiline_values</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="com"># type: bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1972" href="#t1972">1972</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1973" href="#t1973">1973</a></span><span class="t"> <span class="com"># type: (...) -> Deb822DictishParagraphWrapper</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1974" href="#t1974">1974</a></span><span class="t"> <span class="str">r"""Provide a Dict[str, str]-like view of this paragraph with non-standard parameters</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1975" href="#t1975">1975</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1976" href="#t1976">1976</a></span><span class="t"><span class="str"> This method returns a dict-like object representing this paragraph that is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1977" href="#t1977">1977</a></span><span class="t"><span class="str"> optionally configured differently from the default view.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1978" href="#t1978">1978</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1979" href="#t1979">1979</a></span><span class="t"><span class="str"> >>> example_deb822_paragraph = '''</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1980" href="#t1980">1980</a></span><span class="t"><span class="str"> ... Package: foo</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1981" href="#t1981">1981</a></span><span class="t"><span class="str"> ... # Field comment (because it becomes just before a field)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1982" href="#t1982">1982</a></span><span class="t"><span class="str"> ... Depends: libfoo,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1983" href="#t1983">1983</a></span><span class="t"><span class="str"> ... # Inline comment (associated with the next line)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1984" href="#t1984">1984</a></span><span class="t"><span class="str"> ... libbar,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1985" href="#t1985">1985</a></span><span class="t"><span class="str"> ... '''</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1986" href="#t1986">1986</a></span><span class="t"><span class="str"> >>> dfile = parse_deb822_file(example_deb822_paragraph.splitlines())</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1987" href="#t1987">1987</a></span><span class="t"><span class="str"> >>> paragraph = next(iter(dfile))</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1988" href="#t1988">1988</a></span><span class="t"><span class="str"> >>> # With the defaults, you only deal with the semantic values</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1989" href="#t1989">1989</a></span><span class="t"><span class="str"> >>> # - no leading or trailing whitespace on the first part of the value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1990" href="#t1990">1990</a></span><span class="t"><span class="str"> >>> paragraph["Package"]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1991" href="#t1991">1991</a></span><span class="t"><span class="str"> 'foo'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1992" href="#t1992">1992</a></span><span class="t"><span class="str"> >>> # - no inline comments in multiline values (but whitespace will be present</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1993" href="#t1993">1993</a></span><span class="t"><span class="str"> >>> # subsequent lines.)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1994" href="#t1994">1994</a></span><span class="t"><span class="str"> >>> print(paragraph["Depends"])</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1995" href="#t1995">1995</a></span><span class="t"><span class="str"> libfoo,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1996" href="#t1996">1996</a></span><span class="t"><span class="str"> libbar,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1997" href="#t1997">1997</a></span><span class="t"><span class="str"> >>> paragraph['Foo'] = 'bar'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1998" href="#t1998">1998</a></span><span class="t"><span class="str"> >>> paragraph.get('Foo')</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t1999" href="#t1999">1999</a></span><span class="t"><span class="str"> 'bar'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2000" href="#t2000">2000</a></span><span class="t"><span class="str"> >>> paragraph.get('Unknown-Field') is None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2001" href="#t2001">2001</a></span><span class="t"><span class="str"> True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2002" href="#t2002">2002</a></span><span class="t"><span class="str"> >>> # But you get asymmetric behaviour with set vs. get</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2003" href="#t2003">2003</a></span><span class="t"><span class="str"> >>> paragraph['Foo'] = ' bar\n'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2004" href="#t2004">2004</a></span><span class="t"><span class="str"> >>> paragraph['Foo']</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2005" href="#t2005">2005</a></span><span class="t"><span class="str"> 'bar'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2006" href="#t2006">2006</a></span><span class="t"><span class="str"> >>> paragraph['Bar'] = ' bar\n#Comment\n another value\n'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2007" href="#t2007">2007</a></span><span class="t"><span class="str"> >>> # Note that the whitespace on the first line has been normalized.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2008" href="#t2008">2008</a></span><span class="t"><span class="str"> >>> print("Bar: " + paragraph['Bar'])</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2009" href="#t2009">2009</a></span><span class="t"><span class="str"> Bar: bar</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2010" href="#t2010">2010</a></span><span class="t"><span class="str"> another value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2011" href="#t2011">2011</a></span><span class="t"><span class="str"> >>> # The comment is present (in case you where wondering)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2012" href="#t2012">2012</a></span><span class="t"><span class="str"> >>> print(paragraph.get_kvpair_element('Bar').convert_to_text(), end='')</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2013" href="#t2013">2013</a></span><span class="t"><span class="str"> Bar: bar</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2014" href="#t2014">2014</a></span><span class="t"><span class="str"> #Comment</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2015" href="#t2015">2015</a></span><span class="t"><span class="str"> another value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2016" href="#t2016">2016</a></span><span class="t"><span class="str"> >>> # On the other hand, you can choose to see the values as they are</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2017" href="#t2017">2017</a></span><span class="t"><span class="str"> >>> # - We will just reset the paragraph as a "nothing up my sleeve"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2018" href="#t2018">2018</a></span><span class="t"><span class="str"> >>> dfile = parse_deb822_file(example_deb822_paragraph.splitlines())</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2019" href="#t2019">2019</a></span><span class="t"><span class="str"> >>> paragraph = next(iter(dfile))</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2020" href="#t2020">2020</a></span><span class="t"><span class="str"> >>> nonstd_dictview = paragraph.configured_view(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2021" href="#t2021">2021</a></span><span class="t"><span class="str"> ... discard_comments_on_read=False,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2022" href="#t2022">2022</a></span><span class="t"><span class="str"> ... auto_map_initial_line_whitespace=False,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2023" href="#t2023">2023</a></span><span class="t"><span class="str"> ... # For paragraphs with duplicate fields, you can choose to get an error</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2024" href="#t2024">2024</a></span><span class="t"><span class="str"> ... # rather than the dict picking the first value available.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2025" href="#t2025">2025</a></span><span class="t"><span class="str"> ... auto_resolve_ambiguous_fields=False,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2026" href="#t2026">2026</a></span><span class="t"><span class="str"> ... auto_map_final_newline_in_multiline_values=False,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2027" href="#t2027">2027</a></span><span class="t"><span class="str"> ... )</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2028" href="#t2028">2028</a></span><span class="t"><span class="str"> >>> # Because we have reset the state, Foo and Bar are no longer there.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2029" href="#t2029">2029</a></span><span class="t"><span class="str"> >>> 'Bar' not in paragraph and 'Foo' not in paragraph</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2030" href="#t2030">2030</a></span><span class="t"><span class="str"> True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2031" href="#t2031">2031</a></span><span class="t"><span class="str"> >>> # We can now see the comments (discard_comments_on_read=False)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2032" href="#t2032">2032</a></span><span class="t"><span class="str"> >>> # (The leading whitespace in front of "libfoo" is due to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2033" href="#t2033">2033</a></span><span class="t"><span class="str"> >>> # auto_map_initial_line_whitespace=False)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2034" href="#t2034">2034</a></span><span class="t"><span class="str"> >>> print(nonstd_dictview["Depends"], end='')</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2035" href="#t2035">2035</a></span><span class="t"><span class="str"> libfoo,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2036" href="#t2036">2036</a></span><span class="t"><span class="str"> # Inline comment (associated with the next line)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2037" href="#t2037">2037</a></span><span class="t"><span class="str"> libbar,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2038" href="#t2038">2038</a></span><span class="t"><span class="str"> >>> # And all the optional whitespace on the first value line</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2039" href="#t2039">2039</a></span><span class="t"><span class="str"> >>> # (auto_map_initial_line_whitespace=False)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2040" href="#t2040">2040</a></span><span class="t"><span class="str"> >>> nonstd_dictview["Package"] == ' foo\n'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2041" href="#t2041">2041</a></span><span class="t"><span class="str"> True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2042" href="#t2042">2042</a></span><span class="t"><span class="str"> >>> # ... which will give you symmetric behaviour with set vs. get</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2043" href="#t2043">2043</a></span><span class="t"><span class="str"> >>> nonstd_dictview['Foo'] = ' bar \n'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2044" href="#t2044">2044</a></span><span class="t"><span class="str"> >>> nonstd_dictview['Foo']</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2045" href="#t2045">2045</a></span><span class="t"><span class="str"> ' bar \n'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2046" href="#t2046">2046</a></span><span class="t"><span class="str"> >>> nonstd_dictview['Bar'] = ' bar \n#Comment\n another value\n'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2047" href="#t2047">2047</a></span><span class="t"><span class="str"> >>> nonstd_dictview['Bar']</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2048" href="#t2048">2048</a></span><span class="t"><span class="str"> ' bar \n#Comment\n another value\n'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2049" href="#t2049">2049</a></span><span class="t"><span class="str"> >>> # But then you get no help either.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2050" href="#t2050">2050</a></span><span class="t"><span class="str"> >>> try:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2051" href="#t2051">2051</a></span><span class="t"><span class="str"> ... nonstd_dictview["Baz"] = "foo"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2052" href="#t2052">2052</a></span><span class="t"><span class="str"> ... except ValueError:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2053" href="#t2053">2053</a></span><span class="t"><span class="str"> ... print("Rejected")</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2054" href="#t2054">2054</a></span><span class="t"><span class="str"> Rejected</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2055" href="#t2055">2055</a></span><span class="t"><span class="str"> >>> # With auto_map_initial_line_whitespace=False, you have to include minimum a newline</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2056" href="#t2056">2056</a></span><span class="t"><span class="str"> >>> nonstd_dictview["Baz"] = "foo\n"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2057" href="#t2057">2057</a></span><span class="t"><span class="str"> >>> # The absence of leading whitespace gives you the terse variant at the expensive</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2058" href="#t2058">2058</a></span><span class="t"><span class="str"> >>> # readability</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2059" href="#t2059">2059</a></span><span class="t"><span class="str"> >>> paragraph.get_kvpair_element('Baz').convert_to_text()</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2060" href="#t2060">2060</a></span><span class="t"><span class="str"> 'Baz:foo\n'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2061" href="#t2061">2061</a></span><span class="t"><span class="str"> >>> # But because they are views, changes performed via one view is visible in the other</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2062" href="#t2062">2062</a></span><span class="t"><span class="str"> >>> paragraph['Foo']</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2063" href="#t2063">2063</a></span><span class="t"><span class="str"> 'bar'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2064" href="#t2064">2064</a></span><span class="t"><span class="str"> >>> # The views show the values according to their own rules. Therefore, there is an</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2065" href="#t2065">2065</a></span><span class="t"><span class="str"> >>> # asymmetric between paragraph['Foo'] and nonstd_dictview['Foo']</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2066" href="#t2066">2066</a></span><span class="t"><span class="str"> >>> # Nevertheless, you can read or write the fields via either - enabling you to use</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2067" href="#t2067">2067</a></span><span class="t"><span class="str"> >>> # the view that best suit your use-case for the given field.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2068" href="#t2068">2068</a></span><span class="t"><span class="str"> >>> 'Baz' in paragraph and nonstd_dictview.get('Baz') is not None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2069" href="#t2069">2069</a></span><span class="t"><span class="str"> True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2070" href="#t2070">2070</a></span><span class="t"><span class="str"> >>> # Deletion via the view also works</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2071" href="#t2071">2071</a></span><span class="t"><span class="str"> >>> del nonstd_dictview['Baz']</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2072" href="#t2072">2072</a></span><span class="t"><span class="str"> >>> 'Baz' not in paragraph and nonstd_dictview.get('Baz') is None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2073" href="#t2073">2073</a></span><span class="t"><span class="str"> True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2074" href="#t2074">2074</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2075" href="#t2075">2075</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2076" href="#t2076">2076</a></span><span class="t"><span class="str"> :param discard_comments_on_read: When getting a field value from the dict,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2077" href="#t2077">2077</a></span><span class="t"><span class="str"> this parameter decides how in-line comments are handled. When setting</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2078" href="#t2078">2078</a></span><span class="t"><span class="str"> the value, inline comments are still allowed and will be retained.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2079" href="#t2079">2079</a></span><span class="t"><span class="str"> However, keep in mind that this option makes getter and setter asymmetric</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2080" href="#t2080">2080</a></span><span class="t"><span class="str"> as a "get" following a "set" with inline comments will omit the comments</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2081" href="#t2081">2081</a></span><span class="t"><span class="str"> even if they are there (see the code example).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2082" href="#t2082">2082</a></span><span class="t"><span class="str"> :param auto_map_initial_line_whitespace: Special-case the first value line</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2083" href="#t2083">2083</a></span><span class="t"><span class="str"> by trimming unnecessary whitespace leaving only the value. For single-line</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2084" href="#t2084">2084</a></span><span class="t"><span class="str"> values, all space including newline is pruned. For multi-line values, the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2085" href="#t2085">2085</a></span><span class="t"><span class="str"> newline is preserved / needed to distinguish the first line from the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2086" href="#t2086">2086</a></span><span class="t"><span class="str"> following lines. When setting a value, this option normalizes the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2087" href="#t2087">2087</a></span><span class="t"><span class="str"> whitespace of the initial line of the value field.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2088" href="#t2088">2088</a></span><span class="t"><span class="str"> When this option is set to True makes the dictionary behave more like the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2089" href="#t2089">2089</a></span><span class="t"><span class="str"> original Deb822 module.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2090" href="#t2090">2090</a></span><span class="t"><span class="str"> :param preserve_field_comments_on_field_updates: Whether to preserve the field</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2091" href="#t2091">2091</a></span><span class="t"><span class="str"> comments when mutating the field.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2092" href="#t2092">2092</a></span><span class="t"><span class="str"> :param auto_resolve_ambiguous_fields: This parameter is only relevant for paragraphs</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2093" href="#t2093">2093</a></span><span class="t"><span class="str"> that contain the same field multiple times (these are generally invalid). If the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2094" href="#t2094">2094</a></span><span class="t"><span class="str"> caller requests an ambiguous field from an invalid paragraph via a plain field name,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2095" href="#t2095">2095</a></span><span class="t"><span class="str"> the return dict-like object will refuse to resolve the field (not knowing which</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2096" href="#t2096">2096</a></span><span class="t"><span class="str"> version to pick). This parameter (if set to True) instead changes the error into</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2097" href="#t2097">2097</a></span><span class="t"><span class="str"> assuming the caller wants the *first* variant.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2098" href="#t2098">2098</a></span><span class="t"><span class="str"> :param auto_map_final_newline_in_multiline_values: This parameter controls whether</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2099" href="#t2099">2099</a></span><span class="t"><span class="str"> a multiline field with have / need a trailing newline. If True, the trailing</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2100" href="#t2100">2100</a></span><span class="t"><span class="str"> newline is hidden on get and automatically added in set (if missing).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2101" href="#t2101">2101</a></span><span class="t"><span class="str"> When this option is set to True makes the dictionary behave more like the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2102" href="#t2102">2102</a></span><span class="t"><span class="str"> original Deb822 module.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2103" href="#t2103">2103</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2104" href="#t2104">2104</a></span><span class="t"> <span class="key">return</span> <span class="nam">Deb822DictishParagraphWrapper</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2105" href="#t2105">2105</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2106" href="#t2106">2106</a></span><span class="t"> <span class="nam">discard_comments_on_read</span><span class="op">=</span><span class="nam">discard_comments_on_read</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2107" href="#t2107">2107</a></span><span class="t"> <span class="nam">auto_map_initial_line_whitespace</span><span class="op">=</span><span class="nam">auto_map_initial_line_whitespace</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2108" href="#t2108">2108</a></span><span class="t"> <span class="nam">auto_resolve_ambiguous_fields</span><span class="op">=</span><span class="nam">auto_resolve_ambiguous_fields</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2109" href="#t2109">2109</a></span><span class="t"> <span class="nam">preserve_field_comments_on_field_updates</span><span class="op">=</span><span class="nam">preserve_field_comments_on_field_updates</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2110" href="#t2110">2110</a></span><span class="t"> <span class="nam">auto_map_final_newline_in_multiline_values</span><span class="op">=</span><span class="nam">auto_map_final_newline_in_multiline_values</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2111" href="#t2111">2111</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2112" href="#t2112">2112</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2113" href="#t2113">2113</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2114" href="#t2114">2114</a></span><span class="t"> <span class="key">def</span> <span class="nam">_paragraph</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2115" href="#t2115">2115</a></span><span class="t"> <span class="com"># type: () -> Deb822ParagraphElement</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2116" href="#t2116">2116</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2117" href="#t2117">2117</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2118" href="#t2118">2118</a></span><span class="t"> <span class="key">def</span> <span class="nam">order_last</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">field</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2119" href="#t2119">2119</a></span><span class="t"> <span class="com"># type: (ParagraphKey) -> None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2120" href="#t2120">2120</a></span><span class="t"> <span class="str">"""Re-order the given field so it is "last" in the paragraph"""</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t2121" href="#t2121">2121</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> <span class="com"># pragma: no cover</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2122" href="#t2122">2122</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2123" href="#t2123">2123</a></span><span class="t"> <span class="key">def</span> <span class="nam">order_first</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">field</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2124" href="#t2124">2124</a></span><span class="t"> <span class="com"># type: (ParagraphKey) -> None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2125" href="#t2125">2125</a></span><span class="t"> <span class="str">"""Re-order the given field so it is "first" in the paragraph"""</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t2126" href="#t2126">2126</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> <span class="com"># pragma: no cover</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2127" href="#t2127">2127</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2128" href="#t2128">2128</a></span><span class="t"> <span class="key">def</span> <span class="nam">order_before</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">field</span><span class="op">,</span> <span class="nam">reference_field</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2129" href="#t2129">2129</a></span><span class="t"> <span class="com"># type: (ParagraphKey, ParagraphKey) -> None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2130" href="#t2130">2130</a></span><span class="t"> <span class="str">"""Re-order the given field so appears directly after the reference field in the paragraph</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2131" href="#t2131">2131</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2132" href="#t2132">2132</a></span><span class="t"><span class="str"> The reference field must be present."""</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t2133" href="#t2133">2133</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> <span class="com"># pragma: no cover</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2134" href="#t2134">2134</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2135" href="#t2135">2135</a></span><span class="t"> <span class="key">def</span> <span class="nam">order_after</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">field</span><span class="op">,</span> <span class="nam">reference_field</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2136" href="#t2136">2136</a></span><span class="t"> <span class="com"># type: (ParagraphKey, ParagraphKey) -> None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2137" href="#t2137">2137</a></span><span class="t"> <span class="str">"""Re-order the given field so appears directly before the reference field in the paragraph</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2138" href="#t2138">2138</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2139" href="#t2139">2139</a></span><span class="t"><span class="str"> The reference field must be present.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2140" href="#t2140">2140</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t2141" href="#t2141">2141</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> <span class="com"># pragma: no cover</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2142" href="#t2142">2142</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2143" href="#t2143">2143</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2144" href="#t2144">2144</a></span><span class="t"> <span class="key">def</span> <span class="nam">kvpair_count</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2145" href="#t2145">2145</a></span><span class="t"> <span class="com"># type: () -> int</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t2146" href="#t2146">2146</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> <span class="com"># pragma: no cover</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2147" href="#t2147">2147</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2148" href="#t2148">2148</a></span><span class="t"> <span class="key">def</span> <span class="nam">iter_keys</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2149" href="#t2149">2149</a></span><span class="t"> <span class="com"># type: () -> Iterable[ParagraphKey]</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t2150" href="#t2150">2150</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> <span class="com"># pragma: no cover</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2151" href="#t2151">2151</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2152" href="#t2152">2152</a></span><span class="t"> <span class="key">def</span> <span class="nam">contains_kvpair_element</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">item</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2153" href="#t2153">2153</a></span><span class="t"> <span class="com"># type: (object) -> bool</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t2154" href="#t2154">2154</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> <span class="com"># pragma: no cover</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2155" href="#t2155">2155</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2156" href="#t2156">2156</a></span><span class="t"> <span class="key">def</span> <span class="nam">get_kvpair_element</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2157" href="#t2157">2157</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2158" href="#t2158">2158</a></span><span class="t"> <span class="nam">item</span><span class="op">,</span> <span class="com"># type: ParagraphKey</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2159" href="#t2159">2159</a></span><span class="t"> <span class="nam">use_get</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> <span class="com"># type: bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2160" href="#t2160">2160</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2161" href="#t2161">2161</a></span><span class="t"> <span class="com"># type: (...) -> Optional[Deb822KeyValuePairElement]</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t2162" href="#t2162">2162</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> <span class="com"># pragma: no cover</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2163" href="#t2163">2163</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2164" href="#t2164">2164</a></span><span class="t"> <span class="key">def</span> <span class="nam">set_kvpair_element</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">key</span><span class="op">,</span> <span class="nam">value</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2165" href="#t2165">2165</a></span><span class="t"> <span class="com"># type: (ParagraphKey, Deb822KeyValuePairElement) -> None</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t2166" href="#t2166">2166</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> <span class="com"># pragma: no cover</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2167" href="#t2167">2167</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2168" href="#t2168">2168</a></span><span class="t"> <span class="key">def</span> <span class="nam">remove_kvpair_element</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">key</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2169" href="#t2169">2169</a></span><span class="t"> <span class="com"># type: (ParagraphKey) -> None</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t2170" href="#t2170">2170</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> <span class="com"># pragma: no cover</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2171" href="#t2171">2171</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2172" href="#t2172">2172</a></span><span class="t"> <span class="key">def</span> <span class="nam">sort_fields</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2173" href="#t2173">2173</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> <span class="nam">key</span><span class="op">=</span><span class="key">None</span> <span class="com"># type: Optional[Callable[[str], Any]]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2174" href="#t2174">2174</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2175" href="#t2175">2175</a></span><span class="t"> <span class="com"># type: (...) -> None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2176" href="#t2176">2176</a></span><span class="t"> <span class="str">"""Re-order all fields</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2177" href="#t2177">2177</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2178" href="#t2178">2178</a></span><span class="t"><span class="str"> :param key: Provide a key function (same semantics as for sorted). Keep in mind that</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2179" href="#t2179">2179</a></span><span class="t"><span class="str"> the module preserve the cases for field names - in generally, callers are recommended</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2180" href="#t2180">2180</a></span><span class="t"><span class="str"> to use "lower()" to normalize the case.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2181" href="#t2181">2181</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t2182" href="#t2182">2182</a></span><span class="t"> <span class="key">raise</span> <span class="nam">NotImplementedError</span> <span class="com"># pragma: no cover</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2183" href="#t2183">2183</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2184" href="#t2184">2184</a></span><span class="t"> <span class="key">def</span> <span class="nam">set_field_to_simple_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2185" href="#t2185">2185</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2186" href="#t2186">2186</a></span><span class="t"> <span class="nam">item</span><span class="op">,</span> <span class="com"># type: ParagraphKey</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2187" href="#t2187">2187</a></span><span class="t"> <span class="nam">simple_value</span><span class="op">,</span> <span class="com"># type: str</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2188" href="#t2188">2188</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2189" href="#t2189">2189</a></span><span class="t"> <span class="nam">preserve_original_field_comment</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> <span class="com"># type: Optional[bool]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2190" href="#t2190">2190</a></span><span class="t"> <span class="nam">field_comment</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> <span class="com"># type: Optional[Commentish]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2191" href="#t2191">2191</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2192" href="#t2192">2192</a></span><span class="t"> <span class="com"># type: (...) -> None</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t2193" href="#t2193">2193</a></span><span class="t"> <span class="str">r"""Sets a field in this paragraph to a simple "word" or "phrase"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2194" href="#t2194">2194</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2195" href="#t2195">2195</a></span><span class="t"><span class="str"> In many cases, it is better for callers to just use the paragraph as</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2196" href="#t2196">2196</a></span><span class="t"><span class="str"> if it was a dictionary. However, this method does enable to you choose</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2197" href="#t2197">2197</a></span><span class="t"><span class="str"> the field comment (if any), which can be a reason for using it.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2198" href="#t2198">2198</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2199" href="#t2199">2199</a></span><span class="t"><span class="str"> This is suitable for "simple" fields like "Package". Example:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2200" href="#t2200">2200</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2201" href="#t2201">2201</a></span><span class="t"><span class="str"> >>> example_deb822_paragraph = '''</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2202" href="#t2202">2202</a></span><span class="t"><span class="str"> ... Package: foo</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2203" href="#t2203">2203</a></span><span class="t"><span class="str"> ... '''</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2204" href="#t2204">2204</a></span><span class="t"><span class="str"> >>> dfile = parse_deb822_file(example_deb822_paragraph.splitlines())</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2205" href="#t2205">2205</a></span><span class="t"><span class="str"> >>> p = next(iter(dfile))</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2206" href="#t2206">2206</a></span><span class="t"><span class="str"> >>> p.set_field_to_simple_value("Package", "mscgen")</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2207" href="#t2207">2207</a></span><span class="t"><span class="str"> >>> p.set_field_to_simple_value("Architecture", "linux-any kfreebsd-any",</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2208" href="#t2208">2208</a></span><span class="t"><span class="str"> ... field_comment=['Only ported to linux and kfreebsd'])</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2209" href="#t2209">2209</a></span><span class="t"><span class="str"> >>> p.set_field_to_simple_value("Priority", "optional")</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2210" href="#t2210">2210</a></span><span class="t"><span class="str"> >>> print(p.dump(), end='')</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2211" href="#t2211">2211</a></span><span class="t"><span class="str"> Package: mscgen</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2212" href="#t2212">2212</a></span><span class="t"><span class="str"> # Only ported to linux and kfreebsd</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2213" href="#t2213">2213</a></span><span class="t"><span class="str"> Architecture: linux-any kfreebsd-any</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2214" href="#t2214">2214</a></span><span class="t"><span class="str"> Priority: optional</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2215" href="#t2215">2215</a></span><span class="t"><span class="str"> >>> # Values are formatted nicely by default, but it does not work with</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2216" href="#t2216">2216</a></span><span class="t"><span class="str"> >>> # multi-line values</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2217" href="#t2217">2217</a></span><span class="t"><span class="str"> >>> p.set_field_to_simple_value("Foo", "bar\nbin\n")</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2218" href="#t2218">2218</a></span><span class="t"><span class="str"> Traceback (most recent call last):</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2219" href="#t2219">2219</a></span><span class="t"><span class="str"> ...</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2220" href="#t2220">2220</a></span><span class="t"><span class="str"> ValueError: Cannot use set_field_to_simple_value for values with newlines</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2221" href="#t2221">2221</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2222" href="#t2222">2222</a></span><span class="t"><span class="str"> :param item: Name of the field to set. If the paragraph already</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2223" href="#t2223">2223</a></span><span class="t"><span class="str"> contains the field, then it will be replaced. If the field exists,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2224" href="#t2224">2224</a></span><span class="t"><span class="str"> then it will preserve its order in the paragraph. Otherwise, it is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2225" href="#t2225">2225</a></span><span class="t"><span class="str"> added to the end of the paragraph.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2226" href="#t2226">2226</a></span><span class="t"><span class="str"> Note this can be a "paragraph key", which enables you to control</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2227" href="#t2227">2227</a></span><span class="t"><span class="str"> *which* instance of a field is being replaced (in case of duplicate</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2228" href="#t2228">2228</a></span><span class="t"><span class="str"> fields).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2229" href="#t2229">2229</a></span><span class="t"><span class="str"> :param simple_value: The text to use as the value. The value must not</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2230" href="#t2230">2230</a></span><span class="t"><span class="str"> contain newlines. Leading and trailing will be stripped but space</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2231" href="#t2231">2231</a></span><span class="t"><span class="str"> within the value is preserved. The value cannot contain comments</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2232" href="#t2232">2232</a></span><span class="t"><span class="str"> (i.e. if the "#" token appears in the value, then it is considered</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2233" href="#t2233">2233</a></span><span class="t"><span class="str"> a value rather than "start of a comment)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2234" href="#t2234">2234</a></span><span class="t"><span class="str"> :param preserve_original_field_comment: See the description for the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2235" href="#t2235">2235</a></span><span class="t"><span class="str"> parameter with the same name in the set_field_from_raw_string method.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2236" href="#t2236">2236</a></span><span class="t"><span class="str"> :param field_comment: See the description for the parameter with the same</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2237" href="#t2237">2237</a></span><span class="t"><span class="str"> name in the set_field_from_raw_string method.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2238" href="#t2238">2238</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2239" href="#t2239">2239</a></span><span class="t"> <span class="key">if</span> <span class="str">"\n"</span> <span class="key">in</span> <span class="nam">simple_value</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2240" href="#t2240">2240</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2241" href="#t2241">2241</a></span><span class="t"> <span class="str">"Cannot use set_field_to_simple_value for values with newlines"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2242" href="#t2242">2242</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2243" href="#t2243">2243</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2244" href="#t2244">2244</a></span><span class="t"> <span class="com"># Reformat it with a leading space and trailing newline. The latter because it is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2245" href="#t2245">2245</a></span><span class="t"> <span class="com"># necessary if there are any fields after it and the former because it looks nicer so</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2246" href="#t2246">2246</a></span><span class="t"> <span class="com"># have single space after the field separator</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2247" href="#t2247">2247</a></span><span class="t"> <span class="nam">stripped</span> <span class="op">=</span> <span class="nam">simple_value</span><span class="op">.</span><span class="nam">strip</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2248" href="#t2248">2248</a></span><span class="t"> <span class="key">if</span> <span class="nam">stripped</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2248 ↛ 2252</span><span class="annotate long">line 2248 didn't jump to line 2252, because the condition on line 2248 was never false</span></span></p> - <p class="run"><span class="n"><a id="t2249" href="#t2249">2249</a></span><span class="t"> <span class="nam">raw_value</span> <span class="op">=</span> <span class="str">" "</span> <span class="op">+</span> <span class="nam">stripped</span> <span class="op">+</span> <span class="str">"\n"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2250" href="#t2250">2250</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2251" href="#t2251">2251</a></span><span class="t"> <span class="com"># Special-case for empty values</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2252" href="#t2252">2252</a></span><span class="t"> <span class="nam">raw_value</span> <span class="op">=</span> <span class="str">"\n"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2253" href="#t2253">2253</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">set_field_from_raw_string</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2254" href="#t2254">2254</a></span><span class="t"> <span class="nam">item</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2255" href="#t2255">2255</a></span><span class="t"> <span class="nam">raw_value</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2256" href="#t2256">2256</a></span><span class="t"> <span class="nam">preserve_original_field_comment</span><span class="op">=</span><span class="nam">preserve_original_field_comment</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2257" href="#t2257">2257</a></span><span class="t"> <span class="nam">field_comment</span><span class="op">=</span><span class="nam">field_comment</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2258" href="#t2258">2258</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2259" href="#t2259">2259</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2260" href="#t2260">2260</a></span><span class="t"> <span class="key">def</span> <span class="nam">set_field_from_raw_string</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2261" href="#t2261">2261</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2262" href="#t2262">2262</a></span><span class="t"> <span class="nam">item</span><span class="op">,</span> <span class="com"># type: ParagraphKey</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2263" href="#t2263">2263</a></span><span class="t"> <span class="nam">raw_string_value</span><span class="op">,</span> <span class="com"># type: str</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2264" href="#t2264">2264</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2265" href="#t2265">2265</a></span><span class="t"> <span class="nam">preserve_original_field_comment</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> <span class="com"># type: Optional[bool]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2266" href="#t2266">2266</a></span><span class="t"> <span class="nam">field_comment</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> <span class="com"># type: Optional[Commentish]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2267" href="#t2267">2267</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2268" href="#t2268">2268</a></span><span class="t"> <span class="com"># type: (...) -> None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2269" href="#t2269">2269</a></span><span class="t"> <span class="str">"""Sets a field in this paragraph to a given text value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2270" href="#t2270">2270</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2271" href="#t2271">2271</a></span><span class="t"><span class="str"> In many cases, it is better for callers to just use the paragraph as</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2272" href="#t2272">2272</a></span><span class="t"><span class="str"> if it was a dictionary. However, this method does enable to you choose</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2273" href="#t2273">2273</a></span><span class="t"><span class="str"> the field comment (if any) and lets to have a higher degree of control</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2274" href="#t2274">2274</a></span><span class="t"><span class="str"> over whitespace (on the first line), which can be a reason for using it.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2275" href="#t2275">2275</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2276" href="#t2276">2276</a></span><span class="t"><span class="str"> Example usage:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2277" href="#t2277">2277</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2278" href="#t2278">2278</a></span><span class="t"><span class="str"> >>> example_deb822_paragraph = '''</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2279" href="#t2279">2279</a></span><span class="t"><span class="str"> ... Package: foo</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2280" href="#t2280">2280</a></span><span class="t"><span class="str"> ... '''</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2281" href="#t2281">2281</a></span><span class="t"><span class="str"> >>> dfile = parse_deb822_file(example_deb822_paragraph.splitlines())</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2282" href="#t2282">2282</a></span><span class="t"><span class="str"> >>> p = next(iter(dfile))</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2283" href="#t2283">2283</a></span><span class="t"><span class="str"> >>> raw_value = '''</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2284" href="#t2284">2284</a></span><span class="t"><span class="str"> ... Build-Depends: debhelper-compat (= 12),</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2285" href="#t2285">2285</a></span><span class="t"><span class="str"> ... some-other-bd,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2286" href="#t2286">2286</a></span><span class="t"><span class="str"> ... # Comment</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2287" href="#t2287">2287</a></span><span class="t"><span class="str"> ... another-bd,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2288" href="#t2288">2288</a></span><span class="t"><span class="str"> ... '''.lstrip() # Remove leading newline, but *not* the trailing newline</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2289" href="#t2289">2289</a></span><span class="t"><span class="str"> >>> fname, new_value = raw_value.split(':', 1)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2290" href="#t2290">2290</a></span><span class="t"><span class="str"> >>> p.set_field_from_raw_string(fname, new_value)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2291" href="#t2291">2291</a></span><span class="t"><span class="str"> >>> print(p.dump(), end='')</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2292" href="#t2292">2292</a></span><span class="t"><span class="str"> Package: foo</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2293" href="#t2293">2293</a></span><span class="t"><span class="str"> Build-Depends: debhelper-compat (= 12),</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2294" href="#t2294">2294</a></span><span class="t"><span class="str"> some-other-bd,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2295" href="#t2295">2295</a></span><span class="t"><span class="str"> # Comment</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2296" href="#t2296">2296</a></span><span class="t"><span class="str"> another-bd,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2297" href="#t2297">2297</a></span><span class="t"><span class="str"> >>> # Format preserved</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2298" href="#t2298">2298</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2299" href="#t2299">2299</a></span><span class="t"><span class="str"> :param item: Name of the field to set. If the paragraph already</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2300" href="#t2300">2300</a></span><span class="t"><span class="str"> contains the field, then it will be replaced. Otherwise, it is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2301" href="#t2301">2301</a></span><span class="t"><span class="str"> added to the end of the paragraph.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2302" href="#t2302">2302</a></span><span class="t"><span class="str"> Note this can be a "paragraph key", which enables you to control</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2303" href="#t2303">2303</a></span><span class="t"><span class="str"> *which* instance of a field is being replaced (in case of duplicate</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2304" href="#t2304">2304</a></span><span class="t"><span class="str"> fields).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2305" href="#t2305">2305</a></span><span class="t"><span class="str"> :param raw_string_value: The text to use as the value. The text must</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2306" href="#t2306">2306</a></span><span class="t"><span class="str"> be valid deb822 syntax and is used *exactly* as it is given.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2307" href="#t2307">2307</a></span><span class="t"><span class="str"> Accordingly, multi-line values must include mandatory leading space</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2308" href="#t2308">2308</a></span><span class="t"><span class="str"> on continuation lines, newlines after the value, etc. On the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2309" href="#t2309">2309</a></span><span class="t"><span class="str"> flip-side, any optional space or comments will be included.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2310" href="#t2310">2310</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2311" href="#t2311">2311</a></span><span class="t"><span class="str"> Note that the first line will *never* be read as a comment (if the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2312" href="#t2312">2312</a></span><span class="t"><span class="str"> first line of the value starts with a "#" then it will result</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2313" href="#t2313">2313</a></span><span class="t"><span class="str"> in "Field-Name:#..." which is parsed as a value starting with "#"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2314" href="#t2314">2314</a></span><span class="t"><span class="str"> rather than a comment).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2315" href="#t2315">2315</a></span><span class="t"><span class="str"> :param preserve_original_field_comment: If True, then if there is an</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2316" href="#t2316">2316</a></span><span class="t"><span class="str"> existing field and that has a comment, then the comment will remain</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2317" href="#t2317">2317</a></span><span class="t"><span class="str"> after this operation. This is the default is the `field_comment`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2318" href="#t2318">2318</a></span><span class="t"><span class="str"> parameter is omitted.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2319" href="#t2319">2319</a></span><span class="t"><span class="str"> Note that if the parameter is True and the item is ambiguous, this</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2320" href="#t2320">2320</a></span><span class="t"><span class="str"> will raise an AmbiguousDeb822FieldKeyError. When the parameter is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2321" href="#t2321">2321</a></span><span class="t"><span class="str"> omitted, the ambiguity is resolved automatically and if the resolved</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2322" href="#t2322">2322</a></span><span class="t"><span class="str"> field has a comment then that will be preserved (assuming</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2323" href="#t2323">2323</a></span><span class="t"><span class="str"> field_comment is None).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2324" href="#t2324">2324</a></span><span class="t"><span class="str"> :param field_comment: If not None, add or replace the comment for</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2325" href="#t2325">2325</a></span><span class="t"><span class="str"> the field. Each string in the list will become one comment</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2326" href="#t2326">2326</a></span><span class="t"><span class="str"> line (inserted directly before the field name). Will appear in the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2327" href="#t2327">2327</a></span><span class="t"><span class="str"> same order as they do in the list.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2328" href="#t2328">2328</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2329" href="#t2329">2329</a></span><span class="t"><span class="str"> If you want complete control over the formatting of the comments,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2330" href="#t2330">2330</a></span><span class="t"><span class="str"> then ensure that each line start with "#" and end with "\\n" before</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2331" href="#t2331">2331</a></span><span class="t"><span class="str"> the call. Otherwise, leading/trailing whitespace is normalized</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2332" href="#t2332">2332</a></span><span class="t"><span class="str"> and the missing "#"/"\\n" character is inserted.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2333" href="#t2333">2333</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2334" href="#t2334">2334</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2335" href="#t2335">2335</a></span><span class="t"> <span class="nam">new_content</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> <span class="com"># type: List[str]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2336" href="#t2336">2336</a></span><span class="t"> <span class="key">if</span> <span class="nam">preserve_original_field_comment</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2337" href="#t2337">2337</a></span><span class="t"> <span class="key">if</span> <span class="nam">field_comment</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2337 ↛ 2338</span><span class="annotate long">line 2337 didn't jump to line 2338, because the condition on line 2337 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t2338" href="#t2338">2338</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2339" href="#t2339">2339</a></span><span class="t"> <span class="str">'The "preserve_original_field_comment" conflicts with'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2340" href="#t2340">2340</a></span><span class="t"> <span class="str">' "field_comment" parameter'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2341" href="#t2341">2341</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2342" href="#t2342">2342</a></span><span class="t"> <span class="key">elif</span> <span class="nam">field_comment</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2343" href="#t2343">2343</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">field_comment</span><span class="op">,</span> <span class="nam">Deb822CommentElement</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2343 ↛ 2346</span><span class="annotate long">line 2343 didn't jump to line 2346, because the condition on line 2343 was never false</span></span></p> - <p class="run"><span class="n"><a id="t2344" href="#t2344">2344</a></span><span class="t"> <span class="nam">new_content</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">_format_comment</span><span class="op">(</span><span class="nam">x</span><span class="op">)</span> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">field_comment</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2345" href="#t2345">2345</a></span><span class="t"> <span class="nam">field_comment</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2346" href="#t2346">2346</a></span><span class="t"> <span class="nam">preserve_original_field_comment</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2347" href="#t2347">2347</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2348" href="#t2348">2348</a></span><span class="t"> <span class="nam">field_name</span><span class="op">,</span> <span class="nam">_</span><span class="op">,</span> <span class="nam">_</span> <span class="op">=</span> <span class="nam">_unpack_key</span><span class="op">(</span><span class="nam">item</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2349" href="#t2349">2349</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2350" href="#t2350">2350</a></span><span class="t"> <span class="nam">cased_field_name</span> <span class="op">=</span> <span class="nam">field_name</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2351" href="#t2351">2351</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2352" href="#t2352">2352</a></span><span class="t"> <span class="nam">original</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">get_kvpair_element</span><span class="op">(</span><span class="nam">item</span><span class="op">,</span> <span class="nam">use_get</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2353" href="#t2353">2353</a></span><span class="t"> <span class="key">except</span> <span class="nam">AmbiguousDeb822FieldKeyError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2354" href="#t2354">2354</a></span><span class="t"> <span class="key">if</span> <span class="nam">preserve_original_field_comment</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2355" href="#t2355">2355</a></span><span class="t"> <span class="com"># If we were asked to preserve the original comment, then we</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2356" href="#t2356">2356</a></span><span class="t"> <span class="com"># require a strict lookup</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2357" href="#t2357">2357</a></span><span class="t"> <span class="key">raise</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2358" href="#t2358">2358</a></span><span class="t"> <span class="nam">original</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">get_kvpair_element</span><span class="op">(</span><span class="op">(</span><span class="nam">field_name</span><span class="op">,</span> <span class="num">0</span><span class="op">)</span><span class="op">,</span> <span class="nam">use_get</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2359" href="#t2359">2359</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2360" href="#t2360">2360</a></span><span class="t"> <span class="key">if</span> <span class="nam">preserve_original_field_comment</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2361" href="#t2361">2361</a></span><span class="t"> <span class="com"># We simplify preserve_original_field_comment after the lookup of the field.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2362" href="#t2362">2362</a></span><span class="t"> <span class="com"># Otherwise, we can get ambiguous key errors when updating an ambiguous field</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2363" href="#t2363">2363</a></span><span class="t"> <span class="com"># when the caller did not explicitly ask for that behaviour.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2364" href="#t2364">2364</a></span><span class="t"> <span class="nam">preserve_original_field_comment</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2365" href="#t2365">2365</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2366" href="#t2366">2366</a></span><span class="t"> <span class="key">if</span> <span class="nam">original</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2367" href="#t2367">2367</a></span><span class="t"> <span class="com"># If we already have the field, then preserve the original case</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2368" href="#t2368">2368</a></span><span class="t"> <span class="nam">cased_field_name</span> <span class="op">=</span> <span class="nam">original</span><span class="op">.</span><span class="nam">field_name</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2369" href="#t2369">2369</a></span><span class="t"> <span class="nam">raw</span> <span class="op">=</span> <span class="str">":"</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="op">(</span><span class="nam">cased_field_name</span><span class="op">,</span> <span class="nam">raw_string_value</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2370" href="#t2370">2370</a></span><span class="t"> <span class="nam">raw_lines</span> <span class="op">=</span> <span class="nam">raw</span><span class="op">.</span><span class="nam">splitlines</span><span class="op">(</span><span class="nam">keepends</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2371" href="#t2371">2371</a></span><span class="t"> <span class="key">for</span> <span class="nam">i</span><span class="op">,</span> <span class="nam">line</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">raw_lines</span><span class="op">,</span> <span class="nam">start</span><span class="op">=</span><span class="num">1</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2372" href="#t2372">2372</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">line</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2372 ↛ 2373</span><span class="annotate long">line 2372 didn't jump to line 2373, because the condition on line 2372 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t2373" href="#t2373">2373</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2374" href="#t2374">2374</a></span><span class="t"> <span class="str">"Line {i} in new value was missing trailing newline"</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span><span class="nam">i</span><span class="op">=</span><span class="nam">i</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2375" href="#t2375">2375</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2376" href="#t2376">2376</a></span><span class="t"> <span class="key">if</span> <span class="nam">i</span> <span class="op">!=</span> <span class="num">1</span> <span class="key">and</span> <span class="nam">line</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="key">not</span> <span class="key">in</span> <span class="op">(</span><span class="str">" "</span><span class="op">,</span> <span class="str">"\t"</span><span class="op">,</span> <span class="str">"#"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2376 ↛ 2377</span><span class="annotate long">line 2376 didn't jump to line 2377</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t2377" href="#t2377">2377</a></span><span class="t"> <span class="nam">msg</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2378" href="#t2378">2378</a></span><span class="t"> <span class="str">"Line {i} in new value was invalid. It must either start"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2379" href="#t2379">2379</a></span><span class="t"> <span class="str">' with " " space (continuation line) or "#" (comment line).'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2380" href="#t2380">2380</a></span><span class="t"> <span class="str">' The line started with "{line}"'</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2381" href="#t2381">2381</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2382" href="#t2382">2382</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="nam">msg</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span><span class="nam">i</span><span class="op">=</span><span class="nam">i</span><span class="op">,</span> <span class="nam">line</span><span class="op">=</span><span class="nam">line</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2383" href="#t2383">2383</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">raw_lines</span><span class="op">)</span> <span class="op">></span> <span class="num">1</span> <span class="key">and</span> <span class="nam">raw_lines</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"#"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2383 ↛ 2384</span><span class="annotate long">line 2383 didn't jump to line 2384, because the condition on line 2383 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t2384" href="#t2384">2384</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"The last line in a value field cannot be a comment"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2385" href="#t2385">2385</a></span><span class="t"> <span class="nam">new_content</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">raw_lines</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2386" href="#t2386">2386</a></span><span class="t"> <span class="com"># As absurd as it might seem, it is easier to just use the parser to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2387" href="#t2387">2387</a></span><span class="t"> <span class="com"># construct the AST correctly</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2388" href="#t2388">2388</a></span><span class="t"> <span class="nam">deb822_file</span> <span class="op">=</span> <span class="nam">parse_deb822_file</span><span class="op">(</span><span class="nam">iter</span><span class="op">(</span><span class="nam">new_content</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2389" href="#t2389">2389</a></span><span class="t"> <span class="nam">error_token</span> <span class="op">=</span> <span class="nam">deb822_file</span><span class="op">.</span><span class="nam">find_first_error_element</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2390" href="#t2390">2390</a></span><span class="t"> <span class="key">if</span> <span class="nam">error_token</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2390 ↛ 2391</span><span class="annotate long">line 2390 didn't jump to line 2391, because the condition on line 2390 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t2391" href="#t2391">2391</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"Syntax error in new field value for "</span> <span class="op">+</span> <span class="nam">field_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2392" href="#t2392">2392</a></span><span class="t"> <span class="nam">paragraph</span> <span class="op">=</span> <span class="nam">next</span><span class="op">(</span><span class="nam">iter</span><span class="op">(</span><span class="nam">deb822_file</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2393" href="#t2393">2393</a></span><span class="t"> <span class="key">assert</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">paragraph</span><span class="op">,</span> <span class="nam">Deb822NoDuplicateFieldsParagraphElement</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2394" href="#t2394">2394</a></span><span class="t"> <span class="nam">value</span> <span class="op">=</span> <span class="nam">paragraph</span><span class="op">.</span><span class="nam">get_kvpair_element</span><span class="op">(</span><span class="nam">field_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2395" href="#t2395">2395</a></span><span class="t"> <span class="key">assert</span> <span class="nam">value</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2396" href="#t2396">2396</a></span><span class="t"> <span class="key">if</span> <span class="nam">preserve_original_field_comment</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2397" href="#t2397">2397</a></span><span class="t"> <span class="key">if</span> <span class="nam">original</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2398" href="#t2398">2398</a></span><span class="t"> <span class="nam">value</span><span class="op">.</span><span class="nam">comment_element</span> <span class="op">=</span> <span class="nam">original</span><span class="op">.</span><span class="nam">comment_element</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2399" href="#t2399">2399</a></span><span class="t"> <span class="nam">original</span><span class="op">.</span><span class="nam">comment_element</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2400" href="#t2400">2400</a></span><span class="t"> <span class="key">elif</span> <span class="nam">field_comment</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2400 ↛ 2401</span><span class="annotate long">line 2400 didn't jump to line 2401, because the condition on line 2400 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t2401" href="#t2401">2401</a></span><span class="t"> <span class="nam">value</span><span class="op">.</span><span class="nam">comment_element</span> <span class="op">=</span> <span class="nam">field_comment</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2402" href="#t2402">2402</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">set_kvpair_element</span><span class="op">(</span><span class="nam">item</span><span class="op">,</span> <span class="nam">value</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2403" href="#t2403">2403</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2404" href="#t2404">2404</a></span><span class="t"> <span class="op">@</span><span class="nam">overload</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2405" href="#t2405">2405</a></span><span class="t"> <span class="key">def</span> <span class="nam">dump</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2406" href="#t2406">2406</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> <span class="nam">fd</span> <span class="com"># type: IO[bytes]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2407" href="#t2407">2407</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2408" href="#t2408">2408</a></span><span class="t"> <span class="com"># type: (...) -> None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2409" href="#t2409">2409</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2410" href="#t2410">2410</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2411" href="#t2411">2411</a></span><span class="t"> <span class="op">@</span><span class="nam">overload</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2412" href="#t2412">2412</a></span><span class="t"> <span class="key">def</span> <span class="nam">dump</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2413" href="#t2413">2413</a></span><span class="t"> <span class="com"># type: () -> str</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2414" href="#t2414">2414</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2415" href="#t2415">2415</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2416" href="#t2416">2416</a></span><span class="t"> <span class="key">def</span> <span class="nam">dump</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2417" href="#t2417">2417</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> <span class="nam">fd</span><span class="op">=</span><span class="key">None</span> <span class="com"># type: Optional[IO[bytes]]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2418" href="#t2418">2418</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2419" href="#t2419">2419</a></span><span class="t"> <span class="com"># type: (...) -> Optional[str]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2420" href="#t2420">2420</a></span><span class="t"> <span class="key">if</span> <span class="nam">fd</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2420 ↛ 2422</span><span class="annotate long">line 2420 didn't jump to line 2422, because the condition on line 2420 was never false</span></span></p> - <p class="run"><span class="n"><a id="t2421" href="#t2421">2421</a></span><span class="t"> <span class="key">return</span> <span class="str">""</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">t</span><span class="op">.</span><span class="nam">text</span> <span class="key">for</span> <span class="nam">t</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">iter_tokens</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2422" href="#t2422">2422</a></span><span class="t"> <span class="key">for</span> <span class="nam">token</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">iter_tokens</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2423" href="#t2423">2423</a></span><span class="t"> <span class="nam">fd</span><span class="op">.</span><span class="nam">write</span><span class="op">(</span><span class="nam">token</span><span class="op">.</span><span class="nam">text</span><span class="op">.</span><span class="nam">encode</span><span class="op">(</span><span class="str">"utf-8"</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2424" href="#t2424">2424</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2425" href="#t2425">2425</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2426" href="#t2426">2426</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2427" href="#t2427">2427</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822NoDuplicateFieldsParagraphElement</span><span class="op">(</span><span class="nam">Deb822ParagraphElement</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2428" href="#t2428">2428</a></span><span class="t"> <span class="str">"""Paragraph implementation optimized for valid deb822 files</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2429" href="#t2429">2429</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2430" href="#t2430">2430</a></span><span class="t"><span class="str"> When there are no duplicated fields, we can use simpler and faster</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2431" href="#t2431">2431</a></span><span class="t"><span class="str"> datastructures for common operations.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2432" href="#t2432">2432</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2433" href="#t2433">2433</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2434" href="#t2434">2434</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2435" href="#t2435">2435</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2436" href="#t2436">2436</a></span><span class="t"> <span class="nam">kvpair_elements</span><span class="op">,</span> <span class="com"># type: List[Deb822KeyValuePairElement]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2437" href="#t2437">2437</a></span><span class="t"> <span class="nam">kvpair_order</span><span class="op">,</span> <span class="com"># type: OrderedSet</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2438" href="#t2438">2438</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2439" href="#t2439">2439</a></span><span class="t"> <span class="com"># type: (...) -> None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2440" href="#t2440">2440</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2441" href="#t2441">2441</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_elements</span> <span class="op">=</span> <span class="op">{</span><span class="nam">kv</span><span class="op">.</span><span class="nam">field_name</span><span class="op">:</span> <span class="nam">kv</span> <span class="key">for</span> <span class="nam">kv</span> <span class="key">in</span> <span class="nam">kvpair_elements</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2442" href="#t2442">2442</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_order</span> <span class="op">=</span> <span class="nam">kvpair_order</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2443" href="#t2443">2443</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_init_parent_of_parts</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2444" href="#t2444">2444</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2445" href="#t2445">2445</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2446" href="#t2446">2446</a></span><span class="t"> <span class="key">def</span> <span class="nam">kvpair_count</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2447" href="#t2447">2447</a></span><span class="t"> <span class="com"># type: () -> int</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2448" href="#t2448">2448</a></span><span class="t"> <span class="key">return</span> <span class="nam">len</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_elements</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2449" href="#t2449">2449</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2450" href="#t2450">2450</a></span><span class="t"> <span class="key">def</span> <span class="nam">order_last</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">field</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2451" href="#t2451">2451</a></span><span class="t"> <span class="com"># type: (ParagraphKey) -> None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2452" href="#t2452">2452</a></span><span class="t"> <span class="str">"""Re-order the given field so it is "last" in the paragraph"""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2453" href="#t2453">2453</a></span><span class="t"> <span class="nam">unpacked_field</span><span class="op">,</span> <span class="nam">_</span><span class="op">,</span> <span class="nam">_</span> <span class="op">=</span> <span class="nam">_unpack_key</span><span class="op">(</span><span class="nam">field</span><span class="op">,</span> <span class="nam">raise_if_indexed</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2454" href="#t2454">2454</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_order</span><span class="op">.</span><span class="nam">order_last</span><span class="op">(</span><span class="nam">unpacked_field</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2455" href="#t2455">2455</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2456" href="#t2456">2456</a></span><span class="t"> <span class="key">def</span> <span class="nam">order_first</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">field</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2457" href="#t2457">2457</a></span><span class="t"> <span class="com"># type: (ParagraphKey) -> None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2458" href="#t2458">2458</a></span><span class="t"> <span class="str">"""Re-order the given field so it is "first" in the paragraph"""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2459" href="#t2459">2459</a></span><span class="t"> <span class="nam">unpacked_field</span><span class="op">,</span> <span class="nam">_</span><span class="op">,</span> <span class="nam">_</span> <span class="op">=</span> <span class="nam">_unpack_key</span><span class="op">(</span><span class="nam">field</span><span class="op">,</span> <span class="nam">raise_if_indexed</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2460" href="#t2460">2460</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_order</span><span class="op">.</span><span class="nam">order_first</span><span class="op">(</span><span class="nam">unpacked_field</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2461" href="#t2461">2461</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2462" href="#t2462">2462</a></span><span class="t"> <span class="key">def</span> <span class="nam">order_before</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">field</span><span class="op">,</span> <span class="nam">reference_field</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2463" href="#t2463">2463</a></span><span class="t"> <span class="com"># type: (ParagraphKey, ParagraphKey) -> None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2464" href="#t2464">2464</a></span><span class="t"> <span class="str">"""Re-order the given field so appears directly after the reference field in the paragraph</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2465" href="#t2465">2465</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2466" href="#t2466">2466</a></span><span class="t"><span class="str"> The reference field must be present."""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2467" href="#t2467">2467</a></span><span class="t"> <span class="nam">unpacked_field</span><span class="op">,</span> <span class="nam">_</span><span class="op">,</span> <span class="nam">_</span> <span class="op">=</span> <span class="nam">_unpack_key</span><span class="op">(</span><span class="nam">field</span><span class="op">,</span> <span class="nam">raise_if_indexed</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2468" href="#t2468">2468</a></span><span class="t"> <span class="nam">unpacked_ref_field</span><span class="op">,</span> <span class="nam">_</span><span class="op">,</span> <span class="nam">_</span> <span class="op">=</span> <span class="nam">_unpack_key</span><span class="op">(</span><span class="nam">reference_field</span><span class="op">,</span> <span class="nam">raise_if_indexed</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2469" href="#t2469">2469</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_order</span><span class="op">.</span><span class="nam">order_before</span><span class="op">(</span><span class="nam">unpacked_field</span><span class="op">,</span> <span class="nam">unpacked_ref_field</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2470" href="#t2470">2470</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2471" href="#t2471">2471</a></span><span class="t"> <span class="key">def</span> <span class="nam">order_after</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">field</span><span class="op">,</span> <span class="nam">reference_field</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2472" href="#t2472">2472</a></span><span class="t"> <span class="com"># type: (ParagraphKey, ParagraphKey) -> None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2473" href="#t2473">2473</a></span><span class="t"> <span class="str">"""Re-order the given field so appears directly before the reference field in the paragraph</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2474" href="#t2474">2474</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2475" href="#t2475">2475</a></span><span class="t"><span class="str"> The reference field must be present.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2476" href="#t2476">2476</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2477" href="#t2477">2477</a></span><span class="t"> <span class="nam">unpacked_field</span><span class="op">,</span> <span class="nam">_</span><span class="op">,</span> <span class="nam">_</span> <span class="op">=</span> <span class="nam">_unpack_key</span><span class="op">(</span><span class="nam">field</span><span class="op">,</span> <span class="nam">raise_if_indexed</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2478" href="#t2478">2478</a></span><span class="t"> <span class="nam">unpacked_ref_field</span><span class="op">,</span> <span class="nam">_</span><span class="op">,</span> <span class="nam">_</span> <span class="op">=</span> <span class="nam">_unpack_key</span><span class="op">(</span><span class="nam">reference_field</span><span class="op">,</span> <span class="nam">raise_if_indexed</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2479" href="#t2479">2479</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_order</span><span class="op">.</span><span class="nam">order_after</span><span class="op">(</span><span class="nam">unpacked_field</span><span class="op">,</span> <span class="nam">unpacked_ref_field</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2480" href="#t2480">2480</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2481" href="#t2481">2481</a></span><span class="t"> <span class="com"># Overload to narrow the type to just str.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2482" href="#t2482">2482</a></span><span class="t"> <span class="key">def</span> <span class="nam">__iter__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2483" href="#t2483">2483</a></span><span class="t"> <span class="com"># type: () -> Iterator[str]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2484" href="#t2484">2484</a></span><span class="t"> <span class="key">return</span> <span class="nam">iter</span><span class="op">(</span><span class="nam">str</span><span class="op">(</span><span class="nam">k</span><span class="op">)</span> <span class="key">for</span> <span class="nam">k</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_order</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2485" href="#t2485">2485</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2486" href="#t2486">2486</a></span><span class="t"> <span class="key">def</span> <span class="nam">iter_keys</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2487" href="#t2487">2487</a></span><span class="t"> <span class="com"># type: () -> Iterable[str]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2488" href="#t2488">2488</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="op">(</span><span class="nam">str</span><span class="op">(</span><span class="nam">k</span><span class="op">)</span> <span class="key">for</span> <span class="nam">k</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_order</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2489" href="#t2489">2489</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2490" href="#t2490">2490</a></span><span class="t"> <span class="key">def</span> <span class="nam">remove_kvpair_element</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">key</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2491" href="#t2491">2491</a></span><span class="t"> <span class="com"># type: (ParagraphKey) -> None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2492" href="#t2492">2492</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_full_size_cache</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2493" href="#t2493">2493</a></span><span class="t"> <span class="nam">key</span><span class="op">,</span> <span class="nam">_</span><span class="op">,</span> <span class="nam">_</span> <span class="op">=</span> <span class="nam">_unpack_key</span><span class="op">(</span><span class="nam">key</span><span class="op">,</span> <span class="nam">raise_if_indexed</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2494" href="#t2494">2494</a></span><span class="t"> <span class="key">del</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_elements</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2495" href="#t2495">2495</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_order</span><span class="op">.</span><span class="nam">remove</span><span class="op">(</span><span class="nam">key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2496" href="#t2496">2496</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2497" href="#t2497">2497</a></span><span class="t"> <span class="key">def</span> <span class="nam">contains_kvpair_element</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">item</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2498" href="#t2498">2498</a></span><span class="t"> <span class="com"># type: (object) -> bool</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2499" href="#t2499">2499</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">item</span><span class="op">,</span> <span class="op">(</span><span class="nam">str</span><span class="op">,</span> <span class="nam">tuple</span><span class="op">,</span> <span class="nam">Deb822FieldNameToken</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2499 ↛ 2500</span><span class="annotate long">line 2499 didn't jump to line 2500, because the condition on line 2499 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t2500" href="#t2500">2500</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2501" href="#t2501">2501</a></span><span class="t"> <span class="nam">item</span> <span class="op">=</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"ParagraphKey"</span><span class="op">,</span> <span class="nam">item</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2502" href="#t2502">2502</a></span><span class="t"> <span class="nam">key</span><span class="op">,</span> <span class="nam">_</span><span class="op">,</span> <span class="nam">_</span> <span class="op">=</span> <span class="nam">_unpack_key</span><span class="op">(</span><span class="nam">item</span><span class="op">,</span> <span class="nam">raise_if_indexed</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2503" href="#t2503">2503</a></span><span class="t"> <span class="key">return</span> <span class="nam">key</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_elements</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2504" href="#t2504">2504</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2505" href="#t2505">2505</a></span><span class="t"> <span class="key">def</span> <span class="nam">get_kvpair_element</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2506" href="#t2506">2506</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2507" href="#t2507">2507</a></span><span class="t"> <span class="nam">item</span><span class="op">,</span> <span class="com"># type: ParagraphKey</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2508" href="#t2508">2508</a></span><span class="t"> <span class="nam">use_get</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> <span class="com"># type: bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2509" href="#t2509">2509</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2510" href="#t2510">2510</a></span><span class="t"> <span class="com"># type: (...) -> Optional[Deb822KeyValuePairElement]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2511" href="#t2511">2511</a></span><span class="t"> <span class="nam">item</span><span class="op">,</span> <span class="nam">_</span><span class="op">,</span> <span class="nam">_</span> <span class="op">=</span> <span class="nam">_unpack_key</span><span class="op">(</span><span class="nam">item</span><span class="op">,</span> <span class="nam">raise_if_indexed</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2512" href="#t2512">2512</a></span><span class="t"> <span class="key">if</span> <span class="nam">use_get</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2513" href="#t2513">2513</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_elements</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">item</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2514" href="#t2514">2514</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_elements</span><span class="op">[</span><span class="nam">item</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2515" href="#t2515">2515</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2516" href="#t2516">2516</a></span><span class="t"> <span class="key">def</span> <span class="nam">set_kvpair_element</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">key</span><span class="op">,</span> <span class="nam">value</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2517" href="#t2517">2517</a></span><span class="t"> <span class="com"># type: (ParagraphKey, Deb822KeyValuePairElement) -> None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2518" href="#t2518">2518</a></span><span class="t"> <span class="nam">key</span><span class="op">,</span> <span class="nam">_</span><span class="op">,</span> <span class="nam">_</span> <span class="op">=</span> <span class="nam">_unpack_key</span><span class="op">(</span><span class="nam">key</span><span class="op">,</span> <span class="nam">raise_if_indexed</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2519" href="#t2519">2519</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">key</span><span class="op">,</span> <span class="nam">Deb822FieldNameToken</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2519 ↛ 2520</span><span class="annotate long">line 2519 didn't jump to line 2520, because the condition on line 2519 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t2520" href="#t2520">2520</a></span><span class="t"> <span class="key">if</span> <span class="nam">key</span> <span class="key">is</span> <span class="key">not</span> <span class="nam">value</span><span class="op">.</span><span class="nam">field_token</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2521" href="#t2521">2521</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2522" href="#t2522">2522</a></span><span class="t"> <span class="str">"Key is a Deb822FieldNameToken, but not *the* Deb822FieldNameToken"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2523" href="#t2523">2523</a></span><span class="t"> <span class="str">" for the value"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2524" href="#t2524">2524</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2525" href="#t2525">2525</a></span><span class="t"> <span class="nam">key</span> <span class="op">=</span> <span class="nam">value</span><span class="op">.</span><span class="nam">field_name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2526" href="#t2526">2526</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t2527" href="#t2527">2527</a></span><span class="t"> <span class="key">if</span> <span class="nam">key</span> <span class="op">!=</span> <span class="nam">value</span><span class="op">.</span><span class="nam">field_name</span><span class="op">:</span> </span><span class="r"><span class="annotate short">2527 ↛ 2528</span><span class="annotate long">line 2527 didn't jump to line 2528, because the condition on line 2527 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t2528" href="#t2528">2528</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2529" href="#t2529">2529</a></span><span class="t"> <span class="str">"Cannot insert value under a different field value than field name"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2530" href="#t2530">2530</a></span><span class="t"> <span class="str">" from its Deb822FieldNameToken implies"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2531" href="#t2531">2531</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2532" href="#t2532">2532</a></span><span class="t"> <span class="com"># Use the string from the Deb822FieldNameToken as we need to keep that in memory either</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2533" href="#t2533">2533</a></span><span class="t"> <span class="com"># way</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2534" href="#t2534">2534</a></span><span class="t"> <span class="nam">key</span> <span class="op">=</span> <span class="nam">value</span><span class="op">.</span><span class="nam">field_name</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2535" href="#t2535">2535</a></span><span class="t"> <span class="nam">original_value</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_elements</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2536" href="#t2536">2536</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_full_size_cache</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2537" href="#t2537">2537</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_elements</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> <span class="op">=</span> <span class="nam">value</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2538" href="#t2538">2538</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_order</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2539" href="#t2539">2539</a></span><span class="t"> <span class="key">if</span> <span class="nam">original_value</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2540" href="#t2540">2540</a></span><span class="t"> <span class="nam">original_value</span><span class="op">.</span><span class="nam">parent_element</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2541" href="#t2541">2541</a></span><span class="t"> <span class="nam">value</span><span class="op">.</span><span class="nam">parent_element</span> <span class="op">=</span> <span class="nam">self</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2542" href="#t2542">2542</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2543" href="#t2543">2543</a></span><span class="t"> <span class="key">def</span> <span class="nam">sort_fields</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">key</span><span class="op">=</span><span class="key">None</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2544" href="#t2544">2544</a></span><span class="t"> <span class="com"># type: (Optional[Callable[[str], Any]]) -> None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2545" href="#t2545">2545</a></span><span class="t"> <span class="str">"""Re-order all fields</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2546" href="#t2546">2546</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2547" href="#t2547">2547</a></span><span class="t"><span class="str"> :param key: Provide a key function (same semantics as for sorted). Keep in mind that</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2548" href="#t2548">2548</a></span><span class="t"><span class="str"> the module preserve the cases for field names - in generally, callers are recommended</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2549" href="#t2549">2549</a></span><span class="t"><span class="str"> to use "lower()" to normalize the case.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2550" href="#t2550">2550</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2551" href="#t2551">2551</a></span><span class="t"> <span class="key">for</span> <span class="nam">last_field_name</span> <span class="key">in</span> <span class="nam">reversed</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_order</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2552" href="#t2552">2552</a></span><span class="t"> <span class="nam">last_kvpair</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_elements</span><span class="op">[</span><span class="nam">cast</span><span class="op">(</span><span class="str">"_strI"</span><span class="op">,</span> <span class="nam">last_field_name</span><span class="op">)</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2553" href="#t2553">2553</a></span><span class="t"> <span class="key">if</span> <span class="nam">last_kvpair</span><span class="op">.</span><span class="nam">value_element</span><span class="op">.</span><span class="nam">add_final_newline_if_missing</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2554" href="#t2554">2554</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_full_size_cache</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2555" href="#t2555">2555</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2556" href="#t2556">2556</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2557" href="#t2557">2557</a></span><span class="t"> <span class="key">if</span> <span class="nam">key</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2558" href="#t2558">2558</a></span><span class="t"> <span class="nam">key</span> <span class="op">=</span> <span class="nam">default_field_sort_key</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2559" href="#t2559">2559</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2560" href="#t2560">2560</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_order</span> <span class="op">=</span> <span class="nam">OrderedSet</span><span class="op">(</span><span class="nam">sorted</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_order</span><span class="op">,</span> <span class="nam">key</span><span class="op">=</span><span class="nam">key</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2561" href="#t2561">2561</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2562" href="#t2562">2562</a></span><span class="t"> <span class="key">def</span> <span class="nam">iter_parts</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2563" href="#t2563">2563</a></span><span class="t"> <span class="com"># type: () -> Iterable[TokenOrElement]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2564" href="#t2564">2564</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2565" href="#t2565">2565</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_elements</span><span class="op">[</span><span class="nam">x</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2566" href="#t2566">2566</a></span><span class="t"> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"Iterable[_strI]"</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_order</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2567" href="#t2567">2567</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2568" href="#t2568">2568</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2569" href="#t2569">2569</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2570" href="#t2570">2570</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822DuplicateFieldsParagraphElement</span><span class="op">(</span><span class="nam">Deb822ParagraphElement</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2571" href="#t2571">2571</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2572" href="#t2572">2572</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">kvpair_elements</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2573" href="#t2573">2573</a></span><span class="t"> <span class="com"># type: (List[Deb822KeyValuePairElement]) -> None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2574" href="#t2574">2574</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2575" href="#t2575">2575</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_order</span> <span class="op">=</span> <span class="nam">LinkedList</span><span class="op">(</span><span class="op">)</span> <span class="com"># type: LinkedList[Deb822KeyValuePairElement]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2576" href="#t2576">2576</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_elements</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> <span class="com"># type: Dict[_strI, List[KVPNode]]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2577" href="#t2577">2577</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_init_kvpair_fields</span><span class="op">(</span><span class="nam">kvpair_elements</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2578" href="#t2578">2578</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_init_parent_of_parts</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2579" href="#t2579">2579</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2580" href="#t2580">2580</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2581" href="#t2581">2581</a></span><span class="t"> <span class="key">def</span> <span class="nam">has_duplicate_fields</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2582" href="#t2582">2582</a></span><span class="t"> <span class="com"># type: () -> bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2583" href="#t2583">2583</a></span><span class="t"> <span class="com"># Most likely, the answer is "True" but if the caller "fixes" the problem</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2584" href="#t2584">2584</a></span><span class="t"> <span class="com"># then this can return "False"</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2585" href="#t2585">2585</a></span><span class="t"> <span class="key">return</span> <span class="nam">len</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_order</span><span class="op">)</span> <span class="op">></span> <span class="nam">len</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_elements</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2586" href="#t2586">2586</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2587" href="#t2587">2587</a></span><span class="t"> <span class="key">def</span> <span class="nam">_init_kvpair_fields</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">kvpairs</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2588" href="#t2588">2588</a></span><span class="t"> <span class="com"># type: (Iterable[Deb822KeyValuePairElement]) -> None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2589" href="#t2589">2589</a></span><span class="t"> <span class="key">assert</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_order</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2590" href="#t2590">2590</a></span><span class="t"> <span class="key">assert</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_elements</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2591" href="#t2591">2591</a></span><span class="t"> <span class="key">for</span> <span class="nam">kv</span> <span class="key">in</span> <span class="nam">kvpairs</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2592" href="#t2592">2592</a></span><span class="t"> <span class="nam">field_name</span> <span class="op">=</span> <span class="nam">kv</span><span class="op">.</span><span class="nam">field_name</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2593" href="#t2593">2593</a></span><span class="t"> <span class="nam">node</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_order</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">kv</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2594" href="#t2594">2594</a></span><span class="t"> <span class="key">if</span> <span class="nam">field_name</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_elements</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2595" href="#t2595">2595</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_elements</span><span class="op">[</span><span class="nam">field_name</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span><span class="nam">node</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2596" href="#t2596">2596</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2597" href="#t2597">2597</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_elements</span><span class="op">[</span><span class="nam">field_name</span><span class="op">]</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">node</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2598" href="#t2598">2598</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2599" href="#t2599">2599</a></span><span class="t"> <span class="key">def</span> <span class="nam">_nodes_being_relocated</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">field</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2600" href="#t2600">2600</a></span><span class="t"> <span class="com"># type: (ParagraphKey) -> Tuple[List[KVPNode], List[KVPNode]]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2601" href="#t2601">2601</a></span><span class="t"> <span class="nam">key</span><span class="op">,</span> <span class="nam">index</span><span class="op">,</span> <span class="nam">name_token</span> <span class="op">=</span> <span class="nam">_unpack_key</span><span class="op">(</span><span class="nam">field</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2602" href="#t2602">2602</a></span><span class="t"> <span class="nam">nodes</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_elements</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2603" href="#t2603">2603</a></span><span class="t"> <span class="nam">nodes_being_relocated</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2604" href="#t2604">2604</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2605" href="#t2605">2605</a></span><span class="t"> <span class="key">if</span> <span class="nam">name_token</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">index</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2606" href="#t2606">2606</a></span><span class="t"> <span class="nam">single_node</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_resolve_to_single_node</span><span class="op">(</span><span class="nam">nodes</span><span class="op">,</span> <span class="nam">key</span><span class="op">,</span> <span class="nam">index</span><span class="op">,</span> <span class="nam">name_token</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2607" href="#t2607">2607</a></span><span class="t"> <span class="key">assert</span> <span class="nam">single_node</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2608" href="#t2608">2608</a></span><span class="t"> <span class="nam">nodes_being_relocated</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">single_node</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2609" href="#t2609">2609</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2610" href="#t2610">2610</a></span><span class="t"> <span class="nam">nodes_being_relocated</span> <span class="op">=</span> <span class="nam">nodes</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2611" href="#t2611">2611</a></span><span class="t"> <span class="key">return</span> <span class="nam">nodes</span><span class="op">,</span> <span class="nam">nodes_being_relocated</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2612" href="#t2612">2612</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2613" href="#t2613">2613</a></span><span class="t"> <span class="key">def</span> <span class="nam">order_last</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">field</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2614" href="#t2614">2614</a></span><span class="t"> <span class="com"># type: (ParagraphKey) -> None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2615" href="#t2615">2615</a></span><span class="t"> <span class="str">"""Re-order the given field so it is "last" in the paragraph"""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2616" href="#t2616">2616</a></span><span class="t"> <span class="nam">nodes</span><span class="op">,</span> <span class="nam">nodes_being_relocated</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_nodes_being_relocated</span><span class="op">(</span><span class="nam">field</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2617" href="#t2617">2617</a></span><span class="t"> <span class="key">assert</span> <span class="nam">len</span><span class="op">(</span><span class="nam">nodes_being_relocated</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span> <span class="key">or</span> <span class="nam">len</span><span class="op">(</span><span class="nam">nodes</span><span class="op">)</span> <span class="op">==</span> <span class="nam">len</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2618" href="#t2618">2618</a></span><span class="t"> <span class="nam">nodes_being_relocated</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2619" href="#t2619">2619</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2620" href="#t2620">2620</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2621" href="#t2621">2621</a></span><span class="t"> <span class="nam">kvpair_order</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_order</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2622" href="#t2622">2622</a></span><span class="t"> <span class="key">for</span> <span class="nam">node</span> <span class="key">in</span> <span class="nam">nodes_being_relocated</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2623" href="#t2623">2623</a></span><span class="t"> <span class="key">if</span> <span class="nam">kvpair_order</span><span class="op">.</span><span class="nam">tail_node</span> <span class="key">is</span> <span class="nam">node</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2624" href="#t2624">2624</a></span><span class="t"> <span class="com"># Special case for relocating a single node that happens to be the last.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2625" href="#t2625">2625</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2626" href="#t2626">2626</a></span><span class="t"> <span class="nam">kvpair_order</span><span class="op">.</span><span class="nam">remove_node</span><span class="op">(</span><span class="nam">node</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2627" href="#t2627">2627</a></span><span class="t"> <span class="com"># assertion for mypy</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2628" href="#t2628">2628</a></span><span class="t"> <span class="key">assert</span> <span class="nam">kvpair_order</span><span class="op">.</span><span class="nam">tail_node</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2629" href="#t2629">2629</a></span><span class="t"> <span class="nam">kvpair_order</span><span class="op">.</span><span class="nam">insert_node_after</span><span class="op">(</span><span class="nam">node</span><span class="op">,</span> <span class="nam">kvpair_order</span><span class="op">.</span><span class="nam">tail_node</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2630" href="#t2630">2630</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2631" href="#t2631">2631</a></span><span class="t"> <span class="key">if</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2632" href="#t2632">2632</a></span><span class="t"> <span class="nam">len</span><span class="op">(</span><span class="nam">nodes_being_relocated</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2633" href="#t2633">2633</a></span><span class="t"> <span class="key">and</span> <span class="nam">nodes_being_relocated</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="key">is</span> <span class="key">not</span> <span class="nam">nodes</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2634" href="#t2634">2634</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2635" href="#t2635">2635</a></span><span class="t"> <span class="nam">single_node</span> <span class="op">=</span> <span class="nam">nodes_being_relocated</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2636" href="#t2636">2636</a></span><span class="t"> <span class="nam">nodes</span><span class="op">.</span><span class="nam">remove</span><span class="op">(</span><span class="nam">single_node</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2637" href="#t2637">2637</a></span><span class="t"> <span class="nam">nodes</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">single_node</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2638" href="#t2638">2638</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2639" href="#t2639">2639</a></span><span class="t"> <span class="key">def</span> <span class="nam">order_first</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">field</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2640" href="#t2640">2640</a></span><span class="t"> <span class="com"># type: (ParagraphKey) -> None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2641" href="#t2641">2641</a></span><span class="t"> <span class="str">"""Re-order the given field so it is "first" in the paragraph"""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2642" href="#t2642">2642</a></span><span class="t"> <span class="nam">nodes</span><span class="op">,</span> <span class="nam">nodes_being_relocated</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_nodes_being_relocated</span><span class="op">(</span><span class="nam">field</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2643" href="#t2643">2643</a></span><span class="t"> <span class="key">assert</span> <span class="nam">len</span><span class="op">(</span><span class="nam">nodes_being_relocated</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span> <span class="key">or</span> <span class="nam">len</span><span class="op">(</span><span class="nam">nodes</span><span class="op">)</span> <span class="op">==</span> <span class="nam">len</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2644" href="#t2644">2644</a></span><span class="t"> <span class="nam">nodes_being_relocated</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2645" href="#t2645">2645</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2646" href="#t2646">2646</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2647" href="#t2647">2647</a></span><span class="t"> <span class="nam">kvpair_order</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_order</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2648" href="#t2648">2648</a></span><span class="t"> <span class="key">for</span> <span class="nam">node</span> <span class="key">in</span> <span class="nam">nodes_being_relocated</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2649" href="#t2649">2649</a></span><span class="t"> <span class="key">if</span> <span class="nam">kvpair_order</span><span class="op">.</span><span class="nam">head_node</span> <span class="key">is</span> <span class="nam">node</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2650" href="#t2650">2650</a></span><span class="t"> <span class="com"># Special case for relocating a single node that happens to be the first.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2651" href="#t2651">2651</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2652" href="#t2652">2652</a></span><span class="t"> <span class="nam">kvpair_order</span><span class="op">.</span><span class="nam">remove_node</span><span class="op">(</span><span class="nam">node</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2653" href="#t2653">2653</a></span><span class="t"> <span class="com"># assertion for mypy</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2654" href="#t2654">2654</a></span><span class="t"> <span class="key">assert</span> <span class="nam">kvpair_order</span><span class="op">.</span><span class="nam">head_node</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2655" href="#t2655">2655</a></span><span class="t"> <span class="nam">kvpair_order</span><span class="op">.</span><span class="nam">insert_node_before</span><span class="op">(</span><span class="nam">node</span><span class="op">,</span> <span class="nam">kvpair_order</span><span class="op">.</span><span class="nam">head_node</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2656" href="#t2656">2656</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2657" href="#t2657">2657</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">nodes_being_relocated</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span> <span class="key">and</span> <span class="nam">nodes_being_relocated</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="key">is</span> <span class="key">not</span> <span class="nam">nodes</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2658" href="#t2658">2658</a></span><span class="t"> <span class="nam">single_node</span> <span class="op">=</span> <span class="nam">nodes_being_relocated</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2659" href="#t2659">2659</a></span><span class="t"> <span class="nam">nodes</span><span class="op">.</span><span class="nam">remove</span><span class="op">(</span><span class="nam">single_node</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2660" href="#t2660">2660</a></span><span class="t"> <span class="nam">nodes</span><span class="op">.</span><span class="nam">insert</span><span class="op">(</span><span class="num">0</span><span class="op">,</span> <span class="nam">single_node</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2661" href="#t2661">2661</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2662" href="#t2662">2662</a></span><span class="t"> <span class="key">def</span> <span class="nam">order_before</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">field</span><span class="op">,</span> <span class="nam">reference_field</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2663" href="#t2663">2663</a></span><span class="t"> <span class="com"># type: (ParagraphKey, ParagraphKey) -> None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2664" href="#t2664">2664</a></span><span class="t"> <span class="str">"""Re-order the given field so appears directly after the reference field in the paragraph</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2665" href="#t2665">2665</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2666" href="#t2666">2666</a></span><span class="t"><span class="str"> The reference field must be present."""</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2667" href="#t2667">2667</a></span><span class="t"> <span class="nam">nodes</span><span class="op">,</span> <span class="nam">nodes_being_relocated</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_nodes_being_relocated</span><span class="op">(</span><span class="nam">field</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2668" href="#t2668">2668</a></span><span class="t"> <span class="key">assert</span> <span class="nam">len</span><span class="op">(</span><span class="nam">nodes_being_relocated</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span> <span class="key">or</span> <span class="nam">len</span><span class="op">(</span><span class="nam">nodes</span><span class="op">)</span> <span class="op">==</span> <span class="nam">len</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2669" href="#t2669">2669</a></span><span class="t"> <span class="nam">nodes_being_relocated</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2670" href="#t2670">2670</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2671" href="#t2671">2671</a></span><span class="t"> <span class="com"># For "before" we always use the "first" variant as reference in case of doubt</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2672" href="#t2672">2672</a></span><span class="t"> <span class="nam">_</span><span class="op">,</span> <span class="nam">reference_nodes</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_nodes_being_relocated</span><span class="op">(</span><span class="nam">reference_field</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2673" href="#t2673">2673</a></span><span class="t"> <span class="nam">reference_node</span> <span class="op">=</span> <span class="nam">reference_nodes</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2674" href="#t2674">2674</a></span><span class="t"> <span class="key">if</span> <span class="nam">reference_node</span> <span class="key">in</span> <span class="nam">nodes_being_relocated</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2675" href="#t2675">2675</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"Cannot re-order a field relative to itself"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2676" href="#t2676">2676</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2677" href="#t2677">2677</a></span><span class="t"> <span class="nam">kvpair_order</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_order</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2678" href="#t2678">2678</a></span><span class="t"> <span class="key">for</span> <span class="nam">node</span> <span class="key">in</span> <span class="nam">nodes_being_relocated</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2679" href="#t2679">2679</a></span><span class="t"> <span class="nam">kvpair_order</span><span class="op">.</span><span class="nam">remove_node</span><span class="op">(</span><span class="nam">node</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2680" href="#t2680">2680</a></span><span class="t"> <span class="nam">kvpair_order</span><span class="op">.</span><span class="nam">insert_node_before</span><span class="op">(</span><span class="nam">node</span><span class="op">,</span> <span class="nam">reference_node</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2681" href="#t2681">2681</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2682" href="#t2682">2682</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">nodes_being_relocated</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span> <span class="key">and</span> <span class="nam">len</span><span class="op">(</span><span class="nam">nodes</span><span class="op">)</span> <span class="op">></span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2683" href="#t2683">2683</a></span><span class="t"> <span class="com"># Regenerate the (new) relative field order.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2684" href="#t2684">2684</a></span><span class="t"> <span class="nam">field_name</span> <span class="op">=</span> <span class="nam">nodes_being_relocated</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">.</span><span class="nam">value</span><span class="op">.</span><span class="nam">field_name</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2685" href="#t2685">2685</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_regenerate_relative_kvapir_order</span><span class="op">(</span><span class="nam">field_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2686" href="#t2686">2686</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2687" href="#t2687">2687</a></span><span class="t"> <span class="key">def</span> <span class="nam">order_after</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">field</span><span class="op">,</span> <span class="nam">reference_field</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2688" href="#t2688">2688</a></span><span class="t"> <span class="com"># type: (ParagraphKey, ParagraphKey) -> None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2689" href="#t2689">2689</a></span><span class="t"> <span class="str">"""Re-order the given field so appears directly before the reference field in the paragraph</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2690" href="#t2690">2690</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2691" href="#t2691">2691</a></span><span class="t"><span class="str"> The reference field must be present.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2692" href="#t2692">2692</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2693" href="#t2693">2693</a></span><span class="t"> <span class="nam">nodes</span><span class="op">,</span> <span class="nam">nodes_being_relocated</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_nodes_being_relocated</span><span class="op">(</span><span class="nam">field</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2694" href="#t2694">2694</a></span><span class="t"> <span class="key">assert</span> <span class="nam">len</span><span class="op">(</span><span class="nam">nodes_being_relocated</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span> <span class="key">or</span> <span class="nam">len</span><span class="op">(</span><span class="nam">nodes</span><span class="op">)</span> <span class="op">==</span> <span class="nam">len</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2695" href="#t2695">2695</a></span><span class="t"> <span class="nam">nodes_being_relocated</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2696" href="#t2696">2696</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2697" href="#t2697">2697</a></span><span class="t"> <span class="nam">_</span><span class="op">,</span> <span class="nam">reference_nodes</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_nodes_being_relocated</span><span class="op">(</span><span class="nam">reference_field</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2698" href="#t2698">2698</a></span><span class="t"> <span class="com"># For "after" we always use the "last" variant as reference in case of doubt</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2699" href="#t2699">2699</a></span><span class="t"> <span class="nam">reference_node</span> <span class="op">=</span> <span class="nam">reference_nodes</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2700" href="#t2700">2700</a></span><span class="t"> <span class="key">if</span> <span class="nam">reference_node</span> <span class="key">in</span> <span class="nam">nodes_being_relocated</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2701" href="#t2701">2701</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"Cannot re-order a field relative to itself"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2702" href="#t2702">2702</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2703" href="#t2703">2703</a></span><span class="t"> <span class="nam">kvpair_order</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_order</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2704" href="#t2704">2704</a></span><span class="t"> <span class="com"># Use "reversed" to preserve the relative order of the nodes assuming a bulk reorder</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2705" href="#t2705">2705</a></span><span class="t"> <span class="key">for</span> <span class="nam">node</span> <span class="key">in</span> <span class="nam">reversed</span><span class="op">(</span><span class="nam">nodes_being_relocated</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2706" href="#t2706">2706</a></span><span class="t"> <span class="nam">kvpair_order</span><span class="op">.</span><span class="nam">remove_node</span><span class="op">(</span><span class="nam">node</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2707" href="#t2707">2707</a></span><span class="t"> <span class="nam">kvpair_order</span><span class="op">.</span><span class="nam">insert_node_after</span><span class="op">(</span><span class="nam">node</span><span class="op">,</span> <span class="nam">reference_node</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2708" href="#t2708">2708</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2709" href="#t2709">2709</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">nodes_being_relocated</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span> <span class="key">and</span> <span class="nam">len</span><span class="op">(</span><span class="nam">nodes</span><span class="op">)</span> <span class="op">></span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2710" href="#t2710">2710</a></span><span class="t"> <span class="com"># Regenerate the (new) relative field order.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2711" href="#t2711">2711</a></span><span class="t"> <span class="nam">field_name</span> <span class="op">=</span> <span class="nam">nodes_being_relocated</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">.</span><span class="nam">value</span><span class="op">.</span><span class="nam">field_name</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2712" href="#t2712">2712</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_regenerate_relative_kvapir_order</span><span class="op">(</span><span class="nam">field_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2713" href="#t2713">2713</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2714" href="#t2714">2714</a></span><span class="t"> <span class="key">def</span> <span class="nam">_regenerate_relative_kvapir_order</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">field_name</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2715" href="#t2715">2715</a></span><span class="t"> <span class="com"># type: (_strI) -> None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2716" href="#t2716">2716</a></span><span class="t"> <span class="nam">nodes</span> <span class="op">=</span> <span class="op">[</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2717" href="#t2717">2717</a></span><span class="t"> <span class="key">for</span> <span class="nam">node</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_order</span><span class="op">.</span><span class="nam">iter_nodes</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2718" href="#t2718">2718</a></span><span class="t"> <span class="key">if</span> <span class="nam">node</span><span class="op">.</span><span class="nam">value</span><span class="op">.</span><span class="nam">field_name</span> <span class="op">==</span> <span class="nam">field_name</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2719" href="#t2719">2719</a></span><span class="t"> <span class="nam">nodes</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">node</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2720" href="#t2720">2720</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_elements</span><span class="op">[</span><span class="nam">field_name</span><span class="op">]</span> <span class="op">=</span> <span class="nam">nodes</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2721" href="#t2721">2721</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2722" href="#t2722">2722</a></span><span class="t"> <span class="key">def</span> <span class="nam">iter_parts</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2723" href="#t2723">2723</a></span><span class="t"> <span class="com"># type: () -> Iterable[TokenOrElement]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2724" href="#t2724">2724</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_order</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2725" href="#t2725">2725</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2726" href="#t2726">2726</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2727" href="#t2727">2727</a></span><span class="t"> <span class="key">def</span> <span class="nam">kvpair_count</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2728" href="#t2728">2728</a></span><span class="t"> <span class="com"># type: () -> int</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2729" href="#t2729">2729</a></span><span class="t"> <span class="key">return</span> <span class="nam">len</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_order</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2730" href="#t2730">2730</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2731" href="#t2731">2731</a></span><span class="t"> <span class="key">def</span> <span class="nam">iter_keys</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2732" href="#t2732">2732</a></span><span class="t"> <span class="com"># type: () -> Iterable[ParagraphKey]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2733" href="#t2733">2733</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="op">(</span><span class="nam">kv</span><span class="op">.</span><span class="nam">field_name</span> <span class="key">for</span> <span class="nam">kv</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_order</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2734" href="#t2734">2734</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2735" href="#t2735">2735</a></span><span class="t"> <span class="key">def</span> <span class="nam">_resolve_to_single_node</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2736" href="#t2736">2736</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2737" href="#t2737">2737</a></span><span class="t"> <span class="nam">nodes</span><span class="op">,</span> <span class="com"># type: List[KVPNode]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2738" href="#t2738">2738</a></span><span class="t"> <span class="nam">key</span><span class="op">,</span> <span class="com"># type: str</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2739" href="#t2739">2739</a></span><span class="t"> <span class="nam">index</span><span class="op">,</span> <span class="com"># type: Optional[int]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2740" href="#t2740">2740</a></span><span class="t"> <span class="nam">name_token</span><span class="op">,</span> <span class="com"># type: Optional[Deb822FieldNameToken]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2741" href="#t2741">2741</a></span><span class="t"> <span class="nam">use_get</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> <span class="com"># type: bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2742" href="#t2742">2742</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2743" href="#t2743">2743</a></span><span class="t"> <span class="com"># type: (...) -> Optional[KVPNode]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2744" href="#t2744">2744</a></span><span class="t"> <span class="key">if</span> <span class="nam">index</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2745" href="#t2745">2745</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">nodes</span><span class="op">)</span> <span class="op">!=</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2746" href="#t2746">2746</a></span><span class="t"> <span class="key">if</span> <span class="nam">name_token</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2747" href="#t2747">2747</a></span><span class="t"> <span class="nam">node</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_find_node_via_name_token</span><span class="op">(</span><span class="nam">name_token</span><span class="op">,</span> <span class="nam">nodes</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2748" href="#t2748">2748</a></span><span class="t"> <span class="key">if</span> <span class="nam">node</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2749" href="#t2749">2749</a></span><span class="t"> <span class="key">return</span> <span class="nam">node</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2750" href="#t2750">2750</a></span><span class="t"> <span class="nam">msg</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2751" href="#t2751">2751</a></span><span class="t"> <span class="str">"Ambiguous key {key} - the field appears {res_len} times. Use"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2752" href="#t2752">2752</a></span><span class="t"> <span class="str">" ({key}, index) to denote which instance of the field you want. (Index"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2753" href="#t2753">2753</a></span><span class="t"> <span class="str">" can be 0..{res_len_1} or e.g. -1 to denote the last field)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2754" href="#t2754">2754</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2755" href="#t2755">2755</a></span><span class="t"> <span class="key">raise</span> <span class="nam">AmbiguousDeb822FieldKeyError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2756" href="#t2756">2756</a></span><span class="t"> <span class="nam">msg</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span><span class="nam">key</span><span class="op">=</span><span class="nam">key</span><span class="op">,</span> <span class="nam">res_len</span><span class="op">=</span><span class="nam">len</span><span class="op">(</span><span class="nam">nodes</span><span class="op">)</span><span class="op">,</span> <span class="nam">res_len_1</span><span class="op">=</span><span class="nam">len</span><span class="op">(</span><span class="nam">nodes</span><span class="op">)</span> <span class="op">-</span> <span class="num">1</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2757" href="#t2757">2757</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2758" href="#t2758">2758</a></span><span class="t"> <span class="nam">index</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2759" href="#t2759">2759</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2760" href="#t2760">2760</a></span><span class="t"> <span class="key">return</span> <span class="nam">nodes</span><span class="op">[</span><span class="nam">index</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2761" href="#t2761">2761</a></span><span class="t"> <span class="key">except</span> <span class="nam">IndexError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2762" href="#t2762">2762</a></span><span class="t"> <span class="key">if</span> <span class="nam">use_get</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2763" href="#t2763">2763</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2764" href="#t2764">2764</a></span><span class="t"> <span class="nam">msg</span> <span class="op">=</span> <span class="str">'Field "{key}" was present but the index "{index}" was invalid.'</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2765" href="#t2765">2765</a></span><span class="t"> <span class="key">raise</span> <span class="nam">KeyError</span><span class="op">(</span><span class="nam">msg</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span><span class="nam">key</span><span class="op">=</span><span class="nam">key</span><span class="op">,</span> <span class="nam">index</span><span class="op">=</span><span class="nam">index</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2766" href="#t2766">2766</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2767" href="#t2767">2767</a></span><span class="t"> <span class="key">def</span> <span class="nam">get_kvpair_element</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2768" href="#t2768">2768</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2769" href="#t2769">2769</a></span><span class="t"> <span class="nam">item</span><span class="op">,</span> <span class="com"># type: ParagraphKey</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2770" href="#t2770">2770</a></span><span class="t"> <span class="nam">use_get</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> <span class="com"># type: bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2771" href="#t2771">2771</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2772" href="#t2772">2772</a></span><span class="t"> <span class="com"># type: (...) -> Optional[Deb822KeyValuePairElement]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2773" href="#t2773">2773</a></span><span class="t"> <span class="nam">key</span><span class="op">,</span> <span class="nam">index</span><span class="op">,</span> <span class="nam">name_token</span> <span class="op">=</span> <span class="nam">_unpack_key</span><span class="op">(</span><span class="nam">item</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2774" href="#t2774">2774</a></span><span class="t"> <span class="key">if</span> <span class="nam">use_get</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2775" href="#t2775">2775</a></span><span class="t"> <span class="nam">nodes</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_elements</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2776" href="#t2776">2776</a></span><span class="t"> <span class="key">if</span> <span class="nam">nodes</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2777" href="#t2777">2777</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2778" href="#t2778">2778</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2779" href="#t2779">2779</a></span><span class="t"> <span class="nam">nodes</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_elements</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2780" href="#t2780">2780</a></span><span class="t"> <span class="nam">node</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_resolve_to_single_node</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2781" href="#t2781">2781</a></span><span class="t"> <span class="nam">nodes</span><span class="op">,</span> <span class="nam">key</span><span class="op">,</span> <span class="nam">index</span><span class="op">,</span> <span class="nam">name_token</span><span class="op">,</span> <span class="nam">use_get</span><span class="op">=</span><span class="nam">use_get</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2782" href="#t2782">2782</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2783" href="#t2783">2783</a></span><span class="t"> <span class="key">if</span> <span class="nam">node</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2784" href="#t2784">2784</a></span><span class="t"> <span class="key">return</span> <span class="nam">node</span><span class="op">.</span><span class="nam">value</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2785" href="#t2785">2785</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2786" href="#t2786">2786</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2787" href="#t2787">2787</a></span><span class="t"> <span class="op">@</span><span class="nam">staticmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2788" href="#t2788">2788</a></span><span class="t"> <span class="key">def</span> <span class="nam">_find_node_via_name_token</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2789" href="#t2789">2789</a></span><span class="t"> <span class="nam">name_token</span><span class="op">,</span> <span class="com"># type: Deb822FieldNameToken</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2790" href="#t2790">2790</a></span><span class="t"> <span class="nam">elements</span><span class="op">,</span> <span class="com"># type: Iterable[KVPNode]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2791" href="#t2791">2791</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2792" href="#t2792">2792</a></span><span class="t"> <span class="com"># type: (...) -> Optional[KVPNode]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2793" href="#t2793">2793</a></span><span class="t"> <span class="com"># if we are given a name token, then it is non-ambiguous if we have exactly</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2794" href="#t2794">2794</a></span><span class="t"> <span class="com"># that name token in our list of nodes. It will be an O(n) lookup but we</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2795" href="#t2795">2795</a></span><span class="t"> <span class="com"># probably do not have that many duplicate fields (and even if do, it is not</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2796" href="#t2796">2796</a></span><span class="t"> <span class="com"># exactly a valid file, so there little reason to optimize for it)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2797" href="#t2797">2797</a></span><span class="t"> <span class="key">for</span> <span class="nam">node</span> <span class="key">in</span> <span class="nam">elements</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2798" href="#t2798">2798</a></span><span class="t"> <span class="key">if</span> <span class="nam">name_token</span> <span class="key">is</span> <span class="nam">node</span><span class="op">.</span><span class="nam">value</span><span class="op">.</span><span class="nam">field_token</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2799" href="#t2799">2799</a></span><span class="t"> <span class="key">return</span> <span class="nam">node</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2800" href="#t2800">2800</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2801" href="#t2801">2801</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2802" href="#t2802">2802</a></span><span class="t"> <span class="key">def</span> <span class="nam">contains_kvpair_element</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">item</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2803" href="#t2803">2803</a></span><span class="t"> <span class="com"># type: (object) -> bool</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2804" href="#t2804">2804</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">item</span><span class="op">,</span> <span class="op">(</span><span class="nam">str</span><span class="op">,</span> <span class="nam">tuple</span><span class="op">,</span> <span class="nam">Deb822FieldNameToken</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2805" href="#t2805">2805</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2806" href="#t2806">2806</a></span><span class="t"> <span class="nam">item</span> <span class="op">=</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"ParagraphKey"</span><span class="op">,</span> <span class="nam">item</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2807" href="#t2807">2807</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2808" href="#t2808">2808</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">get_kvpair_element</span><span class="op">(</span><span class="nam">item</span><span class="op">,</span> <span class="nam">use_get</span><span class="op">=</span><span class="key">True</span><span class="op">)</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2809" href="#t2809">2809</a></span><span class="t"> <span class="key">except</span> <span class="nam">AmbiguousDeb822FieldKeyError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2810" href="#t2810">2810</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2811" href="#t2811">2811</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2812" href="#t2812">2812</a></span><span class="t"> <span class="key">def</span> <span class="nam">set_kvpair_element</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">key</span><span class="op">,</span> <span class="nam">value</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2813" href="#t2813">2813</a></span><span class="t"> <span class="com"># type: (ParagraphKey, Deb822KeyValuePairElement) -> None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2814" href="#t2814">2814</a></span><span class="t"> <span class="nam">key</span><span class="op">,</span> <span class="nam">index</span><span class="op">,</span> <span class="nam">name_token</span> <span class="op">=</span> <span class="nam">_unpack_key</span><span class="op">(</span><span class="nam">key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2815" href="#t2815">2815</a></span><span class="t"> <span class="key">if</span> <span class="nam">name_token</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2816" href="#t2816">2816</a></span><span class="t"> <span class="key">if</span> <span class="nam">name_token</span> <span class="key">is</span> <span class="key">not</span> <span class="nam">value</span><span class="op">.</span><span class="nam">field_token</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2817" href="#t2817">2817</a></span><span class="t"> <span class="nam">original_nodes</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_elements</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">value</span><span class="op">.</span><span class="nam">field_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2818" href="#t2818">2818</a></span><span class="t"> <span class="nam">original_node</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2819" href="#t2819">2819</a></span><span class="t"> <span class="key">if</span> <span class="nam">original_nodes</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2820" href="#t2820">2820</a></span><span class="t"> <span class="nam">original_node</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_find_node_via_name_token</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2821" href="#t2821">2821</a></span><span class="t"> <span class="nam">name_token</span><span class="op">,</span> <span class="nam">original_nodes</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2822" href="#t2822">2822</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2823" href="#t2823">2823</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2824" href="#t2824">2824</a></span><span class="t"> <span class="key">if</span> <span class="nam">original_node</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2825" href="#t2825">2825</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2826" href="#t2826">2826</a></span><span class="t"> <span class="str">"Key is a Deb822FieldNameToken, but not *the*"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2827" href="#t2827">2827</a></span><span class="t"> <span class="str">" Deb822FieldNameToken for the value nor the"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2828" href="#t2828">2828</a></span><span class="t"> <span class="str">" Deb822FieldNameToken for an existing field in the paragraph"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2829" href="#t2829">2829</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2830" href="#t2830">2830</a></span><span class="t"> <span class="com"># Primarily for mypy's sake</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2831" href="#t2831">2831</a></span><span class="t"> <span class="key">assert</span> <span class="nam">original_nodes</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2832" href="#t2832">2832</a></span><span class="t"> <span class="com"># Rely on the index-based code below to handle update.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2833" href="#t2833">2833</a></span><span class="t"> <span class="nam">index</span> <span class="op">=</span> <span class="nam">original_nodes</span><span class="op">.</span><span class="nam">index</span><span class="op">(</span><span class="nam">original_node</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2834" href="#t2834">2834</a></span><span class="t"> <span class="nam">key</span> <span class="op">=</span> <span class="nam">value</span><span class="op">.</span><span class="nam">field_name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2835" href="#t2835">2835</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2836" href="#t2836">2836</a></span><span class="t"> <span class="key">if</span> <span class="nam">key</span> <span class="op">!=</span> <span class="nam">value</span><span class="op">.</span><span class="nam">field_name</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2837" href="#t2837">2837</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2838" href="#t2838">2838</a></span><span class="t"> <span class="str">"Cannot insert value under a different field value than field name"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2839" href="#t2839">2839</a></span><span class="t"> <span class="str">" from its Deb822FieldNameToken implies"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2840" href="#t2840">2840</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2841" href="#t2841">2841</a></span><span class="t"> <span class="com"># Use the string from the Deb822FieldNameToken as it is a _strI and has the same value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2842" href="#t2842">2842</a></span><span class="t"> <span class="com"># (memory optimization)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2843" href="#t2843">2843</a></span><span class="t"> <span class="nam">key</span> <span class="op">=</span> <span class="nam">value</span><span class="op">.</span><span class="nam">field_name</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2844" href="#t2844">2844</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_full_size_cache</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2845" href="#t2845">2845</a></span><span class="t"> <span class="nam">original_nodes</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_elements</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2846" href="#t2846">2846</a></span><span class="t"> <span class="key">if</span> <span class="nam">original_nodes</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="key">not</span> <span class="nam">original_nodes</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2847" href="#t2847">2847</a></span><span class="t"> <span class="key">if</span> <span class="nam">index</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">index</span> <span class="op">!=</span> <span class="num">0</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2848" href="#t2848">2848</a></span><span class="t"> <span class="nam">msg</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2849" href="#t2849">2849</a></span><span class="t"> <span class="str">"Cannot replace field ({key}, {index}) as the field does not exist"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2850" href="#t2850">2850</a></span><span class="t"> <span class="str">" in the first place. Please index-less key or ({key}, 0) if you"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2851" href="#t2851">2851</a></span><span class="t"> <span class="str">" want to add the field."</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2852" href="#t2852">2852</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2853" href="#t2853">2853</a></span><span class="t"> <span class="key">raise</span> <span class="nam">KeyError</span><span class="op">(</span><span class="nam">msg</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span><span class="nam">key</span><span class="op">=</span><span class="nam">key</span><span class="op">,</span> <span class="nam">index</span><span class="op">=</span><span class="nam">index</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2854" href="#t2854">2854</a></span><span class="t"> <span class="nam">node</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_order</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">value</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2855" href="#t2855">2855</a></span><span class="t"> <span class="key">if</span> <span class="nam">key</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_elements</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2856" href="#t2856">2856</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_elements</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span><span class="nam">node</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2857" href="#t2857">2857</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2858" href="#t2858">2858</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_elements</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">node</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2859" href="#t2859">2859</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2860" href="#t2860">2860</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2861" href="#t2861">2861</a></span><span class="t"> <span class="nam">replace_all</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2862" href="#t2862">2862</a></span><span class="t"> <span class="key">if</span> <span class="nam">index</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2863" href="#t2863">2863</a></span><span class="t"> <span class="nam">replace_all</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2864" href="#t2864">2864</a></span><span class="t"> <span class="nam">node</span> <span class="op">=</span> <span class="nam">original_nodes</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2865" href="#t2865">2865</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">original_nodes</span><span class="op">)</span> <span class="op">!=</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2866" href="#t2866">2866</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_elements</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> <span class="op">=</span> <span class="op">[</span><span class="nam">node</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2867" href="#t2867">2867</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2868" href="#t2868">2868</a></span><span class="t"> <span class="com"># We insist on there being an original node, which as a side effect ensures</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2869" href="#t2869">2869</a></span><span class="t"> <span class="com"># you cannot add additional copies of the field. This means that you cannot</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2870" href="#t2870">2870</a></span><span class="t"> <span class="com"># make the problem worse.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2871" href="#t2871">2871</a></span><span class="t"> <span class="nam">node</span> <span class="op">=</span> <span class="nam">original_nodes</span><span class="op">[</span><span class="nam">index</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2872" href="#t2872">2872</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2873" href="#t2873">2873</a></span><span class="t"> <span class="com"># Replace the value of the existing node plus do a little dance</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2874" href="#t2874">2874</a></span><span class="t"> <span class="com"># for the parent element part.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2875" href="#t2875">2875</a></span><span class="t"> <span class="nam">node</span><span class="op">.</span><span class="nam">value</span><span class="op">.</span><span class="nam">parent_element</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2876" href="#t2876">2876</a></span><span class="t"> <span class="nam">value</span><span class="op">.</span><span class="nam">parent_element</span> <span class="op">=</span> <span class="nam">self</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2877" href="#t2877">2877</a></span><span class="t"> <span class="nam">node</span><span class="op">.</span><span class="nam">value</span> <span class="op">=</span> <span class="nam">value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2878" href="#t2878">2878</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2879" href="#t2879">2879</a></span><span class="t"> <span class="key">if</span> <span class="nam">replace_all</span> <span class="key">and</span> <span class="nam">len</span><span class="op">(</span><span class="nam">original_nodes</span><span class="op">)</span> <span class="op">!=</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2880" href="#t2880">2880</a></span><span class="t"> <span class="com"># If we were in a replace-all mode, discard any remaining nodes</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2881" href="#t2881">2881</a></span><span class="t"> <span class="key">for</span> <span class="nam">n</span> <span class="key">in</span> <span class="nam">original_nodes</span><span class="op">[</span><span class="num">1</span><span class="op">:</span><span class="op">]</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2882" href="#t2882">2882</a></span><span class="t"> <span class="nam">n</span><span class="op">.</span><span class="nam">value</span><span class="op">.</span><span class="nam">parent_element</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2883" href="#t2883">2883</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_order</span><span class="op">.</span><span class="nam">remove_node</span><span class="op">(</span><span class="nam">n</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2884" href="#t2884">2884</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2885" href="#t2885">2885</a></span><span class="t"> <span class="key">def</span> <span class="nam">remove_kvpair_element</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">key</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2886" href="#t2886">2886</a></span><span class="t"> <span class="com"># type: (ParagraphKey) -> None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2887" href="#t2887">2887</a></span><span class="t"> <span class="nam">key</span><span class="op">,</span> <span class="nam">idx</span><span class="op">,</span> <span class="nam">name_token</span> <span class="op">=</span> <span class="nam">_unpack_key</span><span class="op">(</span><span class="nam">key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2888" href="#t2888">2888</a></span><span class="t"> <span class="nam">field_list</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_elements</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2889" href="#t2889">2889</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2890" href="#t2890">2890</a></span><span class="t"> <span class="key">if</span> <span class="nam">name_token</span> <span class="key">is</span> <span class="key">None</span> <span class="key">and</span> <span class="nam">idx</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2891" href="#t2891">2891</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_full_size_cache</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2892" href="#t2892">2892</a></span><span class="t"> <span class="com"># Remove all case</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2893" href="#t2893">2893</a></span><span class="t"> <span class="key">for</span> <span class="nam">node</span> <span class="key">in</span> <span class="nam">field_list</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2894" href="#t2894">2894</a></span><span class="t"> <span class="nam">node</span><span class="op">.</span><span class="nam">value</span><span class="op">.</span><span class="nam">parent_element</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2895" href="#t2895">2895</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_order</span><span class="op">.</span><span class="nam">remove_node</span><span class="op">(</span><span class="nam">node</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2896" href="#t2896">2896</a></span><span class="t"> <span class="key">del</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_elements</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2897" href="#t2897">2897</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2898" href="#t2898">2898</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2899" href="#t2899">2899</a></span><span class="t"> <span class="key">if</span> <span class="nam">name_token</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2900" href="#t2900">2900</a></span><span class="t"> <span class="com"># Indirection between original_node and node for mypy's sake</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2901" href="#t2901">2901</a></span><span class="t"> <span class="nam">original_node</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_find_node_via_name_token</span><span class="op">(</span><span class="nam">name_token</span><span class="op">,</span> <span class="nam">field_list</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2902" href="#t2902">2902</a></span><span class="t"> <span class="key">if</span> <span class="nam">original_node</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2903" href="#t2903">2903</a></span><span class="t"> <span class="nam">msg</span> <span class="op">=</span> <span class="str">'The field "{key}" is present but key used to access it is not.'</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2904" href="#t2904">2904</a></span><span class="t"> <span class="key">raise</span> <span class="nam">KeyError</span><span class="op">(</span><span class="nam">msg</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span><span class="nam">key</span><span class="op">=</span><span class="nam">key</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2905" href="#t2905">2905</a></span><span class="t"> <span class="nam">node</span> <span class="op">=</span> <span class="nam">original_node</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2906" href="#t2906">2906</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2907" href="#t2907">2907</a></span><span class="t"> <span class="key">assert</span> <span class="nam">idx</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2908" href="#t2908">2908</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2909" href="#t2909">2909</a></span><span class="t"> <span class="nam">node</span> <span class="op">=</span> <span class="nam">field_list</span><span class="op">[</span><span class="nam">idx</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2910" href="#t2910">2910</a></span><span class="t"> <span class="key">except</span> <span class="nam">KeyError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2911" href="#t2911">2911</a></span><span class="t"> <span class="nam">msg</span> <span class="op">=</span> <span class="str">'The field "{key}" is present, but the index "{idx}" was invalid.'</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2912" href="#t2912">2912</a></span><span class="t"> <span class="key">raise</span> <span class="nam">KeyError</span><span class="op">(</span><span class="nam">msg</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span><span class="nam">key</span><span class="op">=</span><span class="nam">key</span><span class="op">,</span> <span class="nam">idx</span><span class="op">=</span><span class="nam">idx</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2913" href="#t2913">2913</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2914" href="#t2914">2914</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_full_size_cache</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2915" href="#t2915">2915</a></span><span class="t"> <span class="key">if</span> <span class="nam">len</span><span class="op">(</span><span class="nam">field_list</span><span class="op">)</span> <span class="op">==</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2916" href="#t2916">2916</a></span><span class="t"> <span class="key">del</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_elements</span><span class="op">[</span><span class="nam">key</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2917" href="#t2917">2917</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2918" href="#t2918">2918</a></span><span class="t"> <span class="nam">field_list</span><span class="op">.</span><span class="nam">remove</span><span class="op">(</span><span class="nam">node</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2919" href="#t2919">2919</a></span><span class="t"> <span class="nam">node</span><span class="op">.</span><span class="nam">value</span><span class="op">.</span><span class="nam">parent_element</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2920" href="#t2920">2920</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_order</span><span class="op">.</span><span class="nam">remove_node</span><span class="op">(</span><span class="nam">node</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2921" href="#t2921">2921</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2922" href="#t2922">2922</a></span><span class="t"> <span class="key">def</span> <span class="nam">sort_fields</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">key</span><span class="op">=</span><span class="key">None</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2923" href="#t2923">2923</a></span><span class="t"> <span class="com"># type: (Optional[Callable[[str], Any]]) -> None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2924" href="#t2924">2924</a></span><span class="t"> <span class="str">"""Re-order all fields</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2925" href="#t2925">2925</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2926" href="#t2926">2926</a></span><span class="t"><span class="str"> :param key: Provide a key function (same semantics as for sorted). Keep in mind that</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2927" href="#t2927">2927</a></span><span class="t"><span class="str"> the module preserve the cases for field names - in generally, callers are recommended</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2928" href="#t2928">2928</a></span><span class="t"><span class="str"> to use "lower()" to normalize the case.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2929" href="#t2929">2929</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2930" href="#t2930">2930</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2931" href="#t2931">2931</a></span><span class="t"> <span class="key">if</span> <span class="nam">key</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2932" href="#t2932">2932</a></span><span class="t"> <span class="nam">key</span> <span class="op">=</span> <span class="nam">default_field_sort_key</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2933" href="#t2933">2933</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2934" href="#t2934">2934</a></span><span class="t"> <span class="com"># Work around mypy that cannot seem to shred the Optional notion</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2935" href="#t2935">2935</a></span><span class="t"> <span class="com"># without this little indirection</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2936" href="#t2936">2936</a></span><span class="t"> <span class="nam">key_impl</span> <span class="op">=</span> <span class="nam">key</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2937" href="#t2937">2937</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2938" href="#t2938">2938</a></span><span class="t"> <span class="key">def</span> <span class="nam">_actual_key</span><span class="op">(</span><span class="nam">kvpair</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2939" href="#t2939">2939</a></span><span class="t"> <span class="com"># type: (Deb822KeyValuePairElement) -> Any</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2940" href="#t2940">2940</a></span><span class="t"> <span class="key">return</span> <span class="nam">key_impl</span><span class="op">(</span><span class="nam">kvpair</span><span class="op">.</span><span class="nam">field_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2941" href="#t2941">2941</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2942" href="#t2942">2942</a></span><span class="t"> <span class="key">for</span> <span class="nam">last_kvpair</span> <span class="key">in</span> <span class="nam">reversed</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_order</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2943" href="#t2943">2943</a></span><span class="t"> <span class="key">if</span> <span class="nam">last_kvpair</span><span class="op">.</span><span class="nam">value_element</span><span class="op">.</span><span class="nam">add_final_newline_if_missing</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2944" href="#t2944">2944</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_full_size_cache</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2945" href="#t2945">2945</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2946" href="#t2946">2946</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2947" href="#t2947">2947</a></span><span class="t"> <span class="nam">sorted_kvpair_list</span> <span class="op">=</span> <span class="nam">sorted</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_order</span><span class="op">,</span> <span class="nam">key</span><span class="op">=</span><span class="nam">_actual_key</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2948" href="#t2948">2948</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_order</span> <span class="op">=</span> <span class="nam">LinkedList</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2949" href="#t2949">2949</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_kvpair_elements</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2950" href="#t2950">2950</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_init_kvpair_fields</span><span class="op">(</span><span class="nam">sorted_kvpair_list</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2951" href="#t2951">2951</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2952" href="#t2952">2952</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2953" href="#t2953">2953</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822FileElement</span><span class="op">(</span><span class="nam">Deb822Element</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2954" href="#t2954">2954</a></span><span class="t"> <span class="str">"""Represents the entire deb822 file"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2955" href="#t2955">2955</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2956" href="#t2956">2956</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">token_and_elements</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2957" href="#t2957">2957</a></span><span class="t"> <span class="com"># type: (LinkedList[TokenOrElement]) -> None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2958" href="#t2958">2958</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2959" href="#t2959">2959</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_and_elements</span> <span class="op">=</span> <span class="nam">token_and_elements</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2960" href="#t2960">2960</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_init_parent_of_parts</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2961" href="#t2961">2961</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2962" href="#t2962">2962</a></span><span class="t"> <span class="op">@</span><span class="nam">classmethod</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2963" href="#t2963">2963</a></span><span class="t"> <span class="key">def</span> <span class="nam">new_empty_file</span><span class="op">(</span><span class="nam">cls</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2964" href="#t2964">2964</a></span><span class="t"> <span class="com"># type: () -> Deb822FileElement</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2965" href="#t2965">2965</a></span><span class="t"> <span class="str">"""Creates a new Deb822FileElement with no contents</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2966" href="#t2966">2966</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2967" href="#t2967">2967</a></span><span class="t"><span class="str"> Note that a deb822 file must be non-empty to be considered valid</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2968" href="#t2968">2968</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2969" href="#t2969">2969</a></span><span class="t"> <span class="key">return</span> <span class="nam">cls</span><span class="op">(</span><span class="nam">LinkedList</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2970" href="#t2970">2970</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2971" href="#t2971">2971</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2972" href="#t2972">2972</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_valid_file</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2973" href="#t2973">2973</a></span><span class="t"> <span class="com"># type: () -> bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2974" href="#t2974">2974</a></span><span class="t"> <span class="str">"""Returns true if the file is valid</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2975" href="#t2975">2975</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2976" href="#t2976">2976</a></span><span class="t"><span class="str"> Invalid elements include error elements (Deb822ErrorElement) but also</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2977" href="#t2977">2977</a></span><span class="t"><span class="str"> issues such as paragraphs with duplicate fields or "empty" files</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2978" href="#t2978">2978</a></span><span class="t"><span class="str"> (a valid deb822 file contains at least one paragraph).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2979" href="#t2979">2979</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2980" href="#t2980">2980</a></span><span class="t"> <span class="nam">had_paragraph</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2981" href="#t2981">2981</a></span><span class="t"> <span class="key">for</span> <span class="nam">paragraph</span> <span class="key">in</span> <span class="nam">self</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2982" href="#t2982">2982</a></span><span class="t"> <span class="nam">had_paragraph</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2983" href="#t2983">2983</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">paragraph</span> <span class="key">or</span> <span class="nam">paragraph</span><span class="op">.</span><span class="nam">has_duplicate_fields</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2984" href="#t2984">2984</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2985" href="#t2985">2985</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2986" href="#t2986">2986</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">had_paragraph</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2987" href="#t2987">2987</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2988" href="#t2988">2988</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2989" href="#t2989">2989</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">find_first_error_element</span><span class="op">(</span><span class="op">)</span> <span class="key">is</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2990" href="#t2990">2990</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2991" href="#t2991">2991</a></span><span class="t"> <span class="key">def</span> <span class="nam">find_first_error_element</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2992" href="#t2992">2992</a></span><span class="t"> <span class="com"># type: () -> Optional[Deb822ErrorElement]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2993" href="#t2993">2993</a></span><span class="t"> <span class="str">"""Returns the first Deb822ErrorElement (or None) in the file"""</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2994" href="#t2994">2994</a></span><span class="t"> <span class="key">return</span> <span class="nam">next</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2995" href="#t2995">2995</a></span><span class="t"> <span class="nam">iter</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">iter_recurse</span><span class="op">(</span><span class="nam">only_element_or_token_type</span><span class="op">=</span><span class="nam">Deb822ErrorElement</span><span class="op">)</span><span class="op">)</span><span class="op">,</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2996" href="#t2996">2996</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2997" href="#t2997">2997</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2998" href="#t2998">2998</a></span><span class="t"> <span class="key">def</span> <span class="nam">__iter__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t2999" href="#t2999">2999</a></span><span class="t"> <span class="com"># type: () -> Iterator[Deb822ParagraphElement]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3000" href="#t3000">3000</a></span><span class="t"> <span class="key">return</span> <span class="nam">iter</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">iter_parts_of_type</span><span class="op">(</span><span class="nam">Deb822ParagraphElement</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3001" href="#t3001">3001</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3002" href="#t3002">3002</a></span><span class="t"> <span class="key">def</span> <span class="nam">iter_parts</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3003" href="#t3003">3003</a></span><span class="t"> <span class="com"># type: () -> Iterable[TokenOrElement]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3004" href="#t3004">3004</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_and_elements</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3005" href="#t3005">3005</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3006" href="#t3006">3006</a></span><span class="t"> <span class="key">def</span> <span class="nam">insert</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">idx</span><span class="op">,</span> <span class="nam">para</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3007" href="#t3007">3007</a></span><span class="t"> <span class="com"># type: (int, Deb822ParagraphElement) -> None</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t3008" href="#t3008">3008</a></span><span class="t"> <span class="str">"""Inserts a paragraph into the file at the given "index" of paragraphs</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3009" href="#t3009">3009</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3010" href="#t3010">3010</a></span><span class="t"><span class="str"> Note that if the index is between two paragraphs containing a "free</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3011" href="#t3011">3011</a></span><span class="t"><span class="str"> floating" comment (e.g. paragraph/start-of-file, empty line, comment,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3012" href="#t3012">3012</a></span><span class="t"><span class="str"> empty line, paragraph) then it is unspecified which "side" of the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3013" href="#t3013">3013</a></span><span class="t"><span class="str"> comment the new paragraph will appear and this may change between</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3014" href="#t3014">3014</a></span><span class="t"><span class="str"> versions of python-debian.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3015" href="#t3015">3015</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3016" href="#t3016">3016</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3017" href="#t3017">3017</a></span><span class="t"><span class="str"> >>> original = '''</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3018" href="#t3018">3018</a></span><span class="t"><span class="str"> ... Package: libfoo-dev</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3019" href="#t3019">3019</a></span><span class="t"><span class="str"> ... Depends: libfoo1 (= ${binary:Version}), ${shlib:Depends}, ${misc:Depends}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3020" href="#t3020">3020</a></span><span class="t"><span class="str"> ... '''.lstrip()</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3021" href="#t3021">3021</a></span><span class="t"><span class="str"> >>> deb822_file = parse_deb822_file(original.splitlines())</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3022" href="#t3022">3022</a></span><span class="t"><span class="str"> >>> para1 = Deb822ParagraphElement.new_empty_paragraph()</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3023" href="#t3023">3023</a></span><span class="t"><span class="str"> >>> para1["Source"] = "foo"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3024" href="#t3024">3024</a></span><span class="t"><span class="str"> >>> para1["Build-Depends"] = "debhelper-compat (= 13)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3025" href="#t3025">3025</a></span><span class="t"><span class="str"> >>> para2 = Deb822ParagraphElement.new_empty_paragraph()</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3026" href="#t3026">3026</a></span><span class="t"><span class="str"> >>> para2["Package"] = "libfoo1"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3027" href="#t3027">3027</a></span><span class="t"><span class="str"> >>> para2["Depends"] = "${shlib:Depends}, ${misc:Depends}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3028" href="#t3028">3028</a></span><span class="t"><span class="str"> >>> deb822_file.insert(0, para1)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3029" href="#t3029">3029</a></span><span class="t"><span class="str"> >>> deb822_file.insert(1, para2)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3030" href="#t3030">3030</a></span><span class="t"><span class="str"> >>> expected = '''</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3031" href="#t3031">3031</a></span><span class="t"><span class="str"> ... Source: foo</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3032" href="#t3032">3032</a></span><span class="t"><span class="str"> ... Build-Depends: debhelper-compat (= 13)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3033" href="#t3033">3033</a></span><span class="t"><span class="str"> ...</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3034" href="#t3034">3034</a></span><span class="t"><span class="str"> ... Package: libfoo1</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3035" href="#t3035">3035</a></span><span class="t"><span class="str"> ... Depends: ${shlib:Depends}, ${misc:Depends}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3036" href="#t3036">3036</a></span><span class="t"><span class="str"> ...</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3037" href="#t3037">3037</a></span><span class="t"><span class="str"> ... Package: libfoo-dev</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3038" href="#t3038">3038</a></span><span class="t"><span class="str"> ... Depends: libfoo1 (= ${binary:Version}), ${shlib:Depends}, ${misc:Depends}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3039" href="#t3039">3039</a></span><span class="t"><span class="str"> ... '''.lstrip()</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3040" href="#t3040">3040</a></span><span class="t"><span class="str"> >>> deb822_file.dump() == expected</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3041" href="#t3041">3041</a></span><span class="t"><span class="str"> True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3042" href="#t3042">3042</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3043" href="#t3043">3043</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3044" href="#t3044">3044</a></span><span class="t"> <span class="nam">anchor_node</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3045" href="#t3045">3045</a></span><span class="t"> <span class="nam">needs_newline</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3046" href="#t3046">3046</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_full_size_cache</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3047" href="#t3047">3047</a></span><span class="t"> <span class="key">if</span> <span class="nam">idx</span> <span class="op">==</span> <span class="num">0</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3048" href="#t3048">3048</a></span><span class="t"> <span class="com"># Special-case, if idx is 0, then we insert it before everything else.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3049" href="#t3049">3049</a></span><span class="t"> <span class="com"># This is mostly a cosmetic choice for corner cases involving free-floating</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3050" href="#t3050">3050</a></span><span class="t"> <span class="com"># comments in the file.</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t3051" href="#t3051">3051</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_and_elements</span><span class="op">:</span> </span><span class="r"><span class="annotate short">3051 ↛ 3052</span><span class="annotate long">line 3051 didn't jump to line 3052, because the condition on line 3051 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t3052" href="#t3052">3052</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">para</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3053" href="#t3053">3053</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3054" href="#t3054">3054</a></span><span class="t"> <span class="nam">anchor_node</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_and_elements</span><span class="op">.</span><span class="nam">head_node</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3055" href="#t3055">3055</a></span><span class="t"> <span class="nam">needs_newline</span> <span class="op">=</span> <span class="nam">bool</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_token_and_elements</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3056" href="#t3056">3056</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3057" href="#t3057">3057</a></span><span class="t"> <span class="nam">i</span> <span class="op">=</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t3058" href="#t3058">3058</a></span><span class="t"> <span class="key">for</span> <span class="nam">node</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_and_elements</span><span class="op">.</span><span class="nam">iter_nodes</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">3058 ↛ 3066</span><span class="annotate long">line 3058 didn't jump to line 3066, because the loop on line 3058 didn't complete</span></span></p> - <p class="run"><span class="n"><a id="t3059" href="#t3059">3059</a></span><span class="t"> <span class="nam">entry</span> <span class="op">=</span> <span class="nam">node</span><span class="op">.</span><span class="nam">value</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3060" href="#t3060">3060</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">entry</span><span class="op">,</span> <span class="nam">Deb822ParagraphElement</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3061" href="#t3061">3061</a></span><span class="t"> <span class="nam">i</span> <span class="op">+=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3062" href="#t3062">3062</a></span><span class="t"> <span class="key">if</span> <span class="nam">idx</span> <span class="op">==</span> <span class="nam">i</span> <span class="op">-</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3063" href="#t3063">3063</a></span><span class="t"> <span class="nam">anchor_node</span> <span class="op">=</span> <span class="nam">node</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3064" href="#t3064">3064</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3065" href="#t3065">3065</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t3066" href="#t3066">3066</a></span><span class="t"> <span class="key">if</span> <span class="nam">anchor_node</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">3066 ↛ 3068</span><span class="annotate long">line 3066 didn't jump to line 3068, because the condition on line 3066 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t3067" href="#t3067">3067</a></span><span class="t"> <span class="com"># Empty list or idx after the last paragraph both degenerate into append</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3068" href="#t3068">3068</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">para</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3069" href="#t3069">3069</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t3070" href="#t3070">3070</a></span><span class="t"> <span class="key">if</span> <span class="nam">needs_newline</span><span class="op">:</span> </span><span class="r"><span class="annotate short">3070 ↛ 3076</span><span class="annotate long">line 3070 didn't jump to line 3076, because the condition on line 3070 was never false</span></span></p> - <p class="pln"><span class="n"><a id="t3071" href="#t3071">3071</a></span><span class="t"> <span class="com"># Remember to inject the "separating" newline between two paragraphs</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3072" href="#t3072">3072</a></span><span class="t"> <span class="nam">nl_token</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_set_parent</span><span class="op">(</span><span class="nam">Deb822WhitespaceToken</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3073" href="#t3073">3073</a></span><span class="t"> <span class="nam">anchor_node</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_and_elements</span><span class="op">.</span><span class="nam">insert_before</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3074" href="#t3074">3074</a></span><span class="t"> <span class="nam">nl_token</span><span class="op">,</span> <span class="nam">anchor_node</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3075" href="#t3075">3075</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3076" href="#t3076">3076</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_and_elements</span><span class="op">.</span><span class="nam">insert_before</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_set_parent</span><span class="op">(</span><span class="nam">para</span><span class="op">)</span><span class="op">,</span> <span class="nam">anchor_node</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3077" href="#t3077">3077</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3078" href="#t3078">3078</a></span><span class="t"> <span class="key">def</span> <span class="nam">append</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">paragraph</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3079" href="#t3079">3079</a></span><span class="t"> <span class="com"># type: (Deb822ParagraphElement) -> None</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t3080" href="#t3080">3080</a></span><span class="t"> <span class="str">"""Appends a paragraph to the file</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3081" href="#t3081">3081</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3082" href="#t3082">3082</a></span><span class="t"><span class="str"> >>> deb822_file = Deb822FileElement.new_empty_file()</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3083" href="#t3083">3083</a></span><span class="t"><span class="str"> >>> para1 = Deb822ParagraphElement.new_empty_paragraph()</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3084" href="#t3084">3084</a></span><span class="t"><span class="str"> >>> para1["Source"] = "foo"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3085" href="#t3085">3085</a></span><span class="t"><span class="str"> >>> para1["Build-Depends"] = "debhelper-compat (= 13)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3086" href="#t3086">3086</a></span><span class="t"><span class="str"> >>> para2 = Deb822ParagraphElement.new_empty_paragraph()</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3087" href="#t3087">3087</a></span><span class="t"><span class="str"> >>> para2["Package"] = "foo"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3088" href="#t3088">3088</a></span><span class="t"><span class="str"> >>> para2["Depends"] = "${shlib:Depends}, ${misc:Depends}"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3089" href="#t3089">3089</a></span><span class="t"><span class="str"> >>> deb822_file.append(para1)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3090" href="#t3090">3090</a></span><span class="t"><span class="str"> >>> deb822_file.append(para2)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3091" href="#t3091">3091</a></span><span class="t"><span class="str"> >>> expected = '''</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3092" href="#t3092">3092</a></span><span class="t"><span class="str"> ... Source: foo</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3093" href="#t3093">3093</a></span><span class="t"><span class="str"> ... Build-Depends: debhelper-compat (= 13)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3094" href="#t3094">3094</a></span><span class="t"><span class="str"> ...</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3095" href="#t3095">3095</a></span><span class="t"><span class="str"> ... Package: foo</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3096" href="#t3096">3096</a></span><span class="t"><span class="str"> ... Depends: ${shlib:Depends}, ${misc:Depends}</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3097" href="#t3097">3097</a></span><span class="t"><span class="str"> ... '''.lstrip()</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3098" href="#t3098">3098</a></span><span class="t"><span class="str"> >>> deb822_file.dump() == expected</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3099" href="#t3099">3099</a></span><span class="t"><span class="str"> True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3100" href="#t3100">3100</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3101" href="#t3101">3101</a></span><span class="t"> <span class="nam">tail_element</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_and_elements</span><span class="op">.</span><span class="nam">tail</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t3102" href="#t3102">3102</a></span><span class="t"> <span class="key">if</span> <span class="nam">paragraph</span><span class="op">.</span><span class="nam">parent_element</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">3102 ↛ 3103</span><span class="annotate long">line 3102 didn't jump to line 3103, because the condition on line 3102 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t3103" href="#t3103">3103</a></span><span class="t"> <span class="key">if</span> <span class="nam">paragraph</span><span class="op">.</span><span class="nam">parent_element</span> <span class="key">is</span> <span class="nam">self</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3104" href="#t3104">3104</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"Paragraph is already a part of this file"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3105" href="#t3105">3105</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"Paragraph is already part of another Deb822File"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3106" href="#t3106">3106</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3107" href="#t3107">3107</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_full_size_cache</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3108" href="#t3108">3108</a></span><span class="t"> <span class="com"># We need a separating newline if there is not a whitespace token at the end of the file.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3109" href="#t3109">3109</a></span><span class="t"> <span class="com"># Note the special case where the file ends on a comment; here we insert a whitespace too</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3110" href="#t3110">3110</a></span><span class="t"> <span class="com"># to be sure. Otherwise, we would have to check that there is an empty line before that</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3111" href="#t3111">3111</a></span><span class="t"> <span class="com"># comment and that is too much effort.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3112" href="#t3112">3112</a></span><span class="t"> <span class="key">if</span> <span class="nam">tail_element</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">tail_element</span><span class="op">,</span> <span class="nam">Deb822WhitespaceToken</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3113" href="#t3113">3113</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_and_elements</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3114" href="#t3114">3114</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_set_parent</span><span class="op">(</span><span class="nam">Deb822WhitespaceToken</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3115" href="#t3115">3115</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3116" href="#t3116">3116</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_and_elements</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_set_parent</span><span class="op">(</span><span class="nam">paragraph</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3117" href="#t3117">3117</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3118" href="#t3118">3118</a></span><span class="t"> <span class="key">def</span> <span class="nam">remove</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">paragraph</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3119" href="#t3119">3119</a></span><span class="t"> <span class="com"># type: (Deb822ParagraphElement) -> None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3120" href="#t3120">3120</a></span><span class="t"> <span class="key">if</span> <span class="nam">paragraph</span><span class="op">.</span><span class="nam">parent_element</span> <span class="key">is</span> <span class="key">not</span> <span class="nam">self</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3121" href="#t3121">3121</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"Paragraph is part of a different file"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3122" href="#t3122">3122</a></span><span class="t"> <span class="nam">node</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3123" href="#t3123">3123</a></span><span class="t"> <span class="key">for</span> <span class="nam">node</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_and_elements</span><span class="op">.</span><span class="nam">iter_nodes</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3124" href="#t3124">3124</a></span><span class="t"> <span class="key">if</span> <span class="nam">node</span><span class="op">.</span><span class="nam">value</span> <span class="key">is</span> <span class="nam">paragraph</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3125" href="#t3125">3125</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3126" href="#t3126">3126</a></span><span class="t"> <span class="key">if</span> <span class="nam">node</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3127" href="#t3127">3127</a></span><span class="t"> <span class="key">raise</span> <span class="nam">RuntimeError</span><span class="op">(</span><span class="str">"unable to find paragraph"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3128" href="#t3128">3128</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_full_size_cache</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3129" href="#t3129">3129</a></span><span class="t"> <span class="nam">previous_node</span> <span class="op">=</span> <span class="nam">node</span><span class="op">.</span><span class="nam">previous_node</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3130" href="#t3130">3130</a></span><span class="t"> <span class="nam">next_node</span> <span class="op">=</span> <span class="nam">node</span><span class="op">.</span><span class="nam">next_node</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3131" href="#t3131">3131</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_and_elements</span><span class="op">.</span><span class="nam">remove_node</span><span class="op">(</span><span class="nam">node</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3132" href="#t3132">3132</a></span><span class="t"> <span class="key">if</span> <span class="nam">next_node</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3133" href="#t3133">3133</a></span><span class="t"> <span class="key">if</span> <span class="nam">previous_node</span> <span class="key">and</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">previous_node</span><span class="op">.</span><span class="nam">value</span><span class="op">,</span> <span class="nam">Deb822WhitespaceToken</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3134" href="#t3134">3134</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_and_elements</span><span class="op">.</span><span class="nam">remove_node</span><span class="op">(</span><span class="nam">previous_node</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3135" href="#t3135">3135</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3136" href="#t3136">3136</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">next_node</span><span class="op">.</span><span class="nam">value</span><span class="op">,</span> <span class="nam">Deb822WhitespaceToken</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3137" href="#t3137">3137</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_and_elements</span><span class="op">.</span><span class="nam">remove_node</span><span class="op">(</span><span class="nam">next_node</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3138" href="#t3138">3138</a></span><span class="t"> <span class="nam">paragraph</span><span class="op">.</span><span class="nam">parent_element</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3139" href="#t3139">3139</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3140" href="#t3140">3140</a></span><span class="t"> <span class="key">def</span> <span class="nam">_set_parent</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">t</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3141" href="#t3141">3141</a></span><span class="t"> <span class="com"># type: (TE) -> TE</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3142" href="#t3142">3142</a></span><span class="t"> <span class="nam">t</span><span class="op">.</span><span class="nam">parent_element</span> <span class="op">=</span> <span class="nam">self</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3143" href="#t3143">3143</a></span><span class="t"> <span class="key">return</span> <span class="nam">t</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3144" href="#t3144">3144</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3145" href="#t3145">3145</a></span><span class="t"> <span class="key">def</span> <span class="nam">position_in_parent</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">skip_leading_comments</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Position</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3146" href="#t3146">3146</a></span><span class="t"> <span class="com"># Recursive base-case</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3147" href="#t3147">3147</a></span><span class="t"> <span class="key">return</span> <span class="nam">START_POSITION</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3148" href="#t3148">3148</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3149" href="#t3149">3149</a></span><span class="t"> <span class="key">def</span> <span class="nam">position_in_file</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">skip_leading_comments</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">True</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Position</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3150" href="#t3150">3150</a></span><span class="t"> <span class="com"># By definition</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3151" href="#t3151">3151</a></span><span class="t"> <span class="key">return</span> <span class="nam">START_POSITION</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3152" href="#t3152">3152</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3153" href="#t3153">3153</a></span><span class="t"> <span class="op">@</span><span class="nam">overload</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3154" href="#t3154">3154</a></span><span class="t"> <span class="key">def</span> <span class="nam">dump</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3155" href="#t3155">3155</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> <span class="nam">fd</span> <span class="com"># type: IO[bytes]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3156" href="#t3156">3156</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3157" href="#t3157">3157</a></span><span class="t"> <span class="com"># type: (...) -> None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3158" href="#t3158">3158</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3159" href="#t3159">3159</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3160" href="#t3160">3160</a></span><span class="t"> <span class="op">@</span><span class="nam">overload</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3161" href="#t3161">3161</a></span><span class="t"> <span class="key">def</span> <span class="nam">dump</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3162" href="#t3162">3162</a></span><span class="t"> <span class="com"># type: () -> str</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3163" href="#t3163">3163</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3164" href="#t3164">3164</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3165" href="#t3165">3165</a></span><span class="t"> <span class="key">def</span> <span class="nam">dump</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3166" href="#t3166">3166</a></span><span class="t"> <span class="nam">self</span><span class="op">,</span> <span class="nam">fd</span><span class="op">=</span><span class="key">None</span> <span class="com"># type: Optional[IO[bytes]]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3167" href="#t3167">3167</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3168" href="#t3168">3168</a></span><span class="t"> <span class="com"># type: (...) -> Optional[str]</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t3169" href="#t3169">3169</a></span><span class="t"> <span class="key">if</span> <span class="nam">fd</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">3169 ↛ 3171</span><span class="annotate long">line 3169 didn't jump to line 3171, because the condition on line 3169 was never false</span></span></p> - <p class="run"><span class="n"><a id="t3170" href="#t3170">3170</a></span><span class="t"> <span class="key">return</span> <span class="str">""</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">t</span><span class="op">.</span><span class="nam">text</span> <span class="key">for</span> <span class="nam">t</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">iter_tokens</span><span class="op">(</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3171" href="#t3171">3171</a></span><span class="t"> <span class="key">for</span> <span class="nam">token</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">iter_tokens</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3172" href="#t3172">3172</a></span><span class="t"> <span class="nam">fd</span><span class="op">.</span><span class="nam">write</span><span class="op">(</span><span class="nam">token</span><span class="op">.</span><span class="nam">text</span><span class="op">.</span><span class="nam">encode</span><span class="op">(</span><span class="str">"utf-8"</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3173" href="#t3173">3173</a></span><span class="t"> <span class="key">return</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3174" href="#t3174">3174</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3175" href="#t3175">3175</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3176" href="#t3176">3176</a></span><span class="t"><span class="nam">_combine_error_tokens_into_elements</span> <span class="op">=</span> <span class="nam">combine_into_replacement</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3177" href="#t3177">3177</a></span><span class="t"> <span class="nam">Deb822ErrorToken</span><span class="op">,</span> <span class="nam">Deb822ErrorElement</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3178" href="#t3178">3178</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3179" href="#t3179">3179</a></span><span class="t"><span class="nam">_combine_comment_tokens_into_elements</span> <span class="op">=</span> <span class="nam">combine_into_replacement</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3180" href="#t3180">3180</a></span><span class="t"> <span class="nam">Deb822CommentToken</span><span class="op">,</span> <span class="nam">Deb822CommentElement</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3181" href="#t3181">3181</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3182" href="#t3182">3182</a></span><span class="t"><span class="nam">_combine_vl_elements_into_value_elements</span> <span class="op">=</span> <span class="nam">combine_into_replacement</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3183" href="#t3183">3183</a></span><span class="t"> <span class="nam">Deb822ValueLineElement</span><span class="op">,</span> <span class="nam">Deb822ValueElement</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3184" href="#t3184">3184</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3185" href="#t3185">3185</a></span><span class="t"><span class="nam">_combine_kvp_elements_into_paragraphs</span> <span class="op">=</span> <span class="nam">combine_into_replacement</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3186" href="#t3186">3186</a></span><span class="t"> <span class="nam">Deb822KeyValuePairElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3187" href="#t3187">3187</a></span><span class="t"> <span class="nam">Deb822ParagraphElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3188" href="#t3188">3188</a></span><span class="t"> <span class="nam">constructor</span><span class="op">=</span><span class="nam">Deb822ParagraphElement</span><span class="op">.</span><span class="nam">from_kvpairs</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3189" href="#t3189">3189</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3190" href="#t3190">3190</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3191" href="#t3191">3191</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3192" href="#t3192">3192</a></span><span class="t"><span class="key">def</span> <span class="nam">_parsed_value_render_factory</span><span class="op">(</span><span class="nam">discard_comments</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3193" href="#t3193">3193</a></span><span class="t"> <span class="com"># type: (bool) -> Callable[[Deb822ParsedValueElement], str]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3194" href="#t3194">3194</a></span><span class="t"> <span class="key">return</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3195" href="#t3195">3195</a></span><span class="t"> <span class="nam">Deb822ParsedValueElement</span><span class="op">.</span><span class="nam">convert_to_text_without_comments</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3196" href="#t3196">3196</a></span><span class="t"> <span class="key">if</span> <span class="nam">discard_comments</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3197" href="#t3197">3197</a></span><span class="t"> <span class="key">else</span> <span class="nam">Deb822ParsedValueElement</span><span class="op">.</span><span class="nam">convert_to_text</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3198" href="#t3198">3198</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3199" href="#t3199">3199</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3200" href="#t3200">3200</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3201" href="#t3201">3201</a></span><span class="t"><span class="nam">LIST_SPACE_SEPARATED_INTERPRETATION</span> <span class="op">=</span> <span class="nam">ListInterpretation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3202" href="#t3202">3202</a></span><span class="t"> <span class="nam">whitespace_split_tokenizer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3203" href="#t3203">3203</a></span><span class="t"> <span class="nam">_parse_whitespace_list_value</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3204" href="#t3204">3204</a></span><span class="t"> <span class="nam">Deb822ParsedValueElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3205" href="#t3205">3205</a></span><span class="t"> <span class="nam">Deb822SemanticallySignificantWhiteSpace</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3206" href="#t3206">3206</a></span><span class="t"> <span class="key">lambda</span><span class="op">:</span> <span class="nam">Deb822SpaceSeparatorToken</span><span class="op">(</span><span class="str">" "</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3207" href="#t3207">3207</a></span><span class="t"> <span class="nam">_parsed_value_render_factory</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3208" href="#t3208">3208</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3209" href="#t3209">3209</a></span><span class="t"><span class="nam">LIST_COMMA_SEPARATED_INTERPRETATION</span> <span class="op">=</span> <span class="nam">ListInterpretation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3210" href="#t3210">3210</a></span><span class="t"> <span class="nam">comma_split_tokenizer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3211" href="#t3211">3211</a></span><span class="t"> <span class="nam">_parse_comma_list_value</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3212" href="#t3212">3212</a></span><span class="t"> <span class="nam">Deb822ParsedValueElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3213" href="#t3213">3213</a></span><span class="t"> <span class="nam">Deb822CommaToken</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3214" href="#t3214">3214</a></span><span class="t"> <span class="nam">Deb822CommaToken</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3215" href="#t3215">3215</a></span><span class="t"> <span class="nam">_parsed_value_render_factory</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3216" href="#t3216">3216</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3217" href="#t3217">3217</a></span><span class="t"><span class="nam">LIST_UPLOADERS_INTERPRETATION</span> <span class="op">=</span> <span class="nam">ListInterpretation</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3218" href="#t3218">3218</a></span><span class="t"> <span class="nam">comma_split_tokenizer</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3219" href="#t3219">3219</a></span><span class="t"> <span class="nam">_parse_uploaders_list_value</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3220" href="#t3220">3220</a></span><span class="t"> <span class="nam">Deb822ParsedValueElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3221" href="#t3221">3221</a></span><span class="t"> <span class="nam">Deb822CommaToken</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3222" href="#t3222">3222</a></span><span class="t"> <span class="nam">Deb822CommaToken</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3223" href="#t3223">3223</a></span><span class="t"> <span class="nam">_parsed_value_render_factory</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3224" href="#t3224">3224</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3225" href="#t3225">3225</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3226" href="#t3226">3226</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3227" href="#t3227">3227</a></span><span class="t"><span class="key">def</span> <span class="nam">_non_end_of_line_token</span><span class="op">(</span><span class="nam">v</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3228" href="#t3228">3228</a></span><span class="t"> <span class="com"># type: (TokenOrElement) -> bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3229" href="#t3229">3229</a></span><span class="t"> <span class="com"># Consume tokens until the newline</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3230" href="#t3230">3230</a></span><span class="t"> <span class="key">return</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">v</span><span class="op">,</span> <span class="nam">Deb822WhitespaceToken</span><span class="op">)</span> <span class="key">or</span> <span class="nam">v</span><span class="op">.</span><span class="nam">text</span> <span class="op">!=</span> <span class="str">"\n"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3231" href="#t3231">3231</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3232" href="#t3232">3232</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3233" href="#t3233">3233</a></span><span class="t"><span class="key">def</span> <span class="nam">_build_value_line</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3234" href="#t3234">3234</a></span><span class="t"> <span class="nam">token_stream</span><span class="op">,</span> <span class="com"># type: Iterable[Union[TokenOrElement, Deb822CommentElement]]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3235" href="#t3235">3235</a></span><span class="t"><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3236" href="#t3236">3236</a></span><span class="t"> <span class="com"># type: (...) -> Iterable[Union[TokenOrElement, Deb822ValueLineElement]]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3237" href="#t3237">3237</a></span><span class="t"> <span class="str">"""Parser helper - consumes tokens part of a Deb822ValueEntryElement and turns them into one"""</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3238" href="#t3238">3238</a></span><span class="t"> <span class="nam">buffered_stream</span> <span class="op">=</span> <span class="nam">BufferingIterator</span><span class="op">(</span><span class="nam">token_stream</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3239" href="#t3239">3239</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3240" href="#t3240">3240</a></span><span class="t"> <span class="com"># Deb822ValueLineElement is a bit tricky because of how we handle whitespace</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3241" href="#t3241">3241</a></span><span class="t"> <span class="com"># and comments.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3242" href="#t3242">3242</a></span><span class="t"> <span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3243" href="#t3243">3243</a></span><span class="t"> <span class="com"># In relation to comments, then only continuation lines can have comments.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3244" href="#t3244">3244</a></span><span class="t"> <span class="com"># If there is a comment before a "K: V" line, then the comment is associated</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3245" href="#t3245">3245</a></span><span class="t"> <span class="com"># with the field rather than the value.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3246" href="#t3246">3246</a></span><span class="t"> <span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3247" href="#t3247">3247</a></span><span class="t"> <span class="com"># On the whitespace front, then we separate syntactical mandatory whitespace</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3248" href="#t3248">3248</a></span><span class="t"> <span class="com"># from optional whitespace. As an example:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3249" href="#t3249">3249</a></span><span class="t"> <span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3250" href="#t3250">3250</a></span><span class="t"> <span class="com"># """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3251" href="#t3251">3251</a></span><span class="t"> <span class="com"># # some comment associated with the Depends field</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3252" href="#t3252">3252</a></span><span class="t"> <span class="com"># Depends:_foo_$</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3253" href="#t3253">3253</a></span><span class="t"> <span class="com"># # some comment associated with the line containing "bar"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3254" href="#t3254">3254</a></span><span class="t"> <span class="com"># !________bar_$</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3255" href="#t3255">3255</a></span><span class="t"> <span class="com"># """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3256" href="#t3256">3256</a></span><span class="t"> <span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3257" href="#t3257">3257</a></span><span class="t"> <span class="com"># Where "$" and "!" represents mandatory whitespace (the newline and the first</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3258" href="#t3258">3258</a></span><span class="t"> <span class="com"># space are required for the file to be parsed correctly), where as "_" is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3259" href="#t3259">3259</a></span><span class="t"> <span class="com"># "optional" whitespace (from a syntactical point of view).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3260" href="#t3260">3260</a></span><span class="t"> <span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3261" href="#t3261">3261</a></span><span class="t"> <span class="com"># This distinction enable us to facilitate APIs for easy removal/normalization</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3262" href="#t3262">3262</a></span><span class="t"> <span class="com"># of redundant whitespaces without having programmers worry about trashing</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3263" href="#t3263">3263</a></span><span class="t"> <span class="com"># the file.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3264" href="#t3264">3264</a></span><span class="t"> <span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3265" href="#t3265">3265</a></span><span class="t"> <span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3266" href="#t3266">3266</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3267" href="#t3267">3267</a></span><span class="t"> <span class="nam">comment_element</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3268" href="#t3268">3268</a></span><span class="t"> <span class="nam">continuation_line_token</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3269" href="#t3269">3269</a></span><span class="t"> <span class="nam">token</span> <span class="op">=</span> <span class="key">None</span> <span class="com"># type: Optional[TokenOrElement]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3270" href="#t3270">3270</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3271" href="#t3271">3271</a></span><span class="t"> <span class="key">for</span> <span class="nam">token</span> <span class="key">in</span> <span class="nam">buffered_stream</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3272" href="#t3272">3272</a></span><span class="t"> <span class="nam">start_of_value_entry</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3273" href="#t3273">3273</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">token</span><span class="op">,</span> <span class="nam">Deb822ValueContinuationToken</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3274" href="#t3274">3274</a></span><span class="t"> <span class="nam">continuation_line_token</span> <span class="op">=</span> <span class="nam">token</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3275" href="#t3275">3275</a></span><span class="t"> <span class="nam">start_of_value_entry</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3276" href="#t3276">3276</a></span><span class="t"> <span class="nam">token</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3277" href="#t3277">3277</a></span><span class="t"> <span class="key">elif</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">token</span><span class="op">,</span> <span class="nam">Deb822FieldSeparatorToken</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3278" href="#t3278">3278</a></span><span class="t"> <span class="nam">start_of_value_entry</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3279" href="#t3279">3279</a></span><span class="t"> <span class="key">elif</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">token</span><span class="op">,</span> <span class="nam">Deb822CommentElement</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3280" href="#t3280">3280</a></span><span class="t"> <span class="nam">next_token</span> <span class="op">=</span> <span class="nam">buffered_stream</span><span class="op">.</span><span class="nam">peek</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3281" href="#t3281">3281</a></span><span class="t"> <span class="com"># If the next token is a continuation line token, then this comment</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3282" href="#t3282">3282</a></span><span class="t"> <span class="com"># belong to a value and we might as well just start the value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3283" href="#t3283">3283</a></span><span class="t"> <span class="com"># parsing now.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3284" href="#t3284">3284</a></span><span class="t"> <span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3285" href="#t3285">3285</a></span><span class="t"> <span class="com"># Note that we rely on this behaviour to avoid emitting the comment</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3286" href="#t3286">3286</a></span><span class="t"> <span class="com"># token (failing to do so would cause the comment to appear twice</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3287" href="#t3287">3287</a></span><span class="t"> <span class="com"># in the file).</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3288" href="#t3288">3288</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">next_token</span><span class="op">,</span> <span class="nam">Deb822ValueContinuationToken</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3289" href="#t3289">3289</a></span><span class="t"> <span class="nam">start_of_value_entry</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3290" href="#t3290">3290</a></span><span class="t"> <span class="nam">comment_element</span> <span class="op">=</span> <span class="nam">token</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3291" href="#t3291">3291</a></span><span class="t"> <span class="nam">token</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3292" href="#t3292">3292</a></span><span class="t"> <span class="com"># Use next with None to avoid raising StopIteration inside a generator</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3293" href="#t3293">3293</a></span><span class="t"> <span class="com"># It won't happen, but pylint cannot see that, so we do this instead.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3294" href="#t3294">3294</a></span><span class="t"> <span class="nam">continuation_line_token</span> <span class="op">=</span> <span class="nam">cast</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3295" href="#t3295">3295</a></span><span class="t"> <span class="str">"Deb822ValueContinuationToken"</span><span class="op">,</span> <span class="nam">next</span><span class="op">(</span><span class="nam">buffered_stream</span><span class="op">,</span> <span class="key">None</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3296" href="#t3296">3296</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3297" href="#t3297">3297</a></span><span class="t"> <span class="key">assert</span> <span class="nam">continuation_line_token</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3298" href="#t3298">3298</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3299" href="#t3299">3299</a></span><span class="t"> <span class="key">if</span> <span class="nam">token</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3300" href="#t3300">3300</a></span><span class="t"> <span class="key">yield</span> <span class="nam">token</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3301" href="#t3301">3301</a></span><span class="t"> <span class="key">if</span> <span class="nam">start_of_value_entry</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3302" href="#t3302">3302</a></span><span class="t"> <span class="nam">tokens_in_value</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">buffered_stream</span><span class="op">.</span><span class="nam">takewhile</span><span class="op">(</span><span class="nam">_non_end_of_line_token</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3303" href="#t3303">3303</a></span><span class="t"> <span class="nam">eol_token</span> <span class="op">=</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"Deb822WhitespaceToken"</span><span class="op">,</span> <span class="nam">next</span><span class="op">(</span><span class="nam">buffered_stream</span><span class="op">,</span> <span class="key">None</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3304" href="#t3304">3304</a></span><span class="t"> <span class="key">assert</span> <span class="nam">eol_token</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">eol_token</span><span class="op">.</span><span class="nam">text</span> <span class="op">==</span> <span class="str">"\n"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3305" href="#t3305">3305</a></span><span class="t"> <span class="nam">leading_whitespace</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3306" href="#t3306">3306</a></span><span class="t"> <span class="nam">trailing_whitespace</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3307" href="#t3307">3307</a></span><span class="t"> <span class="com"># "Depends:\n foo" would cause tokens_in_value to be empty for the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3308" href="#t3308">3308</a></span><span class="t"> <span class="com"># first "value line" (the empty part between ":" and "\n")</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t3309" href="#t3309">3309</a></span><span class="t"> <span class="key">if</span> <span class="nam">tokens_in_value</span><span class="op">:</span> </span><span class="r"><span class="annotate short">3309 ↛ 3323</span><span class="annotate long">line 3309 didn't jump to line 3323, because the condition on line 3309 was never false</span></span></p> - <p class="pln"><span class="n"><a id="t3310" href="#t3310">3310</a></span><span class="t"> <span class="com"># Another special-case, "Depends: \n foo" (i.e. space after colon)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3311" href="#t3311">3311</a></span><span class="t"> <span class="com"># should not introduce an IndexError</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3312" href="#t3312">3312</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">tokens_in_value</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span><span class="op">,</span> <span class="nam">Deb822WhitespaceToken</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3313" href="#t3313">3313</a></span><span class="t"> <span class="nam">trailing_whitespace</span> <span class="op">=</span> <span class="nam">cast</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3314" href="#t3314">3314</a></span><span class="t"> <span class="str">"Deb822WhitespaceToken"</span><span class="op">,</span> <span class="nam">tokens_in_value</span><span class="op">.</span><span class="nam">pop</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3315" href="#t3315">3315</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t3316" href="#t3316">3316</a></span><span class="t"> <span class="key">if</span> <span class="nam">tokens_in_value</span> <span class="key">and</span> <span class="nam">isinstance</span><span class="op">(</span> </span><span class="r"><span class="annotate short">3316 ↛ 3319</span><span class="annotate long">line 3316 didn't jump to line 3319, because the condition on line 3316 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t3317" href="#t3317">3317</a></span><span class="t"> <span class="nam">tokens_in_value</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span><span class="op">,</span> <span class="nam">Deb822WhitespaceToken</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3318" href="#t3318">3318</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3319" href="#t3319">3319</a></span><span class="t"> <span class="nam">leading_whitespace</span> <span class="op">=</span> <span class="nam">cast</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3320" href="#t3320">3320</a></span><span class="t"> <span class="str">"Deb822WhitespaceToken"</span><span class="op">,</span> <span class="nam">tokens_in_value</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3321" href="#t3321">3321</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3322" href="#t3322">3322</a></span><span class="t"> <span class="nam">tokens_in_value</span> <span class="op">=</span> <span class="nam">tokens_in_value</span><span class="op">[</span><span class="num">1</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3323" href="#t3323">3323</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822ValueLineElement</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3324" href="#t3324">3324</a></span><span class="t"> <span class="nam">comment_element</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3325" href="#t3325">3325</a></span><span class="t"> <span class="nam">continuation_line_token</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3326" href="#t3326">3326</a></span><span class="t"> <span class="nam">leading_whitespace</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3327" href="#t3327">3327</a></span><span class="t"> <span class="nam">tokens_in_value</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3328" href="#t3328">3328</a></span><span class="t"> <span class="nam">trailing_whitespace</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3329" href="#t3329">3329</a></span><span class="t"> <span class="nam">eol_token</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3330" href="#t3330">3330</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3331" href="#t3331">3331</a></span><span class="t"> <span class="nam">comment_element</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3332" href="#t3332">3332</a></span><span class="t"> <span class="nam">continuation_line_token</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3333" href="#t3333">3333</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3334" href="#t3334">3334</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3335" href="#t3335">3335</a></span><span class="t"><span class="key">def</span> <span class="nam">_build_field_with_value</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3336" href="#t3336">3336</a></span><span class="t"> <span class="nam">token_stream</span><span class="op">,</span> <span class="com"># type: Iterable[Union[TokenOrElement, Deb822ValueElement]]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3337" href="#t3337">3337</a></span><span class="t"><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3338" href="#t3338">3338</a></span><span class="t"> <span class="com"># type: (...) -> Iterable[Union[TokenOrElement, Deb822KeyValuePairElement]]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3339" href="#t3339">3339</a></span><span class="t"> <span class="nam">buffered_stream</span> <span class="op">=</span> <span class="nam">BufferingIterator</span><span class="op">(</span><span class="nam">token_stream</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3340" href="#t3340">3340</a></span><span class="t"> <span class="key">for</span> <span class="nam">token_or_element</span> <span class="key">in</span> <span class="nam">buffered_stream</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3341" href="#t3341">3341</a></span><span class="t"> <span class="nam">start_of_field</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3342" href="#t3342">3342</a></span><span class="t"> <span class="nam">comment_element</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3343" href="#t3343">3343</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">token_or_element</span><span class="op">,</span> <span class="nam">Deb822FieldNameToken</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3344" href="#t3344">3344</a></span><span class="t"> <span class="nam">start_of_field</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3345" href="#t3345">3345</a></span><span class="t"> <span class="key">elif</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">token_or_element</span><span class="op">,</span> <span class="nam">Deb822CommentElement</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3346" href="#t3346">3346</a></span><span class="t"> <span class="nam">comment_element</span> <span class="op">=</span> <span class="nam">token_or_element</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3347" href="#t3347">3347</a></span><span class="t"> <span class="nam">next_token</span> <span class="op">=</span> <span class="nam">buffered_stream</span><span class="op">.</span><span class="nam">peek</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3348" href="#t3348">3348</a></span><span class="t"> <span class="nam">start_of_field</span> <span class="op">=</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">next_token</span><span class="op">,</span> <span class="nam">Deb822FieldNameToken</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t3349" href="#t3349">3349</a></span><span class="t"> <span class="key">if</span> <span class="nam">start_of_field</span><span class="op">:</span> </span><span class="r"><span class="annotate short">3349 ↛ 3356</span><span class="annotate long">line 3349 didn't jump to line 3356, because the condition on line 3349 was never false</span></span></p> - <p class="pln"><span class="n"><a id="t3350" href="#t3350">3350</a></span><span class="t"> <span class="com"># Remember to consume the field token</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3351" href="#t3351">3351</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3352" href="#t3352">3352</a></span><span class="t"> <span class="nam">token_or_element</span> <span class="op">=</span> <span class="nam">next</span><span class="op">(</span><span class="nam">buffered_stream</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t3353" href="#t3353">3353</a></span><span class="t"> <span class="key">except</span> <span class="nam">StopIteration</span><span class="op">:</span> <span class="com"># pragma: no cover</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t3354" href="#t3354">3354</a></span><span class="t"> <span class="key">raise</span> <span class="nam">AssertionError</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3355" href="#t3355">3355</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3356" href="#t3356">3356</a></span><span class="t"> <span class="key">if</span> <span class="nam">start_of_field</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3357" href="#t3357">3357</a></span><span class="t"> <span class="nam">field_name</span> <span class="op">=</span> <span class="nam">token_or_element</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3358" href="#t3358">3358</a></span><span class="t"> <span class="nam">separator</span> <span class="op">=</span> <span class="nam">next</span><span class="op">(</span><span class="nam">buffered_stream</span><span class="op">,</span> <span class="key">None</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3359" href="#t3359">3359</a></span><span class="t"> <span class="nam">value_element</span> <span class="op">=</span> <span class="nam">next</span><span class="op">(</span><span class="nam">buffered_stream</span><span class="op">,</span> <span class="key">None</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t3360" href="#t3360">3360</a></span><span class="t"> <span class="key">if</span> <span class="nam">separator</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">value_element</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">3360 ↛ 3363</span><span class="annotate long">line 3360 didn't jump to line 3363, because the condition on line 3360 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t3361" href="#t3361">3361</a></span><span class="t"> <span class="com"># Early EOF - should not be possible with how the tokenizer works</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3362" href="#t3362">3362</a></span><span class="t"> <span class="com"># right now, but now it is future-proof.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3363" href="#t3363">3363</a></span><span class="t"> <span class="key">if</span> <span class="nam">comment_element</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3364" href="#t3364">3364</a></span><span class="t"> <span class="key">yield</span> <span class="nam">comment_element</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3365" href="#t3365">3365</a></span><span class="t"> <span class="nam">error_elements</span> <span class="op">=</span> <span class="op">[</span><span class="nam">field_name</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3366" href="#t3366">3366</a></span><span class="t"> <span class="key">if</span> <span class="nam">separator</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3367" href="#t3367">3367</a></span><span class="t"> <span class="nam">error_elements</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">separator</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3368" href="#t3368">3368</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822ErrorElement</span><span class="op">(</span><span class="nam">error_elements</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3369" href="#t3369">3369</a></span><span class="t"> <span class="key">return</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3370" href="#t3370">3370</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t3371" href="#t3371">3371</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">separator</span><span class="op">,</span> <span class="nam">Deb822FieldSeparatorToken</span><span class="op">)</span> <span class="key">and</span> <span class="nam">isinstance</span><span class="op">(</span> </span><span class="r"><span class="annotate short">3371 ↛ 3382</span><span class="annotate long">line 3371 didn't jump to line 3382, because the condition on line 3371 was never false</span></span></p> - <p class="pln"><span class="n"><a id="t3372" href="#t3372">3372</a></span><span class="t"> <span class="nam">value_element</span><span class="op">,</span> <span class="nam">Deb822ValueElement</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3373" href="#t3373">3373</a></span><span class="t"> <span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3374" href="#t3374">3374</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822KeyValuePairElement</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3375" href="#t3375">3375</a></span><span class="t"> <span class="nam">comment_element</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3376" href="#t3376">3376</a></span><span class="t"> <span class="nam">cast</span><span class="op">(</span><span class="str">"Deb822FieldNameToken"</span><span class="op">,</span> <span class="nam">field_name</span><span class="op">)</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3377" href="#t3377">3377</a></span><span class="t"> <span class="nam">separator</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3378" href="#t3378">3378</a></span><span class="t"> <span class="nam">value_element</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3379" href="#t3379">3379</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3380" href="#t3380">3380</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3381" href="#t3381">3381</a></span><span class="t"> <span class="com"># We had a parse error, consume until the newline.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3382" href="#t3382">3382</a></span><span class="t"> <span class="nam">error_tokens</span> <span class="op">=</span> <span class="op">[</span><span class="nam">token_or_element</span><span class="op">]</span> <span class="com"># type: List[TokenOrElement]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3383" href="#t3383">3383</a></span><span class="t"> <span class="nam">error_tokens</span><span class="op">.</span><span class="nam">extend</span><span class="op">(</span><span class="nam">buffered_stream</span><span class="op">.</span><span class="nam">takewhile</span><span class="op">(</span><span class="nam">_non_end_of_line_token</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3384" href="#t3384">3384</a></span><span class="t"> <span class="nam">nl</span> <span class="op">=</span> <span class="nam">buffered_stream</span><span class="op">.</span><span class="nam">peek</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3385" href="#t3385">3385</a></span><span class="t"> <span class="com"># Take the newline as well if present</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3386" href="#t3386">3386</a></span><span class="t"> <span class="key">if</span> <span class="nam">nl</span> <span class="key">and</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">nl</span><span class="op">,</span> <span class="nam">Deb822NewlineAfterValueToken</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3387" href="#t3387">3387</a></span><span class="t"> <span class="nam">next</span><span class="op">(</span><span class="nam">buffered_stream</span><span class="op">,</span> <span class="key">None</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3388" href="#t3388">3388</a></span><span class="t"> <span class="nam">error_tokens</span><span class="op">.</span><span class="nam">append</span><span class="op">(</span><span class="nam">nl</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3389" href="#t3389">3389</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822ErrorElement</span><span class="op">(</span><span class="nam">error_tokens</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3390" href="#t3390">3390</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3391" href="#t3391">3391</a></span><span class="t"> <span class="com"># Token is not part of a field, emit it as-is</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3392" href="#t3392">3392</a></span><span class="t"> <span class="key">yield</span> <span class="nam">token_or_element</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3393" href="#t3393">3393</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3394" href="#t3394">3394</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3395" href="#t3395">3395</a></span><span class="t"><span class="key">def</span> <span class="nam">_abort_on_error_tokens</span><span class="op">(</span><span class="nam">sequence</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3396" href="#t3396">3396</a></span><span class="t"> <span class="com"># type: (Iterable[TokenOrElement]) -> Iterable[TokenOrElement]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3397" href="#t3397">3397</a></span><span class="t"> <span class="nam">line_no</span> <span class="op">=</span> <span class="num">1</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3398" href="#t3398">3398</a></span><span class="t"> <span class="key">for</span> <span class="nam">token</span> <span class="key">in</span> <span class="nam">sequence</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3399" href="#t3399">3399</a></span><span class="t"> <span class="com"># We are always called while the sequence consists entirely of tokens</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t3400" href="#t3400">3400</a></span><span class="t"> <span class="key">if</span> <span class="nam">token</span><span class="op">.</span><span class="nam">is_error</span><span class="op">:</span> </span><span class="r"><span class="annotate short">3400 ↛ 3401</span><span class="annotate long">line 3400 didn't jump to line 3401, because the condition on line 3400 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t3401" href="#t3401">3401</a></span><span class="t"> <span class="nam">error_as_text</span> <span class="op">=</span> <span class="nam">token</span><span class="op">.</span><span class="nam">convert_to_text</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">"\n"</span><span class="op">,</span> <span class="str">"\\n"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3402" href="#t3402">3402</a></span><span class="t"> <span class="key">raise</span> <span class="nam">SyntaxOrParseError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3403" href="#t3403">3403</a></span><span class="t"> <span class="str">'Syntax or Parse error on or near line {line_no}: "{error_as_text}"'</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3404" href="#t3404">3404</a></span><span class="t"> <span class="nam">error_as_text</span><span class="op">=</span><span class="nam">error_as_text</span><span class="op">,</span> <span class="nam">line_no</span><span class="op">=</span><span class="nam">line_no</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3405" href="#t3405">3405</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3406" href="#t3406">3406</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3407" href="#t3407">3407</a></span><span class="t"> <span class="nam">line_no</span> <span class="op">+=</span> <span class="nam">token</span><span class="op">.</span><span class="nam">convert_to_text</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">count</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3408" href="#t3408">3408</a></span><span class="t"> <span class="key">yield</span> <span class="nam">token</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3409" href="#t3409">3409</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3410" href="#t3410">3410</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3411" href="#t3411">3411</a></span><span class="t"><span class="key">def</span> <span class="nam">parse_deb822_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3412" href="#t3412">3412</a></span><span class="t"> <span class="nam">sequence</span><span class="op">,</span> <span class="com"># type: Union[Iterable[Union[str, bytes]], str]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3413" href="#t3413">3413</a></span><span class="t"> <span class="op">*</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3414" href="#t3414">3414</a></span><span class="t"> <span class="nam">accept_files_with_error_tokens</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> <span class="com"># type: bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3415" href="#t3415">3415</a></span><span class="t"> <span class="nam">accept_files_with_duplicated_fields</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> <span class="com"># type: bool</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3416" href="#t3416">3416</a></span><span class="t"> <span class="nam">encoding</span><span class="op">=</span><span class="str">"utf-8"</span><span class="op">,</span> <span class="com"># type: str</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3417" href="#t3417">3417</a></span><span class="t"><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3418" href="#t3418">3418</a></span><span class="t"> <span class="com"># type: (...) -> Deb822FileElement</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3419" href="#t3419">3419</a></span><span class="t"> <span class="str">"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3420" href="#t3420">3420</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3421" href="#t3421">3421</a></span><span class="t"><span class="str"> :param sequence: An iterable over lines of str or bytes (an open file for</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3422" href="#t3422">3422</a></span><span class="t"><span class="str"> reading will do). If line endings are provided in the input, then they</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3423" href="#t3423">3423</a></span><span class="t"><span class="str"> must be present on every line (except the last) will be preserved as-is.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3424" href="#t3424">3424</a></span><span class="t"><span class="str"> If omitted and the content is at least 2 lines, then parser will assume</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3425" href="#t3425">3425</a></span><span class="t"><span class="str"> implicit newlines.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3426" href="#t3426">3426</a></span><span class="t"><span class="str"> :param accept_files_with_error_tokens: If True, files with critical syntax</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3427" href="#t3427">3427</a></span><span class="t"><span class="str"> or parse errors will be returned as "successfully" parsed. Usually,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3428" href="#t3428">3428</a></span><span class="t"><span class="str"> working on files with this kind of errors are not desirable as it is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3429" href="#t3429">3429</a></span><span class="t"><span class="str"> hard to make sense of such files (and they might in fact not be a deb822</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3430" href="#t3430">3430</a></span><span class="t"><span class="str"> file at all). When set to False (the default) a ValueError is raised if</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3431" href="#t3431">3431</a></span><span class="t"><span class="str"> there is a critical syntax or parse error.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3432" href="#t3432">3432</a></span><span class="t"><span class="str"> Note that duplicated fields in a paragraph is not considered a critical</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3433" href="#t3433">3433</a></span><span class="t"><span class="str"> parse error by this parser as the implementation can gracefully cope</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3434" href="#t3434">3434</a></span><span class="t"><span class="str"> with these. Use accept_files_with_duplicated_fields to determine if</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3435" href="#t3435">3435</a></span><span class="t"><span class="str"> such files should be accepted.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3436" href="#t3436">3436</a></span><span class="t"><span class="str"> :param accept_files_with_duplicated_fields: If True, then</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3437" href="#t3437">3437</a></span><span class="t"><span class="str"> files containing paragraphs with duplicated fields will be returned as</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3438" href="#t3438">3438</a></span><span class="t"><span class="str"> "successfully" parsed even though they are invalid according to the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3439" href="#t3439">3439</a></span><span class="t"><span class="str"> specification. The paragraphs will prefer the first appearance of the</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3440" href="#t3440">3440</a></span><span class="t"><span class="str"> field unless caller explicitly requests otherwise (e.g., via</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3441" href="#t3441">3441</a></span><span class="t"><span class="str"> Deb822ParagraphElement.configured_view). If False, then this method</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3442" href="#t3442">3442</a></span><span class="t"><span class="str"> will raise a ValueError if any duplicated fields are seen inside any</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3443" href="#t3443">3443</a></span><span class="t"><span class="str"> paragraph.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3444" href="#t3444">3444</a></span><span class="t"><span class="str"> :param encoding: The encoding to use (this is here to support Deb822-like</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3445" href="#t3445">3445</a></span><span class="t"><span class="str"> APIs, new code should not use this parameter).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3446" href="#t3446">3446</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3447" href="#t3447">3447</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t3448" href="#t3448">3448</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">sequence</span><span class="op">,</span> <span class="op">(</span><span class="nam">str</span><span class="op">,</span> <span class="nam">bytes</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">3448 ↛ 3450</span><span class="annotate long">line 3448 didn't jump to line 3450, because the condition on line 3448 was never true</span></span></p> - <p class="pln"><span class="n"><a id="t3449" href="#t3449">3449</a></span><span class="t"> <span class="com"># Match the deb822 API.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3450" href="#t3450">3450</a></span><span class="t"> <span class="nam">sequence</span> <span class="op">=</span> <span class="nam">sequence</span><span class="op">.</span><span class="nam">splitlines</span><span class="op">(</span><span class="key">True</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3451" href="#t3451">3451</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3452" href="#t3452">3452</a></span><span class="t"> <span class="com"># The order of operations are important here. As an example,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3453" href="#t3453">3453</a></span><span class="t"> <span class="com"># _build_value_line assumes that all comment tokens have been merged</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3454" href="#t3454">3454</a></span><span class="t"> <span class="com"># into comment elements. Likewise, _build_field_and_value assumes</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3455" href="#t3455">3455</a></span><span class="t"> <span class="com"># that value tokens (along with their comments) have been combined</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3456" href="#t3456">3456</a></span><span class="t"> <span class="com"># into elements.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3457" href="#t3457">3457</a></span><span class="t"> <span class="nam">tokens</span> <span class="op">=</span> <span class="nam">tokenize_deb822_file</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3458" href="#t3458">3458</a></span><span class="t"> <span class="nam">sequence</span><span class="op">,</span> <span class="nam">encoding</span><span class="op">=</span><span class="nam">encoding</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3459" href="#t3459">3459</a></span><span class="t"> <span class="op">)</span> <span class="com"># type: Iterable[TokenOrElement]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3460" href="#t3460">3460</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">accept_files_with_error_tokens</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3461" href="#t3461">3461</a></span><span class="t"> <span class="nam">tokens</span> <span class="op">=</span> <span class="nam">_abort_on_error_tokens</span><span class="op">(</span><span class="nam">tokens</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3462" href="#t3462">3462</a></span><span class="t"> <span class="nam">tokens</span> <span class="op">=</span> <span class="nam">_combine_comment_tokens_into_elements</span><span class="op">(</span><span class="nam">tokens</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3463" href="#t3463">3463</a></span><span class="t"> <span class="nam">tokens</span> <span class="op">=</span> <span class="nam">_build_value_line</span><span class="op">(</span><span class="nam">tokens</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3464" href="#t3464">3464</a></span><span class="t"> <span class="nam">tokens</span> <span class="op">=</span> <span class="nam">_combine_vl_elements_into_value_elements</span><span class="op">(</span><span class="nam">tokens</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3465" href="#t3465">3465</a></span><span class="t"> <span class="nam">tokens</span> <span class="op">=</span> <span class="nam">_build_field_with_value</span><span class="op">(</span><span class="nam">tokens</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3466" href="#t3466">3466</a></span><span class="t"> <span class="nam">tokens</span> <span class="op">=</span> <span class="nam">_combine_kvp_elements_into_paragraphs</span><span class="op">(</span><span class="nam">tokens</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3467" href="#t3467">3467</a></span><span class="t"> <span class="com"># Combine any free-floating error tokens into error elements. We do</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3468" href="#t3468">3468</a></span><span class="t"> <span class="com"># this last as it enables other parts of the parser to include error</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3469" href="#t3469">3469</a></span><span class="t"> <span class="com"># tokens in their error elements if they discover something is wrong.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3470" href="#t3470">3470</a></span><span class="t"> <span class="nam">tokens</span> <span class="op">=</span> <span class="nam">_combine_error_tokens_into_elements</span><span class="op">(</span><span class="nam">tokens</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3471" href="#t3471">3471</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3472" href="#t3472">3472</a></span><span class="t"> <span class="nam">deb822_file</span> <span class="op">=</span> <span class="nam">Deb822FileElement</span><span class="op">(</span><span class="nam">LinkedList</span><span class="op">(</span><span class="nam">tokens</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3473" href="#t3473">3473</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3474" href="#t3474">3474</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">accept_files_with_duplicated_fields</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3475" href="#t3475">3475</a></span><span class="t"> <span class="key">for</span> <span class="nam">no</span><span class="op">,</span> <span class="nam">paragraph</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">deb822_file</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t3476" href="#t3476">3476</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">paragraph</span><span class="op">,</span> <span class="nam">Deb822DuplicateFieldsParagraphElement</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">3476 ↛ 3477</span><span class="annotate long">line 3476 didn't jump to line 3477, because the condition on line 3476 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t3477" href="#t3477">3477</a></span><span class="t"> <span class="nam">field_names</span> <span class="op">=</span> <span class="nam">set</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3478" href="#t3478">3478</a></span><span class="t"> <span class="nam">dup_field</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3479" href="#t3479">3479</a></span><span class="t"> <span class="key">for</span> <span class="nam">field</span> <span class="key">in</span> <span class="nam">paragraph</span><span class="op">.</span><span class="nam">keys</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3480" href="#t3480">3480</a></span><span class="t"> <span class="nam">field_name</span><span class="op">,</span> <span class="nam">_</span><span class="op">,</span> <span class="nam">_</span> <span class="op">=</span> <span class="nam">_unpack_key</span><span class="op">(</span><span class="nam">field</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3481" href="#t3481">3481</a></span><span class="t"> <span class="com"># assert for mypy</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3482" href="#t3482">3482</a></span><span class="t"> <span class="key">assert</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">field_name</span><span class="op">,</span> <span class="nam">str</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3483" href="#t3483">3483</a></span><span class="t"> <span class="key">if</span> <span class="nam">field_name</span> <span class="key">in</span> <span class="nam">field_names</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3484" href="#t3484">3484</a></span><span class="t"> <span class="nam">dup_field</span> <span class="op">=</span> <span class="nam">field_name</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3485" href="#t3485">3485</a></span><span class="t"> <span class="key">break</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3486" href="#t3486">3486</a></span><span class="t"> <span class="nam">field_names</span><span class="op">.</span><span class="nam">add</span><span class="op">(</span><span class="nam">field_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3487" href="#t3487">3487</a></span><span class="t"> <span class="key">if</span> <span class="nam">dup_field</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3488" href="#t3488">3488</a></span><span class="t"> <span class="nam">msg</span> <span class="op">=</span> <span class="str">'Duplicate field "{dup_field}" in paragraph number {no}'</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3489" href="#t3489">3489</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="nam">msg</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span><span class="nam">dup_field</span><span class="op">=</span><span class="nam">dup_field</span><span class="op">,</span> <span class="nam">no</span><span class="op">=</span><span class="nam">no</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3490" href="#t3490">3490</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3491" href="#t3491">3491</a></span><span class="t"> <span class="key">return</span> <span class="nam">deb822_file</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3492" href="#t3492">3492</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3493" href="#t3493">3493</a></span><span class="t"> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t3494" href="#t3494">3494</a></span><span class="t"><span class="key">if</span> <span class="nam">__name__</span> <span class="op">==</span> <span class="str">"__main__"</span><span class="op">:</span> <span class="com"># pragma: no cover</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t3495" href="#t3495">3495</a></span><span class="t"> <span class="key">import</span> <span class="nam">doctest</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3496" href="#t3496">3496</a></span><span class="t"> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t3497" href="#t3497">3497</a></span><span class="t"> <span class="nam">doctest</span><span class="op">.</span><span class="nam">testmod</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_e9c451f4ae334f76_locatable_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_e9c451f4ae334f76_tokens_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_e9c451f4ae334f76_tokens_py.html b/coverage-report/d_e9c451f4ae334f76_tokens_py.html deleted file mode 100644 index 0df9eb4..0000000 --- a/coverage-report/d_e9c451f4ae334f76_tokens_py.html +++ /dev/null @@ -1,615 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/lsp/vendoring/_deb822_repro/tokens.py: 83%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/lsp/vendoring/_deb822_repro/tokens.py</b>: - <span class="pc_cov">83%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">230 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">198<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">32<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">4<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">13<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_e9c451f4ae334f76_parsing_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_e9c451f4ae334f76_types_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">import</span> <span class="nam">re</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">sys</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">weakref</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"><span class="key">from</span> <span class="nam">weakref</span> <span class="key">import</span> <span class="nam">ReferenceType</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">_util</span> <span class="key">import</span> <span class="nam">BufferingIterator</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">from</span> <span class="op">.</span><span class="nam">locatable</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">Locatable</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">START_POSITION</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="nam">Range</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">ONE_CHAR_RANGE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> <span class="nam">ONE_LINE_RANGE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">Position</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"><span class="key">from</span> <span class="nam">debian</span><span class="op">.</span><span class="nam">_util</span> <span class="key">import</span> <span class="nam">resolve_ref</span><span class="op">,</span> <span class="nam">_strI</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"><span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> <span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">Optional</span><span class="op">,</span> <span class="nam">cast</span><span class="op">,</span> <span class="nam">TYPE_CHECKING</span><span class="op">,</span> <span class="nam">Iterable</span><span class="op">,</span> <span class="nam">Union</span><span class="op">,</span> <span class="nam">Dict</span><span class="op">,</span> <span class="nam">Callable</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"><span class="key">except</span> <span class="nam">ImportError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> <span class="com"># pylint: disable=unnecessary-lambda-assignment</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">TYPE_CHECKING</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> <span class="nam">cast</span> <span class="op">=</span> <span class="key">lambda</span> <span class="nam">t</span><span class="op">,</span> <span class="nam">v</span><span class="op">:</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"><span class="key">if</span> <span class="nam">TYPE_CHECKING</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> <span class="key">from</span> <span class="op">.</span><span class="nam">parsing</span> <span class="key">import</span> <span class="nam">Deb822Element</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"><span class="com"># Consume whitespace and a single word.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"><span class="nam">_RE_WHITESPACE_SEPARATED_WORD_LIST</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="str">r"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"><span class="str"> (?P<space_before>\s*) # Consume any whitespace before the word</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"><span class="str"> # The space only occurs in practise if the line starts</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"><span class="str"> # with space.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"><span class="str"> # Optionally consume a word (needed to handle the case</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"><span class="str"> # when there are no words left and someone applies this</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="str"> # pattern to the remaining text). This is mostly here as</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"><span class="str"> # a fail-safe.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"><span class="str"> (?P<word>\S+) # Consume the word (if present)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"><span class="str"> (?P<trailing_whitespace>\s*) # Consume trailing whitespace</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"><span class="str">"""</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"> <span class="nam">re</span><span class="op">.</span><span class="nam">VERBOSE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"><span class="nam">_RE_COMMA_SEPARATED_WORD_LIST</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"> <span class="str">r"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"><span class="str"> # This regex is slightly complicated by the fact that it should work with</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"><span class="str"> # finditer and consume the entire value.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"><span class="str"> #</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"><span class="str"> # To do this, we structure the regex so it always starts on a comma (except</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"><span class="str"> # for the first iteration, where we permit the absence of a comma)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"><span class="str"> (?: # Optional space followed by a mandatory comma unless</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"><span class="str"> # it is the start of the "line" (in which case, we</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"><span class="str"> # allow the comma to be omitted)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"><span class="str"> ^</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"><span class="str"> |</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"><span class="str"> (?:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"><span class="str"> (?P<space_before_comma>\s*) # This space only occurs in practise if the line</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"><span class="str"> # starts with space + comma.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"><span class="str"> (?P<comma> ,)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"><span class="str"> )</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"><span class="str"> )</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"><span class="str"> # From here it is "optional space, maybe a word and then optional space" again. One reason why</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"><span class="str"> # all of it is optional is to gracefully cope with trailing commas.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"><span class="str"> (?P<space_before_word>\s*)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"><span class="str"> (?P<word> [^,\s] (?: [^,]*[^,\s])? )? # "Words" can contain spaces for comma separated list.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"><span class="str"> # But surrounding whitespace is ignored</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"><span class="str"> (?P<space_after_word>\s*)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"><span class="str">"""</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> <span class="nam">re</span><span class="op">.</span><span class="nam">VERBOSE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"><span class="com"># From Policy 5.1:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"><span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"><span class="com"># The field name is composed of US-ASCII characters excluding control</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"><span class="com"># characters, space, and colon (i.e., characters in the ranges U+0021</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"><span class="com"># (!) through U+0039 (9), and U+003B (;) through U+007E (~),</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"><span class="com"># inclusive). Field names must not begin with the comment character</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"><span class="com"># (U+0023 #), nor with the hyphen character (U+002D -).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"><span class="com">#</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"><span class="com"># That combines to this regex of questionable readability</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"><span class="nam">_RE_FIELD_LINE</span> <span class="op">=</span> <span class="nam">re</span><span class="op">.</span><span class="nam">compile</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"> <span class="str">r"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"><span class="str"> ^ # Start of line</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"><span class="str"> (?P<field_name> # Capture group for the field name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"><span class="str"> [\x21\x22\x24-\x2C\x2F-\x39\x3B-\x7F] # First character</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"><span class="str"> [\x21-\x39\x3B-\x7F]* # Subsequent characters (if any)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"><span class="str"> )</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"><span class="str"> (?P<separator> : )</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"><span class="str"> (?P<space_before_value> \s* )</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"><span class="str"> (?: # Field values are not mandatory on the same line</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t94" href="#t94">94</a></span><span class="t"><span class="str"> # as the field name.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t95" href="#t95">95</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t96" href="#t96">96</a></span><span class="t"><span class="str"> (?P<value> \S(?:.*\S)? ) # Values must start and end on a "non-space"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t97" href="#t97">97</a></span><span class="t"><span class="str"> (?P<space_after_value> \s* ) # We can have optional space after the value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t98" href="#t98">98</a></span><span class="t"><span class="str"> )?</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t99" href="#t99">99</a></span><span class="t"><span class="str">"""</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t100" href="#t100">100</a></span><span class="t"> <span class="nam">re</span><span class="op">.</span><span class="nam">VERBOSE</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t101" href="#t101">101</a></span><span class="t"><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t102" href="#t102">102</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t103" href="#t103">103</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t104" href="#t104">104</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822Token</span><span class="op">(</span><span class="nam">Locatable</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t105" href="#t105">105</a></span><span class="t"> <span class="str">"""A token is an atomic syntactical element from a deb822 file</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t106" href="#t106">106</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t107" href="#t107">107</a></span><span class="t"><span class="str"> A file is parsed into a series of tokens. If these tokens are converted to</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t108" href="#t108">108</a></span><span class="t"><span class="str"> text in exactly the same order, you get exactly the same file - bit-for-bit.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t109" href="#t109">109</a></span><span class="t"><span class="str"> Accordingly ever bit of text in a file must be assigned to exactly one</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t110" href="#t110">110</a></span><span class="t"><span class="str"> Deb822Token.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t111" href="#t111">111</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t112" href="#t112">112</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t113" href="#t113">113</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="str">"_text"</span><span class="op">,</span> <span class="str">"_parent_element"</span><span class="op">,</span> <span class="str">"_token_size"</span><span class="op">,</span> <span class="str">"__weakref__"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t114" href="#t114">114</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t115" href="#t115">115</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">text</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t116" href="#t116">116</a></span><span class="t"> <span class="com"># type: (str) -> None</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t117" href="#t117">117</a></span><span class="t"> <span class="key">if</span> <span class="nam">text</span> <span class="op">==</span> <span class="str">""</span><span class="op">:</span> <span class="com"># pragma: no cover</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t118" href="#t118">118</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"Tokens must have content"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t119" href="#t119">119</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_text</span> <span class="op">=</span> <span class="nam">text</span> <span class="com"># type: str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t120" href="#t120">120</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent_element</span> <span class="op">=</span> <span class="key">None</span> <span class="com"># type: Optional[ReferenceType['Deb822Element']]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t121" href="#t121">121</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_size</span> <span class="op">=</span> <span class="key">None</span> <span class="com"># type: Optional[Range]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t122" href="#t122">122</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_verify_token_text</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t123" href="#t123">123</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t124" href="#t124">124</a></span><span class="t"> <span class="key">def</span> <span class="nam">__repr__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t125" href="#t125">125</a></span><span class="t"> <span class="com"># type: () -> str</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t126" href="#t126">126</a></span><span class="t"> <span class="key">return</span> <span class="str">"{clsname}('{text}')"</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t127" href="#t127">127</a></span><span class="t"> <span class="nam">clsname</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">__class__</span><span class="op">.</span><span class="nam">__name__</span><span class="op">,</span> <span class="nam">text</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">_text</span><span class="op">.</span><span class="nam">replace</span><span class="op">(</span><span class="str">"\n"</span><span class="op">,</span> <span class="str">"\\n"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t128" href="#t128">128</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t129" href="#t129">129</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t130" href="#t130">130</a></span><span class="t"> <span class="key">def</span> <span class="nam">_verify_token_text</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t131" href="#t131">131</a></span><span class="t"> <span class="com"># type: () -> None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t132" href="#t132">132</a></span><span class="t"> <span class="key">if</span> <span class="str">"\n"</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_text</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t133" href="#t133">133</a></span><span class="t"> <span class="nam">is_single_line_token</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t134" href="#t134">134</a></span><span class="t"> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_comment</span> <span class="key">or</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_error</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t135" href="#t135">135</a></span><span class="t"> <span class="nam">is_single_line_token</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t136" href="#t136">136</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">is_single_line_token</span> <span class="key">and</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">is_whitespace</span><span class="op">:</span> </span><span class="r"><span class="annotate short">136 ↛ 137</span><span class="annotate long">line 136 didn't jump to line 137, because the condition on line 136 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t137" href="#t137">137</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t138" href="#t138">138</a></span><span class="t"> <span class="str">"Only whitespace, error and comment tokens may contain newlines"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t139" href="#t139">139</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t140" href="#t140">140</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">self</span><span class="op">.</span><span class="nam">text</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">140 ↛ 141</span><span class="annotate long">line 140 didn't jump to line 141, because the condition on line 140 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t141" href="#t141">141</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span><span class="str">"Tokens containing whitespace must end on a newline"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t142" href="#t142">142</a></span><span class="t"> <span class="key">if</span> <span class="nam">is_single_line_token</span> <span class="key">and</span> <span class="str">"\n"</span> <span class="key">in</span> <span class="nam">self</span><span class="op">.</span><span class="nam">text</span><span class="op">[</span><span class="op">:</span><span class="op">-</span><span class="num">1</span><span class="op">]</span><span class="op">:</span> </span><span class="r"><span class="annotate short">142 ↛ 143</span><span class="annotate long">line 142 didn't jump to line 143, because the condition on line 142 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t143" href="#t143">143</a></span><span class="t"> <span class="key">raise</span> <span class="nam">ValueError</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t144" href="#t144">144</a></span><span class="t"> <span class="str">"Comments and error tokens must not contain embedded newlines"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t145" href="#t145">145</a></span><span class="t"> <span class="str">" (only end on one)"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t146" href="#t146">146</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t147" href="#t147">147</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t148" href="#t148">148</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t149" href="#t149">149</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_whitespace</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t150" href="#t150">150</a></span><span class="t"> <span class="com"># type: () -> bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t151" href="#t151">151</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t152" href="#t152">152</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t153" href="#t153">153</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t154" href="#t154">154</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_comment</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t155" href="#t155">155</a></span><span class="t"> <span class="com"># type: () -> bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t156" href="#t156">156</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t157" href="#t157">157</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t158" href="#t158">158</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t159" href="#t159">159</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_error</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t160" href="#t160">160</a></span><span class="t"> <span class="com"># type: () -> bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t161" href="#t161">161</a></span><span class="t"> <span class="key">return</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t162" href="#t162">162</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t163" href="#t163">163</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t164" href="#t164">164</a></span><span class="t"> <span class="key">def</span> <span class="nam">text</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t165" href="#t165">165</a></span><span class="t"> <span class="com"># type: () -> str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t166" href="#t166">166</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_text</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t167" href="#t167">167</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t168" href="#t168">168</a></span><span class="t"> <span class="com"># To support callers that want a simple interface for converting tokens and elements to text</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t169" href="#t169">169</a></span><span class="t"> <span class="key">def</span> <span class="nam">convert_to_text</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t170" href="#t170">170</a></span><span class="t"> <span class="com"># type: () -> str</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t171" href="#t171">171</a></span><span class="t"> <span class="key">return</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_text</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t172" href="#t172">172</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t173" href="#t173">173</a></span><span class="t"> <span class="key">def</span> <span class="nam">size</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="op">*</span><span class="op">,</span> <span class="nam">skip_leading_comments</span><span class="op">:</span> <span class="nam">bool</span> <span class="op">=</span> <span class="key">False</span><span class="op">)</span> <span class="op">-></span> <span class="nam">Range</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t174" href="#t174">174</a></span><span class="t"> <span class="com"># As tokens are an atomic unit</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t175" href="#t175">175</a></span><span class="t"> <span class="nam">token_size</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_size</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t176" href="#t176">176</a></span><span class="t"> <span class="key">if</span> <span class="nam">token_size</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t177" href="#t177">177</a></span><span class="t"> <span class="key">return</span> <span class="nam">token_size</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t178" href="#t178">178</a></span><span class="t"> <span class="nam">token_len</span> <span class="op">=</span> <span class="nam">len</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_text</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t179" href="#t179">179</a></span><span class="t"> <span class="key">if</span> <span class="nam">token_len</span> <span class="op">==</span> <span class="num">1</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t180" href="#t180">180</a></span><span class="t"> <span class="com"># The indirection with `r` because mypy gets confused and thinks that `token_size`</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t181" href="#t181">181</a></span><span class="t"> <span class="com"># cannot have any type at all.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t182" href="#t182">182</a></span><span class="t"> <span class="nam">token_size</span> <span class="op">=</span> <span class="nam">ONE_CHAR_RANGE</span> <span class="key">if</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_text</span> <span class="op">!=</span> <span class="str">"\n"</span> <span class="key">else</span> <span class="nam">ONE_LINE_RANGE</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t183" href="#t183">183</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t184" href="#t184">184</a></span><span class="t"> <span class="nam">new_lines</span> <span class="op">=</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_text</span><span class="op">.</span><span class="nam">count</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t185" href="#t185">185</a></span><span class="t"> <span class="key">assert</span> <span class="key">not</span> <span class="nam">new_lines</span> <span class="key">or</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_text</span><span class="op">[</span><span class="op">-</span><span class="num">1</span><span class="op">]</span> <span class="op">==</span> <span class="str">"\n"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t186" href="#t186">186</a></span><span class="t"> <span class="nam">end_pos</span> <span class="op">=</span> <span class="nam">Position</span><span class="op">(</span><span class="nam">new_lines</span><span class="op">,</span> <span class="num">0</span><span class="op">)</span> <span class="key">if</span> <span class="nam">new_lines</span> <span class="key">else</span> <span class="nam">Position</span><span class="op">(</span><span class="num">0</span><span class="op">,</span> <span class="nam">token_len</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t187" href="#t187">187</a></span><span class="t"> <span class="nam">token_size</span> <span class="op">=</span> <span class="nam">Range</span><span class="op">(</span><span class="nam">START_POSITION</span><span class="op">,</span> <span class="nam">end_pos</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t188" href="#t188">188</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_token_size</span> <span class="op">=</span> <span class="nam">token_size</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t189" href="#t189">189</a></span><span class="t"> <span class="key">return</span> <span class="nam">token_size</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t190" href="#t190">190</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t191" href="#t191">191</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t192" href="#t192">192</a></span><span class="t"> <span class="key">def</span> <span class="nam">parent_element</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t193" href="#t193">193</a></span><span class="t"> <span class="com"># type: () -> Optional[Deb822Element]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t194" href="#t194">194</a></span><span class="t"> <span class="key">return</span> <span class="nam">resolve_ref</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">_parent_element</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t195" href="#t195">195</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t196" href="#t196">196</a></span><span class="t"> <span class="op">@</span><span class="nam">parent_element</span><span class="op">.</span><span class="nam">setter</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t197" href="#t197">197</a></span><span class="t"> <span class="key">def</span> <span class="nam">parent_element</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">new_parent</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t198" href="#t198">198</a></span><span class="t"> <span class="com"># type: (Optional[Deb822Element]) -> None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t199" href="#t199">199</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent_element</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t200" href="#t200">200</a></span><span class="t"> <span class="nam">weakref</span><span class="op">.</span><span class="nam">ref</span><span class="op">(</span><span class="nam">new_parent</span><span class="op">)</span> <span class="key">if</span> <span class="nam">new_parent</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span> <span class="key">else</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t201" href="#t201">201</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t202" href="#t202">202</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t203" href="#t203">203</a></span><span class="t"> <span class="key">def</span> <span class="nam">clear_parent_if_parent</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">parent</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t204" href="#t204">204</a></span><span class="t"> <span class="com"># type: (Deb822Element) -> None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t205" href="#t205">205</a></span><span class="t"> <span class="key">if</span> <span class="nam">parent</span> <span class="key">is</span> <span class="nam">self</span><span class="op">.</span><span class="nam">parent_element</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t206" href="#t206">206</a></span><span class="t"> <span class="nam">self</span><span class="op">.</span><span class="nam">_parent_element</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t207" href="#t207">207</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t208" href="#t208">208</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t209" href="#t209">209</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822WhitespaceToken</span><span class="op">(</span><span class="nam">Deb822Token</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t210" href="#t210">210</a></span><span class="t"> <span class="str">"""The token is a kind of whitespace.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t211" href="#t211">211</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t212" href="#t212">212</a></span><span class="t"><span class="str"> Some whitespace tokens are critical for the format (such as the Deb822ValueContinuationToken,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t213" href="#t213">213</a></span><span class="t"><span class="str"> spaces that separate words in list separated by spaces or newlines), while other whitespace</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t214" href="#t214">214</a></span><span class="t"><span class="str"> tokens are truly insignificant (space before a newline, space after a comma in a comma</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t215" href="#t215">215</a></span><span class="t"><span class="str"> list, etc.).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t216" href="#t216">216</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t217" href="#t217">217</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t218" href="#t218">218</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t219" href="#t219">219</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t220" href="#t220">220</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t221" href="#t221">221</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_whitespace</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t222" href="#t222">222</a></span><span class="t"> <span class="com"># type: () -> bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t223" href="#t223">223</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t224" href="#t224">224</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t225" href="#t225">225</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t226" href="#t226">226</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822SemanticallySignificantWhiteSpace</span><span class="op">(</span><span class="nam">Deb822WhitespaceToken</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t227" href="#t227">227</a></span><span class="t"> <span class="str">"""Whitespace that (if removed) would change the meaning of the file (or cause syntax errors)"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t228" href="#t228">228</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t229" href="#t229">229</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t230" href="#t230">230</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t231" href="#t231">231</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t232" href="#t232">232</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822NewlineAfterValueToken</span><span class="op">(</span><span class="nam">Deb822SemanticallySignificantWhiteSpace</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t233" href="#t233">233</a></span><span class="t"> <span class="str">"""The newline after a value token.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t234" href="#t234">234</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t235" href="#t235">235</a></span><span class="t"><span class="str"> If not followed by a continuation token, this also marks the end of the field.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t236" href="#t236">236</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t237" href="#t237">237</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t238" href="#t238">238</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t239" href="#t239">239</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t240" href="#t240">240</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t241" href="#t241">241</a></span><span class="t"> <span class="com"># type: () -> None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t242" href="#t242">242</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t243" href="#t243">243</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t244" href="#t244">244</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t245" href="#t245">245</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822ValueContinuationToken</span><span class="op">(</span><span class="nam">Deb822SemanticallySignificantWhiteSpace</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t246" href="#t246">246</a></span><span class="t"> <span class="str">"""The whitespace denoting a value spanning an additional line (the first space on a line)"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t247" href="#t247">247</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t248" href="#t248">248</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t249" href="#t249">249</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t250" href="#t250">250</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t251" href="#t251">251</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822SpaceSeparatorToken</span><span class="op">(</span><span class="nam">Deb822SemanticallySignificantWhiteSpace</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t252" href="#t252">252</a></span><span class="t"> <span class="str">"""Whitespace between values in a space list (e.g. "Architectures")"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t253" href="#t253">253</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t254" href="#t254">254</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t255" href="#t255">255</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t256" href="#t256">256</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t257" href="#t257">257</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822ErrorToken</span><span class="op">(</span><span class="nam">Deb822Token</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t258" href="#t258">258</a></span><span class="t"> <span class="str">"""Token that represents a syntactical error"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t259" href="#t259">259</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t260" href="#t260">260</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t261" href="#t261">261</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t262" href="#t262">262</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t263" href="#t263">263</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_error</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t264" href="#t264">264</a></span><span class="t"> <span class="com"># type: () -> bool</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t265" href="#t265">265</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t266" href="#t266">266</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t267" href="#t267">267</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t268" href="#t268">268</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822CommentToken</span><span class="op">(</span><span class="nam">Deb822Token</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t269" href="#t269">269</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t270" href="#t270">270</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t271" href="#t271">271</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t272" href="#t272">272</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t273" href="#t273">273</a></span><span class="t"> <span class="key">def</span> <span class="nam">is_comment</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t274" href="#t274">274</a></span><span class="t"> <span class="com"># type: () -> bool</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t275" href="#t275">275</a></span><span class="t"> <span class="key">return</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t276" href="#t276">276</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t277" href="#t277">277</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t278" href="#t278">278</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822FieldNameToken</span><span class="op">(</span><span class="nam">Deb822Token</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t279" href="#t279">279</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t280" href="#t280">280</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t281" href="#t281">281</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t282" href="#t282">282</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">text</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t283" href="#t283">283</a></span><span class="t"> <span class="com"># type: (str) -> None</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t284" href="#t284">284</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">text</span><span class="op">,</span> <span class="nam">_strI</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">284 ↛ 285</span><span class="annotate long">line 284 didn't jump to line 285, because the condition on line 284 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t285" href="#t285">285</a></span><span class="t"> <span class="nam">text</span> <span class="op">=</span> <span class="nam">_strI</span><span class="op">(</span><span class="nam">sys</span><span class="op">.</span><span class="nam">intern</span><span class="op">(</span><span class="nam">text</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t286" href="#t286">286</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="nam">text</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t287" href="#t287">287</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t288" href="#t288">288</a></span><span class="t"> <span class="op">@</span><span class="nam">property</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t289" href="#t289">289</a></span><span class="t"> <span class="key">def</span> <span class="nam">text</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t290" href="#t290">290</a></span><span class="t"> <span class="com"># type: () -> _strI</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t291" href="#t291">291</a></span><span class="t"> <span class="key">return</span> <span class="nam">cast</span><span class="op">(</span><span class="str">"_strI"</span><span class="op">,</span> <span class="nam">self</span><span class="op">.</span><span class="nam">_text</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t292" href="#t292">292</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t293" href="#t293">293</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t294" href="#t294">294</a></span><span class="t"><span class="com"># The colon after the field name, parenthesis, etc.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t295" href="#t295">295</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822SeparatorToken</span><span class="op">(</span><span class="nam">Deb822Token</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t296" href="#t296">296</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t297" href="#t297">297</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t298" href="#t298">298</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t299" href="#t299">299</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t300" href="#t300">300</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822FieldSeparatorToken</span><span class="op">(</span><span class="nam">Deb822Token</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t301" href="#t301">301</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t302" href="#t302">302</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t303" href="#t303">303</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t304" href="#t304">304</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t305" href="#t305">305</a></span><span class="t"> <span class="com"># type: () -> None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t306" href="#t306">306</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="str">":"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t307" href="#t307">307</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t308" href="#t308">308</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t309" href="#t309">309</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822CommaToken</span><span class="op">(</span><span class="nam">Deb822SeparatorToken</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t310" href="#t310">310</a></span><span class="t"> <span class="str">"""Used by the comma-separated list value parsers to denote a comma between two value tokens."""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t311" href="#t311">311</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t312" href="#t312">312</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t313" href="#t313">313</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t314" href="#t314">314</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t315" href="#t315">315</a></span><span class="t"> <span class="com"># type: () -> None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t316" href="#t316">316</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="str">","</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t317" href="#t317">317</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t318" href="#t318">318</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t319" href="#t319">319</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822PipeToken</span><span class="op">(</span><span class="nam">Deb822SeparatorToken</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t320" href="#t320">320</a></span><span class="t"> <span class="str">"""Used in some dependency fields as OR relation"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t321" href="#t321">321</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t322" href="#t322">322</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t323" href="#t323">323</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t324" href="#t324">324</a></span><span class="t"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t325" href="#t325">325</a></span><span class="t"> <span class="com"># type: () -> None</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t326" href="#t326">326</a></span><span class="t"> <span class="nam">super</span><span class="op">(</span><span class="op">)</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="str">"|"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t327" href="#t327">327</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t328" href="#t328">328</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t329" href="#t329">329</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822ValueToken</span><span class="op">(</span><span class="nam">Deb822Token</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t330" href="#t330">330</a></span><span class="t"> <span class="str">"""A field value can be split into multi "Deb822ValueToken"s (as well as separator tokens)"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t331" href="#t331">331</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t332" href="#t332">332</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t333" href="#t333">333</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t334" href="#t334">334</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t335" href="#t335">335</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822ValueDependencyToken</span><span class="op">(</span><span class="nam">Deb822Token</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t336" href="#t336">336</a></span><span class="t"> <span class="str">"""Package name, architecture name, a version number, or a profile name in a dependency field"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t337" href="#t337">337</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t338" href="#t338">338</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t339" href="#t339">339</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t340" href="#t340">340</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t341" href="#t341">341</a></span><span class="t"><span class="key">class</span> <span class="nam">Deb822ValueDependencyVersionRelationOperatorToken</span><span class="op">(</span><span class="nam">Deb822Token</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t342" href="#t342">342</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t343" href="#t343">343</a></span><span class="t"> <span class="nam">__slots__</span> <span class="op">=</span> <span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t344" href="#t344">344</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t345" href="#t345">345</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t346" href="#t346">346</a></span><span class="t"><span class="key">def</span> <span class="nam">tokenize_deb822_file</span><span class="op">(</span><span class="nam">sequence</span><span class="op">,</span> <span class="nam">encoding</span><span class="op">=</span><span class="str">"utf-8"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t347" href="#t347">347</a></span><span class="t"> <span class="com"># type: (Iterable[Union[str, bytes]], str) -> Iterable[Deb822Token]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t348" href="#t348">348</a></span><span class="t"> <span class="str">"""Tokenize a deb822 file</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t349" href="#t349">349</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t350" href="#t350">350</a></span><span class="t"><span class="str"> :param sequence: An iterable of lines (a file open for reading will do)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t351" href="#t351">351</a></span><span class="t"><span class="str"> :param encoding: The encoding to use (this is here to support Deb822-like</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t352" href="#t352">352</a></span><span class="t"><span class="str"> APIs, new code should not use this parameter).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t353" href="#t353">353</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t354" href="#t354">354</a></span><span class="t"> <span class="nam">current_field_name</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t355" href="#t355">355</a></span><span class="t"> <span class="nam">field_name_cache</span> <span class="op">=</span> <span class="op">{</span><span class="op">}</span> <span class="com"># type: Dict[str, _strI]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t356" href="#t356">356</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t357" href="#t357">357</a></span><span class="t"> <span class="key">def</span> <span class="nam">_normalize_input</span><span class="op">(</span><span class="nam">s</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t358" href="#t358">358</a></span><span class="t"> <span class="com"># type: (Iterable[Union[str, bytes]]) -> Iterable[str]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t359" href="#t359">359</a></span><span class="t"> <span class="key">for</span> <span class="nam">x</span> <span class="key">in</span> <span class="nam">s</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t360" href="#t360">360</a></span><span class="t"> <span class="key">if</span> <span class="nam">isinstance</span><span class="op">(</span><span class="nam">x</span><span class="op">,</span> <span class="nam">bytes</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">360 ↛ 361</span><span class="annotate long">line 360 didn't jump to line 361, because the condition on line 360 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t361" href="#t361">361</a></span><span class="t"> <span class="nam">x</span> <span class="op">=</span> <span class="nam">x</span><span class="op">.</span><span class="nam">decode</span><span class="op">(</span><span class="nam">encoding</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t362" href="#t362">362</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">x</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t363" href="#t363">363</a></span><span class="t"> <span class="com"># We always end on a newline because it makes a lot of code simpler. The pain</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t364" href="#t364">364</a></span><span class="t"> <span class="com"># points relates to mutations that add content after the last field. Sadly, these</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t365" href="#t365">365</a></span><span class="t"> <span class="com"># mutations can happen via adding fields, reordering fields, etc. and are too hard</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t366" href="#t366">366</a></span><span class="t"> <span class="com"># to track to make it worth it to support the special case that makes up missing</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t367" href="#t367">367</a></span><span class="t"> <span class="com"># a newline at the end of the file.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t368" href="#t368">368</a></span><span class="t"> <span class="nam">x</span> <span class="op">+=</span> <span class="str">"\n"</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t369" href="#t369">369</a></span><span class="t"> <span class="key">yield</span> <span class="nam">x</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t370" href="#t370">370</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t371" href="#t371">371</a></span><span class="t"> <span class="nam">text_stream</span> <span class="op">=</span> <span class="nam">BufferingIterator</span><span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t372" href="#t372">372</a></span><span class="t"> <span class="nam">_normalize_input</span><span class="op">(</span><span class="nam">sequence</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t373" href="#t373">373</a></span><span class="t"> <span class="op">)</span> <span class="com"># type: BufferingIterator[str]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t374" href="#t374">374</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t375" href="#t375">375</a></span><span class="t"> <span class="key">for</span> <span class="nam">line</span> <span class="key">in</span> <span class="nam">text_stream</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t376" href="#t376">376</a></span><span class="t"> <span class="key">if</span> <span class="nam">line</span><span class="op">.</span><span class="nam">isspace</span><span class="op">(</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t377" href="#t377">377</a></span><span class="t"> <span class="key">if</span> <span class="nam">current_field_name</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t378" href="#t378">378</a></span><span class="t"> <span class="com"># Blank lines terminate fields</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t379" href="#t379">379</a></span><span class="t"> <span class="nam">current_field_name</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t380" href="#t380">380</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t381" href="#t381">381</a></span><span class="t"> <span class="com"># If there are multiple whitespace-only lines, we combine them</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t382" href="#t382">382</a></span><span class="t"> <span class="com"># into one token.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t383" href="#t383">383</a></span><span class="t"> <span class="nam">r</span> <span class="op">=</span> <span class="nam">list</span><span class="op">(</span><span class="nam">text_stream</span><span class="op">.</span><span class="nam">takewhile</span><span class="op">(</span><span class="nam">str</span><span class="op">.</span><span class="nam">isspace</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t384" href="#t384">384</a></span><span class="t"> <span class="key">if</span> <span class="nam">r</span><span class="op">:</span> </span><span class="r"><span class="annotate short">384 ↛ 385</span><span class="annotate long">line 384 didn't jump to line 385, because the condition on line 384 was never true</span></span></p> - <p class="mis show_mis"><span class="n"><a id="t385" href="#t385">385</a></span><span class="t"> <span class="nam">line</span> <span class="op">+=</span> <span class="str">""</span><span class="op">.</span><span class="nam">join</span><span class="op">(</span><span class="nam">r</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t386" href="#t386">386</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t387" href="#t387">387</a></span><span class="t"> <span class="com"># whitespace tokens are likely to have duplicate cases (like</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t388" href="#t388">388</a></span><span class="t"> <span class="com"># single newline tokens), so we intern the strings there.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t389" href="#t389">389</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822WhitespaceToken</span><span class="op">(</span><span class="nam">sys</span><span class="op">.</span><span class="nam">intern</span><span class="op">(</span><span class="nam">line</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t390" href="#t390">390</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t391" href="#t391">391</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t392" href="#t392">392</a></span><span class="t"> <span class="key">if</span> <span class="nam">line</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="op">==</span> <span class="str">"#"</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t393" href="#t393">393</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822CommentToken</span><span class="op">(</span><span class="nam">line</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t394" href="#t394">394</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t395" href="#t395">395</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t396" href="#t396">396</a></span><span class="t"> <span class="key">if</span> <span class="nam">line</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> <span class="key">in</span> <span class="op">(</span><span class="str">" "</span><span class="op">,</span> <span class="str">"\t"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t397" href="#t397">397</a></span><span class="t"> <span class="key">if</span> <span class="nam">current_field_name</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">397 ↛ 407</span><span class="annotate long">line 397 didn't jump to line 407, because the condition on line 397 was never false</span></span></p> - <p class="pln"><span class="n"><a id="t398" href="#t398">398</a></span><span class="t"> <span class="com"># We emit a separate whitespace token for the newline as it makes some</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t399" href="#t399">399</a></span><span class="t"> <span class="com"># things easier later (see _build_value_line)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t400" href="#t400">400</a></span><span class="t"> <span class="nam">leading</span> <span class="op">=</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">intern</span><span class="op">(</span><span class="nam">line</span><span class="op">[</span><span class="num">0</span><span class="op">]</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t401" href="#t401">401</a></span><span class="t"> <span class="com"># Pull out the leading space and newline</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t402" href="#t402">402</a></span><span class="t"> <span class="nam">line</span> <span class="op">=</span> <span class="nam">line</span><span class="op">[</span><span class="num">1</span><span class="op">:</span><span class="op">-</span><span class="num">1</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t403" href="#t403">403</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822ValueContinuationToken</span><span class="op">(</span><span class="nam">leading</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t404" href="#t404">404</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822ValueToken</span><span class="op">(</span><span class="nam">line</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t405" href="#t405">405</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822NewlineAfterValueToken</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t406" href="#t406">406</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t407" href="#t407">407</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822ErrorToken</span><span class="op">(</span><span class="nam">line</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t408" href="#t408">408</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t409" href="#t409">409</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t410" href="#t410">410</a></span><span class="t"> <span class="nam">field_line_match</span> <span class="op">=</span> <span class="nam">_RE_FIELD_LINE</span><span class="op">.</span><span class="nam">match</span><span class="op">(</span><span class="nam">line</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t411" href="#t411">411</a></span><span class="t"> <span class="key">if</span> <span class="nam">field_line_match</span><span class="op">:</span> </span><span class="r"><span class="annotate short">411 ↛ 455</span><span class="annotate long">line 411 didn't jump to line 455, because the condition on line 411 was never false</span></span></p> - <p class="pln"><span class="n"><a id="t412" href="#t412">412</a></span><span class="t"> <span class="com"># The line is a field, which means there is a bit to unpack</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t413" href="#t413">413</a></span><span class="t"> <span class="com"># - note that by definition, leading and trailing whitespace is insignificant</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t414" href="#t414">414</a></span><span class="t"> <span class="com"># on the value part directly after the field separator</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t415" href="#t415">415</a></span><span class="t"> <span class="op">(</span><span class="nam">field_name</span><span class="op">,</span> <span class="nam">_</span><span class="op">,</span> <span class="nam">space_before</span><span class="op">,</span> <span class="nam">value</span><span class="op">,</span> <span class="nam">space_after</span><span class="op">)</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t416" href="#t416">416</a></span><span class="t"> <span class="nam">field_line_match</span><span class="op">.</span><span class="nam">groups</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t417" href="#t417">417</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t418" href="#t418">418</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t419" href="#t419">419</a></span><span class="t"> <span class="nam">current_field_name</span> <span class="op">=</span> <span class="nam">field_name_cache</span><span class="op">.</span><span class="nam">get</span><span class="op">(</span><span class="nam">field_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t420" href="#t420">420</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t421" href="#t421">421</a></span><span class="t"> <span class="key">if</span> <span class="nam">value</span> <span class="key">is</span> <span class="key">None</span> <span class="key">or</span> <span class="nam">value</span> <span class="op">==</span> <span class="str">""</span><span class="op">:</span> </span><span class="r"><span class="annotate short">421 ↛ 424</span><span class="annotate long">line 421 didn't jump to line 424</span></span></p> - <p class="pln"><span class="n"><a id="t422" href="#t422">422</a></span><span class="t"> <span class="com"># If there is no value, then merge the two space elements into space_after</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t423" href="#t423">423</a></span><span class="t"> <span class="com"># as it makes it easier to handle the newline.</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t424" href="#t424">424</a></span><span class="t"> <span class="nam">space_after</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t425" href="#t425">425</a></span><span class="t"> <span class="nam">space_before</span> <span class="op">+</span> <span class="nam">space_after</span> <span class="key">if</span> <span class="nam">space_after</span> <span class="key">else</span> <span class="nam">space_before</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t426" href="#t426">426</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t427" href="#t427">427</a></span><span class="t"> <span class="nam">space_before</span> <span class="op">=</span> <span class="str">""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t428" href="#t428">428</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t429" href="#t429">429</a></span><span class="t"> <span class="key">if</span> <span class="nam">space_after</span><span class="op">:</span> </span><span class="r"><span class="annotate short">429 ↛ 435</span><span class="annotate long">line 429 didn't jump to line 435, because the condition on line 429 was never false</span></span></p> - <p class="pln"><span class="n"><a id="t430" href="#t430">430</a></span><span class="t"> <span class="com"># We emit a separate whitespace token for the newline as it makes some</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t431" href="#t431">431</a></span><span class="t"> <span class="com"># things easier later (see _build_value_line)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t432" href="#t432">432</a></span><span class="t"> <span class="key">if</span> <span class="nam">space_after</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"><span class="annotate short">432 ↛ 435</span><span class="annotate long">line 432 didn't jump to line 435, because the condition on line 432 was never false</span></span></p> - <p class="run"><span class="n"><a id="t433" href="#t433">433</a></span><span class="t"> <span class="nam">space_after</span> <span class="op">=</span> <span class="nam">space_after</span><span class="op">[</span><span class="op">:</span><span class="op">-</span><span class="num">1</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t434" href="#t434">434</a></span><span class="t"> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t435" href="#t435">435</a></span><span class="t"> <span class="key">if</span> <span class="nam">current_field_name</span> <span class="key">is</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"><span class="annotate short">435 ↛ 443</span><span class="annotate long">line 435 didn't jump to line 443, because the condition on line 435 was never false</span></span></p> - <p class="run"><span class="n"><a id="t436" href="#t436">436</a></span><span class="t"> <span class="nam">field_name</span> <span class="op">=</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">intern</span><span class="op">(</span><span class="nam">field_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t437" href="#t437">437</a></span><span class="t"> <span class="nam">current_field_name</span> <span class="op">=</span> <span class="nam">_strI</span><span class="op">(</span><span class="nam">field_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t438" href="#t438">438</a></span><span class="t"> <span class="nam">field_name_cache</span><span class="op">[</span><span class="nam">field_name</span><span class="op">]</span> <span class="op">=</span> <span class="nam">current_field_name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t439" href="#t439">439</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t440" href="#t440">440</a></span><span class="t"> <span class="com"># We use current_field_name from here as it is a _strI.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t441" href="#t441">441</a></span><span class="t"> <span class="com"># Delete field_name to avoid accidentally using it and getting bugs</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t442" href="#t442">442</a></span><span class="t"> <span class="com"># that should not happen.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t443" href="#t443">443</a></span><span class="t"> <span class="key">del</span> <span class="nam">field_name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t444" href="#t444">444</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t445" href="#t445">445</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822FieldNameToken</span><span class="op">(</span><span class="nam">current_field_name</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t446" href="#t446">446</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822FieldSeparatorToken</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t447" href="#t447">447</a></span><span class="t"> <span class="key">if</span> <span class="nam">space_before</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t448" href="#t448">448</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822WhitespaceToken</span><span class="op">(</span><span class="nam">sys</span><span class="op">.</span><span class="nam">intern</span><span class="op">(</span><span class="nam">space_before</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="par run show_par"><span class="n"><a id="t449" href="#t449">449</a></span><span class="t"> <span class="key">if</span> <span class="nam">value</span><span class="op">:</span> </span><span class="r"><span class="annotate short">449 ↛ 451</span><span class="annotate long">line 449 didn't jump to line 451, because the condition on line 449 was never false</span></span></p> - <p class="run"><span class="n"><a id="t450" href="#t450">450</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822ValueToken</span><span class="op">(</span><span class="nam">value</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t451" href="#t451">451</a></span><span class="t"> <span class="key">if</span> <span class="nam">space_after</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t452" href="#t452">452</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822WhitespaceToken</span><span class="op">(</span><span class="nam">sys</span><span class="op">.</span><span class="nam">intern</span><span class="op">(</span><span class="nam">space_after</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t453" href="#t453">453</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822NewlineAfterValueToken</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t454" href="#t454">454</a></span><span class="t"> <span class="key">else</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t455" href="#t455">455</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822ErrorToken</span><span class="op">(</span><span class="nam">line</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t456" href="#t456">456</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t457" href="#t457">457</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t458" href="#t458">458</a></span><span class="t"><span class="key">def</span> <span class="nam">_value_line_tokenizer</span><span class="op">(</span><span class="nam">func</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t459" href="#t459">459</a></span><span class="t"> <span class="com"># type: (Callable[[str], Iterable[Deb822Token]]) -> (Callable[[str], Iterable[Deb822Token]])</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t460" href="#t460">460</a></span><span class="t"> <span class="key">def</span> <span class="nam">impl</span><span class="op">(</span><span class="nam">v</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t461" href="#t461">461</a></span><span class="t"> <span class="com"># type: (str) -> Iterable[Deb822Token]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t462" href="#t462">462</a></span><span class="t"> <span class="nam">first_line</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t463" href="#t463">463</a></span><span class="t"> <span class="key">for</span> <span class="nam">no</span><span class="op">,</span> <span class="nam">line</span> <span class="key">in</span> <span class="nam">enumerate</span><span class="op">(</span><span class="nam">v</span><span class="op">.</span><span class="nam">splitlines</span><span class="op">(</span><span class="nam">keepends</span><span class="op">=</span><span class="key">True</span><span class="op">)</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t464" href="#t464">464</a></span><span class="t"> <span class="key">assert</span> <span class="key">not</span> <span class="nam">v</span><span class="op">.</span><span class="nam">isspace</span><span class="op">(</span><span class="op">)</span> <span class="key">or</span> <span class="nam">no</span> <span class="op">==</span> <span class="num">0</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t465" href="#t465">465</a></span><span class="t"> <span class="key">if</span> <span class="nam">line</span><span class="op">.</span><span class="nam">startswith</span><span class="op">(</span><span class="str">"#"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t466" href="#t466">466</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822CommentToken</span><span class="op">(</span><span class="nam">line</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t467" href="#t467">467</a></span><span class="t"> <span class="key">continue</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t468" href="#t468">468</a></span><span class="t"> <span class="nam">has_newline</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t469" href="#t469">469</a></span><span class="t"> <span class="nam">continuation_line_marker</span> <span class="op">=</span> <span class="key">None</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t470" href="#t470">470</a></span><span class="t"> <span class="key">if</span> <span class="key">not</span> <span class="nam">first_line</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t471" href="#t471">471</a></span><span class="t"> <span class="nam">continuation_line_marker</span> <span class="op">=</span> <span class="nam">line</span><span class="op">[</span><span class="num">0</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t472" href="#t472">472</a></span><span class="t"> <span class="nam">line</span> <span class="op">=</span> <span class="nam">line</span><span class="op">[</span><span class="num">1</span><span class="op">:</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t473" href="#t473">473</a></span><span class="t"> <span class="nam">first_line</span> <span class="op">=</span> <span class="key">False</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t474" href="#t474">474</a></span><span class="t"> <span class="key">if</span> <span class="nam">line</span><span class="op">.</span><span class="nam">endswith</span><span class="op">(</span><span class="str">"\n"</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t475" href="#t475">475</a></span><span class="t"> <span class="nam">has_newline</span> <span class="op">=</span> <span class="key">True</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t476" href="#t476">476</a></span><span class="t"> <span class="nam">line</span> <span class="op">=</span> <span class="nam">line</span><span class="op">[</span><span class="op">:</span><span class="op">-</span><span class="num">1</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t477" href="#t477">477</a></span><span class="t"> <span class="key">if</span> <span class="nam">continuation_line_marker</span> <span class="key">is</span> <span class="key">not</span> <span class="key">None</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t478" href="#t478">478</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822ValueContinuationToken</span><span class="op">(</span><span class="nam">sys</span><span class="op">.</span><span class="nam">intern</span><span class="op">(</span><span class="nam">continuation_line_marker</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t479" href="#t479">479</a></span><span class="t"> <span class="key">yield</span> <span class="key">from</span> <span class="nam">func</span><span class="op">(</span><span class="nam">line</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t480" href="#t480">480</a></span><span class="t"> <span class="key">if</span> <span class="nam">has_newline</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t481" href="#t481">481</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822NewlineAfterValueToken</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t482" href="#t482">482</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t483" href="#t483">483</a></span><span class="t"> <span class="key">return</span> <span class="nam">impl</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t484" href="#t484">484</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t485" href="#t485">485</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t486" href="#t486">486</a></span><span class="t"><span class="op">@</span><span class="nam">_value_line_tokenizer</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t487" href="#t487">487</a></span><span class="t"><span class="key">def</span> <span class="nam">whitespace_split_tokenizer</span><span class="op">(</span><span class="nam">v</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t488" href="#t488">488</a></span><span class="t"> <span class="com"># type: (str) -> Iterable[Deb822Token]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t489" href="#t489">489</a></span><span class="t"> <span class="key">assert</span> <span class="str">"\n"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t490" href="#t490">490</a></span><span class="t"> <span class="key">for</span> <span class="nam">match</span> <span class="key">in</span> <span class="nam">_RE_WHITESPACE_SEPARATED_WORD_LIST</span><span class="op">.</span><span class="nam">finditer</span><span class="op">(</span><span class="nam">v</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t491" href="#t491">491</a></span><span class="t"> <span class="nam">space_before</span><span class="op">,</span> <span class="nam">word</span><span class="op">,</span> <span class="nam">space_after</span> <span class="op">=</span> <span class="nam">match</span><span class="op">.</span><span class="nam">groups</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t492" href="#t492">492</a></span><span class="t"> <span class="key">if</span> <span class="nam">space_before</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t493" href="#t493">493</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822SpaceSeparatorToken</span><span class="op">(</span><span class="nam">sys</span><span class="op">.</span><span class="nam">intern</span><span class="op">(</span><span class="nam">space_before</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t494" href="#t494">494</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822ValueToken</span><span class="op">(</span><span class="nam">word</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t495" href="#t495">495</a></span><span class="t"> <span class="key">if</span> <span class="nam">space_after</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t496" href="#t496">496</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822SpaceSeparatorToken</span><span class="op">(</span><span class="nam">sys</span><span class="op">.</span><span class="nam">intern</span><span class="op">(</span><span class="nam">space_after</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t497" href="#t497">497</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t498" href="#t498">498</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t499" href="#t499">499</a></span><span class="t"><span class="op">@</span><span class="nam">_value_line_tokenizer</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t500" href="#t500">500</a></span><span class="t"><span class="key">def</span> <span class="nam">comma_split_tokenizer</span><span class="op">(</span><span class="nam">v</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t501" href="#t501">501</a></span><span class="t"> <span class="com"># type: (str) -> Iterable[Deb822Token]</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t502" href="#t502">502</a></span><span class="t"> <span class="key">assert</span> <span class="str">"\n"</span> <span class="key">not</span> <span class="key">in</span> <span class="nam">v</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t503" href="#t503">503</a></span><span class="t"> <span class="key">for</span> <span class="nam">match</span> <span class="key">in</span> <span class="nam">_RE_COMMA_SEPARATED_WORD_LIST</span><span class="op">.</span><span class="nam">finditer</span><span class="op">(</span><span class="nam">v</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t504" href="#t504">504</a></span><span class="t"> <span class="nam">space_before_comma</span><span class="op">,</span> <span class="nam">comma</span><span class="op">,</span> <span class="nam">space_before_word</span><span class="op">,</span> <span class="nam">word</span><span class="op">,</span> <span class="nam">space_after_word</span> <span class="op">=</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t505" href="#t505">505</a></span><span class="t"> <span class="nam">match</span><span class="op">.</span><span class="nam">groups</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t506" href="#t506">506</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t507" href="#t507">507</a></span><span class="t"> <span class="key">if</span> <span class="nam">space_before_comma</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t508" href="#t508">508</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822WhitespaceToken</span><span class="op">(</span><span class="nam">sys</span><span class="op">.</span><span class="nam">intern</span><span class="op">(</span><span class="nam">space_before_comma</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t509" href="#t509">509</a></span><span class="t"> <span class="key">if</span> <span class="nam">comma</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t510" href="#t510">510</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822CommaToken</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t511" href="#t511">511</a></span><span class="t"> <span class="key">if</span> <span class="nam">space_before_word</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t512" href="#t512">512</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822WhitespaceToken</span><span class="op">(</span><span class="nam">sys</span><span class="op">.</span><span class="nam">intern</span><span class="op">(</span><span class="nam">space_before_word</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t513" href="#t513">513</a></span><span class="t"> <span class="key">if</span> <span class="nam">word</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t514" href="#t514">514</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822ValueToken</span><span class="op">(</span><span class="nam">word</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t515" href="#t515">515</a></span><span class="t"> <span class="key">if</span> <span class="nam">space_after_word</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t516" href="#t516">516</a></span><span class="t"> <span class="key">yield</span> <span class="nam">Deb822WhitespaceToken</span><span class="op">(</span><span class="nam">sys</span><span class="op">.</span><span class="nam">intern</span><span class="op">(</span><span class="nam">space_after_word</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_e9c451f4ae334f76_parsing_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_e9c451f4ae334f76_types_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/d_e9c451f4ae334f76_types_py.html b/coverage-report/d_e9c451f4ae334f76_types_py.html deleted file mode 100644 index f12c5ae..0000000 --- a/coverage-report/d_e9c451f4ae334f76_types_py.html +++ /dev/null @@ -1,192 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for src/debputy/lsp/vendoring/_deb822_repro/types.py: 85%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>src/debputy/lsp/vendoring/_deb822_repro/types.py</b>: - <span class="pc_cov">85%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">26 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">22<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">4<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">4<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="d_e9c451f4ae334f76_tokens_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_maintscript_snippet_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="run"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"> <span class="key">from</span> <span class="nam">typing</span> <span class="key">import</span> <span class="nam">TypeVar</span><span class="op">,</span> <span class="nam">Union</span><span class="op">,</span> <span class="nam">Tuple</span><span class="op">,</span> <span class="nam">List</span><span class="op">,</span> <span class="nam">Callable</span><span class="op">,</span> <span class="nam">Iterator</span><span class="op">,</span> <span class="nam">TYPE_CHECKING</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> <span class="key">if</span> <span class="nam">TYPE_CHECKING</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"> <span class="key">from</span> <span class="op">.</span><span class="nam">tokens</span> <span class="key">import</span> <span class="nam">Deb822Token</span><span class="op">,</span> <span class="nam">Deb822FieldNameToken</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> <span class="key">from</span> <span class="op">.</span><span class="nam">parsing</span> <span class="key">import</span> <span class="op">(</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"> <span class="nam">Deb822Element</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="nam">Deb822CommentElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">Deb822ParsedValueElement</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="op">)</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="key">from</span> <span class="op">.</span><span class="nam">formatter</span> <span class="key">import</span> <span class="nam">FormatterContentToken</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t12" href="#t12">12</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t13" href="#t13">13</a></span><span class="t"> <span class="nam">TokenOrElement</span> <span class="op">=</span> <span class="nam">Union</span><span class="op">[</span><span class="str">"Deb822Element"</span><span class="op">,</span> <span class="str">"Deb822Token"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t14" href="#t14">14</a></span><span class="t"> <span class="nam">TE</span> <span class="op">=</span> <span class="nam">TypeVar</span><span class="op">(</span><span class="str">"TE"</span><span class="op">,</span> <span class="nam">bound</span><span class="op">=</span><span class="nam">TokenOrElement</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t15" href="#t15">15</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t16" href="#t16">16</a></span><span class="t"> <span class="com"># Used as a resulting element for "mapping" functions that map TE -> R (see _combine_parts)</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t17" href="#t17">17</a></span><span class="t"> <span class="nam">R</span> <span class="op">=</span> <span class="nam">TypeVar</span><span class="op">(</span><span class="str">"R"</span><span class="op">,</span> <span class="nam">bound</span><span class="op">=</span><span class="str">"Deb822Element"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t18" href="#t18">18</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t19" href="#t19">19</a></span><span class="t"> <span class="nam">VE</span> <span class="op">=</span> <span class="nam">TypeVar</span><span class="op">(</span><span class="str">"VE"</span><span class="op">,</span> <span class="nam">bound</span><span class="op">=</span><span class="str">"Deb822Element"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t20" href="#t20">20</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t21" href="#t21">21</a></span><span class="t"> <span class="nam">ST</span> <span class="op">=</span> <span class="nam">TypeVar</span><span class="op">(</span><span class="str">"ST"</span><span class="op">,</span> <span class="nam">bound</span><span class="op">=</span><span class="str">"Deb822Token"</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t22" href="#t22">22</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t23" href="#t23">23</a></span><span class="t"> <span class="com"># Internal type for part of the paragraph key. Used to facility _unpack_key.</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t24" href="#t24">24</a></span><span class="t"> <span class="nam">ParagraphKeyBase</span> <span class="op">=</span> <span class="nam">Union</span><span class="op">[</span><span class="str">"Deb822FieldNameToken"</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t25" href="#t25">25</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t26" href="#t26">26</a></span><span class="t"> <span class="nam">ParagraphKey</span> <span class="op">=</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">ParagraphKeyBase</span><span class="op">,</span> <span class="nam">Tuple</span><span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="nam">int</span><span class="op">]</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t27" href="#t27">27</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t28" href="#t28">28</a></span><span class="t"> <span class="nam">Commentish</span> <span class="op">=</span> <span class="nam">Union</span><span class="op">[</span><span class="nam">List</span><span class="op">[</span><span class="nam">str</span><span class="op">]</span><span class="op">,</span> <span class="str">"Deb822CommentElement"</span><span class="op">]</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t29" href="#t29">29</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t30" href="#t30">30</a></span><span class="t"> <span class="nam">FormatterCallback</span> <span class="op">=</span> <span class="nam">Callable</span><span class="op">[</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t31" href="#t31">31</a></span><span class="t"> <span class="op">[</span><span class="nam">str</span><span class="op">,</span> <span class="str">"FormatterContentToken"</span><span class="op">,</span> <span class="nam">Iterator</span><span class="op">[</span><span class="str">"FormatterContentToken"</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t32" href="#t32">32</a></span><span class="t"> <span class="nam">Iterator</span><span class="op">[</span><span class="nam">Union</span><span class="op">[</span><span class="str">"FormatterContentToken"</span><span class="op">,</span> <span class="nam">str</span><span class="op">]</span><span class="op">]</span><span class="op">,</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t33" href="#t33">33</a></span><span class="t"> <span class="op">]</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t34" href="#t34">34</a></span><span class="t"> <span class="key">try</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t35" href="#t35">35</a></span><span class="t"> <span class="com"># Set __doc__ attributes if possible</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t36" href="#t36">36</a></span><span class="t"> <span class="nam">TE</span><span class="op">.</span><span class="nam">__doc__</span> <span class="op">=</span> <span class="str">"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t37" href="#t37">37</a></span><span class="t"><span class="str"> Generic "Token or Element" type</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t38" href="#t38">38</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t39" href="#t39">39</a></span><span class="t"> <span class="nam">R</span><span class="op">.</span><span class="nam">__doc__</span> <span class="op">=</span> <span class="str">"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t40" href="#t40">40</a></span><span class="t"><span class="str"> For internal usage in _deb822_repro</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t41" href="#t41">41</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t42" href="#t42">42</a></span><span class="t"> <span class="nam">VE</span><span class="op">.</span><span class="nam">__doc__</span> <span class="op">=</span> <span class="str">"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t43" href="#t43">43</a></span><span class="t"><span class="str"> Value type/element in a list interpretation of a field value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t44" href="#t44">44</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t45" href="#t45">45</a></span><span class="t"> <span class="nam">ST</span><span class="op">.</span><span class="nam">__doc__</span> <span class="op">=</span> <span class="str">"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t46" href="#t46">46</a></span><span class="t"><span class="str"> Separator type/token in a list interpretation of a field value</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t47" href="#t47">47</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t48" href="#t48">48</a></span><span class="t"> <span class="nam">ParagraphKeyBase</span><span class="op">.</span><span class="nam">__doc__</span> <span class="op">=</span> <span class="str">"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t49" href="#t49">49</a></span><span class="t"><span class="str"> For internal usage in _deb822_repro</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t50" href="#t50">50</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t51" href="#t51">51</a></span><span class="t"> <span class="nam">ParagraphKey</span><span class="op">.</span><span class="nam">__doc__</span> <span class="op">=</span> <span class="str">"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t52" href="#t52">52</a></span><span class="t"><span class="str"> Anything accepted as a key for a paragraph field lookup. The simple case being</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t53" href="#t53">53</a></span><span class="t"><span class="str"> a str. Alternative variants are mostly interesting for paragraphs with repeated</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t54" href="#t54">54</a></span><span class="t"><span class="str"> fields (to enable unambiguous lookups)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t55" href="#t55">55</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t56" href="#t56">56</a></span><span class="t"> <span class="nam">Commentish</span><span class="op">.</span><span class="nam">__doc__</span> <span class="op">=</span> <span class="str">"""</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t57" href="#t57">57</a></span><span class="t"><span class="str"> Anything accepted as input for a Comment. The simple case is the list</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t58" href="#t58">58</a></span><span class="t"><span class="str"> of string (each element being a line of comment). The alternative format is</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t59" href="#t59">59</a></span><span class="t"><span class="str"> there for enable reuse of an existing element (e.g. to avoid "unpacking"</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t60" href="#t60">60</a></span><span class="t"><span class="str"> only to "re-pack" an existing comment element).</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t61" href="#t61">61</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t62" href="#t62">62</a></span><span class="t"> <span class="nam">FormatterCallback</span><span class="op">.</span><span class="nam">__doc__</span> <span class="op">=</span> <span class="str">"""\</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t63" href="#t63">63</a></span><span class="t"><span class="str"> Formatter callback used with the round-trip safe parser</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t64" href="#t64">64</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t65" href="#t65">65</a></span><span class="t"><span class="str"> See debian._repro_deb822.formatter.format_field for details</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t66" href="#t66">66</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t67" href="#t67">67</a></span><span class="t"> <span class="key">except</span> <span class="nam">AttributeError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t68" href="#t68">68</a></span><span class="t"> <span class="com"># Python 3.5 does not allow update to the __doc__ attribute - ignore that</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t69" href="#t69">69</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t70" href="#t70">70</a></span><span class="t"><span class="key">except</span> <span class="nam">ImportError</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t71" href="#t71">71</a></span><span class="t"> <span class="key">pass</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t72" href="#t72">72</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t73" href="#t73">73</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t74" href="#t74">74</a></span><span class="t"><span class="key">class</span> <span class="nam">AmbiguousDeb822FieldKeyError</span><span class="op">(</span><span class="nam">KeyError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t75" href="#t75">75</a></span><span class="t"> <span class="str">"""Specialized version of KeyError to denote a valid but ambiguous field name</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t76" href="#t76">76</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t77" href="#t77">77</a></span><span class="t"><span class="str"> This exception occurs if:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t78" href="#t78">78</a></span><span class="t"><span class="str"> * the field is accessed via a str on a configured view that does not automatically</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t79" href="#t79">79</a></span><span class="t"><span class="str"> resolve ambiguous field names (see Deb822ParagraphElement.configured_view), AND</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t80" href="#t80">80</a></span><span class="t"><span class="str"> * a concrete paragraph contents a repeated field (which is not valid in deb822</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t81" href="#t81">81</a></span><span class="t"><span class="str"> but the module supports parsing them)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t82" href="#t82">82</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t83" href="#t83">83</a></span><span class="t"><span class="str"> Note that the default is to automatically resolve ambiguous fields. Accordingly</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t84" href="#t84">84</a></span><span class="t"><span class="str"> you will only see this exception if you have "opted in" on wanting to know that</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t85" href="#t85">85</a></span><span class="t"><span class="str"> the lookup was ambiguous.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t86" href="#t86">86</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t87" href="#t87">87</a></span><span class="t"><span class="str"> The ambiguity can be resolved by using a tuple of (<field-name>, <filed-index>)</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t88" href="#t88">88</a></span><span class="t"><span class="str"> instead of <field-name>.</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t89" href="#t89">89</a></span><span class="t"><span class="str"> """</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t90" href="#t90">90</a></span><span class="t"> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t91" href="#t91">91</a></span><span class="t"> </span><span class="r"></span></p> - <p class="run"><span class="n"><a id="t92" href="#t92">92</a></span><span class="t"><span class="key">class</span> <span class="nam">SyntaxOrParseError</span><span class="op">(</span><span class="nam">ValueError</span><span class="op">)</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t93" href="#t93">93</a></span><span class="t"> <span class="str">"""Specialized version of ValueError for syntax/parse errors."""</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="d_e9c451f4ae334f76_tokens_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_267b6307937f1878_maintscript_snippet_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/deb_materialization_py.html b/coverage-report/deb_materialization_py.html deleted file mode 100644 index bbd6295..0000000 --- a/coverage-report/deb_materialization_py.html +++ /dev/null @@ -1,110 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for deb_materialization.py: 0%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>deb_materialization.py</b>: - <span class="pc_cov">0%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">3 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">0<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">3<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">4<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="index.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="deb_packer_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="pln"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="com">#!/usr/bin/python3 -B</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">pathlib</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">sys</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="nam">DEBPUTY_ROOT_DIR</span> <span class="op">=</span> <span class="nam">pathlib</span><span class="op">.</span><span class="nam">Path</span><span class="op">(</span><span class="nam">__file__</span><span class="op">)</span><span class="op">.</span><span class="nam">parent</span> <span class="com"># TODO: Subst during install</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">if</span> <span class="nam">__name__</span> <span class="op">==</span> <span class="str">'__main__'</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="com"># setup PYTHONPATH: add our installation directory.</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">sys</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">insert</span><span class="op">(</span><span class="num">0</span><span class="op">,</span> <span class="nam">str</span><span class="op">(</span><span class="nam">DEBPUTY_ROOT_DIR</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">commands</span><span class="op">.</span><span class="nam">deb_materialization</span> <span class="key">import</span> <span class="nam">main</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">main</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="index.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="deb_packer_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/deb_packer_py.html b/coverage-report/deb_packer_py.html deleted file mode 100644 index 505e60e..0000000 --- a/coverage-report/deb_packer_py.html +++ /dev/null @@ -1,110 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage for deb_packer.py: 0%</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="pyfile"> -<header> - <div class="content"> - <h1> - <span class="text">Coverage for </span><b>deb_packer.py</b>: - <span class="pc_cov">0%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>r</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>p</kbd> - toggle line displays - </p> - <p> - <kbd>j</kbd> - <kbd>k</kbd> - next/prev highlighted chunk - </p> - <p> - <kbd>0</kbd> (zero) top of page - </p> - <p> - <kbd>1</kbd> (one) first highlighted chunk - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>u</kbd> up to the index - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <h2> - <span class="text">3 statements </span> - <button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">0<span class="text"> run</span></button> - <button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">3<span class="text"> missing</span></button> - <button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">4<span class="text"> excluded</span></button> - <button type="button" class="par run show_par button_toggle_par" value="par" data-shortcut="p" title="Toggle lines partially run">0<span class="text"> partial</span></button> - </h2> - <p class="text"> - <a id="prevFileLink" class="nav" href="deb_materialization_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_9ae9c81fc31f2694_gnome_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - <aside class="hidden"> - <button type="button" class="button_next_chunk" data-shortcut="j"/> - <button type="button" class="button_prev_chunk" data-shortcut="k"/> - <button type="button" class="button_top_of_page" data-shortcut="0"/> - <button type="button" class="button_first_chunk" data-shortcut="1"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_to_index" data-shortcut="u"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> - </div> -</header> -<main id="source"> - <p class="pln"><span class="n"><a id="t1" href="#t1">1</a></span><span class="t"><span class="com">#!/usr/bin/python3 -B</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t2" href="#t2">2</a></span><span class="t"><span class="key">import</span> <span class="nam">pathlib</span> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t3" href="#t3">3</a></span><span class="t"><span class="key">import</span> <span class="nam">sys</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t4" href="#t4">4</a></span><span class="t"> </span><span class="r"></span></p> - <p class="mis show_mis"><span class="n"><a id="t5" href="#t5">5</a></span><span class="t"><span class="nam">DEBPUTY_ROOT_DIR</span> <span class="op">=</span> <span class="nam">pathlib</span><span class="op">.</span><span class="nam">Path</span><span class="op">(</span><span class="nam">__file__</span><span class="op">)</span><span class="op">.</span><span class="nam">parent</span> <span class="com"># TODO: Subst during install</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t6" href="#t6">6</a></span><span class="t"> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t7" href="#t7">7</a></span><span class="t"><span class="key">if</span> <span class="nam">__name__</span> <span class="op">==</span> <span class="str">'__main__'</span><span class="op">:</span> </span><span class="r"></span></p> - <p class="pln"><span class="n"><a id="t8" href="#t8">8</a></span><span class="t"> <span class="com"># setup PYTHONPATH: add our installation directory.</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t9" href="#t9">9</a></span><span class="t"> <span class="nam">sys</span><span class="op">.</span><span class="nam">path</span><span class="op">.</span><span class="nam">insert</span><span class="op">(</span><span class="num">0</span><span class="op">,</span> <span class="nam">str</span><span class="op">(</span><span class="nam">DEBPUTY_ROOT_DIR</span><span class="op">)</span><span class="op">)</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t10" href="#t10">10</a></span><span class="t"> <span class="key">from</span> <span class="nam">debputy</span><span class="op">.</span><span class="nam">commands</span><span class="op">.</span><span class="nam">deb_packer</span> <span class="key">import</span> <span class="nam">main</span> </span><span class="r"></span></p> - <p class="exc show_exc"><span class="n"><a id="t11" href="#t11">11</a></span><span class="t"> <span class="nam">main</span><span class="op">(</span><span class="op">)</span> </span><span class="r"></span></p> -</main> -<footer> - <div class="content"> - <p> - <a id="prevFileLink" class="nav" href="deb_materialization_py.html">« prev</a> - <a id="indexLink" class="nav" href="index.html">^ index</a> - <a id="nextFileLink" class="nav" href="d_9ae9c81fc31f2694_gnome_py.html">» next</a> - - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</footer> -</body> -</html> diff --git a/coverage-report/favicon_32.png b/coverage-report/favicon_32.png Binary files differdeleted file mode 100644 index 8649f04..0000000 --- a/coverage-report/favicon_32.png +++ /dev/null diff --git a/coverage-report/index.html b/coverage-report/index.html deleted file mode 100644 index ca54ec0..0000000 --- a/coverage-report/index.html +++ /dev/null @@ -1,1118 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Coverage report</title> - <link rel="icon" sizes="32x32" href="favicon_32.png"> - <link rel="stylesheet" href="style.css" type="text/css"> - <script type="text/javascript" src="coverage_html.js" defer></script> -</head> -<body class="indexfile"> -<header> - <div class="content"> - <h1>Coverage report: - <span class="pc_cov">62%</span> - </h1> - <aside id="help_panel_wrapper"> - <input id="help_panel_state" type="checkbox"> - <label for="help_panel_state"> - <img id="keyboard_icon" src="keybd_closed.png" alt="Show/hide keyboard shortcuts" /> - </label> - <div id="help_panel"> - <p class="legend">Shortcuts on this page</p> - <div class="keyhelp"> - <p> - <kbd>n</kbd> - <kbd>s</kbd> - <kbd>m</kbd> - <kbd>x</kbd> - <kbd>b</kbd> - <kbd>p</kbd> - <kbd>c</kbd> - change column sorting - </p> - <p> - <kbd>[</kbd> - <kbd>]</kbd> - prev/next file - </p> - <p> - <kbd>?</kbd> show/hide this help - </p> - </div> - </div> - </aside> - <form id="filter_container"> - <input id="filter" type="text" value="" placeholder="filter..." /> - </form> - <p class="text"> - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> -</header> -<main id="index"> - <table class="index" data-sortable> - <thead> - <tr class="tablehead" title="Click to sort"> - <th class="name left" aria-sort="none" data-shortcut="n">Module</th> - <th aria-sort="none" data-default-sort-order="descending" data-shortcut="s">statements</th> - <th aria-sort="none" data-default-sort-order="descending" data-shortcut="m">missing</th> - <th aria-sort="none" data-default-sort-order="descending" data-shortcut="x">excluded</th> - <th aria-sort="none" data-default-sort-order="descending" data-shortcut="b">branches</th> - <th aria-sort="none" data-default-sort-order="descending" data-shortcut="p">partial</th> - <th class="right" aria-sort="none" data-shortcut="c">coverage</th> - </tr> - </thead> - <tbody> - <tr class="file"> - <td class="name left"><a href="deb_materialization_py.html">deb_materialization.py</a></td> - <td>3</td> - <td>3</td> - <td>4</td> - <td>0</td> - <td>0</td> - <td class="right" data-ratio="0 3">0%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="deb_packer_py.html">deb_packer.py</a></td> - <td>3</td> - <td>3</td> - <td>4</td> - <td>0</td> - <td>0</td> - <td class="right" data-ratio="0 3">0%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_9ae9c81fc31f2694_gnome_py.html">debputy/plugins/gnome.py</a></td> - <td>38</td> - <td>1</td> - <td>0</td> - <td>12</td> - <td>1</td> - <td class="right" data-ratio="48 50">96%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_9ae9c81fc31f2694_numpy3_py.html">debputy/plugins/numpy3.py</a></td> - <td>34</td> - <td>6</td> - <td>0</td> - <td>10</td> - <td>0</td> - <td class="right" data-ratio="38 44">86%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_9ae9c81fc31f2694_perl_openssl_py.html">debputy/plugins/perl_openssl.py</a></td> - <td>20</td> - <td>4</td> - <td>0</td> - <td>4</td> - <td>0</td> - <td class="right" data-ratio="18 24">75%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_08cd1ad648464ded_debputy_self_hosting_py.html">self-hosting-plugins/debputy_self_hosting.py</a></td> - <td>13</td> - <td>3</td> - <td>0</td> - <td>2</td> - <td>1</td> - <td class="right" data-ratio="11 15">73%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_08cd1ad648464ded_debputy_self_hosting_test_py.html">self-hosting-plugins/debputy_self_hosting_test.py</a></td> - <td>5</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td class="right" data-ratio="5 5">100%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_267b6307937f1878___init___py.html">src/debputy/__init__.py</a></td> - <td>7</td> - <td>1</td> - <td>0</td> - <td>2</td> - <td>1</td> - <td class="right" data-ratio="7 9">78%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_267b6307937f1878__deb_options_profiles_py.html">src/debputy/_deb_options_profiles.py</a></td> - <td>27</td> - <td>2</td> - <td>1</td> - <td>18</td> - <td>1</td> - <td class="right" data-ratio="42 45">93%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_267b6307937f1878__manifest_constants_py.html">src/debputy/_manifest_constants.py</a></td> - <td>37</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td class="right" data-ratio="37 37">100%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_267b6307937f1878_architecture_support_py.html">src/debputy/architecture_support.py</a></td> - <td>107</td> - <td>5</td> - <td>0</td> - <td>56</td> - <td>1</td> - <td class="right" data-ratio="155 163">95%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_267b6307937f1878_builtin_manifest_rules_py.html">src/debputy/builtin_manifest_rules.py</a></td> - <td>79</td> - <td>10</td> - <td>0</td> - <td>36</td> - <td>4</td> - <td class="right" data-ratio="99 115">86%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_2882d0a735873825___init___py.html">src/debputy/commands/__init__.py</a></td> - <td>0</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td class="right" data-ratio="0 0">100%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_2882d0a735873825_deb_materialization_py.html">src/debputy/commands/deb_materialization.py</a></td> - <td>236</td> - <td>207</td> - <td>2</td> - <td>104</td> - <td>0</td> - <td class="right" data-ratio="31 340">9%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_2882d0a735873825_deb_packer_py.html">src/debputy/commands/deb_packer.py</a></td> - <td>197</td> - <td>81</td> - <td>2</td> - <td>54</td> - <td>7</td> - <td class="right" data-ratio="145 251">58%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_6e57078c9ef7177d___init___py.html">src/debputy/commands/debputy_cmd/__init__.py</a></td> - <td>0</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td class="right" data-ratio="0 0">100%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_6e57078c9ef7177d_context_py.html">src/debputy/commands/debputy_cmd/context.py</a></td> - <td>283</td> - <td>152</td> - <td>4</td> - <td>97</td> - <td>2</td> - <td class="right" data-ratio="161 380">42%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_6e57078c9ef7177d_dc_util_py.html">src/debputy/commands/debputy_cmd/dc_util.py</a></td> - <td>7</td> - <td>4</td> - <td>0</td> - <td>4</td> - <td>0</td> - <td class="right" data-ratio="3 11">27%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_6e57078c9ef7177d_lint_and_lsp_cmds_py.html">src/debputy/commands/debputy_cmd/lint_and_lsp_cmds.py</a></td> - <td>65</td> - <td>50</td> - <td>0</td> - <td>24</td> - <td>0</td> - <td class="right" data-ratio="23 89">26%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_6e57078c9ef7177d_output_py.html">src/debputy/commands/debputy_cmd/output.py</a></td> - <td>191</td> - <td>150</td> - <td>0</td> - <td>86</td> - <td>0</td> - <td class="right" data-ratio="47 277">17%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_6e57078c9ef7177d_plugin_cmds_py.html">src/debputy/commands/debputy_cmd/plugin_cmds.py</a></td> - <td>541</td> - <td>463</td> - <td>0</td> - <td>287</td> - <td>1</td> - <td class="right" data-ratio="107 828">13%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_267b6307937f1878_deb_packaging_support_py.html">src/debputy/deb_packaging_support.py</a></td> - <td>799</td> - <td>666</td> - <td>1</td> - <td>476</td> - <td>1</td> - <td class="right" data-ratio="170 1275">13%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_267b6307937f1878_debhelper_emulation_py.html">src/debputy/debhelper_emulation.py</a></td> - <td>143</td> - <td>36</td> - <td>0</td> - <td>69</td> - <td>3</td> - <td class="right" data-ratio="155 212">73%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_23db3c975895bd86___init___py.html">src/debputy/dh_migration/__init__.py</a></td> - <td>0</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td class="right" data-ratio="0 0">100%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_23db3c975895bd86_migration_py.html">src/debputy/dh_migration/migration.py</a></td> - <td>192</td> - <td>172</td> - <td>1</td> - <td>114</td> - <td>0</td> - <td class="right" data-ratio="20 306">7%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_23db3c975895bd86_migrators_py.html">src/debputy/dh_migration/migrators.py</a></td> - <td>7</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td class="right" data-ratio="7 7">100%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_23db3c975895bd86_migrators_impl_py.html">src/debputy/dh_migration/migrators_impl.py</a></td> - <td>669</td> - <td>114</td> - <td>0</td> - <td>395</td> - <td>39</td> - <td class="right" data-ratio="863 1064">81%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_23db3c975895bd86_models_py.html">src/debputy/dh_migration/models.py</a></td> - <td>86</td> - <td>11</td> - <td>0</td> - <td>32</td> - <td>4</td> - <td class="right" data-ratio="99 118">84%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_267b6307937f1878_elf_util_py.html">src/debputy/elf_util.py</a></td> - <td>100</td> - <td>17</td> - <td>0</td> - <td>45</td> - <td>12</td> - <td class="right" data-ratio="110 145">76%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_267b6307937f1878_exceptions_py.html">src/debputy/exceptions.py</a></td> - <td>50</td> - <td>5</td> - <td>2</td> - <td>12</td> - <td>0</td> - <td class="right" data-ratio="57 62">92%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_267b6307937f1878_filesystem_scan_py.html">src/debputy/filesystem_scan.py</a></td> - <td>1104</td> - <td>268</td> - <td>1</td> - <td>548</td> - <td>74</td> - <td class="right" data-ratio="1226 1652">74%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_267b6307937f1878_highlevel_manifest_py.html">src/debputy/highlevel_manifest.py</a></td> - <td>801</td> - <td>237</td> - <td>3</td> - <td>395</td> - <td>52</td> - <td class="right" data-ratio="803 1196">67%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_267b6307937f1878_highlevel_manifest_parser_py.html">src/debputy/highlevel_manifest_parser.py</a></td> - <td>253</td> - <td>71</td> - <td>2</td> - <td>120</td> - <td>13</td> - <td class="right" data-ratio="255 373">68%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_267b6307937f1878_installations_py.html">src/debputy/installations.py</a></td> - <td>499</td> - <td>157</td> - <td>5</td> - <td>291</td> - <td>36</td> - <td class="right" data-ratio="511 790">65%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_267b6307937f1878_intermediate_manifest_py.html">src/debputy/intermediate_manifest.py</a></td> - <td>172</td> - <td>52</td> - <td>0</td> - <td>98</td> - <td>22</td> - <td class="right" data-ratio="168 270">62%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_267b6307937f1878_interpreter_py.html">src/debputy/interpreter.py</a></td> - <td>82</td> - <td>2</td> - <td>6</td> - <td>40</td> - <td>3</td> - <td class="right" data-ratio="117 122">96%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_7764373ba25ba45b___init___py.html">src/debputy/linting/__init__.py</a></td> - <td>0</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td class="right" data-ratio="0 0">100%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_7764373ba25ba45b_lint_impl_py.html">src/debputy/linting/lint_impl.py</a></td> - <td>152</td> - <td>125</td> - <td>0</td> - <td>64</td> - <td>0</td> - <td class="right" data-ratio="27 216">12%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_7764373ba25ba45b_lint_util_py.html">src/debputy/linting/lint_util.py</a></td> - <td>117</td> - <td>66</td> - <td>7</td> - <td>48</td> - <td>1</td> - <td class="right" data-ratio="70 165">42%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_5d0ec0d5422112df___init___py.html">src/debputy/lsp/__init__.py</a></td> - <td>0</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td class="right" data-ratio="0 0">100%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_5d0ec0d5422112df_debputy_ls_py.html">src/debputy/lsp/debputy_ls.py</a></td> - <td>48</td> - <td>15</td> - <td>0</td> - <td>18</td> - <td>2</td> - <td class="right" data-ratio="49 66">74%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_5d0ec0d5422112df_lsp_debian_changelog_py.html">src/debputy/lsp/lsp_debian_changelog.py</a></td> - <td>108</td> - <td>81</td> - <td>0</td> - <td>28</td> - <td>0</td> - <td class="right" data-ratio="29 136">21%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_5d0ec0d5422112df_lsp_debian_control_py.html">src/debputy/lsp/lsp_debian_control.py</a></td> - <td>216</td> - <td>53</td> - <td>0</td> - <td>102</td> - <td>14</td> - <td class="right" data-ratio="229 318">72%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_5d0ec0d5422112df_lsp_debian_control_reference_data_py.html">src/debputy/lsp/lsp_debian_control_reference_data.py</a></td> - <td>335</td> - <td>123</td> - <td>6</td> - <td>124</td> - <td>13</td> - <td class="right" data-ratio="269 459">59%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_5d0ec0d5422112df_lsp_debian_copyright_py.html">src/debputy/lsp/lsp_debian_copyright.py</a></td> - <td>173</td> - <td>137</td> - <td>0</td> - <td>80</td> - <td>0</td> - <td class="right" data-ratio="46 253">18%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_5d0ec0d5422112df_lsp_debian_debputy_manifest_py.html">src/debputy/lsp/lsp_debian_debputy_manifest.py</a></td> - <td>467</td> - <td>95</td> - <td>0</td> - <td>234</td> - <td>43</td> - <td class="right" data-ratio="541 701">77%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_5d0ec0d5422112df_lsp_debian_rules_py.html">src/debputy/lsp/lsp_debian_rules.py</a></td> - <td>188</td> - <td>146</td> - <td>0</td> - <td>82</td> - <td>0</td> - <td class="right" data-ratio="48 270">18%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_5d0ec0d5422112df_lsp_debian_tests_control_py.html">src/debputy/lsp/lsp_debian_tests_control.py</a></td> - <td>160</td> - <td>124</td> - <td>0</td> - <td>74</td> - <td>0</td> - <td class="right" data-ratio="46 234">20%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_5d0ec0d5422112df_lsp_dispatch_py.html">src/debputy/lsp/lsp_dispatch.py</a></td> - <td>82</td> - <td>50</td> - <td>0</td> - <td>30</td> - <td>0</td> - <td class="right" data-ratio="48 112">43%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_5d0ec0d5422112df_lsp_features_py.html">src/debputy/lsp/lsp_features.py</a></td> - <td>107</td> - <td>38</td> - <td>2</td> - <td>42</td> - <td>6</td> - <td class="right" data-ratio="85 149">57%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_5d0ec0d5422112df_lsp_generic_deb822_py.html">src/debputy/lsp/lsp_generic_deb822.py</a></td> - <td>203</td> - <td>101</td> - <td>0</td> - <td>84</td> - <td>11</td> - <td class="right" data-ratio="133 287">46%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_5d0ec0d5422112df_quickfixes_py.html">src/debputy/lsp/quickfixes.py</a></td> - <td>63</td> - <td>32</td> - <td>0</td> - <td>20</td> - <td>0</td> - <td class="right" data-ratio="35 83">42%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_5d0ec0d5422112df_spellchecking_py.html">src/debputy/lsp/spellchecking.py</a></td> - <td>152</td> - <td>42</td> - <td>2</td> - <td>70</td> - <td>14</td> - <td class="right" data-ratio="158 222">71%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_5d0ec0d5422112df_text_edit_py.html">src/debputy/lsp/text_edit.py</a></td> - <td>66</td> - <td>57</td> - <td>0</td> - <td>28</td> - <td>0</td> - <td class="right" data-ratio="9 94">10%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_5d0ec0d5422112df_text_util_py.html">src/debputy/lsp/text_util.py</a></td> - <td>59</td> - <td>18</td> - <td>0</td> - <td>20</td> - <td>2</td> - <td class="right" data-ratio="53 79">67%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_50e3cc0df0cc5f51___init___py.html">src/debputy/lsp/vendoring/__init__.py</a></td> - <td>0</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td class="right" data-ratio="0 0">100%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_e9c451f4ae334f76___init___py.html">src/debputy/lsp/vendoring/_deb822_repro/__init__.py</a></td> - <td>3</td> - <td>0</td> - <td>1</td> - <td>0</td> - <td>0</td> - <td class="right" data-ratio="3 3">100%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_e9c451f4ae334f76__util_py.html">src/debputy/lsp/vendoring/_deb822_repro/_util.py</a></td> - <td>154</td> - <td>62</td> - <td>3</td> - <td>70</td> - <td>5</td> - <td class="right" data-ratio="127 224">57%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_e9c451f4ae334f76_formatter_py.html">src/debputy/lsp/vendoring/_deb822_repro/formatter.py</a></td> - <td>128</td> - <td>24</td> - <td>0</td> - <td>78</td> - <td>12</td> - <td class="right" data-ratio="164 206">80%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_e9c451f4ae334f76_locatable_py.html">src/debputy/lsp/vendoring/_deb822_repro/locatable.py</a></td> - <td>122</td> - <td>11</td> - <td>5</td> - <td>58</td> - <td>5</td> - <td class="right" data-ratio="162 180">90%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_e9c451f4ae334f76_parsing_py.html">src/debputy/lsp/vendoring/_deb822_repro/parsing.py</a></td> - <td>1464</td> - <td>541</td> - <td>30</td> - <td>709</td> - <td>80</td> - <td class="right" data-ratio="1292 2173">59%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_e9c451f4ae334f76_tokens_py.html">src/debputy/lsp/vendoring/_deb822_repro/tokens.py</a></td> - <td>230</td> - <td>32</td> - <td>4</td> - <td>108</td> - <td>13</td> - <td class="right" data-ratio="279 338">83%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_e9c451f4ae334f76_types_py.html">src/debputy/lsp/vendoring/_deb822_repro/types.py</a></td> - <td>26</td> - <td>4</td> - <td>4</td> - <td>0</td> - <td>0</td> - <td class="right" data-ratio="22 26">85%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_267b6307937f1878_maintscript_snippet_py.html">src/debputy/maintscript_snippet.py</a></td> - <td>87</td> - <td>28</td> - <td>0</td> - <td>44</td> - <td>6</td> - <td class="right" data-ratio="83 131">63%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_267b6307937f1878_manifest_conditions_py.html">src/debputy/manifest_conditions.py</a></td> - <td>134</td> - <td>43</td> - <td>2</td> - <td>38</td> - <td>3</td> - <td class="right" data-ratio="112 172">65%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_4f754ff76d8638bb___init___py.html">src/debputy/manifest_parser/__init__.py</a></td> - <td>0</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td class="right" data-ratio="0 0">100%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_4f754ff76d8638bb_base_types_py.html">src/debputy/manifest_parser/base_types.py</a></td> - <td>213</td> - <td>33</td> - <td>9</td> - <td>104</td> - <td>7</td> - <td class="right" data-ratio="267 317">84%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_4f754ff76d8638bb_declarative_parser_py.html">src/debputy/manifest_parser/declarative_parser.py</a></td> - <td>781</td> - <td>161</td> - <td>0</td> - <td>446</td> - <td>70</td> - <td class="right" data-ratio="928 1227">76%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_4f754ff76d8638bb_exceptions_py.html">src/debputy/manifest_parser/exceptions.py</a></td> - <td>5</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td class="right" data-ratio="5 5">100%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_4f754ff76d8638bb_mapper_code_py.html">src/debputy/manifest_parser/mapper_code.py</a></td> - <td>32</td> - <td>4</td> - <td>0</td> - <td>10</td> - <td>2</td> - <td class="right" data-ratio="36 42">86%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_4f754ff76d8638bb_parser_data_py.html">src/debputy/manifest_parser/parser_data.py</a></td> - <td>54</td> - <td>7</td> - <td>12</td> - <td>30</td> - <td>2</td> - <td class="right" data-ratio="71 84">85%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_4f754ff76d8638bb_parser_doc_py.html">src/debputy/manifest_parser/parser_doc.py</a></td> - <td>132</td> - <td>25</td> - <td>0</td> - <td>85</td> - <td>9</td> - <td class="right" data-ratio="171 217">79%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_4f754ff76d8638bb_util_py.html">src/debputy/manifest_parser/util.py</a></td> - <td>192</td> - <td>18</td> - <td>3</td> - <td>88</td> - <td>12</td> - <td class="right" data-ratio="248 280">89%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_128305113a77411b___init___py.html">src/debputy/package_build/__init__.py</a></td> - <td>0</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td class="right" data-ratio="0 0">100%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_128305113a77411b_assemble_deb_py.html">src/debputy/package_build/assemble_deb.py</a></td> - <td>98</td> - <td>79</td> - <td>0</td> - <td>37</td> - <td>0</td> - <td class="right" data-ratio="19 135">14%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_267b6307937f1878_packager_provided_files_py.html">src/debputy/packager_provided_files.py</a></td> - <td>140</td> - <td>22</td> - <td>0</td> - <td>82</td> - <td>14</td> - <td class="right" data-ratio="186 222">84%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_267b6307937f1878_packages_py.html">src/debputy/packages.py</a></td> - <td>167</td> - <td>76</td> - <td>2</td> - <td>96</td> - <td>6</td> - <td class="right" data-ratio="135 263">51%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_36a196ce5f578895___init___py.html">src/debputy/packaging/__init__.py</a></td> - <td>0</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td class="right" data-ratio="0 0">100%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_36a196ce5f578895_alternatives_py.html">src/debputy/packaging/alternatives.py</a></td> - <td>75</td> - <td>15</td> - <td>0</td> - <td>36</td> - <td>12</td> - <td class="right" data-ratio="82 111">74%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_36a196ce5f578895_debconf_templates_py.html">src/debputy/packaging/debconf_templates.py</a></td> - <td>32</td> - <td>19</td> - <td>0</td> - <td>8</td> - <td>0</td> - <td class="right" data-ratio="13 40">32%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_36a196ce5f578895_makeshlibs_py.html">src/debputy/packaging/makeshlibs.py</a></td> - <td>182</td> - <td>139</td> - <td>2</td> - <td>80</td> - <td>2</td> - <td class="right" data-ratio="47 262">18%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_267b6307937f1878_path_matcher_py.html">src/debputy/path_matcher.py</a></td> - <td>279</td> - <td>66</td> - <td>3</td> - <td>142</td> - <td>13</td> - <td class="right" data-ratio="304 421">72%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_4faea183f900b252___init___py.html">src/debputy/plugin/__init__.py</a></td> - <td>0</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td class="right" data-ratio="0 0">100%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_64287305fe0c6642___init___py.html">src/debputy/plugin/api/__init__.py</a></td> - <td>3</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td class="right" data-ratio="3 3">100%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_64287305fe0c6642_example_processing_py.html">src/debputy/plugin/api/example_processing.py</a></td> - <td>62</td> - <td>4</td> - <td>0</td> - <td>30</td> - <td>0</td> - <td class="right" data-ratio="88 92">96%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_64287305fe0c6642_feature_set_py.html">src/debputy/plugin/api/feature_set.py</a></td> - <td>35</td> - <td>8</td> - <td>0</td> - <td>10</td> - <td>0</td> - <td class="right" data-ratio="33 45">73%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_64287305fe0c6642_impl_py.html">src/debputy/plugin/api/impl.py</a></td> - <td>753</td> - <td>302</td> - <td>2</td> - <td>320</td> - <td>52</td> - <td class="right" data-ratio="589 1073">55%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_64287305fe0c6642_impl_types_py.html">src/debputy/plugin/api/impl_types.py</a></td> - <td>526</td> - <td>98</td> - <td>6</td> - <td>187</td> - <td>23</td> - <td class="right" data-ratio="555 713">78%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_64287305fe0c6642_plugin_parser_py.html">src/debputy/plugin/api/plugin_parser.py</a></td> - <td>35</td> - <td>0</td> - <td>0</td> - <td>2</td> - <td>0</td> - <td class="right" data-ratio="37 37">100%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_64287305fe0c6642_spec_py.html">src/debputy/plugin/api/spec.py</a></td> - <td>282</td> - <td>36</td> - <td>66</td> - <td>143</td> - <td>7</td> - <td class="right" data-ratio="368 425">87%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_4b9be07fb6071cd2___init___py.html">src/debputy/plugin/api/test_api/__init__.py</a></td> - <td>3</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td class="right" data-ratio="3 3">100%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_4b9be07fb6071cd2_test_impl_py.html">src/debputy/plugin/api/test_api/test_impl.py</a></td> - <td>296</td> - <td>43</td> - <td>0</td> - <td>132</td> - <td>25</td> - <td class="right" data-ratio="352 428">82%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_4b9be07fb6071cd2_test_spec_py.html">src/debputy/plugin/api/test_api/test_spec.py</a></td> - <td>79</td> - <td>0</td> - <td>11</td> - <td>16</td> - <td>0</td> - <td class="right" data-ratio="95 95">100%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_d5d6843b45eec01e___init___py.html">src/debputy/plugin/debputy/__init__.py</a></td> - <td>0</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td class="right" data-ratio="0 0">100%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_d5d6843b45eec01e_binary_package_rules_py.html">src/debputy/plugin/debputy/binary_package_rules.py</a></td> - <td>173</td> - <td>23</td> - <td>0</td> - <td>58</td> - <td>6</td> - <td class="right" data-ratio="190 231">82%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_d5d6843b45eec01e_debputy_plugin_py.html">src/debputy/plugin/debputy/debputy_plugin.py</a></td> - <td>78</td> - <td>0</td> - <td>0</td> - <td>4</td> - <td>0</td> - <td class="right" data-ratio="82 82">100%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_d5d6843b45eec01e_discard_rules_py.html">src/debputy/plugin/debputy/discard_rules.py</a></td> - <td>34</td> - <td>1</td> - <td>0</td> - <td>12</td> - <td>1</td> - <td class="right" data-ratio="44 46">96%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_d5d6843b45eec01e_manifest_root_rules_py.html">src/debputy/plugin/debputy/manifest_root_rules.py</a></td> - <td>57</td> - <td>9</td> - <td>2</td> - <td>16</td> - <td>2</td> - <td class="right" data-ratio="58 73">79%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_d5d6843b45eec01e_metadata_detectors_py.html">src/debputy/plugin/debputy/metadata_detectors.py</a></td> - <td>228</td> - <td>6</td> - <td>0</td> - <td>140</td> - <td>7</td> - <td class="right" data-ratio="355 368">96%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_d5d6843b45eec01e_package_processors_py.html">src/debputy/plugin/debputy/package_processors.py</a></td> - <td>168</td> - <td>70</td> - <td>0</td> - <td>100</td> - <td>6</td> - <td class="right" data-ratio="146 268">54%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_d5d6843b45eec01e_paths_py.html">src/debputy/plugin/debputy/paths.py</a></td> - <td>4</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td class="right" data-ratio="4 4">100%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_d5d6843b45eec01e_private_api_py.html">src/debputy/plugin/debputy/private_api.py</a></td> - <td>541</td> - <td>72</td> - <td>2</td> - <td>138</td> - <td>42</td> - <td class="right" data-ratio="555 679">82%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_d5d6843b45eec01e_service_management_py.html">src/debputy/plugin/debputy/service_management.py</a></td> - <td>163</td> - <td>20</td> - <td>2</td> - <td>95</td> - <td>17</td> - <td class="right" data-ratio="212 258">82%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_d5d6843b45eec01e_shlib_metadata_detectors_py.html">src/debputy/plugin/debputy/shlib_metadata_detectors.py</a></td> - <td>17</td> - <td>0</td> - <td>0</td> - <td>6</td> - <td>0</td> - <td class="right" data-ratio="23 23">100%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_d5d6843b45eec01e_strip_non_determinism_py.html">src/debputy/plugin/debputy/strip_non_determinism.py</a></td> - <td>109</td> - <td>31</td> - <td>1</td> - <td>48</td> - <td>9</td> - <td class="right" data-ratio="107 157">68%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_d5d6843b45eec01e_types_py.html">src/debputy/plugin/debputy/types.py</a></td> - <td>7</td> - <td>0</td> - <td>0</td> - <td>2</td> - <td>0</td> - <td class="right" data-ratio="9 9">100%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_267b6307937f1878_substitution_py.html">src/debputy/substitution.py</a></td> - <td>153</td> - <td>20</td> - <td>6</td> - <td>62</td> - <td>8</td> - <td class="right" data-ratio="183 215">85%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_267b6307937f1878_transformation_rules_py.html">src/debputy/transformation_rules.py</a></td> - <td>271</td> - <td>57</td> - <td>2</td> - <td>119</td> - <td>24</td> - <td class="right" data-ratio="285 390">73%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_267b6307937f1878_types_py.html">src/debputy/types.py</a></td> - <td>3</td> - <td>0</td> - <td>3</td> - <td>0</td> - <td>0</td> - <td class="right" data-ratio="3 3">100%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_267b6307937f1878_util_py.html">src/debputy/util.py</a></td> - <td>426</td> - <td>136</td> - <td>9</td> - <td>192</td> - <td>31</td> - <td class="right" data-ratio="401 618">65%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_267b6307937f1878_version_py.html">src/debputy/version.py</a></td> - <td>38</td> - <td>9</td> - <td>0</td> - <td>6</td> - <td>2</td> - <td class="right" data-ratio="33 44">75%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_6c155ce9dd9f7742___init___py.html">src/debputy/yaml/__init__.py</a></td> - <td>3</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td class="right" data-ratio="3 3">100%</td> - </tr> - <tr class="file"> - <td class="name left"><a href="d_6c155ce9dd9f7742_compat_py.html">src/debputy/yaml/compat.py</a></td> - <td>9</td> - <td>4</td> - <td>0</td> - <td>0</td> - <td>0</td> - <td class="right" data-ratio="5 9">56%</td> - </tr> - </tbody> - <tfoot> - <tr class="total"> - <td class="name left">Total</td> - <td>18832</td> - <td>6614</td> - <td>247</td> - <td>8766</td> - <td>919</td> - <td class="right" data-ratio="16990 27598">62%</td> - </tr> - </tfoot> - </table> - <p id="no_rows"> - No items found using the specified filter. - </p> -</main> -<footer> - <div class="content"> - <p> - <a class="nav" href="https://coverage.readthedocs.io/en/7.2.7">coverage.py v7.2.7</a>, - created at 2024-04-07 12:14 +0200 - </p> - </div> - <aside class="hidden"> - <a id="prevFileLink" class="nav" href="d_6c155ce9dd9f7742_compat_py.html"/> - <a id="nextFileLink" class="nav" href="deb_materialization_py.html"/> - <button type="button" class="button_prev_file" data-shortcut="["/> - <button type="button" class="button_next_file" data-shortcut="]"/> - <button type="button" class="button_show_hide_help" data-shortcut="?"/> - </aside> -</footer> -</body> -</html> diff --git a/coverage-report/keybd_closed.png b/coverage-report/keybd_closed.png Binary files differdeleted file mode 100644 index 0a2e112..0000000 --- a/coverage-report/keybd_closed.png +++ /dev/null diff --git a/coverage-report/keybd_open.png b/coverage-report/keybd_open.png Binary files differdeleted file mode 100644 index 8bc77cc..0000000 --- a/coverage-report/keybd_open.png +++ /dev/null diff --git a/coverage-report/status.json b/coverage-report/status.json deleted file mode 100644 index 123f3f6..0000000 --- a/coverage-report/status.json +++ /dev/null @@ -1 +0,0 @@ -{"format":2,"version":"7.2.7","globals":"2c15d122d3f4577c3b4b4bdde2258d63","files":{"deb_materialization_py":{"hash":"ec494d518e48908fe881f7a92ed25940","index":{"nums":[0,1,3,4,3,0,0,0],"html_filename":"deb_materialization_py.html","relative_filename":"deb_materialization.py"}},"deb_packer_py":{"hash":"19eec50e51f6c66c6bb7133ba3e653b6","index":{"nums":[0,1,3,4,3,0,0,0],"html_filename":"deb_packer_py.html","relative_filename":"deb_packer.py"}},"d_9ae9c81fc31f2694_gnome_py":{"hash":"82fc1949c3dcebe56ae2af4bc5696f62","index":{"nums":[0,1,38,0,1,12,1,1],"html_filename":"d_9ae9c81fc31f2694_gnome_py.html","relative_filename":"debputy/plugins/gnome.py"}},"d_9ae9c81fc31f2694_numpy3_py":{"hash":"b25f738dfc2967da3cb052c9f54c580d","index":{"nums":[0,1,34,0,6,10,0,0],"html_filename":"d_9ae9c81fc31f2694_numpy3_py.html","relative_filename":"debputy/plugins/numpy3.py"}},"d_9ae9c81fc31f2694_perl_openssl_py":{"hash":"dc6ad0e0cd8feb9028c1620cedb10095","index":{"nums":[0,1,20,0,4,4,0,2],"html_filename":"d_9ae9c81fc31f2694_perl_openssl_py.html","relative_filename":"debputy/plugins/perl_openssl.py"}},"d_08cd1ad648464ded_debputy_self_hosting_py":{"hash":"34e3af127bd5e346b58597c381e09df8","index":{"nums":[0,1,13,0,3,2,1,1],"html_filename":"d_08cd1ad648464ded_debputy_self_hosting_py.html","relative_filename":"self-hosting-plugins/debputy_self_hosting.py"}},"d_08cd1ad648464ded_debputy_self_hosting_test_py":{"hash":"09dbb3c4981922e9f1a706b55f4ba767","index":{"nums":[0,1,5,0,0,0,0,0],"html_filename":"d_08cd1ad648464ded_debputy_self_hosting_test_py.html","relative_filename":"self-hosting-plugins/debputy_self_hosting_test.py"}},"d_267b6307937f1878___init___py":{"hash":"7d83d2758b4cf1c40b2752dd0418b1e9","index":{"nums":[0,1,7,0,1,2,1,1],"html_filename":"d_267b6307937f1878___init___py.html","relative_filename":"src/debputy/__init__.py"}},"d_267b6307937f1878__deb_options_profiles_py":{"hash":"b3bbc20caa78686e8b8043bee8a6af02","index":{"nums":[0,1,27,1,2,18,1,1],"html_filename":"d_267b6307937f1878__deb_options_profiles_py.html","relative_filename":"src/debputy/_deb_options_profiles.py"}},"d_267b6307937f1878__manifest_constants_py":{"hash":"091426b35352bf4e823647d027802ced","index":{"nums":[0,1,37,0,0,0,0,0],"html_filename":"d_267b6307937f1878__manifest_constants_py.html","relative_filename":"src/debputy/_manifest_constants.py"}},"d_267b6307937f1878_architecture_support_py":{"hash":"1cba32b21ffa2134faa640aa22cba92d","index":{"nums":[0,1,107,0,5,56,1,3],"html_filename":"d_267b6307937f1878_architecture_support_py.html","relative_filename":"src/debputy/architecture_support.py"}},"d_267b6307937f1878_builtin_manifest_rules_py":{"hash":"7bbf3f7e0757f1e39af99f592ad28433","index":{"nums":[0,1,79,0,10,36,4,6],"html_filename":"d_267b6307937f1878_builtin_manifest_rules_py.html","relative_filename":"src/debputy/builtin_manifest_rules.py"}},"d_2882d0a735873825___init___py":{"hash":"ca2411bb2d5283cba14da3ce60f5feec","index":{"nums":[0,1,0,0,0,0,0,0],"html_filename":"d_2882d0a735873825___init___py.html","relative_filename":"src/debputy/commands/__init__.py"}},"d_2882d0a735873825_deb_materialization_py":{"hash":"9b77648ecaf2b92e7848f1af1034b502","index":{"nums":[0,1,236,2,207,104,0,102],"html_filename":"d_2882d0a735873825_deb_materialization_py.html","relative_filename":"src/debputy/commands/deb_materialization.py"}},"d_2882d0a735873825_deb_packer_py":{"hash":"b711a595ea2e806c58c85e3c3b183ed5","index":{"nums":[0,1,197,2,81,54,7,25],"html_filename":"d_2882d0a735873825_deb_packer_py.html","relative_filename":"src/debputy/commands/deb_packer.py"}},"d_6e57078c9ef7177d___init___py":{"hash":"ca2411bb2d5283cba14da3ce60f5feec","index":{"nums":[0,1,0,0,0,0,0,0],"html_filename":"d_6e57078c9ef7177d___init___py.html","relative_filename":"src/debputy/commands/debputy_cmd/__init__.py"}},"d_6e57078c9ef7177d_context_py":{"hash":"aff701afa279cf1a3498774f83d15c30","index":{"nums":[0,1,283,4,152,97,2,67],"html_filename":"d_6e57078c9ef7177d_context_py.html","relative_filename":"src/debputy/commands/debputy_cmd/context.py"}},"d_6e57078c9ef7177d_dc_util_py":{"hash":"45fcc84ba7f2bc07531a76918d04d82c","index":{"nums":[0,1,7,0,4,4,0,4],"html_filename":"d_6e57078c9ef7177d_dc_util_py.html","relative_filename":"src/debputy/commands/debputy_cmd/dc_util.py"}},"d_6e57078c9ef7177d_lint_and_lsp_cmds_py":{"hash":"57ddc952e3ee1f2717ff16ac2b403dbb","index":{"nums":[0,1,65,0,50,24,0,16],"html_filename":"d_6e57078c9ef7177d_lint_and_lsp_cmds_py.html","relative_filename":"src/debputy/commands/debputy_cmd/lint_and_lsp_cmds.py"}},"d_6e57078c9ef7177d_output_py":{"hash":"f3f4b36bcb45b9a2fcfd0b02d3dffa55","index":{"nums":[0,1,191,0,150,86,0,80],"html_filename":"d_6e57078c9ef7177d_output_py.html","relative_filename":"src/debputy/commands/debputy_cmd/output.py"}},"d_6e57078c9ef7177d_plugin_cmds_py":{"hash":"c943bb6ad3cd4d1c2fcfca460f9d5397","index":{"nums":[0,1,541,0,463,287,1,258],"html_filename":"d_6e57078c9ef7177d_plugin_cmds_py.html","relative_filename":"src/debputy/commands/debputy_cmd/plugin_cmds.py"}},"d_267b6307937f1878_deb_packaging_support_py":{"hash":"78d6b9e6721fdc382739e8ac326b18a8","index":{"nums":[0,1,799,1,666,476,1,439],"html_filename":"d_267b6307937f1878_deb_packaging_support_py.html","relative_filename":"src/debputy/deb_packaging_support.py"}},"d_267b6307937f1878_debhelper_emulation_py":{"hash":"3036b9abd6eb01615288e32e5c449997","index":{"nums":[0,1,143,0,36,69,3,21],"html_filename":"d_267b6307937f1878_debhelper_emulation_py.html","relative_filename":"src/debputy/debhelper_emulation.py"}},"d_23db3c975895bd86___init___py":{"hash":"ca2411bb2d5283cba14da3ce60f5feec","index":{"nums":[0,1,0,0,0,0,0,0],"html_filename":"d_23db3c975895bd86___init___py.html","relative_filename":"src/debputy/dh_migration/__init__.py"}},"d_23db3c975895bd86_migration_py":{"hash":"a5b1ab39ec311689f491b322c55fdf25","index":{"nums":[0,1,192,1,172,114,0,114],"html_filename":"d_23db3c975895bd86_migration_py.html","relative_filename":"src/debputy/dh_migration/migration.py"}},"d_23db3c975895bd86_migrators_py":{"hash":"6735120d0251f26545aba49468d91e8e","index":{"nums":[0,1,7,0,0,0,0,0],"html_filename":"d_23db3c975895bd86_migrators_py.html","relative_filename":"src/debputy/dh_migration/migrators.py"}},"d_23db3c975895bd86_migrators_impl_py":{"hash":"381a8c757328cdbc9606df2cb809fdb0","index":{"nums":[0,1,669,0,114,395,39,87],"html_filename":"d_23db3c975895bd86_migrators_impl_py.html","relative_filename":"src/debputy/dh_migration/migrators_impl.py"}},"d_23db3c975895bd86_models_py":{"hash":"83cf7db4b5a088218934821ec5fca5ef","index":{"nums":[0,1,86,0,11,32,4,8],"html_filename":"d_23db3c975895bd86_models_py.html","relative_filename":"src/debputy/dh_migration/models.py"}},"d_267b6307937f1878_elf_util_py":{"hash":"675dea9eb87ebb9890bb566ea1cc8817","index":{"nums":[0,1,100,0,17,45,12,18],"html_filename":"d_267b6307937f1878_elf_util_py.html","relative_filename":"src/debputy/elf_util.py"}},"d_267b6307937f1878_exceptions_py":{"hash":"f5c831a0650c0d6cf43070a245873271","index":{"nums":[0,1,50,2,5,12,0,0],"html_filename":"d_267b6307937f1878_exceptions_py.html","relative_filename":"src/debputy/exceptions.py"}},"d_267b6307937f1878_filesystem_scan_py":{"hash":"4b48bcc8a65442b9e41911855ca8467b","index":{"nums":[0,1,1104,1,268,548,74,158],"html_filename":"d_267b6307937f1878_filesystem_scan_py.html","relative_filename":"src/debputy/filesystem_scan.py"}},"d_267b6307937f1878_highlevel_manifest_py":{"hash":"f444f0abe5d85bc21ff673bc5b1bab29","index":{"nums":[0,1,801,3,237,395,52,156],"html_filename":"d_267b6307937f1878_highlevel_manifest_py.html","relative_filename":"src/debputy/highlevel_manifest.py"}},"d_267b6307937f1878_highlevel_manifest_parser_py":{"hash":"f698b912249cd4a9d15e6280315f25eb","index":{"nums":[0,1,253,2,71,120,13,47],"html_filename":"d_267b6307937f1878_highlevel_manifest_parser_py.html","relative_filename":"src/debputy/highlevel_manifest_parser.py"}},"d_267b6307937f1878_installations_py":{"hash":"789b7c975a4b087e9f56f386f3c6ca28","index":{"nums":[0,1,499,5,157,291,36,122],"html_filename":"d_267b6307937f1878_installations_py.html","relative_filename":"src/debputy/installations.py"}},"d_267b6307937f1878_intermediate_manifest_py":{"hash":"3aea08002cf68315c96456fc9021ac11","index":{"nums":[0,1,172,0,52,98,22,50],"html_filename":"d_267b6307937f1878_intermediate_manifest_py.html","relative_filename":"src/debputy/intermediate_manifest.py"}},"d_267b6307937f1878_interpreter_py":{"hash":"29c5356a98b617c84315b7f2e2a60122","index":{"nums":[0,1,82,6,2,40,3,3],"html_filename":"d_267b6307937f1878_interpreter_py.html","relative_filename":"src/debputy/interpreter.py"}},"d_7764373ba25ba45b___init___py":{"hash":"ca2411bb2d5283cba14da3ce60f5feec","index":{"nums":[0,1,0,0,0,0,0,0],"html_filename":"d_7764373ba25ba45b___init___py.html","relative_filename":"src/debputy/linting/__init__.py"}},"d_7764373ba25ba45b_lint_impl_py":{"hash":"0e089ae5aefe6964606f500bd98836eb","index":{"nums":[0,1,152,0,125,64,0,64],"html_filename":"d_7764373ba25ba45b_lint_impl_py.html","relative_filename":"src/debputy/linting/lint_impl.py"}},"d_7764373ba25ba45b_lint_util_py":{"hash":"fcba0bcfafc89e551212e8c890996be3","index":{"nums":[0,1,117,7,66,48,1,29],"html_filename":"d_7764373ba25ba45b_lint_util_py.html","relative_filename":"src/debputy/linting/lint_util.py"}},"d_5d0ec0d5422112df___init___py":{"hash":"ca2411bb2d5283cba14da3ce60f5feec","index":{"nums":[0,1,0,0,0,0,0,0],"html_filename":"d_5d0ec0d5422112df___init___py.html","relative_filename":"src/debputy/lsp/__init__.py"}},"d_5d0ec0d5422112df_debputy_ls_py":{"hash":"4767e00ea86944aa9b7a7f747cc330c6","index":{"nums":[0,1,48,0,15,18,2,2],"html_filename":"d_5d0ec0d5422112df_debputy_ls_py.html","relative_filename":"src/debputy/lsp/debputy_ls.py"}},"d_5d0ec0d5422112df_lsp_debian_changelog_py":{"hash":"2ceb2fb149a267c0a0eec8e0550cd4fa","index":{"nums":[0,1,108,0,81,28,0,26],"html_filename":"d_5d0ec0d5422112df_lsp_debian_changelog_py.html","relative_filename":"src/debputy/lsp/lsp_debian_changelog.py"}},"d_5d0ec0d5422112df_lsp_debian_control_py":{"hash":"10abbb1f60e549e4e93f566bbc218cb0","index":{"nums":[0,1,216,0,53,102,14,36],"html_filename":"d_5d0ec0d5422112df_lsp_debian_control_py.html","relative_filename":"src/debputy/lsp/lsp_debian_control.py"}},"d_5d0ec0d5422112df_lsp_debian_control_reference_data_py":{"hash":"42a61732dbd8881d26f70516b3ddcc44","index":{"nums":[0,1,335,6,123,124,13,67],"html_filename":"d_5d0ec0d5422112df_lsp_debian_control_reference_data_py.html","relative_filename":"src/debputy/lsp/lsp_debian_control_reference_data.py"}},"d_5d0ec0d5422112df_lsp_debian_copyright_py":{"hash":"9e4dafd9d0cd67fe72657f0fd4b7e693","index":{"nums":[0,1,173,0,137,80,0,70],"html_filename":"d_5d0ec0d5422112df_lsp_debian_copyright_py.html","relative_filename":"src/debputy/lsp/lsp_debian_copyright.py"}},"d_5d0ec0d5422112df_lsp_debian_debputy_manifest_py":{"hash":"e27833e92bf333ef7a3f768c29c74400","index":{"nums":[0,1,467,0,95,234,43,65],"html_filename":"d_5d0ec0d5422112df_lsp_debian_debputy_manifest_py.html","relative_filename":"src/debputy/lsp/lsp_debian_debputy_manifest.py"}},"d_5d0ec0d5422112df_lsp_debian_rules_py":{"hash":"89dad59e6e3b26b2bbc38f2f730ca520","index":{"nums":[0,1,188,0,146,82,0,76],"html_filename":"d_5d0ec0d5422112df_lsp_debian_rules_py.html","relative_filename":"src/debputy/lsp/lsp_debian_rules.py"}},"d_5d0ec0d5422112df_lsp_debian_tests_control_py":{"hash":"f7aa8d7a7b06d6b7369ba8605fa79f46","index":{"nums":[0,1,160,0,124,74,0,64],"html_filename":"d_5d0ec0d5422112df_lsp_debian_tests_control_py.html","relative_filename":"src/debputy/lsp/lsp_debian_tests_control.py"}},"d_5d0ec0d5422112df_lsp_dispatch_py":{"hash":"f8b54e886f3703c2c40f403a634f9845","index":{"nums":[0,1,82,0,50,30,0,14],"html_filename":"d_5d0ec0d5422112df_lsp_dispatch_py.html","relative_filename":"src/debputy/lsp/lsp_dispatch.py"}},"d_5d0ec0d5422112df_lsp_features_py":{"hash":"c55ced2a13ce4bafa85f792a741c8915","index":{"nums":[0,1,107,2,38,42,6,26],"html_filename":"d_5d0ec0d5422112df_lsp_features_py.html","relative_filename":"src/debputy/lsp/lsp_features.py"}},"d_5d0ec0d5422112df_lsp_generic_deb822_py":{"hash":"41d268dcb612ee86700a1ef76b4bae53","index":{"nums":[0,1,203,0,101,84,11,53],"html_filename":"d_5d0ec0d5422112df_lsp_generic_deb822_py.html","relative_filename":"src/debputy/lsp/lsp_generic_deb822.py"}},"d_5d0ec0d5422112df_quickfixes_py":{"hash":"d5500c05c3042d75d93cf33c770f8dee","index":{"nums":[0,1,63,0,32,20,0,16],"html_filename":"d_5d0ec0d5422112df_quickfixes_py.html","relative_filename":"src/debputy/lsp/quickfixes.py"}},"d_5d0ec0d5422112df_spellchecking_py":{"hash":"cda3918a66c34cc79b79d668a3904734","index":{"nums":[0,1,152,2,42,70,14,22],"html_filename":"d_5d0ec0d5422112df_spellchecking_py.html","relative_filename":"src/debputy/lsp/spellchecking.py"}},"d_5d0ec0d5422112df_text_edit_py":{"hash":"1691605b37033b1ed5c758136d2679dc","index":{"nums":[0,1,66,0,57,28,0,28],"html_filename":"d_5d0ec0d5422112df_text_edit_py.html","relative_filename":"src/debputy/lsp/text_edit.py"}},"d_5d0ec0d5422112df_text_util_py":{"hash":"3c33657f417a40ed2af1764eaeabb13a","index":{"nums":[0,1,59,0,18,20,2,8],"html_filename":"d_5d0ec0d5422112df_text_util_py.html","relative_filename":"src/debputy/lsp/text_util.py"}},"d_50e3cc0df0cc5f51___init___py":{"hash":"ca2411bb2d5283cba14da3ce60f5feec","index":{"nums":[0,1,0,0,0,0,0,0],"html_filename":"d_50e3cc0df0cc5f51___init___py.html","relative_filename":"src/debputy/lsp/vendoring/__init__.py"}},"d_e9c451f4ae334f76___init___py":{"hash":"88e0b9e508dcf2840705ab5f4e91f99f","index":{"nums":[0,1,3,1,0,0,0,0],"html_filename":"d_e9c451f4ae334f76___init___py.html","relative_filename":"src/debputy/lsp/vendoring/_deb822_repro/__init__.py"}},"d_e9c451f4ae334f76__util_py":{"hash":"4d61ece6b7f751f58f2cda84693fde86","index":{"nums":[0,1,154,3,62,70,5,35],"html_filename":"d_e9c451f4ae334f76__util_py.html","relative_filename":"src/debputy/lsp/vendoring/_deb822_repro/_util.py"}},"d_e9c451f4ae334f76_formatter_py":{"hash":"efe88dd797b272baffcc026efb05a312","index":{"nums":[0,1,128,0,24,78,12,18],"html_filename":"d_e9c451f4ae334f76_formatter_py.html","relative_filename":"src/debputy/lsp/vendoring/_deb822_repro/formatter.py"}},"d_e9c451f4ae334f76_locatable_py":{"hash":"32b65d1875ea86f8191ac0ff9ee16ed1","index":{"nums":[0,1,122,5,11,58,5,7],"html_filename":"d_e9c451f4ae334f76_locatable_py.html","relative_filename":"src/debputy/lsp/vendoring/_deb822_repro/locatable.py"}},"d_e9c451f4ae334f76_parsing_py":{"hash":"efa5e7f40d30e0ae013047834ee934e5","index":{"nums":[0,1,1464,30,541,709,80,340],"html_filename":"d_e9c451f4ae334f76_parsing_py.html","relative_filename":"src/debputy/lsp/vendoring/_deb822_repro/parsing.py"}},"d_e9c451f4ae334f76_tokens_py":{"hash":"d1451737d674a5ad78ecbc01d997ad91","index":{"nums":[0,1,230,4,32,108,13,27],"html_filename":"d_e9c451f4ae334f76_tokens_py.html","relative_filename":"src/debputy/lsp/vendoring/_deb822_repro/tokens.py"}},"d_e9c451f4ae334f76_types_py":{"hash":"c2c5ab44598cf6a534a3b8b8c6ad011b","index":{"nums":[0,1,26,4,4,0,0,0],"html_filename":"d_e9c451f4ae334f76_types_py.html","relative_filename":"src/debputy/lsp/vendoring/_deb822_repro/types.py"}},"d_267b6307937f1878_maintscript_snippet_py":{"hash":"6cf199326e1c56b89dc47252de15abc4","index":{"nums":[0,1,87,0,28,44,6,20],"html_filename":"d_267b6307937f1878_maintscript_snippet_py.html","relative_filename":"src/debputy/maintscript_snippet.py"}},"d_267b6307937f1878_manifest_conditions_py":{"hash":"322ef450f66be66cd790fb546df3273c","index":{"nums":[0,1,134,2,43,38,3,17],"html_filename":"d_267b6307937f1878_manifest_conditions_py.html","relative_filename":"src/debputy/manifest_conditions.py"}},"d_4f754ff76d8638bb___init___py":{"hash":"ca2411bb2d5283cba14da3ce60f5feec","index":{"nums":[0,1,0,0,0,0,0,0],"html_filename":"d_4f754ff76d8638bb___init___py.html","relative_filename":"src/debputy/manifest_parser/__init__.py"}},"d_4f754ff76d8638bb_base_types_py":{"hash":"422e06effcc76e9124a373ab8ab09c4b","index":{"nums":[0,1,213,9,33,104,7,17],"html_filename":"d_4f754ff76d8638bb_base_types_py.html","relative_filename":"src/debputy/manifest_parser/base_types.py"}},"d_4f754ff76d8638bb_declarative_parser_py":{"hash":"fdda82628d29fa9c22775b99fae8d3f8","index":{"nums":[0,1,781,0,161,446,70,138],"html_filename":"d_4f754ff76d8638bb_declarative_parser_py.html","relative_filename":"src/debputy/manifest_parser/declarative_parser.py"}},"d_4f754ff76d8638bb_exceptions_py":{"hash":"68d16a3555cc6f63e08c195b8b026ef2","index":{"nums":[0,1,5,0,0,0,0,0],"html_filename":"d_4f754ff76d8638bb_exceptions_py.html","relative_filename":"src/debputy/manifest_parser/exceptions.py"}},"d_4f754ff76d8638bb_mapper_code_py":{"hash":"f8869c1090a47099867aff79962d0615","index":{"nums":[0,1,32,0,4,10,2,2],"html_filename":"d_4f754ff76d8638bb_mapper_code_py.html","relative_filename":"src/debputy/manifest_parser/mapper_code.py"}},"d_4f754ff76d8638bb_parser_data_py":{"hash":"284a3e6e3062916e8b24c50f20ad33b7","index":{"nums":[0,1,54,12,7,30,2,6],"html_filename":"d_4f754ff76d8638bb_parser_data_py.html","relative_filename":"src/debputy/manifest_parser/parser_data.py"}},"d_4f754ff76d8638bb_parser_doc_py":{"hash":"47368090e6c2adc535d089904df75088","index":{"nums":[0,1,132,0,25,85,9,21],"html_filename":"d_4f754ff76d8638bb_parser_doc_py.html","relative_filename":"src/debputy/manifest_parser/parser_doc.py"}},"d_4f754ff76d8638bb_util_py":{"hash":"6f6831dbb7b5d018362aea99054abd1c","index":{"nums":[0,1,192,3,18,88,12,14],"html_filename":"d_4f754ff76d8638bb_util_py.html","relative_filename":"src/debputy/manifest_parser/util.py"}},"d_128305113a77411b___init___py":{"hash":"ca2411bb2d5283cba14da3ce60f5feec","index":{"nums":[0,1,0,0,0,0,0,0],"html_filename":"d_128305113a77411b___init___py.html","relative_filename":"src/debputy/package_build/__init__.py"}},"d_128305113a77411b_assemble_deb_py":{"hash":"e15da1ebe84008e8dcf311dad8d955f6","index":{"nums":[0,1,98,0,79,37,0,37],"html_filename":"d_128305113a77411b_assemble_deb_py.html","relative_filename":"src/debputy/package_build/assemble_deb.py"}},"d_267b6307937f1878_packager_provided_files_py":{"hash":"7f8542b048c377e315e46ca18c648a42","index":{"nums":[0,1,140,0,22,82,14,14],"html_filename":"d_267b6307937f1878_packager_provided_files_py.html","relative_filename":"src/debputy/packager_provided_files.py"}},"d_267b6307937f1878_packages_py":{"hash":"b0c833e1faa1961b02c787656cf17163","index":{"nums":[0,1,167,2,76,96,6,52],"html_filename":"d_267b6307937f1878_packages_py.html","relative_filename":"src/debputy/packages.py"}},"d_36a196ce5f578895___init___py":{"hash":"ca2411bb2d5283cba14da3ce60f5feec","index":{"nums":[0,1,0,0,0,0,0,0],"html_filename":"d_36a196ce5f578895___init___py.html","relative_filename":"src/debputy/packaging/__init__.py"}},"d_36a196ce5f578895_alternatives_py":{"hash":"18c2a860c74a72a872096e6613560c3d","index":{"nums":[0,1,75,0,15,36,12,14],"html_filename":"d_36a196ce5f578895_alternatives_py.html","relative_filename":"src/debputy/packaging/alternatives.py"}},"d_36a196ce5f578895_debconf_templates_py":{"hash":"e372d10ff45d2d2b5b70a79b810f866f","index":{"nums":[0,1,32,0,19,8,0,8],"html_filename":"d_36a196ce5f578895_debconf_templates_py.html","relative_filename":"src/debputy/packaging/debconf_templates.py"}},"d_36a196ce5f578895_makeshlibs_py":{"hash":"9f0c915a9b925cad68e84028ae810a90","index":{"nums":[0,1,182,2,139,80,2,76],"html_filename":"d_36a196ce5f578895_makeshlibs_py.html","relative_filename":"src/debputy/packaging/makeshlibs.py"}},"d_267b6307937f1878_path_matcher_py":{"hash":"c382f8d2bd0d68c55be3a8e4c440ba5f","index":{"nums":[0,1,279,3,66,142,13,51],"html_filename":"d_267b6307937f1878_path_matcher_py.html","relative_filename":"src/debputy/path_matcher.py"}},"d_4faea183f900b252___init___py":{"hash":"ca2411bb2d5283cba14da3ce60f5feec","index":{"nums":[0,1,0,0,0,0,0,0],"html_filename":"d_4faea183f900b252___init___py.html","relative_filename":"src/debputy/plugin/__init__.py"}},"d_64287305fe0c6642___init___py":{"hash":"c17fed53095e6333637f71c409fd86de","index":{"nums":[0,1,3,0,0,0,0,0],"html_filename":"d_64287305fe0c6642___init___py.html","relative_filename":"src/debputy/plugin/api/__init__.py"}},"d_64287305fe0c6642_example_processing_py":{"hash":"9208b92a711e2f7a540d6d61bd10f5d7","index":{"nums":[0,1,62,0,4,30,0,0],"html_filename":"d_64287305fe0c6642_example_processing_py.html","relative_filename":"src/debputy/plugin/api/example_processing.py"}},"d_64287305fe0c6642_feature_set_py":{"hash":"786bbaae874c59411cb1d53fb3b53b42","index":{"nums":[0,1,35,0,8,10,0,4],"html_filename":"d_64287305fe0c6642_feature_set_py.html","relative_filename":"src/debputy/plugin/api/feature_set.py"}},"d_64287305fe0c6642_impl_py":{"hash":"31720d3fb8dd89ce61604353dc3f48c2","index":{"nums":[0,1,753,2,302,320,52,182],"html_filename":"d_64287305fe0c6642_impl_py.html","relative_filename":"src/debputy/plugin/api/impl.py"}},"d_64287305fe0c6642_impl_types_py":{"hash":"3d4c59dd03a781d184df9fdc90b7780f","index":{"nums":[0,1,526,6,98,187,23,60],"html_filename":"d_64287305fe0c6642_impl_types_py.html","relative_filename":"src/debputy/plugin/api/impl_types.py"}},"d_64287305fe0c6642_plugin_parser_py":{"hash":"b9dffd1632dd8d900a6355a4fc7395a2","index":{"nums":[0,1,35,0,0,2,0,0],"html_filename":"d_64287305fe0c6642_plugin_parser_py.html","relative_filename":"src/debputy/plugin/api/plugin_parser.py"}},"d_64287305fe0c6642_spec_py":{"hash":"c6569e7b7ec77a4afc83604f1e801c31","index":{"nums":[0,1,282,66,36,143,7,21],"html_filename":"d_64287305fe0c6642_spec_py.html","relative_filename":"src/debputy/plugin/api/spec.py"}},"d_4b9be07fb6071cd2___init___py":{"hash":"3de0ff9db73356b216779b7359cc7e76","index":{"nums":[0,1,3,0,0,0,0,0],"html_filename":"d_4b9be07fb6071cd2___init___py.html","relative_filename":"src/debputy/plugin/api/test_api/__init__.py"}},"d_4b9be07fb6071cd2_test_impl_py":{"hash":"f1a4b7c468b08ce9778f2931c139da3b","index":{"nums":[0,1,296,0,43,132,25,33],"html_filename":"d_4b9be07fb6071cd2_test_impl_py.html","relative_filename":"src/debputy/plugin/api/test_api/test_impl.py"}},"d_4b9be07fb6071cd2_test_spec_py":{"hash":"6079325e8e6d1b04eea8c5b473c3be01","index":{"nums":[0,1,79,11,0,16,0,0],"html_filename":"d_4b9be07fb6071cd2_test_spec_py.html","relative_filename":"src/debputy/plugin/api/test_api/test_spec.py"}},"d_d5d6843b45eec01e___init___py":{"hash":"ca2411bb2d5283cba14da3ce60f5feec","index":{"nums":[0,1,0,0,0,0,0,0],"html_filename":"d_d5d6843b45eec01e___init___py.html","relative_filename":"src/debputy/plugin/debputy/__init__.py"}},"d_d5d6843b45eec01e_binary_package_rules_py":{"hash":"a110c66383aa27918dfef839389275ef","index":{"nums":[0,1,173,0,23,58,6,18],"html_filename":"d_d5d6843b45eec01e_binary_package_rules_py.html","relative_filename":"src/debputy/plugin/debputy/binary_package_rules.py"}},"d_d5d6843b45eec01e_debputy_plugin_py":{"hash":"631718a061ad30a3643c5ad491bb3cf0","index":{"nums":[0,1,78,0,0,4,0,0],"html_filename":"d_d5d6843b45eec01e_debputy_plugin_py.html","relative_filename":"src/debputy/plugin/debputy/debputy_plugin.py"}},"d_d5d6843b45eec01e_discard_rules_py":{"hash":"cb880206078fbf7e29d1e5dd7aa26b74","index":{"nums":[0,1,34,0,1,12,1,1],"html_filename":"d_d5d6843b45eec01e_discard_rules_py.html","relative_filename":"src/debputy/plugin/debputy/discard_rules.py"}},"d_d5d6843b45eec01e_manifest_root_rules_py":{"hash":"bd58df4c6c7d838d1bdec17166abcc70","index":{"nums":[0,1,57,2,9,16,2,6],"html_filename":"d_d5d6843b45eec01e_manifest_root_rules_py.html","relative_filename":"src/debputy/plugin/debputy/manifest_root_rules.py"}},"d_d5d6843b45eec01e_metadata_detectors_py":{"hash":"fc813e3cd4a388fcebff1f8e1e634861","index":{"nums":[0,1,228,0,6,140,7,7],"html_filename":"d_d5d6843b45eec01e_metadata_detectors_py.html","relative_filename":"src/debputy/plugin/debputy/metadata_detectors.py"}},"d_d5d6843b45eec01e_package_processors_py":{"hash":"28d75879e9543dfa0f1321c5997fd865","index":{"nums":[0,1,168,0,70,100,6,52],"html_filename":"d_d5d6843b45eec01e_package_processors_py.html","relative_filename":"src/debputy/plugin/debputy/package_processors.py"}},"d_d5d6843b45eec01e_paths_py":{"hash":"daf78889ee63f4edb75c06394b84c682","index":{"nums":[0,1,4,0,0,0,0,0],"html_filename":"d_d5d6843b45eec01e_paths_py.html","relative_filename":"src/debputy/plugin/debputy/paths.py"}},"d_d5d6843b45eec01e_private_api_py":{"hash":"f287821ddbee295bceedce1990edcc5d","index":{"nums":[0,1,541,2,72,138,42,52],"html_filename":"d_d5d6843b45eec01e_private_api_py.html","relative_filename":"src/debputy/plugin/debputy/private_api.py"}},"d_d5d6843b45eec01e_service_management_py":{"hash":"f6a3c4b8d99581707411c37ea534885a","index":{"nums":[0,1,163,2,20,95,17,26],"html_filename":"d_d5d6843b45eec01e_service_management_py.html","relative_filename":"src/debputy/plugin/debputy/service_management.py"}},"d_d5d6843b45eec01e_shlib_metadata_detectors_py":{"hash":"8f49972bbdcc4c421ae1996f9d8a2f2b","index":{"nums":[0,1,17,0,0,6,0,0],"html_filename":"d_d5d6843b45eec01e_shlib_metadata_detectors_py.html","relative_filename":"src/debputy/plugin/debputy/shlib_metadata_detectors.py"}},"d_d5d6843b45eec01e_strip_non_determinism_py":{"hash":"b4dc3706155bfeb1f67626f676f66f2d","index":{"nums":[0,1,109,1,31,48,9,19],"html_filename":"d_d5d6843b45eec01e_strip_non_determinism_py.html","relative_filename":"src/debputy/plugin/debputy/strip_non_determinism.py"}},"d_d5d6843b45eec01e_types_py":{"hash":"bcb93ed8f41b8cc4822508201ca2c268","index":{"nums":[0,1,7,0,0,2,0,0],"html_filename":"d_d5d6843b45eec01e_types_py.html","relative_filename":"src/debputy/plugin/debputy/types.py"}},"d_267b6307937f1878_substitution_py":{"hash":"c3f56ff943c21a685a461046d7645adc","index":{"nums":[0,1,153,6,20,62,8,12],"html_filename":"d_267b6307937f1878_substitution_py.html","relative_filename":"src/debputy/substitution.py"}},"d_267b6307937f1878_transformation_rules_py":{"hash":"4a2a9b0e8734961e8d3cd6713b50e823","index":{"nums":[0,1,271,2,57,119,24,48],"html_filename":"d_267b6307937f1878_transformation_rules_py.html","relative_filename":"src/debputy/transformation_rules.py"}},"d_267b6307937f1878_types_py":{"hash":"239b2dd0bd6d5a429a3352e173882fa6","index":{"nums":[0,1,3,3,0,0,0,0],"html_filename":"d_267b6307937f1878_types_py.html","relative_filename":"src/debputy/types.py"}},"d_267b6307937f1878_util_py":{"hash":"5f2f0f86e176833214219e7a6135ddba","index":{"nums":[0,1,426,9,136,192,31,81],"html_filename":"d_267b6307937f1878_util_py.html","relative_filename":"src/debputy/util.py"}},"d_267b6307937f1878_version_py":{"hash":"508c8e794269632fe70a5f00ebc48457","index":{"nums":[0,1,38,0,9,6,2,2],"html_filename":"d_267b6307937f1878_version_py.html","relative_filename":"src/debputy/version.py"}},"d_6c155ce9dd9f7742___init___py":{"hash":"3c72eb02694220a793fdc161737285dc","index":{"nums":[0,1,3,0,0,0,0,0],"html_filename":"d_6c155ce9dd9f7742___init___py.html","relative_filename":"src/debputy/yaml/__init__.py"}},"d_6c155ce9dd9f7742_compat_py":{"hash":"3996b777c64c6cef6a265b542e6bf80c","index":{"nums":[0,1,9,0,4,0,0,0],"html_filename":"d_6c155ce9dd9f7742_compat_py.html","relative_filename":"src/debputy/yaml/compat.py"}}}}
\ No newline at end of file diff --git a/coverage-report/style.css b/coverage-report/style.css deleted file mode 100644 index 11b24c4..0000000 --- a/coverage-report/style.css +++ /dev/null @@ -1,309 +0,0 @@ -@charset "UTF-8"; -/* Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 */ -/* For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt */ -/* Don't edit this .css file. Edit the .scss file instead! */ -html, body, h1, h2, h3, p, table, td, th { margin: 0; padding: 0; border: 0; font-weight: inherit; font-style: inherit; font-size: 100%; font-family: inherit; vertical-align: baseline; } - -body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; font-size: 1em; background: #fff; color: #000; } - -@media (prefers-color-scheme: dark) { body { background: #1e1e1e; } } - -@media (prefers-color-scheme: dark) { body { color: #eee; } } - -html > body { font-size: 16px; } - -a:active, a:focus { outline: 2px dashed #007acc; } - -p { font-size: .875em; line-height: 1.4em; } - -table { border-collapse: collapse; } - -td { vertical-align: top; } - -table tr.hidden { display: none !important; } - -p#no_rows { display: none; font-size: 1.2em; } - -a.nav { text-decoration: none; color: inherit; } - -a.nav:hover { text-decoration: underline; color: inherit; } - -.hidden { display: none; } - -header { background: #f8f8f8; width: 100%; z-index: 2; border-bottom: 1px solid #ccc; } - -@media (prefers-color-scheme: dark) { header { background: black; } } - -@media (prefers-color-scheme: dark) { header { border-color: #333; } } - -header .content { padding: 1rem 3.5rem; } - -header h2 { margin-top: .5em; font-size: 1em; } - -header p.text { margin: .5em 0 -.5em; color: #666; font-style: italic; } - -@media (prefers-color-scheme: dark) { header p.text { color: #aaa; } } - -header.sticky { position: fixed; left: 0; right: 0; height: 2.5em; } - -header.sticky .text { display: none; } - -header.sticky h1, header.sticky h2 { font-size: 1em; margin-top: 0; display: inline-block; } - -header.sticky .content { padding: 0.5rem 3.5rem; } - -header.sticky .content p { font-size: 1em; } - -header.sticky ~ #source { padding-top: 6.5em; } - -main { position: relative; z-index: 1; } - -footer { margin: 1rem 3.5rem; } - -footer .content { padding: 0; color: #666; font-style: italic; } - -@media (prefers-color-scheme: dark) { footer .content { color: #aaa; } } - -#index { margin: 1rem 0 0 3.5rem; } - -h1 { font-size: 1.25em; display: inline-block; } - -#filter_container { float: right; margin: 0 2em 0 0; } - -#filter_container input { width: 10em; padding: 0.2em 0.5em; border: 2px solid #ccc; background: #fff; color: #000; } - -@media (prefers-color-scheme: dark) { #filter_container input { border-color: #444; } } - -@media (prefers-color-scheme: dark) { #filter_container input { background: #1e1e1e; } } - -@media (prefers-color-scheme: dark) { #filter_container input { color: #eee; } } - -#filter_container input:focus { border-color: #007acc; } - -header button { font-family: inherit; font-size: inherit; border: 1px solid; border-radius: .2em; color: inherit; padding: .1em .5em; margin: 1px calc(.1em + 1px); cursor: pointer; border-color: #ccc; } - -@media (prefers-color-scheme: dark) { header button { border-color: #444; } } - -header button:active, header button:focus { outline: 2px dashed #007acc; } - -header button.run { background: #eeffee; } - -@media (prefers-color-scheme: dark) { header button.run { background: #373d29; } } - -header button.run.show_run { background: #dfd; border: 2px solid #00dd00; margin: 0 .1em; } - -@media (prefers-color-scheme: dark) { header button.run.show_run { background: #373d29; } } - -header button.mis { background: #ffeeee; } - -@media (prefers-color-scheme: dark) { header button.mis { background: #4b1818; } } - -header button.mis.show_mis { background: #fdd; border: 2px solid #ff0000; margin: 0 .1em; } - -@media (prefers-color-scheme: dark) { header button.mis.show_mis { background: #4b1818; } } - -header button.exc { background: #f7f7f7; } - -@media (prefers-color-scheme: dark) { header button.exc { background: #333; } } - -header button.exc.show_exc { background: #eee; border: 2px solid #808080; margin: 0 .1em; } - -@media (prefers-color-scheme: dark) { header button.exc.show_exc { background: #333; } } - -header button.par { background: #ffffd5; } - -@media (prefers-color-scheme: dark) { header button.par { background: #650; } } - -header button.par.show_par { background: #ffa; border: 2px solid #bbbb00; margin: 0 .1em; } - -@media (prefers-color-scheme: dark) { header button.par.show_par { background: #650; } } - -#help_panel, #source p .annotate.long { display: none; position: absolute; z-index: 999; background: #ffffcc; border: 1px solid #888; border-radius: .2em; color: #333; padding: .25em .5em; } - -#source p .annotate.long { white-space: normal; float: right; top: 1.75em; right: 1em; height: auto; } - -#help_panel_wrapper { float: right; position: relative; } - -#keyboard_icon { margin: 5px; } - -#help_panel_state { display: none; } - -#help_panel { top: 25px; right: 0; padding: .75em; border: 1px solid #883; color: #333; } - -#help_panel .keyhelp p { margin-top: .75em; } - -#help_panel .legend { font-style: italic; margin-bottom: 1em; } - -.indexfile #help_panel { width: 25em; } - -.pyfile #help_panel { width: 18em; } - -#help_panel_state:checked ~ #help_panel { display: block; } - -kbd { border: 1px solid black; border-color: #888 #333 #333 #888; padding: .1em .35em; font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-weight: bold; background: #eee; border-radius: 3px; } - -#source { padding: 1em 0 1em 3.5rem; font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace; } - -#source p { position: relative; white-space: pre; } - -#source p * { box-sizing: border-box; } - -#source p .n { float: left; text-align: right; width: 3.5rem; box-sizing: border-box; margin-left: -3.5rem; padding-right: 1em; color: #999; } - -@media (prefers-color-scheme: dark) { #source p .n { color: #777; } } - -#source p .n.highlight { background: #ffdd00; } - -#source p .n a { margin-top: -4em; padding-top: 4em; text-decoration: none; color: #999; } - -@media (prefers-color-scheme: dark) { #source p .n a { color: #777; } } - -#source p .n a:hover { text-decoration: underline; color: #999; } - -@media (prefers-color-scheme: dark) { #source p .n a:hover { color: #777; } } - -#source p .t { display: inline-block; width: 100%; box-sizing: border-box; margin-left: -.5em; padding-left: 0.3em; border-left: 0.2em solid #fff; } - -@media (prefers-color-scheme: dark) { #source p .t { border-color: #1e1e1e; } } - -#source p .t:hover { background: #f2f2f2; } - -@media (prefers-color-scheme: dark) { #source p .t:hover { background: #282828; } } - -#source p .t:hover ~ .r .annotate.long { display: block; } - -#source p .t .com { color: #008000; font-style: italic; line-height: 1px; } - -@media (prefers-color-scheme: dark) { #source p .t .com { color: #6a9955; } } - -#source p .t .key { font-weight: bold; line-height: 1px; } - -#source p .t .str { color: #0451a5; } - -@media (prefers-color-scheme: dark) { #source p .t .str { color: #9cdcfe; } } - -#source p.mis .t { border-left: 0.2em solid #ff0000; } - -#source p.mis.show_mis .t { background: #fdd; } - -@media (prefers-color-scheme: dark) { #source p.mis.show_mis .t { background: #4b1818; } } - -#source p.mis.show_mis .t:hover { background: #f2d2d2; } - -@media (prefers-color-scheme: dark) { #source p.mis.show_mis .t:hover { background: #532323; } } - -#source p.run .t { border-left: 0.2em solid #00dd00; } - -#source p.run.show_run .t { background: #dfd; } - -@media (prefers-color-scheme: dark) { #source p.run.show_run .t { background: #373d29; } } - -#source p.run.show_run .t:hover { background: #d2f2d2; } - -@media (prefers-color-scheme: dark) { #source p.run.show_run .t:hover { background: #404633; } } - -#source p.exc .t { border-left: 0.2em solid #808080; } - -#source p.exc.show_exc .t { background: #eee; } - -@media (prefers-color-scheme: dark) { #source p.exc.show_exc .t { background: #333; } } - -#source p.exc.show_exc .t:hover { background: #e2e2e2; } - -@media (prefers-color-scheme: dark) { #source p.exc.show_exc .t:hover { background: #3c3c3c; } } - -#source p.par .t { border-left: 0.2em solid #bbbb00; } - -#source p.par.show_par .t { background: #ffa; } - -@media (prefers-color-scheme: dark) { #source p.par.show_par .t { background: #650; } } - -#source p.par.show_par .t:hover { background: #f2f2a2; } - -@media (prefers-color-scheme: dark) { #source p.par.show_par .t:hover { background: #6d5d0c; } } - -#source p .r { position: absolute; top: 0; right: 2.5em; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; } - -#source p .annotate { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; color: #666; padding-right: .5em; } - -@media (prefers-color-scheme: dark) { #source p .annotate { color: #ddd; } } - -#source p .annotate.short:hover ~ .long { display: block; } - -#source p .annotate.long { width: 30em; right: 2.5em; } - -#source p input { display: none; } - -#source p input ~ .r label.ctx { cursor: pointer; border-radius: .25em; } - -#source p input ~ .r label.ctx::before { content: "▶ "; } - -#source p input ~ .r label.ctx:hover { background: #e8f4ff; color: #666; } - -@media (prefers-color-scheme: dark) { #source p input ~ .r label.ctx:hover { background: #0f3a42; } } - -@media (prefers-color-scheme: dark) { #source p input ~ .r label.ctx:hover { color: #aaa; } } - -#source p input:checked ~ .r label.ctx { background: #d0e8ff; color: #666; border-radius: .75em .75em 0 0; padding: 0 .5em; margin: -.25em 0; } - -@media (prefers-color-scheme: dark) { #source p input:checked ~ .r label.ctx { background: #056; } } - -@media (prefers-color-scheme: dark) { #source p input:checked ~ .r label.ctx { color: #aaa; } } - -#source p input:checked ~ .r label.ctx::before { content: "▼ "; } - -#source p input:checked ~ .ctxs { padding: .25em .5em; overflow-y: scroll; max-height: 10.5em; } - -#source p label.ctx { color: #999; display: inline-block; padding: 0 .5em; font-size: .8333em; } - -@media (prefers-color-scheme: dark) { #source p label.ctx { color: #777; } } - -#source p .ctxs { display: block; max-height: 0; overflow-y: hidden; transition: all .2s; padding: 0 .5em; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; white-space: nowrap; background: #d0e8ff; border-radius: .25em; margin-right: 1.75em; text-align: right; } - -@media (prefers-color-scheme: dark) { #source p .ctxs { background: #056; } } - -#index { font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 0.875em; } - -#index table.index { margin-left: -.5em; } - -#index td, #index th { text-align: right; width: 5em; padding: .25em .5em; border-bottom: 1px solid #eee; } - -@media (prefers-color-scheme: dark) { #index td, #index th { border-color: #333; } } - -#index td.name, #index th.name { text-align: left; width: auto; } - -#index th { font-style: italic; color: #333; cursor: pointer; } - -@media (prefers-color-scheme: dark) { #index th { color: #ddd; } } - -#index th:hover { background: #eee; } - -@media (prefers-color-scheme: dark) { #index th:hover { background: #333; } } - -#index th[aria-sort="ascending"], #index th[aria-sort="descending"] { white-space: nowrap; background: #eee; padding-left: .5em; } - -@media (prefers-color-scheme: dark) { #index th[aria-sort="ascending"], #index th[aria-sort="descending"] { background: #333; } } - -#index th[aria-sort="ascending"]::after { font-family: sans-serif; content: " ↑"; } - -#index th[aria-sort="descending"]::after { font-family: sans-serif; content: " ↓"; } - -#index td.name a { text-decoration: none; color: inherit; } - -#index tr.total td, #index tr.total_dynamic td { font-weight: bold; border-top: 1px solid #ccc; border-bottom: none; } - -#index tr.file:hover { background: #eee; } - -@media (prefers-color-scheme: dark) { #index tr.file:hover { background: #333; } } - -#index tr.file:hover td.name { text-decoration: underline; color: inherit; } - -#scroll_marker { position: fixed; z-index: 3; right: 0; top: 0; width: 16px; height: 100%; background: #fff; border-left: 1px solid #eee; will-change: transform; } - -@media (prefers-color-scheme: dark) { #scroll_marker { background: #1e1e1e; } } - -@media (prefers-color-scheme: dark) { #scroll_marker { border-color: #333; } } - -#scroll_marker .marker { background: #ccc; position: absolute; min-height: 3px; width: 100%; } - -@media (prefers-color-scheme: dark) { #scroll_marker .marker { background: #444; } } |